diff --git a/sdk-1/LicenseAgreement.txt b/sdk-1/LicenseAgreement.txt new file mode 100644 index 0000000..e6b24d8 --- /dev/null +++ b/sdk-1/LicenseAgreement.txt @@ -0,0 +1,184 @@ +IMPORTANT: Read Before Using The Accompanying Software + + +3COM PALM OS SOFTWARE DEVELOPMENT KIT +SOFTWARE LICENSE AGREEMENT + + +YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND +CONDITIONS BEFORE USING THE ACCOMPANYING SOFTWARE, +THE USE OF WHICH IS LICENSED BY PALM COMPUTING, INC., A +SUBSIDIARY OF 3COM CORPORATION (COLLECTIVELY, "3COM"), +TO ITS CUSTOMERS FOR THEIR USE ONLY AS SET FORTH +BELOW. IF YOU DO NOT AGREE TO THE TERMS AND +CONDITIONS OF THIS AGREEMENT, DO NOT USE THE +SOFTWARE. USING ANY PART OF THE SOFTWARE INDICATES +THAT YOU ACCEPT THESE TERMS. + +LICENSE: 3Com grants you a nonexclusive, royalty-free license to use the +accompanying software program(s) (the "Software") subject to the terms and +restrictions set forth in this License Agreement. Except as explicitly set forth +below, (i) you are not permitted to lease or rent (except under separate mutually +agreeable terms set forth in writing and signed by both parties), distribute or +sublicense the Software or to use the Software in a time-sharing arrangement or +in any other unauthorized manner; (ii) no license is granted to you in the human +readable code of the Software (source code); and (iii) this License Agreement +does not grant you any rights to patents, copyrights, trade secrets, trademarks, or +any other rights in respect to the Software. + +The Software is licensed to be used on any personal computer and/or any Palm +Computing platform product, provided that the Software is used only in +connection with your development of products for use with Palm Computing +platform products. The Software contains certain sample source code in the +form of example applications (including several conduits) and code fragments +(both in the source code files and documentation provided hereunder), and may +include a tutorial application (collectively, "Sample Source Code"). You may +use the Sample Source Code internally to develop products for Palm Computing +platform products. You may distribute any such products built with the Sample +Source Code, provided that you include the following copyright notice within +your source code and in the location of your own copyright notice: "Portions +copyright c 1998 3Com Corporation or its subsidiaries. All rights reserved." + +Notwithstanding anything else in this License Agreement, you may not distribute +the conduit development kit header files included as part of the Software to +anyone for any reason. + +Except as described above, the Software and supporting documentation may be +copied only as essential for backup or archive purposes in support of your use of +the Software as permitted hereunder. You must reproduce and include all +copyright notices and any other proprietary rights notices appearing on the +Software on any copies that you make. + +NO ASSIGNMENT; NO REVERSE ENGINEERING: You may transfer the +Software and this License Agreement to another party if the other party agrees in +writing to accept the terms and conditions of this License Agreement. If you +transfer the Software, you must at the same time either transfer all copies of the +Software as well as the supporting documentation to the same party or destroy +any such materials not transferred. Except as set forth above, you may not +transfer or assign the Software or your rights under this License Agreement. + +Modification, reverse engineering, reverse compiling, or disassembly of the +Software is expressly prohibited. However, if you are a European Community +("EC") resident, information necessary to achieve interoperability of the +Software with other programs within the meaning of the EC Directive on the +Legal Protection of Computer Programs is available to you from 3Com upon +written request. + +EXPORT RESTRICTIONS: You agree that you will not export or re-export +the Software or accompanying documentation (or any copies thereof) or any +products utilizing the Software or such documentation in violation of any +applicable laws or regulations of the United States or the country in which you +obtained them. + +TRADE SECRETS; TITLE: You acknowledge and agree that the structure, +sequence and organization of the Software are the valuable trade secrets of +3Com and its suppliers. You agree to hold such trade secrets in confidence. +You further acknowledge and agree that ownership of, and title to, the Software +and all subsequent copies thereof regardless of the form or media are held by +3Com and its suppliers. + +UNITED STATES GOVERNMENT LEGEND: The Software is commercial +in nature and developed solely at private expense. The Software is delivered as +"Commercial Computer Software" as defined in DFARS 252.227-7014 (June +1995) or as a commercial item as defined in FAR 2.101(a) and as such is +provided with only such rights as are provided in this License Agreement, which +is 3Com's standard commercial license for the Software. Technical data is +provided with limited rights only as provided in DFAR 252.227-7015 (Nov. +1995) or FAR 52.227-14 (June 1987), whichever is applicable. + +TERM AND TERMINATION: This License Agreement is effective until +terminated. You may terminate it at any time by destroying the Software and +documentation together with all copies and merged portions in any form. It will +also terminate immediately if you fail to comply with any term or condition of +this License Agreement. Upon such termination you agree to destroy the +Software and documentation, together with all copies and merged portions in any +form. + +GOVERNING LAW: This License Agreement shall be governed by the laws +of the State of California as such laws are applied to agreements entered into and +to be performed entirely within California between California residents and by +the laws of the United States. You agree that the United Nations Convention on +Contracts for the International Sale of Goods (1980) is hereby excluded in its +entirety from application to this License Agreement. + +LIMITED WARRANTY: 3Com warrants the media containing the Software +for a period of ninety (90) days from the date of original purchase from 3Com or +its authorized retailer. Proof of date of purchase will be required. Any updates +to the Software provided by 3Com (which may be provided by 3Com at its sole +discretion) shall be governed by the terms of this License Agreement. The sole +obligation of 3Com with respect to this express warranty shall be (at the +discretion of 3Com) to refund the purchase price paid by you for the Software on +the defective media, or to replace the Software on new media. 3Com makes no +warranty or representation that its software products will meet your requirements +or will work in combination with any hardware or applications software products +provided by third parties, that the operation of the software products will be +uninterrupted or error free, or that all defects in the Software will be corrected. + +OBTAINING WARRANTY SERVICE: You must contact 3Com's Palm +Computing, Inc. Customer Service within the applicable warranty period to +obtain warranty service authorization. Dated proof of original purchase will be +required. 3Com is not responsible for your products or parts received without +warranty service authorization. + +WARRANTIES EXCLUSIVE: IF TH SOFTWARE MEDIA DOES NOT +OPERATE AS WARRANTED ABOVE, YOUR SOLE REMEDY FOR +BREACH OF THAT WARRANTY SHALL BE REPLACEMENT OF THE +SOFTWARE ON NEW MEDIA OR REFUND OF THE PURCHASE +PRICE PAID, AT THE OPTION OF 3COM AND DEPENDENT UPON +PRIOR AUTHORIZATION. TO THE FULL EXTENT ALLOWED BY +LAW, THE FOREGOING WARRANTIES AND REMEDIES ARE +EXCLUSIVE AND ARE IN LIEU OF ALL OTHER WARRANTIES, +TERMS, OR CONDITIONS, EXPRESS OR IMPLIED, EITHER IN FACT +OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, +INCLUDING WARRANTIES, TERMS, OR CONDITIONS OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +AND SATISFACTORY QUALITY. 3COM NEITHER ASSUMES NOR +AUTHORIZES ANY OTHER PERSON TO ASSUME FOR IT ANY +OTHER LIABILITY IN CONNECTION WITH THE SALE, +INSTALLATION, MAINTENANCE OR USE OF ITS PRODUCTS. + +3Com shall not be liable under this warranty if its testing and examination +disclose that the alleged defect in the product does not exist or was caused by +your or any third person's misuse, neglect, improper installation or testing, +unauthorized attempts to repair or modify, or any other cause beyond the range +of the intended use, or by accident, fire, lightning, or other hazards or acts of +God. This warranty does not apply when the malfunction results from the use of +this product in conjunction with accessories, other products, or ancillary or +peripheral equipment and 3Com determines that there is no fault with the +product itself. + +LIMITATION OF LIABILITY. TO THE FULL EXTENT ALLOWED +BY LAW 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS +ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT +(INCLUDING NEGLIGENCE), FOR INCIDENTAL, CONSEQUENTIAL, +INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF ANY KIND, OR +FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF +INFORMATION OR DATA, OR OTHER FINANCIAL LOSS ARISING +OUT OF OR IN CONNECTION WITH THE SALE, INSTALLATION, +MAINTENANCE, USE, PERFORMANCE, FAILURE, OR +INTERRUPTION OF THIS PRODUCT, EVEN IF 3COM OR ITS +AUTHORIZED RESELLER HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES, AND LIMITS ITS LIABILITY TO +REPLACEMENT OF THE SOFTWARE ON NEW MEDIA, OR REFUND +OF THE PURCHASE PRICE PAID, AT THE OPTION OF 3COM. THIS +DISCLAIMER OF LIABILITY FOR DAMAGES WILL NOT BE +AFFECTED IF ANY REMEDY PROVIDED HEREIN SHALL FAIL OF +ITS ESSENTIAL PURPOSE. +SEVERABILITY: In the event any provision of this License Agreement is +found to be invalid, illegal or unenforceable, the validity, legality and +enforceability of any of the remaining provisions shall not in any way be +affected or impaired and a valid, legal and enforceable provision of similar intent +and economic impact shall be substituted therefor. The headings used in this +Agreement are for convenience only and shall not be considered part of the +Agreement. + +ENTIRE AGREEMENT: This License Agreement sets forth the entire +understanding and agreement between you and 3Com, supersedes all prior +agreements, whether written or oral, with respect to the Software and subject +matter hereof, and may be amended only in a writing signed by both parties. + +Palm Computing, Inc., a subsidiary of 3Com Corporation +1565 Charleston Road +Mountain View, California 94043 +(650) 237-6000 + diff --git a/sdk-1/include/Core/AppBuildRules.h b/sdk-1/include/Core/AppBuildRules.h new file mode 100644 index 0000000..d10f93a --- /dev/null +++ b/sdk-1/include/Core/AppBuildRules.h @@ -0,0 +1,35 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * AppBuildRules.h + * + * Description: + * This header file can beused as a template for + * application specific build options. To use, simple copy this file + * and place it into your local directory. + * + * Typically, the options specified in this file are used to build + * with different forms of error-checking, etc. and are not common to all projects. + * + * History: + * 6/6/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +// Run with error checking that forces all handles to be locked before +// they are accessed. Before alpha, all applications should be able to run with this +// option on. +#define MEMORY_FORCE_LOCK 1 + + +// Set these according to which Shell commands you want to +// link with. +#define SHELL_COMMAND_DB 0 // Available +#define SHELL_COMMAND_UI 0 // Not Available +#define SHELL_COMMAND_APP 0 // Not Available +#define SHELL_COMMAND_EMULATOR 1 // Available + diff --git a/sdk-1/include/Core/BuildRules.h b/sdk-1/include/Core/BuildRules.h new file mode 100644 index 0000000..00bf5a6 --- /dev/null +++ b/sdk-1/include/Core/BuildRules.h @@ -0,0 +1,166 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * BuildRules.h + * + * Description: + * Build Rules for Pilot. This file is necessary for + * the CodeWarrior environment since it doesn't permit #defines + * in the "Makefile". + * + * This file is included from within Common.h + * + * History: + * 12/13/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __BUILDRULES_H__ +#define __BUILDRULES_H__ + +/************************************************************ + * Compilation Control Options + *************************************************************/ + +// The makefile should set the define EMULATION_LEVEL to one of the following +// constants: +#define EMULATION_NONE 0 // native environment +#define EMULATION_WINDOWS 1 // emulate on Windows +#define EMULATION_DOS 2 // emulate on DOS +#define EMULATION_MAC 3 // emulate on Macintosh + + +// If emulation is not EMULATION_NONE, the following define controls +// whether we are talking to a touchdown device over the serial port, +// or if we are emulating a memory card in local RAM. +// +// The makefile should set the define MEMORY_TYPE to one of the following +// constants +#define MEMORY_LOCAL 0 // Emulate using local memory card image +#define MEMORY_REMOTE 1 // Pass calls through serial port to the device + + +// The makefile should set the define ENVIRONMENT to one of the following: +#define ENVIRONMENT_CW 0 // CodeWarrior on the Mac +#define ENVIRONMENT_MPW 1 // MPW on the Mac + + +// The makefile should set the define ERROR_CHECK_LEVEL to one of the +// following constants: +#define ERROR_CHECK_NONE 0 // compile no error checking code +#define ERROR_CHECK_PARTIAL 1 // display for fatal errors only +#define ERROR_CHECK_FULL 2 // display fatal or non-fatal errors + + +// The makefile should set the define CPU_TYPE to one of the +// following constants: +#define CPU_68K 0 // Motorola 68K type +#define CPU_x86 1 // Intel x86 type + + +// The makefile should set the define HW_TARGET to one of the +// following constants: +#define HW_TARGET_NONE 0 // Emulating +#define HW_TARGET_302 1 // Motorola 302 ADS board +#define HW_TARGET_328EMU 2 // Motorola 328 Emulator ADS board +#define HW_TARGET_328 3 // Motorola 328 ADS board +#define HW_TARGET_TD1 4 // Pilot hardware + + +// The makefile should set the define MEMORY_FORCE_LOCK to one of the +// following. +#define MEMORY_FORCE_LOCK_OFF 0 // Don't force all handles to be locked +#define MEMORY_FORCE_LOCK_ON 1 // Force all handles to be locked before usage + + +// The makefile should set the define DEBUG_LEVEL to one of the +// following. THIS DEFINE IS ONLY USED BY A COUPLE MODULES SO WE +// DON'T GIVE IT A DEFAULT VALUE BELOW... +// ANY MODULE THAT USES THIS DEFINE SHOULD VERIFY THAT IT IS DEFINED!! +#define DEBUG_LEVEL_NONE 1 // None: Does not auto-launch Console or Debugger +#define DEBUG_LEVEL_PARTIAL 2 // Partial: Auto-Launches Console but skips debugger +#define DEBUG_LEVEL_FULL 3 // Full: Waits in debugger on reset + + +// The makefile should set the define COUNTRY to one of the +// following constants: +#define COUNTRY_UNITED_STATES 0 +#define COUNTRY_FRANCE 1 +#define COUNTRY_GERMANY 2 + + +// The makefile should set the define LANGUAGE to one of the +// following constants: +#define LANGUAGE_ENGLISH 0 +#define LANGUAGE_FRENCH 1 +#define LANGUAGE_GERMAN 2 + + + +/************************************************************ + * Include the following file when running under the CodeWarriror + * IDE so that default build options can be overriden. The default + * version of this file is in the Incs: directory. If an app wishes + * to override the default options, it should create a copy of this + * include file in it's own local directory. This include file + * is never used when building from MPW since MPW can specify compiler + * defines from the command line. + *************************************************************/ +#ifndef CMD_LINE_BUILD // pre-defined only from MPW + #include "AppBuildRules.h" + + #include +#endif + + + +/************************************************************ + * Settings, these can be overriden in the makefile + *************************************************************/ +#ifndef EMULATION_LEVEL + #define EMULATION_LEVEL EMULATION_NONE +#endif + +#if EMULATION_LEVEL == EMULATION_NONE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +#ifndef MEMORY_TYPE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +#ifndef ENVIRONMENT + #define ENVIRONMENT ENVIRONMENT_CW +#endif + +#ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL ERROR_CHECK_FULL +#endif + +#ifndef CPU_TYPE + #define CPU_TYPE CPU_68K +#endif + +#ifndef HW_TARGET + #define HW_TARGET HW_TARGET_NONE +#endif + +#ifndef MEMORY_FORCE_LOCK + #define MEMORY_FORCE_LOCK MEMORY_FORCE_LOCK_OFF +#endif + +#ifndef COUNTRY + #define COUNTRY COUNTRY_UNITED_STATES +#endif + +#ifndef LANGUAGE + #define LANGUAGE LANGUAGE_ENGLISH +#endif + + + +#endif // __BUILDRULES_H__ diff --git a/sdk-1/include/Core/Common.h b/sdk-1/include/Core/Common.h new file mode 100644 index 0000000..422d944 --- /dev/null +++ b/sdk-1/include/Core/Common.h @@ -0,0 +1,217 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Common.h + * + * Description: + * Common header file for all Pilot routines. + * Contains elementary data types + * + * History: + * 10/19/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + + +#ifndef __COMMON_H__ +#define __COMMON_H__ + + +/************************************************************ + * Build Rules + *************************************************************/ +#include + + +/************************************************************ + * Define whether or not we are direct linking, or going through + * traps. + * + * When eumulating we use directy linking. + * When running under native mode, we use traps EXCEPT for the + * modules that actually install the routines into the trap table. + * These modules will set the DIRECT_LINK define to 1 + *************************************************************/ +#ifndef USE_TRAPS + +#if EMULATION_LEVEL == EMULATION_NONE + #define USE_TRAPS 1 +#else + #define USE_TRAPS 0 +#endif + +#endif + + +#if USE_TRAPS == 0 +#define ONEWORD_INLINE(trapNum) +#define TWOWORD_INLINE(w1, w2) +#define THREEWORD_INLINE(w1, w2, w3) +#define FOURWORD_INLINE(w1, w2, w3, w4) +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) +#else +#ifdef __GNUC__ +#define ASMWORD(W) asm("dc.w %c0"::"i"(W)); +#define ONEWORD_INLINE(trapNum) \ + {ASMWORD(trapNum)} +#define TWOWORD_INLINE(w1, w2) \ + {ASMWORD(w1)ASMWORD(w2)} +#define THREEWORD_INLINE(w1, w2, w3) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)} +#define FOURWORD_INLINE(w1, w2, w3, w4) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)} +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)} +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)} +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)} +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)} +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)} +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)ASMWORD(w10)} +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)ASMWORD(w10)ASMWORD(w11)} +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)ASMWORD(w10)ASMWORD(w11)ASMWORD(w12)} +#else +#define ONEWORD_INLINE(trapNum) \ + = trapNum +#define TWOWORD_INLINE(w1, w2) \ + = {w1,w2} +#define THREEWORD_INLINE(w1, w2, w3) \ + = {w1,w2,w3} +#define FOURWORD_INLINE(w1, w2, w3, w4) \ + = {w1,w2,w3,w4} +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) \ + = {w1,w2,w3,w4,w5} +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) \ + = {w1,w2,w3,w4,w5,w6} +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) \ + = {w1,w2,w3,w4,w5,w6,w7} +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) \ + = {w1,w2,w3,w4,w5,w6,w7,w8} +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9} +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10} +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11} +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12} +#endif +#endif + + + +/******************************************************************** + * Elementary data types + ********************************************************************/ + +// Fixed size data types +typedef char SByte; // 8 bits +typedef unsigned char Byte; + +typedef short SWord; // 16 bits +typedef unsigned short Word; + +typedef long SDWord; // 32 bits +typedef unsigned long DWord; + + +// Logical data types +typedef unsigned char Boolean; + +typedef char Char; // Used for character strings +typedef unsigned char UChar; + +typedef short Short; // >= Byte +typedef unsigned short UShort; + +typedef short Int; // >= Word (use short so MPW and CW agree) +typedef unsigned short UInt; + +typedef long Long; // >= DWord +typedef unsigned long ULong; + +typedef short Err; + +typedef DWord LocalID; // local (card relative) chunk ID + + + +/************************************************************ + * Pointer Types + *************************************************************/ +typedef void* VoidPtr; +typedef VoidPtr* VoidHand; + + +// Fixed size data types +typedef SByte* SBytePtr; +typedef Byte* BytePtr; + +typedef SWord* SWordPtr; +typedef Word* WordPtr; + +typedef SDWord* SDWordPtr; +typedef DWord* DWordPtr; + + +// Logical data types +typedef Boolean* BooleanPtr; + +typedef Char* CharPtr; +typedef UChar* UCharPtr; + +typedef Short* ShortPtr; +typedef UShort* UShortPtr; + +typedef Int* IntPtr; +typedef UInt* UIntPtr; + +typedef Long* LongPtr; +typedef ULong* ULongPtr; + + +// Include the following typedefs if types.h wasn't read. +#ifndef __TYPES__ + +// Generic Pointer types used by Memory Manager +// We have to define Ptr as char* because that's what the Mac includes do. +typedef char* Ptr; // global pointer +typedef Ptr* Handle; // global handle + + +// Function types +typedef Long (*ProcPtr)(); + +#endif /* __TYPES__ */ + + +/************************************************************ + * Common constants + *************************************************************/ +#ifndef NULL +#define NULL 0 +#endif // NULL + +#ifndef __TYPES__ // Macintosh Types +enum {false, true}; +#define __TYPES__ +#endif + +#endif //__COMMON_H__ diff --git a/sdk-1/include/Core/Hardware/Hardware.h b/sdk-1/include/Core/Hardware/Hardware.h new file mode 100644 index 0000000..ce019f3 --- /dev/null +++ b/sdk-1/include/Core/Hardware/Hardware.h @@ -0,0 +1,246 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Hardware.h + * + * Description: + * General Hardware Equates. This header file + * contains general hardware configuration equates that are not dependent on + * the version of the hardware we're running on. Equates specific to + * a certain component like the 68328, etc. is contained in separate + * header files. + * + * History: + * 4/27/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HARDWARE_H__ +#define __HARDWARE_H__ + + + + +/************************************************************************** + * General Equates + ***************************************************************************/ + +// Bits in the low memory global GHwrWakeUp +#define hwrWakeUpGeneral 0x0001 +#define hwrWakeUpPWM 0x0002 +#define hwrWakeUpFromKey 0x0004 // set if we woke from a key press +#define hwrWakeUpReturnToSleep 0x0008 // set if we woke from 24 hr. interrupt + // in which case we want to go right back to sleep + + + +// Bits for the call HwrDockSignals +#define hwrDockInSyncButton 0x0001 // Dock button +#define hwrDockInGeneric1 0x0002 // General Purpose input #1 + +#define hwrDockOutGeneric0 0x0001 // General Purpose output #0 + + + +// Define # of card slots +#if EMULATION_LEVEL == EMULATION_NONE +#define hwrNumCardSlots 1 // 1 card slot +#else +#define hwrNumCardSlots 2 // 2 card slots for emulation +#endif + + +// Screen Dimensions +#define hwrDisplayWidth 160 // Width of display +#define hwrDisplayHeight 160 // Height of display + +// Screen refresh rate +#define hwrDisplayPeriod 12 // frame period in ms. + + +// Battery scaling: +// Voltage = (level + hwrVoltStepsOffset) / hwrStepsPerVolt +#define hwrStepsPerVolt 78 // 78 = 1 volt. +#define hwrVoltStepsOffset 0 // Add to level before scaling + +//---------------------------------------------------------------------------- +// Digitizer Dimensions +//---------------------------------------------------------------------------- +#define hwrSystemTop (hwrDisplayHeight+4) +#define hwrSystemHeight 56 + +// Graffiti Area +#define hwrGraffitiTop hwrSystemTop // Top coordinate of Graffiti area +#define hwrGraffitiLeft 27 // Left coordinate of Graffiti area +#define hwrGraffitiWidth 106 // Width of Graffiti area +#define hwrGraffitiHeight hwrSystemHeight // Height of Graffiti area +#define hwrGraffitiSplit (hwrGraffitiLeft+62) // Split mode dividing line + +// Launch Button +#define hwrLaunchBtnLeft 0 +#define hwrLaunchBtnTop hwrSystemTop +#define hwrLaunchBtnWidth 27 +#define hwrLaunchBtnHeight (hwrSystemHeight/2) + +// Menu Button +#define hwrMenuBtnLeft 0 +#define hwrMenuBtnTop (hwrSystemTop+hwrMenuBtnHeight) +#define hwrMenuBtnWidth 27 +#define hwrMenuBtnHeight (hwrSystemHeight/2) + +// Calculator Button +#define hwrCalcBtnLeft 133 +#define hwrCalcBtnTop hwrSystemTop +#define hwrCalcBtnWidth 27 +#define hwrCalcBtnHeight (hwrSystemHeight/2) + +// Find Button +#define hwrFindBtnLeft 133 +#define hwrFindBtnTop (hwrSystemTop+hwrCalcBtnHeight) +#define hwrFindBtnWidth 27 +#define hwrFindBtnHeight (hwrSystemHeight/2) + + + +/************************************************************************** + * Prototypes of functions used only when running on the real hardware + ***************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + // These routines are only accessed from the Debugger so they don't + // need traps. + void HwrPreRAMInit(void); + + void HwrPreDebugInit(void); + + void HwrInit(void); + + void HwrPostDebugInit(void); + + Err HwrFlashWriteSub(Ptr bodyP); + + void HwrResetNMI(void); + + DWord HwrGetRAMSize(UInt cardNo, DWord limit); + + void HwrDrawSplashScreen(void); + + void HwrDisableInts(void); + + void HwrShutDownPLL(void); + + void HwrLowBatteryHandler(void); + + + // These routines are for "general" use. + void HwrIRQ1Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ1Handler); + void HwrIRQ2Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ2Handler); + void HwrIRQ3Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ3Handler); + void HwrIRQ4Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ4Handler); + void HwrIRQ5Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ5Handler); + void HwrIRQ6Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ6Handler); + + + void HwrGetRAMMapping(Ptr /*CardInfoPtr*/ cardInfoP, UInt* numBlocksP, + DWordPtr physBlockInfoP, DWordPtr logBlockInfoP) + SYS_TRAP(sysTrapHwrGetRAMMapping); + + DWord HwrMemWritable(VoidPtr addr) + SYS_TRAP(sysTrapHwrMemWritable); + + DWord HwrMemReadable(VoidPtr addr) + SYS_TRAP(sysTrapHwrMemReadable); + + Err HwrCursor(Boolean set, Int* modeP, PointType* whereP, PointType* sizeP, + UInt* blinkP) + SYS_TRAP(sysTrapHwrCursor); + + void HwrDelay(ULong microseconds) + SYS_TRAP(sysTrapHwrDelay); + + void HwrDoze(Boolean onlyNMI) + SYS_TRAP(sysTrapHwrDoze); + + void HwrSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapHwrSleep); + + Err HwrWake(void) + SYS_TRAP(sysTrapHwrWake); + + Err HwrSetSystemClock(ULong* freqP) + SYS_TRAP(sysTrapHwrSetSystemClock); + + Err HwrSetCPUDutyCycle(UInt* dutyP) + SYS_TRAP(sysTrapHwrSetCPUDutyCycle); + + Err HwrLCDInit(UInt framePeriod, VoidPtr baseP, UInt width, + UInt height, UInt depth) + SYS_TRAP(sysTrapHwrLCDInit); + + Err HwrLCDBaseAddr(Ptr* newAddrP) + SYS_TRAP(sysTrapHwrLCDBaseAddr); + + Err HwrLCDDrawBitmap(UInt x, UInt y, Ptr bitmapP, Boolean clearFirst) + SYS_TRAP(sysTrapHwrLCDDrawBitmap); + + Err HwrLCDSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapHwrLCDSleep); + + Err HwrLCDWake(void) + SYS_TRAP(sysTrapHwrLCDWake); + + Err HwrTimerInit(UInt timer) + SYS_TRAP(sysTrapHwrTimerInit); + + Err HwrTimerSleep(UInt timer) + SYS_TRAP(sysTrapHwrTimerSleep); + + Err HwrTimerWake(UInt timer) + SYS_TRAP(sysTrapHwrTimerWake); + + UInt HwrBatteryLevel(void) + SYS_TRAP(sysTrapHwrBatteryLevel); + + Boolean HwrPluggedIn(void) + SYS_TRAP(sysTrapHwrPluggedIn); + + Boolean HwrEnableDataWrites(void) + SYS_TRAP(sysTrapHwrEnableDataWrites); + + void HwrDisableDataWrites(void) + SYS_TRAP(sysTrapHwrDisableDataWrites); + + Err HwrDockSignals(WordPtr inputsP, Word outputSet, Word outputClr) + SYS_TRAP(sysTrapHwrDockSignals); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _HwrWake \ + ASM_SYS_TRAP(sysTrapHwrWake) + + +#endif //__HARDWARE_H__ + +#endif // NON_PORTABLE diff --git a/sdk-1/include/Core/Hardware/HardwarePrv.h b/sdk-1/include/Core/Hardware/HardwarePrv.h new file mode 100644 index 0000000..62a1a43 --- /dev/null +++ b/sdk-1/include/Core/Hardware/HardwarePrv.h @@ -0,0 +1,174 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * HardwarePrv.h + * + * Description: + * Private Hardware Equates. This header file + * contains equates that are common across all platforms but that + * change value for each hardware rev and platform. + * + * History: + * 4/27/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HARDWAREPRV_H__ +#define __HARDWAREPRV_H__ + + +// This must be defined on the command line before using this header!! +#if HW_TARGET != HW_TARGET_NONE + #ifndef HW_REV + #error THE COMPILER VARIABLE HW_REV MUST BE DEFINED!! + #endif +#endif + + + +/*********************************************************************** + * Equates for Emulation Mode + ***********************************************************************/ +#if HW_TARGET == HW_TARGET_NONE + +#define hwrCardSize 0x10000000L // Size of each card slot + +// DOLATER.. take this out??? +// Under native mode, this mask can be used to convert a pointer to a card offseš +//#define hwrCardOffsetMask 0x0FFFFFFFL + + +#endif + + + +/*********************************************************************** + * First Rev of the Pilot Hardware + ***********************************************************************/ +#if HW_TARGET == HW_TARGET_TD1 + + +// Define location and setup for the 68328 Dragonball chip +#define hwr68328Base 0xFFFFF000L // Base address of 68328 + + + +// Define the base of card 0 and the size of each card slot. +#if HW_REV <= 3 +#define hwrCardBase0 0x00800000L // starts here +#define hwrCardSize 0x00800000L // Size of each card slot +#define hwrFlashBase 0x00F00000L // Base of Flash ROM +#define hwrFlashSize 0x00080000L // Size of Flash ROM +#define hwrCardOffsetMask 0x007FFFFFL // Used to convert a pointer to a card offset + +#else // HW_REV >= 4 +#define hwrCardBase0 0x10000000L // starts here +#define hwrCardSize 0x10000000L // Size of each card slot +#define hwrFlashBase 0x10C00000L // Base of Flash ROM +#define hwrFlashSize 0x00080000L // Size of Flash ROM +#define hwrCardOffsetMask 0x0FFFFFFFL // Used to convert a pointer to a card offset + +#endif + +// Define the Flash width +#define hwrROMWidth 2 + +// Define location and setup for the 68681 Duart +#define hwrDuartBase 0x10E00000 // Base address of DUART + +#define hwrDuartClock 3686400 // in Hertz (3.6864 MHz) + +// Setting of ACR register except for baud rate select +// Timer mode - Crystal clock /1 +#define hwrDuartACRReg 0x60 + + +#endif // HW_TARGET == HW_TARGET_TD1 + + + + +/*********************************************************************** + * Motorola 68302 Development board + ***********************************************************************/ +#if HW_TARGET == HW_TARGET_302 + +// Define # of card slots and base address of each slot +#define hwrNumCardSlots 1 // 1 card slot +#define hwrCardBase0 0x00000000L // starts at 0 +#define hwrCardSize 0x10000000L // Size of each card slot + +// Under native mode, this mask can be used to convert a pointer to a card offseš +#define hwrCardOffsetMask 0x0FFFFFFFL + + +// Define location and setup for the 68681 Duart +#define hwrDuartBase 0x00400000 // Base address of DUART + +#define hwrDuartClock 3686400 // in Hertz (3.6864 MHz) + +#define hwrDuartIntVec 25 // Interrupt vector number for DUART + + +// Setting of ACR register except for baud rate select +// Timer mode - Crystal clock /1 +#define hwrDuartACRReg 0x60 + + +// Define the Flash base address +#define hwrFlashBase 0x00200000L +#define hwrROMWidth 2 + + +#endif // HW_TARGET == HW_TARGET_302 + + + + +/*********************************************************************** + * Motorola 68328 Emulator Development board + ***********************************************************************/ +#if HW_TARGET == HW_TARGET_328EMU + + +// Define # of card slots and base address of each slot +#define hwrNumCardSlots 1 // 1 card slot +#define hwrCardBase0 0x00000000L // starts at 0 +#define hwrCardSize 0x10000000L // Size of each card slot + +// Under native mode, this mask can be used to convert a pointer to a card offseš +#define hwrCardOffsetMask 0x0FFFFFFFL + + +// Define location and setup for the 68681 Duart +#define hwrDuartBase 0x00F00000 // Base address of DUART + +#define hwrDuartClock 3686400 // in Hertz (3.6864 MHz) + +#define hwrDuartIntVec 25 // Interrupt vector number for DUART + + + +// Setting of ACR register except for baud rate select +// Timer mode - Crystal clock /1 +#define hwrDuartACRReg 0x60 + + + +// Define the Flash base address +#define hwrFlashBase 0x00400000L +#define hwrROMWidth 2 + + + +#endif // HW_TARGET == HW_TARGET_328EMU + + +#endif //__HARDWARE_H__ +#endif // NON_PORTABLE diff --git a/sdk-1/include/Core/Hardware/HardwareTD1.h b/sdk-1/include/Core/Hardware/HardwareTD1.h new file mode 100644 index 0000000..63b1ca4 --- /dev/null +++ b/sdk-1/include/Core/Hardware/HardwareTD1.h @@ -0,0 +1,308 @@ +/******************************************************************* + * Touchdown Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * HardwareTD1.h + * + * Description: + * Hardware Equates for the TD1 platform. This header file + * contains equates specific to Hardware platform TD1. + * It is included only in the modules "ROMHardwareTD1.c" and + * "AMXHardwareTD1.c". + * + * History: + * 6/13/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HARDWARETD1_H__ +#define __HARDWARETD1_H__ + + + +#if HW_REV == 1 +/************************************************************************ + * Port F Bit settings + ************************************************************************/ +#define hwrTD1PortFPanelYPOff 0x01 // (L) Vcc to Y Panel +#define hwrTD1PortFPanelYMOn 0x02 // (H) Gnd to Y Panel +#define hwrTD1PortFPanelXPOff 0x04 // (L) Vcc to X Panel +#define hwrTD1PortFPanelXMOn 0x08 // (H) Gnd to X Panel +#define hwrTD1PortFUnused4 0x10 +#define hwrTD1PortFUnused5 0x20 +#define hwrTD1PortFUnused6 0x40 +#define hwrTD1PortFSerialOn 0x80 // (H) Serial driver Enable + + +// Configurations of the panel control bits +#define hwrTD1PortFPanelMask 0x0F // Panel control bits + +// Configure for lowest power +#define hwrTD1PortFPanelCfgOff (hwrTD1PortFPanelYPOff | \ + hwrTD1PortFPanelXPOff) + +// Configure to generate pen interrupt +#define hwrTD1PortFPanelCfgPenIRQ (hwrTD1PortFPanelXMOn | \ + hwrTD1PortFPanelYPOff | \ + hwrTD1PortFPanelXPOff) + +// Configure to Measure Y Position +#define hwrTD1PortFPanelCfgYMeas (hwrTD1PortFPanelXMOn | \ + hwrTD1PortFPanelYPOff) + +// Configure to Measure X Position +#define hwrTD1PortFPanelCfgXMeas (hwrTD1PortFPanelXPOff | \ + hwrTD1PortFPanelYMOn) + + + +/************************************************************************ + * Port J Bit Assignments + ************************************************************************/ +#define hwrTD1PortJADCSOff 0x02 // (L) A/D Chip select +#define hwrTD1PortJBattOff 0x10 // (L) Battery Voltage measure +#define hwrTD1PortJLCDEnableOn 0x20 // (H) LCD Display On +#define hwrTD1PortJLCDVccOff 0x40 // (L) LCD Vcc +#define hwrTD1PortJLCDVeeOn 0x80 // (H) LCD Vee + + +/************************************************************************ + * Port K Bit Assignments + ************************************************************************/ +#define hwrTD1PortKSelfRefOff 0x08 // (L) PSRAM Self Refresh mode +#define hwrTD1PortKSelfRefOffBit 3 + + +/************************************************************************ + * Port M Bit Assignments + ************************************************************************/ +#define hwrTD1PortMVccFail 0x04 // (L) Input indicates 3.3v is too low +#define hwrTD1PortMCardIRQ 0x08 // (L) IRQ3 input from card +#define hwrTD1PortMUnused4 0x10 // Unused (IRQ2) +#define hwrTD1PortMDockButton 0x20 // (L) Sync button from Serial Doc +#define hwrTD1PortMPenIO 0x40 // Pen input/output +#define hwrTD1PortMDockIn 0x80 // (L) Gen. Purpose input from Serial Doc + + + +/************************************************************************ + * SPIM Base Configuration + ************************************************************************/ +#define hwrTD1SPIMBaseControl (hwr328SPIMControlRateDiv32 | \ + hwr328SPIMControlIntEnable | \ + hwr328SPIMControlInvPolarity | \ + hwr328SPIMControlOppPhase | \ + 16-1) + + +/************************************************************************ + * Macros for turning write-protection on/off + * These are used in-line for MemSemaphoreReserve and MemSemaphoreRelease + * for performance reasons. + ************************************************************************/ +#define hwrWriteProtectOff() \ + { \ + HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \ + /* Word mask; */ \ + \ + /* DOLATER.. take this out.... */ \ + /* mask = baseP->csAGroupMask; */ \ + \ + /* Clr read-only bit in chip select register for storage area */ \ + baseP->csASelect1 &= ~(0x0008); \ + baseP->csASelect2 &= ~(0x0008); \ + \ + /* DOLATER.. take this out... */ \ + /* baseP->csAGroupMask = mask; */ \ + } + +#ifndef BUILD_OPTION_WP_OFF +#define hwrWriteProtectOn() \ + { \ + HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \ + /* Word mask; */ \ + \ + /* DOLATER.. take this out.... */ \ + /* mask = baseP->csAGroupMask; */ \ + \ + /* Set read-only bit in chip select register for storage area */ \ + baseP->csASelect1 |= (0x0008); \ + baseP->csASelect2 |= (0x0008); \ + \ + /* DOLATER.. take this out... */ \ + /* baseP->csAGroupMask = mask; */ \ + } +#else +#define hwrWriteProtectOn() +#endif + + +#elif HW_REV >= 2 +/************************************************************************ + * Port D Bit settings + ************************************************************************/ +#define hwrTD1PortDNoExtPower 0x80 // (L) External DC input + +/************************************************************************ + * Port F Bit settings + ************************************************************************/ +#define hwrTD1PortFPanelYPOff 0x01 // (L) Vcc to Y Panel +#define hwrTD1PortFPanelYMOn 0x02 // (H) Gnd to Y Panel +#define hwrTD1PortFPanelXPOff 0x04 // (L) Vcc to X Panel +#define hwrTD1PortFPanelXMOn 0x08 // (H) Gnd to X Panel +#define hwrTD1PortFLCDEnableOn 0x10 // (H) LCD Display on +#define hwrTD1PortFLCDVccOff 0x20 // (L) LCD Vcc +#define hwrTD1PortFLCDVeeOn 0x40 // (H) LCD Vee +#define hwrTD1PortFADCSOff 0x80 // (L) A/D Chip Select + + +// Configurations of the panel control bits +#define hwrTD1PortFPanelMask 0x0F // Panel control bits + +// Configure for lowest power +#define hwrTD1PortFPanelCfgOff (hwrTD1PortFPanelYPOff | \ + hwrTD1PortFPanelXPOff) + +// Configure to generate pen interrupt +#define hwrTD1PortFPanelCfgPenIRQ (hwrTD1PortFPanelXMOn | \ + hwrTD1PortFPanelYPOff | \ + hwrTD1PortFPanelXPOff) + +// Configure to Measure Y Position +#define hwrTD1PortFPanelCfgYMeas (hwrTD1PortFPanelXMOn | \ + hwrTD1PortFPanelYPOff) + +// Configure to Measure X Position +#define hwrTD1PortFPanelCfgXMeas (hwrTD1PortFPanelXPOff | \ + hwrTD1PortFPanelYMOn) + + +/************************************************************************ + * Port G Bit Assignments + ************************************************************************/ +#define hwrTD1PortGSerialOn 0x08 // (H) Serial Driver Enable +#define hwrTD1PortGBattOff 0x10 // (L) Battery Voltage Measure +#define hwrTD1PortGRefreshOut 0x20 // (L) Timer 1 output to signal refresh +#define hwrTD1PortGSelfRefOff 0x40 // (L) PSRAM Self Refresh mode +#define hwrTD1PortGSelfRefOffBit 6 // Bit # for above +#define hwrTD1PortGDockOut1 0x80 // (H) Gen. Purpose output on Serial Doc + + +/************************************************************************ + * Port M Bit Assignments + ************************************************************************/ +#define hwrTD1PortMVccFail 0x04 // (L) Input indicates 3.3v is too low +#define hwrTD1PortMCardIRQ 0x08 // (L) IRQ3 input from card +#define hwrTD1PortMUnused4 0x10 // Unused (IRQ2) +#define hwrTD1PortMDockButton 0x20 // (L) Sync button from Serial Doc +#define hwrTD1PortMPenIO 0x40 // Pen input/output +#define hwrTD1PortMDockIn 0x80 // (L) Gen. Purpose input from Serial Doc + + + +/************************************************************************ + * SPIM Base Configuration + ************************************************************************/ +#define hwrTD1SPIMBaseControl (hwr328SPIMControlRateDiv16 | \ + hwr328SPIMControlIntEnable | \ + hwr328SPIMControlInvPolarity | \ + hwr328SPIMControlOppPhase | \ + 16-1) + + +/************************************************************************ + * Macros for turning write-protection on/off + * These are used in-line for MemSemaphoreReserve and MemSemaphoreRelease + * for performance reasons. + ************************************************************************/ +#define hwrWriteProtectOff() \ + { \ + HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \ + /* Word mask; */ \ + \ + /* DOLATER.. take this out.... */ \ + /* mask = baseP->csAGroupMask; */ \ + \ + /* Clr read-only bit in chip select register for storage area */ \ + baseP->csASelect1 &= ~(0x0008); \ + baseP->csASelect3 &= ~(0x0008); \ + \ + /* DOLATER.. take this out... */ \ + /*baseP->csAGroupMask = mask; */ \ + } + +#ifndef BUILD_OPTION_WP_OFF +#define hwrWriteProtectOn() \ + { \ + HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \ + /* Word mask; */ \ + \ + /* DOLATER.. take this out.... */ \ + /* mask = baseP->csAGroupMask; */ \ + \ + /* Set read-only bit in chip select register for storage area */ \ + baseP->csASelect1 |= (0x0008); \ + baseP->csASelect3 |= (0x0008); \ + \ + /* DOLATER.. take this out... */ \ + /*baseP->csAGroupMask = mask; */ \ + } +#else +#define hwrWriteProtectOn() +#endif + +#else // HW_REV==2 + #error "Compiler variable HW_REV not valid!!!" +#endif + + +/************************************************************************ + *Initial values for the PLL. We set the system clock to be VCO/2 so + * the system clock speed becomes: + * + * 32768 * ((hwrTD1FreqSelP + 1) * 14 + hwrTD1FreqSelQ + 1) + * -------------------------------------------------------- + * 2 + ************************************************************************/ +// NON-ASIC versions must run at 8 Mhz. +#if HW_REV < 4 +#define hwrTD1PLLControl (hwr328PLLControlClkEn | \ + hwr328PLLControlSysVCODiv2 | \ + hwr328PLLControlPixVCODiv2) +//#define hwrTD1FreqSelQ 0x05 +#define hwrTD1FreqSelQ 0x07 // vmk 11/20/95 tunes clock freq for 38400 baud, + // allowing standard baud rates 2400-57600 to function +//#define hwrTD1FreqSelP 0x23 +#define hwrTD1FreqSelP 0x24 +#define hwrTD1Frequency (32768*((hwrTD1FreqSelP+1)*14+hwrTD1FreqSelQ+1)/2) + +// OLD ASIC versions must run between 10 and 12.5 Mhz. +#elif HW_REV == 4 +#define hwrTD1PLLControl (hwr328PLLControlClkEn | \ + hwr328PLLControlSysVCODiv1 | \ + hwr328PLLControlPixVCODiv1) +#define hwrTD1FreqSelQ 0x05 +#define hwrTD1FreqSelP 0x19 +#define hwrTD1Frequency (32768*((hwrTD1FreqSelP+1)*14+hwrTD1FreqSelQ+1)/1) + + +// NEW ASIC versions run at 16.580608 Mhz +#else +#define hwrTD1PLLControl (hwr328PLLControlClkEn | \ + hwr328PLLControlSysVCODiv1 | \ + hwr328PLLControlPixVCODiv1) +#define hwrTD1FreqSelQ 0x01 +#define hwrTD1FreqSelP 0x23 +#define hwrTD1Frequency (32768*((hwrTD1FreqSelP+1)*14+hwrTD1FreqSelQ+1)/1) +#endif + + + +#endif //__HARDWARETD1_H__ + +#endif // NON_PORTABLE diff --git a/sdk-1/include/Core/Hardware/M68328Hwr.h b/sdk-1/include/Core/Hardware/M68328Hwr.h new file mode 100644 index 0000000..b5da7c4 --- /dev/null +++ b/sdk-1/include/Core/Hardware/M68328Hwr.h @@ -0,0 +1,638 @@ +/******************************************************************* + * Touchdown Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * M68328Hwr.h + * + * Description: + * Hardware Equates for the Motorola 68328 Dragonball chip + * + * History: + * 4/19/95 RM - Created by Ron Marianetti + * 5/15/95 VMK - Added macros for RTC bits + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So apps don't include this... + + +#ifndef __M68328HWR_H__ +#define __M68328HWR_H__ + + +#include // Touchdown includes + + +/*********************************************************************** + * Motorola 68328 registers + ***********************************************************************/ +typedef struct HwrDBallType { + + Byte scr; // $000: System Control Register + Byte ___filler1[0xFF]; + + Word csAGroupBase; // $100: Chip Select Group A Base Register + Word csBGroupBase; // $102: Chip Select Group B Base Register + Word csCGroupBase; // $104: Chip Select Group C Base Register + Word csDGroupBase; // $106: Chip Select Group D Base Register + + Word csAGroupMask; // $108: Chip Select Group A Mask Register + Word csBGroupMask; // $10A: Chip Select Group B Mask Register + Word csCGroupMask; // $10C: Chip Select Group C Mask Register + Word csDGroupMask; // $10E: Chip Select Group D Mask Register + + DWord csASelect0; // $110: Group A Chip Select 0 Register + DWord csASelect1; // $114: Group A Chip Select 1 Register + DWord csASelect2; // $118: Group A Chip Select 2 Register + DWord csASelect3; // $11C: Group A Chip Select 3 Register + + DWord csBSelect0; // $120: Group B Chip Select 0 Register + DWord csBSelect1; // $124: Group B Chip Select 1 Register + DWord csBSelect2; // $128: Group B Chip Select 2 Register + DWord csBSelect3; // $12C: Group B Chip Select 3 Register + + DWord csCSelect0; // $130: Group C Chip Select 0 Register + DWord csCSelect1; // $134: Group C Chip Select 1 Register + DWord csCSelect2; // $138: Group C Chip Select 2 Register + DWord csCSelect3; // $13C: Group C Chip Select 3 Register + + DWord csDSelect0; // $140: Group D Chip Select 0 Register + DWord csDSelect1; // $144: Group D Chip Select 1 Register + DWord csDSelect2; // $148: Group D Chip Select 2 Register + DWord csDSelect3; // $14C: Group D Chip Select 3 Register + + Word csDebug; // $150: Chip Select debug register + Byte ___filler2[0x200-0x152]; + + Word pllControl; // $200: PLL Control Register + Word pllFreqSel; // $202: PLL Frequency Select Register + Word pllTest; // $204: PLL Test Register + Byte __filler44; + Byte pwrControl; // $207: Power Control Register + + Byte ___filler3[0x300-0x208]; + + Byte intVector; // $300: Interrupt Vector Register + Byte ___filler4; + Word intControl; // $302: Interrupt Control Register + Word intMaskHi; // $304: Interrupt Mask Register/HIGH word + Word intMaskLo; // $306: Interrupt Mask Register/LOW word + Word intWakeupEnHi; // $308: Interrupt Wakeup Enable Register + Word intWakeupEnLo; // $30A: Interrupt Wakeup Enable Register + Word intStatusHi; // $30C: Interrupt Status Register/HIGH word + Word intStatusLo; // $30E: Interrupt Status Register/LOW word + Word intPendingHi; // $310: Interrupt Pending Register + Word intPendingLo; // $312: Interrupt Pending Register + + Byte ___filler4a[0x400-0x314]; + + Byte portADir; // $400: Port A Direction Register + Byte portAData; // $401: Port A Data Register + Byte ___filler5; + Byte portASelect; // $403: Port A Select Register + + Byte ___filler6[4]; + + Byte portBDir; // $408: Port B Direction Register + Byte portBData; // $409: Port B Data Register + Byte ___filler7; + Byte portBSelect; // $40B: Port B Select Register + + Byte ___filler8[4]; + + Byte portCDir; // $410: Port C Direction Register + Byte portCData; // $411: Port C Data Register + Byte ___filler9; + Byte portCSelect; // $413: Port C Select Register + + Byte ___filler10[4]; + + Byte portDDir; // $418: Port D Direction Register + Byte portDData; // $419: Port D Data Register + Byte portDPullupEn; // $41A: Port D Pull-up Enable + Byte ___filler11; + Byte portDPolarity; // $41C: Port D Polarity Register + Byte portDIntReqEn; // $41D: Port D Interrupt Request Enable + Byte ___filler12; + Byte portDIntEdge; // $41F: Port D IRQ Edge Register + + Byte portEDir; // $420: Port E Direction Register + Byte portEData; // $421: Port E Data Register + Byte ___filler13; + Byte portESelect; // $423: Port E Select Register + + Byte ___filler14[4]; + + Byte portFDir; // $428: Port F Direction Register + Byte portFData; // $429: Port F Data Register + Byte portFPullupEn; // $42A: Port F Pull-up Enable + Byte portFSelect; // $42B: Port F Select Register + + Byte ___filler16[4]; + + Byte portGDir; // $430: Port G Direction Register + Byte portGData; // $431: Port G Data Register + Byte portGPullupEn; // $432: Port G Pull-up Enable + Byte portGSelect; // $433: Port G Select Register + + Byte ___filler18[4]; + + Byte portJDir; // $438: Port J Direction Register + Byte portJData; // $439: Port J Data Register + Byte ___filler19; + Byte portJSelect; // $43B: Port J Select Register + + Byte ___filler19a[4]; + + Byte portKDir; // $440: Port K Direction Register + Byte portKData; // $441: Port K Data Register + Byte portKPullupEn; // $442: Port K Pull-up Enable + Byte portKSelect; // $443: Port K Select Register + + Byte ___filler21[4]; + + Byte portMDir; // $448: Port M Direction Register + Byte portMData; // $449: Port M Data Register + Byte portMPullupEn; // $44A: Port M Pull-up Enable Register + Byte portMSelect; // $44B: Port M Select Register + + Byte ___filler22[4]; + + Byte ___filler23[0x500-0x450]; + + Word pwmControl; // $500: PWM Control Register + Word pwmPeriod; // $502: PWM Period Register + Word pwmWidth; // $504: PWM Width Register + Word pwmCounter; // $506: PWM Counter + + Byte ___filler24[0x600-0x508]; + + Word tmr1Control; // $600: Timer 1 Control Register + Word tmr1Prescaler; // $602: Timer 1 Prescaler Register + Word tmr1Compare; // $604: Timer 1 Compare Register + Word tmr1Capture; // $606: Timer 1 Capture Register + Word tmr1Counter; // $608: Timer 1 Counter Register + Word tmr1Status; // $60A: Timer 1 Status Register + + Word tmr2Control; // $60C: Timer 2 Control Register + Word tmr2Prescaler; // $60E: Timer 2 Prescaler Register + Word tmr2Compare; // $610: Timer 2 Compare Register + Word tmr2Capture; // $612: Timer 2 Capture Register + Word tmr2Counter; // $614: Timer 2 Counter Register + Word tmr2Status; // $616: Timer 2 Status Register + + Word wdControl; // $618: Watchdog Control Register + Word wdReference; // $61A: Watchdog Reference Register + Word wdCounter; // $61C: Watchdog Counter + + Byte ___filler25[0x700-0x61E]; + + Word spiSlave; // $700: SPI Slave Register + + Byte ___filler26[0x800-0x702]; + + Word spiMasterData; // $800: SPI Master Data Register + Word spiMasterControl; // $802: SPI Master Control Register + + Byte ___filler27[0x900-0x804]; + + Word uControl; // $900: Uart Control Register + Word uBaud; // $902: Uart Baud Control Register + Word uReceive; // $904: Uart Receive Register + Word uTransmit; // $906: Uart Transmit Register + Word uMisc; // $908: Uart Miscellaneous Register + + Byte ___filler28[0xA00-0x90A]; + + DWord lcdStartAddr; // $A00: Screen Starting Address Register + Byte ___filler29; + Byte lcdPageWidth; // $A05: Virtual Page Width Register + Byte ___filler30[2]; + Word lcdScreenWidth; // $A08: Screen Width Register + Word lcdScreenHeight; // $A0A: Screen Height Register + Byte ___filler31[0xA18-0xA0C]; + Word lcdCursorXPos; // $A18: Cursor X Position + Word lcdCursorYPos; // $A1A: Cursor Y Position + Word lcdCursorWidthHeight; // $A1C: Cursor Width and Height + Byte ___filler32; + Byte lcdBlinkControl; // $A1F: Blink Control Register + Byte lcdPanelControl; // $A20: Panel Interface Control Register + Byte lcdPolarity; // $A21: Polarity Config Register + Byte ___filler33; + Byte lcdACDRate; // $A23: ACD (M) Rate Control Register + Byte ___filler34; + Byte lcdPixelClock; // $A25: Pixel Clock Divider Register + Byte ___filler35; + Byte lcdClockControl; // $A27: Clocking Control Register + Byte ___filler36; + Byte lcdLastBufferAddr; // $A29: Last Buffer Address Register + Byte ___filler37; + Byte lcdOctetTermCount; // $A2B: Octet Terminal Count Register + Byte ___filler38; + Byte lcdPanningOffset; // $A2D: Panning Offset Register + Byte ___filler39[3]; + Byte lcdFrameRate; // $A31: Frame Rate Control Modulation Register + Word lcdGrayPalette; // $A32: Gray Palette Mapping Register + Byte lcdReserved; // $A34: Reserved + + Byte ___filler40[0xB00-0xA35]; + + DWord rtcHourMinSec; // $B00: RTC Hours, Minutes, Seconds Register + DWord rtcAlarm; // $B04: RTC Alarm Register + DWord rtcReserved; // $B08: RTC Reserved + Word rtcControl; // $B0C: RTC Control Register + Word rtcIntStatus; // $B0E: RTC Interrupt Status Register + Word rtcIntEnable; // $B10: RTC Interrupt Enable Register + Word stopWatch; // $B12: Stopwatch Minutes + + } HwrDBallType; + +typedef volatile HwrDBallType* HwrDBallPtr; + + +/************************************************************************ + * LCD Controller Bits + ************************************************************************/ +#define hwr328LcdCursorXPosCtlMask 0xC000 + #define hwr328LcdCursorXPosCtlTrans 0x0000 + #define hwr328LcdCursorXPosCtlBlack 0x4000 + #define hwr328LcdCursorXPosCtlReverse 0x8000 + +#define hwr328LcdBlinkControlEnable 0x80 + +#define hwr328LcdPanelControlBusMask 0x06 + #define hwr328LcdPanelControlBus1Bit 0x00 + #define hwr328LcdPanelControlBus2Bit 0x02 + #define hwr328LcdPanelControlBus4Bit 0x04 +#define hwr328LcdPanelControlGrayScale 0x01 + +#define hwr328LcdPolarityShiftClock 0x08 +#define hwr328LcdPolarityFLM 0x04 +#define hwr328LcdPolarityLP 0x02 +#define hwr328LcdPolarityPixel 0x01 + +#define hwr328LcdClockControlEnable 0x80 +#define hwr328LcdClockControl16WordBursts 0x40 +#define hwr328LcdClockControlBurstRateMask 0x30 +// Old dragonball allows up to 4 clocks/word +#if HW_REV < 3 + #define hwr328LcdClockControlBurstRate1 0x00 + #define hwr328LcdClockControlBurstRate2 0x10 + #define hwr328LcdClockControlBurstRate3 0x20 + #define hwr328LcdClockControlBurstRate4 0x30 +// New dragonball allows up to 16 clocks/word +#else + #define hwr328LcdClockControlBurstRate1 0x00 + #define hwr328LcdClockControlBurstRate2 0x04 + #define hwr328LcdClockControlBurstRate3 0x08 + #define hwr328LcdClockControlBurstRate4 0x0C + #define hwr328LcdClockControlBurstRate5 0x10 + #define hwr328LcdClockControlBurstRate6 0x14 + #define hwr328LcdClockControlBurstRate7 0x18 + #define hwr328LcdClockControlBurstRate8 0x1C + #define hwr328LcdClockControlBurstRate9 0x20 + #define hwr328LcdClockControlBurstRate10 0x24 + #define hwr328LcdClockControlBurstRate11 0x28 + #define hwr328LcdClockControlBurstRate12 0x2C + #define hwr328LcdClockControlBurstRate13 0x30 + #define hwr328LcdClockControlBurstRate14 0x34 + #define hwr328LcdClockControlBurstRate15 0x38 + #define hwr328LcdClockControlBurstRate16 0x3C +#endif +#define hwr328LcdClockControl8BitBus 0x02 +#define hwr328LcdClockControlPixelClkSrc 0x01 + + +/************************************************************************ + * Interrupt Controller Bits + ************************************************************************/ +// intMaskHi bits +#define hwr328IntHiNMI 0x0080 +#define hwr328IntHiTimer1 0x0040 +#define hwr328IntHiSPIS 0x0020 +#define hwr328IntHiPen 0x0010 +#define hwr328IntHiIRQ6 0x0008 +#define hwr328IntHiIRQ3 0x0004 +#define hwr328IntHiIRQ2 0x0002 +#define hwr328IntHiIRQ1 0x0001 + +//NOTE: Due to a bug in early rev's of the DragonBall, the clear bits for +/// IRQ1,2,3,6 are different than the indicator bits +#define hwr328IntHiIRQ6Clr 0x0001 +#define hwr328IntHiIRQ3Clr 0x0002 +#define hwr328IntHiIRQ2Clr 0x0004 +#define hwr328IntHiIRQ1Clr 0x0008 + +// intMaskLo bits +#define hwr328IntLoInt7 0x8000 +#define hwr328IntLoInt6 0x4000 +#define hwr328IntLoInt5 0x2000 +#define hwr328IntLoInt4 0x1000 +#define hwr328IntLoInt3 0x0800 +#define hwr328IntLoInt2 0x0400 +#define hwr328IntLoInt1 0x0200 +#define hwr328IntLoInt0 0x0100 +#define hwr328IntLoAllKeys 0xFF00 +#define hwr328IntLoInt0Bit 8 +#define hwr328IntLoPWM 0x0080 +#define hwr328IntLoPWMBit 7 +#define hwr328IntLoKbd 0x0040 +#define hwr328IntLoLCDC 0x0020 +#define hwr328IntLoRTC 0x0010 +#define hwr328IntLoRTCBit 4 +#define hwr328IntLoWDT 0x0008 +#define hwr328IntLoUART 0x0004 +#define hwr328IntLoUARTBit 2 +#define hwr328IntLoTimer2 0x0002 +#define hwr328IntLoTimer2Bit 1 +#define hwr328IntLoSPIM 0x0001 + +// intControl bits +// NOTE: These are different (at least in version 0G58E) that documented in the +// User's manual +#define hwr328IntCtlEdge1 0x0800 +#define hwr328IntCtlEdge2 0x0400 +#define hwr328IntCtlEdge3 0x0200 +#define hwr328IntCtlEdge6 0x0100 +#define hwr328IntCtlPol1 0x8000 +#define hwr328IntCtlPol2 0x4000 +#define hwr328IntCtlPol3 0x2000 +#define hwr328IntCtlPol6 0x1000 + + +/************************************************************************ + * Timer bits + ************************************************************************/ +#define hwr328TmrControlUnused 0xFE00 +#define hwr328TmrControlFreeRun 0x0100 +#define hwr328TmrControlCaptureEdgeMask 0x00C0 + #define hwr328TmrControlCaptureEdgeNone 0x0000 + #define hwr328TmrControlCaptureEdgeRising 0x0040 + #define hwr328TmrControlCaptureEdgeFalling 0x0080 + #define hwr328TmrControlCaptureEdgeBoth 0x00C0 +#define hwr328TmrControlOutputModeToggle 0x0020 +#define hwr328TmrControlEnInterrupt 0x0010 +#define hwr328TmrControlClkSrcMask 0x000E + #define hwr328TmrControlClkSrcStop 0x0000 + #define hwr328TmrControlClkSrcSys 0x0002 + #define hwr328TmrControlClkSrcSysBy16 0x0004 + #define hwr328TmrControlClkSrcTIN 0x0006 + #define hwr328TmrControlClkSrc32KHz 0x0008 +#define hwr328TmrControlEnable 0x0001 + +#define hwr328TmrStatusCapture 0x0002 +#define hwr328TmrStatusCaptureBit 1 +#define hwr328TmrStatusCompare 0x0001 +#define hwr328TmrStatusCompareBit 0 + + +/************************************************************************ + * 68328 Serial Port Register Bits + ************************************************************************/ +// uControl Register +#define hwr328UControlUARTEnable 0x8000 +#define hwr328UControlRxEnable 0x4000 +#define hwr328UControlTxEnable 0x2000 +#define hwr328UControlRxClock1x 0x1000 +#define hwr328UControlParityEn 0x0800 +#define hwr328UControlParityOdd 0x0400 +#define hwr328UControlStopBits2 0x0200 +#define hwr328UControlDataBits8 0x0100 +#define hwr328UControlGPIODeltaEn 0x0080 +#define hwr328UControlCTSDeltaEn 0x0040 +#define hwr328UControlRxFullEn 0x0020 +#define hwr328UControlRxHalfEn 0x0010 +#define hwr328UControlRxRdyEn 0x0008 +#define hwr328UControlTxEmptyEn 0x0004 +#define hwr328UControlTxHalfEn 0x0002 +#define hwr328UControlTxAvailEn 0x0001 + +#define hwr328UControlEnableAll (hwr328UControlUARTEnable | \ + hwr328UControlRxEnable | \ + hwr328UControlTxEnable) + +// uBaud Register +#define hwr328UBaudGPIODelta 0x8000 +#define hwr328UBaudGPIOData 0x4000 +#define hwr328UBaudGPIODirOut 0x2000 +#define hwr328UBaudGPIOSrcBaudGen 0x1000 +#define hwr328UBaudBaudSrcGPIO 0x0800 +#define hwr328UBaudDivider 0x0700 +#define hwr328UBaudPrescaler 0x003F + +#define hwr328UBaudDivideBitOffset 8 + + +// uReceive Register +#define hwr328UReceiveFIFOFull 0x8000 +#define hwr328UReceiveFIFOHalf 0x4000 +#define hwr328UReceiveDataRdy 0x2000 +#define hwr328UReceiveDataRdyBit 13 +#define hwr328UReceiveOverrunErr 0x0800 +#define hwr328UReceiveOverrunErrBit 11 +#define hwr328UReceiveFrameErr 0x0400 +#define hwr328UReceiveFrameErrBit 10 +#define hwr328UReceiveBreakErr 0x0200 +#define hwr328UReceiveBreakErrBit 9 +#define hwr328UReceiveParityErr 0x0100 +#define hwr328UReceiveParityErrBit 8 +#define hwr328UReceiveData 0x00FF + +#define hwr328UReceiveErrsMask (hwr328UReceiveOverrunErr | \ + hwr328UReceiveFrameErr | \ + hwr328UReceiveBreakErr | \ + hwr328UReceiveParityErr) + +// uTransmit Register +#define hwr328UTransmitFIFOEmpty 0x8000 +#define hwr328UTransmitFIFOHalf 0x4000 +#define hwr328UTransmitTxAvail 0x2000 +#define hwr328UTransmitSendBreak 0x1000 +#define hwr328UTransmitIgnoreCTS 0x0800 +#define hwr328UTransmitCTSStatus 0x0200 +#define hwr328UTransmitCTSDelta 0x0100 +#define hwr328UTransmitData 0x00FF + +// uMisc Register +#define hwr328UMiscClkSrcGPIO 0x4000 +#define hwr328UMiscForceParityErr 0x2000 +#define hwr328UMiscLoopback 0x1000 +#define hwr328UMiscReservedMask 0x8F00 +#define hwr328UMiscRTSThruFIFO 0x0080 +#define hwr328UMiscRTSOut 0x0040 +#define hwr328UMiscIRDAEn 0x0020 +#define hwr328UMiscLoopIRDA 0x0010 +#define hwr328UMiscUnused 0x000F + + + +/************************************************************************ + * PWM Bits + ************************************************************************/ +// PWM register bits of interest +#define hwr328PWMControlEnable 0x0010 +#define hwr328PWMControlEnableIRQ 0x4000 +#define hwr328PWMControlLoad 0x0100 +#define hwr328PWMIRQStatus 0x8000 +// PWM divider chain output selectors +#define hwr328PWMControlDivMask 0x0007 +#define hwr328PWMControlDivBy2 0x0 +#define hwr328PWMControlDivBy4 0x1 +#define hwr328PWMControlDivBy8 0x2 +#define hwr328PWMControlDivBy16 0x3 +#define hwr328PWMControlDivBy32 0x4 +#define hwr328PWMControlDivBy64 0x5 +#define hwr328PWMControlDivBy128 0x6 +#define hwr328PWMControlDivBy256 0x7 + + +/************************************************************************ + * PLL Bits + ************************************************************************/ +#define hwr328PLLControlDisable 0x0008 +#define hwr328PLLControlClkEn 0x0010 + +#define hwr328PLLControlSysVCODiv2 0x0000 +#define hwr328PLLControlSysVCODiv4 0x0100 +#define hwr328PLLControlSysVCODiv8 0x0200 +#define hwr328PLLControlSysVCODiv16 0x0300 +#define hwr328PLLControlSysVCODiv1 0x0400 + +#define hwr328PLLControlPixVCODiv2 0x0000 +#define hwr328PLLControlPixVCODiv4 0x080 +#define hwr328PLLControlPixVCODiv8 0x1000 +#define hwr328PLLControlPixVCODiv16 0x1800 +#define hwr328PLLControlPixVCODiv1 0x2000 + +/************************************************************************ + * Real Time Clock (RTC) Bits + ************************************************************************/ + +// RTC Control Register (RTCCTL) bits +#define hwr328RTCControlRTCEnable 0x80 +#define hwr328RTCControlRefSelMask 0x20 +#define hwr328RTCControlRefSel38400 0x20 // 38.4 kHz reference frequency +#define hwr328RTCControlRefSel32768 0x00 // 32.768 kHz reference frequency + +// RTC Interrupt Enable Register (RTCIENR) bits +#define hwr328RTCIntEnableSec 0x10 +#define hwr328RTCIntEnable24Hr 0x08 +#define hwr328RTCIntEnableAlarm 0x04 +#define hwr328RTCIntEnableMinute 0x02 +#define hwr328RTCIntEnableStopWatch 0x01 + +// RTC Interrupt Status Register bits +#define hwr328RTCIntStatusSec 0x10 +#define hwr328RTCIntStatus24Hr 0x08 +#define hwr328RTCIntStatusAlarm 0x04 +#define hwr328RTCIntStatusMinute 0x02 +#define hwr328RTCIntStatusStopWatch 0x01 + +// RTC Alarm register (RTCALRM) masks and offsets +#define hwr328RTCAlarmSecondsMask 0x0000003fL +#define hwr328RTCAlarmSecondsOffset 0 +#define hwr328RTCAlarmMinutesMask 0x003f0000L +#define hwr328RTCAlarmMinutesOffset 16 +#define hwr328RTCAlarmHoursMask 0x1f000000L +#define hwr328RTCAlarmHoursOffset 24 + +// RTC hours/minutes/seconds register (RTCHMS) masks and offsets +#define hwr328RTCHourMinSecSecondsMask 0x0000003fL +#define hwr328RTCHourMinSecSecondsOffset 0 +#define hwr328RTCHourMinSecMinutesMask 0x003f0000L +#define hwr328RTCHourMinSecMinutesOffset 16 +#define hwr328RTCHourMinSecHoursMask 0x1f000000L +#define hwr328RTCHourMinSecHoursOffset 24 + + +/************************************************************************ + * SPI Master bits + ************************************************************************/ +#define hwr328SPIMControlRateMask 0xE000 + #define hwr328SPIMControlRateDiv4 0x0000 + #define hwr328SPIMControlRateDiv8 0x2000 + #define hwr328SPIMControlRateDiv16 0x4000 + #define hwr328SPIMControlRateDiv32 0x6000 + #define hwr328SPIMControlRateDiv64 0x8000 + #define hwr328SPIMControlRateDiv128 0xA000 + #define hwr328SPIMControlRateDiv256 0xC000 + #define hwr328SPIMControlRateDiv512 0xE000 +#define hwr328SPIMControlEnable 0x0200 +#define hwr328SPIMControlExchange 0x0100 +#define hwr328SPIMControlIntStatus 0x0080 +#define hwr328SPIMControlIntEnable 0x0040 +#define hwr328SPIMControlOppPhase 0x0020 +#define hwr328SPIMControlInvPolarity 0x0010 +#define hwr328SPIMControlBitsMask 0x000F + + +/************************************************************************ + * I/O Port C pins + ************************************************************************/ +#define hwr328PortCMOClk 0x01 +#define hwr328PortCUDS 0x02 +#define hwr328PortCLDS 0x04 +#define hwr328PortCNMI 0x10 +#define hwr328PortCDTack 0x20 +#define hwr328PortCPcmciaWE 0x40 + + +/************************************************************************ + * I/O Port G pins + ************************************************************************/ +#define hwr328PortGUartTxD 0x01 +#define hwr328PortGUartRxD 0x02 +#define hwr328PortGPwmOut 0x04 +#define hwr328PortGTOut2 0x08 +#define hwr328PortGTIn2 0x10 +#define hwr328PortGTOut1 0x20 +#define hwr328PortGTIn1 0x40 +#define hwr328PortGRtcOut 0x80 + + +/************************************************************************ + * I/O Port K pins + ************************************************************************/ +#define hwr328PortKSpimTxD 0x01 +#define hwr328PortKSpimRxD 0x02 +#define hwr328PortKSpimClkO 0x04 +#define hwr328PortKSpisEn 0x08 +#define hwr328PortKSpisRxD 0x10 +#define hwr328PortKSpisClkI 0x20 +#define hwr328PortKPcmciaCE2 0x40 +#define hwr328PortKPcmciaCE1 0x80 + + +/************************************************************************ + * I/O Port M pins + ************************************************************************/ +#define hwr328PortMCTS 0x01 +#define hwr328PortMRTS 0x02 +#define hwr328PortMIRQ6 0x04 +#define hwr328PortMIRQ3 0x08 +#define hwr328PortMIRQ2 0x10 +#define hwr328PortMIRQ1 0x20 +#define hwr328PortMPenIRQ 0x40 +#define hwr328PortMUnused7 0x80 + + + + + +#endif // __M68328_H__ + +#endif // NON_PORTABLE + + + + + + + + + + + diff --git a/sdk-1/include/Core/Hardware/M68681Hwr.h b/sdk-1/include/Core/Hardware/M68681Hwr.h new file mode 100644 index 0000000..917868f --- /dev/null +++ b/sdk-1/include/Core/Hardware/M68681Hwr.h @@ -0,0 +1,119 @@ +/******************************************************************* + * Touchdown Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * M68681Hwr.h + * + * Description: + * Hardware Equates for the Motorola 68681 Duart + * + * History: + * 1/18/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + + +#include // Touchdown includes + + +/*********************************************************************** + * Motorola 68681 DUART registers + ***********************************************************************/ +typedef union HwrDuartType { + + // Read Registers + struct { + Byte u0; + Byte mra; // Mode registers 1A and 2A + Byte u2; + Byte sra; // Status register A + Byte u4; + Byte doNotAccess1; // Do Not Access + Byte u6; + Byte rba; // Receive Buffer A + Byte u8; + Byte ipcr; // Inport Port Change Register + Byte uA; + Byte isr; // Input Status Register + Byte uC; + Byte cur; // Current MSB of counter + Byte uE; + Byte clr; // Current LSB of counter + Byte u10; + Byte mrb; // Mode registers 1B and 2B + Byte u12; + Byte srb; // Status register B + Byte u14; + Byte doNotAccess2; // Do Not Access + Byte u16; + Byte rbb; // Receive Buffer B + Byte u18; + Byte ivr; // Interrupt vector register + Byte u1A; + Byte ipr; // Input Port register + Byte u1C; + Byte startCtr; // Start Counter command register + Byte u1E; + Byte stopCtr; // Stop Counter command register + } read; + + // Write Registers + struct { + Byte u0; + Byte mra; // Mode registers 1A and 2A + Byte u2; + Byte csra; // Clock Select Register A + Byte u4; + Byte cra; // Command Register A + Byte u6; + Byte tba; // Transmit Buffer A + Byte u8; + Byte acr; // Auxiliary Control Register + Byte uA; + Byte imr; // Interrupt Mask Register + Byte uC; + Byte ctur; // Counter/Timer Upper Preload Register + Byte uE; + Byte ctlr; // Couunter/Timer Lower Preload Register + Byte u10; + Byte mrb; // Mode registers 1B and 2B + Byte u12; + Byte csrb; // Clock Select Register B + Byte u14; + Byte crb; // Command Register B + Byte u16; + Byte tbb; // Transmitter Buffer B + Byte u18; + Byte ivr; // Interrupt Vector Register + Byte u1A; + Byte opcr; // Output Port Config Register + Byte u1C; + Byte opSet; // Output Port Bit Set + Byte u1E; + Byte opReset; // Output Port Bit Reset + } write; + } HwrDuartType; + +typedef volatile HwrDuartType* HwrDuartPtr; + + + + + +/*********************************************************************** + * For Final code on the Touchdown Hardware, define all register bits here + * for now, we'll just define a few and use numbers in the code for the rest + ***********************************************************************/ + +// Status Register (SR) +#define hwrDuartSRRegRB 0x80 // Receive Break +#define hwrDuartSRRegFE 0x40 // Framing Err +#define hwrDuartSRRegPE 0x20 // Parity Err +#define hwrDuartSRRegOE 0x10 // Overrun Err +#define hwrDuartSRRegTxEMP 0x08 // Transmitter Empty +#define hwrDuartSRRegTxRDY 0x04 // Transmitter Ready +#define hwrDuartSRRegFFULL 0x02 // FIFO Full +#define hwrDuartSRRegRxRDY 0x01 // Receiver Ready diff --git a/sdk-1/include/Core/Hardware/M68KHwr.h b/sdk-1/include/Core/Hardware/M68KHwr.h new file mode 100644 index 0000000..c03c8a1 --- /dev/null +++ b/sdk-1/include/Core/Hardware/M68KHwr.h @@ -0,0 +1,109 @@ +/************************************************************************************** + * + * DHwr.h + * + * Pilot debugger remote hardware/system info. + * + ************************************************************************************** + * MODIFICATION HISTORY + **************************************************************************************/ + +#ifndef __M68KHWR_H +#define __M68KHWR_H + +// Pilot common definitions +#include + + +/*********************************************************************** + * Breakpoint words we use + ***********************************************************************/ +#define m68kTrapInstr 0x4E40 +#define m68kTrapVectorMask 0x000F + +/*********************************************************************** + * 68000 Exception Vector table + ***********************************************************************/ +typedef struct M68KExcTableType { + DWord initStack; // initial stack pointer + DWord initPC; // initial PC + + DWord busErr; // 08 + DWord addressErr; // 0C + DWord illegalInstr; // 10 + DWord divideByZero; // 14 + DWord chk; // 18 + DWord trap; // 1C + DWord privilege; // 20 + DWord trace; // 24 + DWord aTrap; // 28 + DWord fTrap; // 2C + DWord reserved12; // 30 + DWord coproc; // 34 + DWord formatErr; // 38 + DWord unitializedInt; // 3C + + DWord reserved[8]; // 40-5C + + DWord spuriousInt; // 60 + DWord autoVec1; // 64 + DWord autoVec2; // 68 + DWord autoVec3; // 6C + DWord autoVec4; // 70 + DWord autoVec5; // 74 + DWord autoVec6; // 78 + DWord autoVec7; // 7C + + DWord trapN[16]; // 80 - BC + + DWord unassigned[16]; // C0 - FC + } M68KExcTableType; + + + +/************************************************************************************** + * 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. + * + **************************************************************************************/ +typedef struct M68KRegsType { + DWord d[8]; /* data registers */ + DWord a[7]; /* address registers */ + DWord usp; /* user stack pointer */ + DWord ssp; /* supervisor stack pointer */ + DWord pc; /* program counter */ + Word sr; /* status register */ +} M68KRegsType; + + + + +/************************************************************************************** + * bit masks for testing M68000 status register fields + **************************************************************************************/ + +/* trace mode */ +#define m68kSrTraceMask 0x08000 +#define m68kSrTraceBit 15 + +/* supervisor state */ +#define m68kSrSupervisorMask 0x02000 + +/* interrupt mask */ +#define m68kSrInterruptMask 0x00700 +#define m68kSrInterruptOffset 8 /* offset for right-shifting interrupt mask */ + +/* condition codes */ +#define m68kSrExtendMask 0x00010 +#define m68kSrNegativeMask 0x00008 +#define m68kSrZeroMask 0x00004 +#define m68kSrOverflowMask 0x00002 +#define m68kSrCarryMask 0x00001 + + + +#endif //__M68KHWR_H + diff --git a/sdk-1/include/Core/Pilot.h b/sdk-1/include/Core/Pilot.h new file mode 100644 index 0000000..c4a7fe9 --- /dev/null +++ b/sdk-1/include/Core/Pilot.h @@ -0,0 +1,50 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Pilot.h + * + * Description: + * Include file used by UI library source code modules + * + * History: + * 6/6/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + + +// This tells "SysAll.h" not to use it's own pre-compiled header +#define __PILOT_H__ + +#include "Common.h" + +// Include the pre-compiled header, if not overriden. This pre-compiled header +// can be automatically re-generated by CodeWarrior by including the +// source file "Pilot.pch" in your project. + +// The following Mac include file must be included before the Pilot +// headers for the emulator modules that have both Mac and Pilot +// code in them +#if EMULATION_LEVEL == EMULATION_MAC +#include +#endif + + +// The following ANSI header files have function declarations used by some +// of the UI modules. + + +// Fastest compilation speed is obtained by not including these +// headers when the pre-compiled header is used. +#ifndef __INCLUDED_PILOT_H_OBJ__ +#include +#include + +#define NON_PORTABLE +#include +#include + +#endif diff --git a/sdk-1/include/Core/Pilot.pch b/sdk-1/include/Core/Pilot.pch new file mode 100644 index 0000000..f581c57 --- /dev/null +++ b/sdk-1/include/Core/Pilot.pch @@ -0,0 +1,30 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Pilot.pch + * + * Description: + * Source file used to generate pre-compiled headers for Pilot + * UI modules + * + * History: + * 6/6/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +// By including this module in your CodeWarrior project. You can automatically +// regenerate the pre-compiled header file used by the UI modules called +// Pilot.h.obj +#ifdef EMULATION_LEVEL + #pragma precompile_target ":Obj:Pilot.h.obj.mpw" +#else + #pragma precompile_target ":Obj:Pilot.h.obj" +#endif + +// Include the World.... +#include + diff --git a/sdk-1/include/Core/SysBuildRules.h b/sdk-1/include/Core/SysBuildRules.h new file mode 100644 index 0000000..2cd16a6 --- /dev/null +++ b/sdk-1/include/Core/SysBuildRules.h @@ -0,0 +1,25 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysBuildRules.h + * + * Description: + * This header file can beused as a template for + * common build options across all applications. To use, simply break + * the pencil and edit. + * + * + * Typically, the options specified in this file are used to + * set the language and country for the emulator + * + * History: + * 6/6/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +//#define LANGUAGE LANGUAGE_FRENCH +//#define COUNTRY COUNTRY_FRANCE diff --git a/sdk-1/include/Core/System/AlarmMgr.h b/sdk-1/include/Core/System/AlarmMgr.h new file mode 100644 index 0000000..5a6d6da --- /dev/null +++ b/sdk-1/include/Core/System/AlarmMgr.h @@ -0,0 +1,209 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * AlarmMgr.h + * + * Description: + * Include file for Alarm Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __ALARM_MGR_H__ +#define __ALARM_MGR_H__ + + +// Include elementary types +#include +#include + + + + +/************************************************************ + * Alarm Manager result codes + * (almErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define almErrMemory (almErrorClass | 1) // ran out of memory +#define almErrFull (almErrorClass | 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. +typedef struct SysAlarmTriggeredParamType { + DWord ref; // --> alarm reference value passed by caller; + ULong alarmSeconds; // --> alarm date/time in seconds since 1/1/1904; + + Boolean purgeAlarm; // <-- 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 + } SysAlarmTriggeredParamType; + +// 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. +typedef struct SysDisplayAlarmParamType { + DWord ref; // alarm reference value passed by caller; + ULong alarmSeconds; // alarm date/time in seconds since 1/1/1904; + Boolean soundAlarm; // non-zero if alarm needs to be sounded; + } SysDisplayAlarmParamType; + + + +/******************************************************************** + * Alarm Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// 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. +// +Err AlmInit(void) + SYS_TRAP(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. +// +Err AlmSetAlarm(UInt cardNo, LocalID dbID, DWord ref, + ULong alarmSeconds, Boolean quiet) + SYS_TRAP(sysTrapAlmSetAlarm); + + +// AlmGetAlarm() +// +// Gets the alarm seconds for a given app. +// Zero is returned if there is no alarm setting for the app. +ULong AlmGetAlarm(UInt cardNo, LocalID dbID, DWordPtr refP) + SYS_TRAP(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. +// +void AlmEnableNotification(Boolean enable) + SYS_TRAP(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. +// +void AlmDisplayAlarm(Boolean okToDisplay) + SYS_TRAP(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. +// +void AlmCancelAll(void) + SYS_TRAP(sysTrapAlmCancelAll); + + + +// AlmAlarmCallback() +// +// This function is called at interrupt time by the Time Manager when +// an alarm goes off. +// +void AlmAlarmCallback(void) + SYS_TRAP(sysTrapAlmAlarmCallback); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __ALARM_MGR_H__ + diff --git a/sdk-1/include/Core/System/AlarmPrv.h b/sdk-1/include/Core/System/AlarmPrv.h new file mode 100644 index 0000000..4ef9c41 --- /dev/null +++ b/sdk-1/include/Core/System/AlarmPrv.h @@ -0,0 +1,111 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * AlarmPrv.h + * + * Description: + * Private Include file for Alarm Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifdef NON_PORTABLE +#ifndef __ALARM_PRV_H__ +#define __ALARM_PRV_H__ + + + +/************************************************************ + * Alarm Manager Constants + * + *************************************************************/ +#define almMinTableLength 2 // minimum # of entries in alarm table; + // MUST NOT BE ZERO. + +#define almMaxTableLength 20 // maximum # of enries in alarm table + + +/******************************************************************* + * Alarm Manager alarm table structures + * + *******************************************************************/ + +// An entry in the alarm table +typedef struct AlmEntryType { + DWord ref; // alarm reference value passed by caller; + + ULong alarmSeconds; // alarm date/time in seconds since 1/1/1904; + // a value of 0 indicates unused entry; + + LocalID dbID; // creator app database ID; + Word cardNo : 1; // creator app card number; + + Word quiet : 1; // 1 indicates that the caller wants + // to be quietly notified when the alarm + // goes off without all the alarm bells + // and whistles; + + Word triggered : 1; // 1 indicates the alarm has been triggered; + + Word notified : 1; // 1 indicates we notified the caller that + // the alarm went off; + } AlmEntryType; + +typedef AlmEntryType* AlmEntryPtr; + + +// The alarm table +typedef struct AlmTableType { + Short numEntries; // Number of entries in alarm Table; + + // List of alarm entries; + // This is a variable size field which + // ***MUST BE LAST*** + AlmEntryType list[almMinTableLength]; + } AlmTableType; + +typedef AlmTableType* AlmTablePtr; +typedef AlmTablePtr* AlmTableHandle; + + +/******************************************************************* + * Alarm Manager Globals + * + *******************************************************************/ +typedef struct AlmGlobalsType { + // We're not making the alarm table a part of the + // Alarm Globals structure because it is allowed + // to resize, thus posing a problem for + // AlmAlarmCallback() which needs to access the + // Alarm Globals at interrupt time. + AlmTableHandle tableH; // alarm table handle; + + ULong lastSoundSeconds; + // alarm seconds of the last alarm for + // which an alarm was sounded; + + Word displaying : 1;// 1 indicates we're blocked waiting for + // some app to finish displaying an alarm + // dialog box; set and cleared by + // AlmDisplayNextAlarm(); + + Word triggered : 1; // 1 indicates an alarm was triggered; this + // field is set by the AlmAlarmCallback() and + // is checked and cleared by AlmDisplayAlarm(); + + Byte disableCount; // if this value is greater than zero, Alarm + // notifications are disabled (see AlmEnableNotification); + } AlmGlobalsType; + +typedef AlmGlobalsType* AlmGlobalsPtr; + + +#endif // __ALARM_MGR_H__ +#endif // NON_PORTABLE diff --git a/sdk-1/include/Core/System/CMClient.h b/sdk-1/include/Core/System/CMClient.h new file mode 100644 index 0000000..97ad26d --- /dev/null +++ b/sdk-1/include/Core/System/CMClient.h @@ -0,0 +1,118 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * CMClient.h + * + * Description: + * Connection Management Protocol client definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __CMCLIENT_H__ +#define __CMCLIENT_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Pilot common definitions + #include "Common.h" + #include "SerLink.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Pilot common definitions + #include + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + +/************************************************************ + * Connection Manager result codes + * (cmpErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define cmErrParam (cmpErrorClass | 1) // bad parameter +#define cmErrTimedOut (cmpErrorClass | 2) // connection initiation/listenning timed out +#define cmErrComm (cmpErrorClass | 3) // communication(send/receive) error +#define cmErrCommVersion (cmpErrorClass | 4) // incompatible comm version +#define cmErrMemory (cmpErrorClass | 5) // insufficient memory error +#define cmErrCommBusy (cmpErrorClass | 6) // PAD server is already in use +#define cmErrUserCan (cmpErrorClass | 7) // attempt cancelled by user + + + +/******************************************************************** + * Connection Manager Constants + ********************************************************************/ + +#define cmWakeupTransactionID 0xFF + +/******************************************************************** + * Connection Manager Structures + ********************************************************************/ +typedef Int (*CmAbortProc)(DWord userRef); + +typedef struct CmParamType { + UInt localSocket; // -> user's socket + UInt remoteSocket; // -> remote socket + ULong maxBaud; // -> maximum baud rate which can be used + Boolean viaModem; // -> set to true if connecting via modem + CmAbortProc abortProc; // -> ptr to abort procedure + DWord userRef; // -> reference value for abort procedure + } CmParamType; + +typedef CmParamType* CmParamPtr; + + +typedef struct CmSessionType { + // Parameters passed by user + CmParamType param; // user parameters + + UInt serRefNum; // serial library reference number + } CmSessionType; + +typedef CmSessionType* CmSessionPtr; + + + + +/******************************************************************** + * Connection Manager API Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Listens for a "wakeup" message from the broadcaster +// and completes the connection handshake by sending the "init" +// or "abort" message(called by client). +Err CmListen(CmParamPtr paramP); + + +#ifdef __cplusplus +} +#endif + + + +/******************************************************************** + * Connection Manager Macros + ********************************************************************/ + + + +#endif // __CMCLIENT_H__ diff --git a/sdk-1/include/Core/System/CMCommon.h b/sdk-1/include/Core/System/CMCommon.h new file mode 100644 index 0000000..d6737f6 --- /dev/null +++ b/sdk-1/include/Core/System/CMCommon.h @@ -0,0 +1,107 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * CMCommon.h + * + * Description: + * Connection Management Protocol common definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __CMCOMMON_H__ +#define __CMCOMMON_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Pilot common definitions + #include "Common.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Pilot common definitions + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + +/******************************************************************** + * CMP Packet Format + ********************************************************************/ + +// The CMP packets are used for transmitting data for the Pilot CMP protocol layer. +// The structure of the CMP packet is built into the data part of the SLP packet and is, +// therefore, constrained by the SLP packet data size limitations. + + +// Packet type values used in the CMP packet body "type" field: +// +typedef enum CmpType { + cmpWakeup = 1, // CMP Wakeup packet sent from server to client + cmpInit, // CMP Init packet sent from client to server + cmpAbort // CMP Abort packet sent from client to server + } CmpType; + + +// cmpInit and cmpWakeup packet body structure: +// +typedef struct CmpBodyType { + Byte type; // CMP packet type + + Byte flags; // in cmpInit packets: indicates which values were adjusted by + // the client(defined below); in cmpWakeup pakcets: null; + // in cmpAbort packets: reason for abort. + + DWord commVersion; // in cmpWakeup: server comm software version number; + // in cmpInit: client comm version + + DWord baudRate; // in cmpWakeup: max server baud rate; + // in cmpInit packets: the prescribed baud rate + } CmpBodyType; + +typedef CmpBodyType* CmpBodyPtr; + +// Flags used in the packet body "flags" field of cmpInit +// packets. These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpInitFlagChangeBaudRate 0x80 // signals that the baud rate was adjusted by the client + + +// Flags used in the packet body "flags" field of cmpAbort packets. +// These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpAbortFlagVersionError 0x80 // signals incompatible comm versions + + + +/******************************************************************** + * CMP Protocol Parameters + ********************************************************************/ + +// This transaction id is used by cmpWakeup packets. cmpInit and cmpAbort +// packets MUST use a different transaction id. +// +#define cmpWakeupTransactionID 0xFF + +// This is the baud rate at which CMP connections are initiated +// +#define cmpInitialBaudRate 9600L + +// This is the time limit for trying to initiate a connection +// +#define cmpMaxInitiateSec 20 + + +#endif // __CMCOMMON_H__ diff --git a/sdk-1/include/Core/System/CMServer.h b/sdk-1/include/Core/System/CMServer.h new file mode 100644 index 0000000..aea4f0d --- /dev/null +++ b/sdk-1/include/Core/System/CMServer.h @@ -0,0 +1,104 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * CMServer.h + * + * Description: + * Connection Management Protocol server definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __CMSERVER_H__ +#define __CMSERVER_H__ + +// Pilot common definitions +#include + +//#include + + + +/************************************************************ + * Connection Manager result codes + * (cmpErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define cmErrParam (cmpErrorClass | 1) // bad parameter +#define cmErrTimedOut (cmpErrorClass | 2) // connection initiation/listenning timed out +#define cmErrComm (cmpErrorClass | 3) // communication(send/receive) error +#define cmErrCommVersion (cmpErrorClass | 4) // incompatible comm version +#define cmErrMemory (cmpErrorClass | 5) // insufficient memory error +#define cmErrCommBusy (cmpErrorClass | 6) // PAD server is already in use +#define cmErrUserCan (cmpErrorClass | 7) // attempt cancelled by user + + + +/******************************************************************** + * Connection Manager Constants + ********************************************************************/ + +/******************************************************************** + * Connection Manager Structures + ********************************************************************/ +typedef Int (*CmAbortProc)(DWord userRef); + +typedef struct CmParamType { + UInt localSocket; // -> user's socket + UInt remoteSocket; // -> remote socket + ULong maxBaud; // -> maximum baud rate which can be used + ULong hwShakeAbove; // -> enable HW hand-shake above this baud + Boolean viaModem; // -> set to true if connecting via modem + CmAbortProc abortProc; // -> ptr to abort procedure + DWord userRef; // -> reference value for abort procedure + } CmParamType; + +typedef CmParamType* CmParamPtr; + + +typedef struct CmSessionType { + // Parameters passed by user + CmParamType param; // user parameters + + UInt serRefNum; // serial library reference number + } CmSessionType; + +typedef CmSessionType* CmSessionPtr; + + + + +/******************************************************************** + * Connection Manager API Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Initiates connection establishment by sending "wakeup" packets +// and listens for connection handshake(called by server). +Err CmBroadcast(CmParamPtr paramP) + SYS_TRAP(sysTrapCmBroadcast); + + +#ifdef __cplusplus +} +#endif + + + +/******************************************************************** + * Connection Manager Macros + ********************************************************************/ + + + +#endif // __CMSERVER_H__ diff --git a/sdk-1/include/Core/System/ConsoleMgr.h b/sdk-1/include/Core/System/ConsoleMgr.h new file mode 100644 index 0000000..93859a2 --- /dev/null +++ b/sdk-1/include/Core/System/ConsoleMgr.h @@ -0,0 +1,51 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * ConsoleMgr.h + * + * 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 + * + *******************************************************************/ + +#ifndef __CONSOLEMGR_H__ +#define __CONSOLEMGR_H__ + + + + +/******************************************************************** + * Console Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err ConPutS(CharPtr message) + SYS_TRAP(sysTrapConPutS); + +Err ConGetS(CharPtr message, Long timeout) + SYS_TRAP(sysTrapConGetS); + + +#ifdef __cplusplus +} +#endif + + + + +#endif // __CONSOLEMGR_H__ + + + + diff --git a/sdk-1/include/Core/System/Crc.h b/sdk-1/include/Core/System/Crc.h new file mode 100644 index 0000000..9c089ac --- /dev/null +++ b/sdk-1/include/Core/System/Crc.h @@ -0,0 +1,64 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Crc.h + * AUTHOR: Vitaly Kruglikov: May 10, 1995 + * + * + * DESCRIPTION: + * This is the header file for the CRC calculation routines for Pilot. + * + * + * REVISION HISTORY: + * 5/10/95 vmk Initial version. + * + **********************************************************************/ + + +#ifndef __CRC_H__ +#define __CRC_H__ + + +// Include elementary types +#include +#include + + + + +/******************************************************************** + * CRC Calculation Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + + +// Crc16CalcBlock() +// +// Calculate the 16-bit CRC of a data block using the table lookup method. +// +Word Crc16CalcBlock(VoidPtr bufP, UInt count, Word crc) + SYS_TRAP(sysTrapCrc16CalcBlock); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __CRC_H__ + diff --git a/sdk-1/include/Core/System/DLClient.h b/sdk-1/include/Core/System/DLClient.h new file mode 100644 index 0000000..1ec54e3 --- /dev/null +++ b/sdk-1/include/Core/System/DLClient.h @@ -0,0 +1,190 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DLClient.h + * + * Description: + * Desktop Link Protocol(DLP) client implementation definitions. + * + * History: + * 7/12/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + +#define INCLUDE_VIEWER_ID + +#ifndef __DL_CLIENT_H__ +#define __DL_CLIENT_H__ + + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + +// Pilot common definitions +#include "Common.h" + +// Desktop Link common definitions +#include "DLCommon.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + +// Pilot common definitions +#include + +// Desktop Link common definitions +#include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + + +/************************************************************ + * DLK result codes + * (dlkErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define dlkErrParam (dlkErrorClass | 1) // invalid parameter +#define dlkErrSessClosed (dlkErrorClass | 2) // session closed unexpectedly +#define dlkErrMemory (dlkErrorClass | 3) // memory allocation error +#define dlkErrLocalCan (dlkErrorClass | 4) // cancelled by local user +#define dlkErrNoSession (dlkErrorClass | 5) // could not establish a session +#define dlkErrSizeErr (dlkErrorClass | 6) // reply length is too big +#define dlkErrTooManyClients (dlkErrorClass | 7) // reply length is too big +#define dlkErrBufTooSmall (dlkErrorClass | 8) // reply buffer is too small +#define dlkErrCreate (dlkErrorClass | 9) // error creating database +#define dlkErrNotEnoughSpace (dlkErrorClass | 10) // not enough space on remote +#define dlkErrAlreadyExists (dlkErrorClass | 11) // cannot create a duplicate +#define dlkErrNotFound (dlkErrorClass | 12) // database/record/resource/block not found +#define dlkErrDelete (dlkErrorClass | 13) // delete error +#define dlkErrClose (dlkErrorClass | 14) // close error +#define dlkErrAdd (dlkErrorClass | 15) // add record/resource error +#define dlkErrRead (dlkErrorClass | 16) // read record/resource/block error +#define dlkErrUserInfo (dlkErrorClass | 17) // error reading/writing user info +#define dlkErrReplyFormat (dlkErrorClass | 18) // reply format error +#define dlkErrDeleted (dlkErrorClass | 19) // record was deleted +#define dlkErrOpen (dlkErrorClass | 20) // record was deleted + + + +/******************************************************************** + * DLK Session Structures + ********************************************************************/ + +// +// DLP Client session information +// + +typedef Int (*DlkAbortProcPtr)(DWord userRef); + + +typedef struct DlkClientSessionType { + // Information supplied by user + Byte remoteSocket; // server socket + Byte localSocket; // workstation socket + DlkAbortProcPtr abortProcP; // ptr to abort proc + DWord userRef; // user reference value for abort proc + + // Session status information + Int numClients; // Number of clients + Byte dlpRefNum; // DLP session reference number + + // Reply buffer + WordPtr replyBufP; + ULong replyBufSize; + } DlkClientSessionType; + +typedef DlkClientSessionType* DlkClientSessionPtr; + + +// +// Parameter passed to DlkInitClient() +// +typedef struct DlkClientParamType { + Byte remoteSocket; // server socket for SP + Byte localSocket; // workstation socket + DlkAbortProcPtr abortProcP; + DWord userRef; + } DlkClientParamType; + +typedef DlkClientParamType* DlkClientParamPtr; + + +/******************************************************************** + * DLK Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// +// CLIENT API +// + +// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam, +// * dlkErrNoSession, dlkErrMemory, dlkErrTooManyClients +Err DlkInitClient(DlkClientParamPtr paramP, BytePtr refNumP); + +Err DlkClientDone(Byte refNum); + +Err DlkSendTickle(Byte refNum); + +Err DlkOpenDatabase(Byte refNum, Byte cardNo, CharPtr nameP, Byte mode, + BytePtr dlkDBIDP); + +Err DlkCreateDatabase(Byte refNum, Byte cardNo, CharPtr name, Word dbFlags, + DWord creator, DWord type, BytePtr dbIDP); + +Err DlkDeleteDatabase(Byte refNum, UInt cardNo, CharPtr nameP); + +Err DlkCloseDatabase(Byte refNum, Byte dbID); + +Err DlkReadOpenDBInfo(Byte refNum, Byte dbID, WordPtr numRecP); + +Err DlkReadAppBlock(Byte refNum, Byte dbID, UInt offset, UInt numBytes, + VoidPtr bufP, UInt bufSize, UIntPtr rcvdLenP, UIntPtr blkSizeP); + +Err DlkAddRecord(Byte refNum, Byte dbID, VoidPtr recP, + Word recSize, DWordPtr recIDP); + +Err DlkReadRecord(Byte refNum, Byte dbID, UInt index, UInt offset, + UInt numBytes, VoidPtr bufP, UInt bufSize, DWordPtr recIDP, + BytePtr attrP, BytePtr categoryP, UIntPtr rcvdLenP, UIntPtr recSizeP); + +Err DlkDeleteAllRecords(Byte RefNum, Byte dbID); + +Err DlkWriteUserInfo(Byte refNum, CharPtr userNameP, DWord userID, + DWord lastSyncPC); + +Err DlkReadUserInfo(Byte refNum, CharPtr userNameBufP, DWordPtr userIDP, + DWordPtr lastSyncPCP); + +Err DlkNotifyOpenConduit(Byte refNum, BooleanPtr cancelP); + +Err DlkNotifyEndOfSync(Byte refNum, DlpSyncTermCode termCode); + +Err DlkResetRemote(Byte refNum); + +Err DlkGetDBNameViaCallAppTest(Byte refNum, Word cardNo, Word index, CharPtr bufP, Word bufSize); + + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * DLK Macros + ********************************************************************/ + + + +#endif // __DL_CLIENT_H__ diff --git a/sdk-1/include/Core/System/DLCommon.h b/sdk-1/include/Core/System/DLCommon.h new file mode 100644 index 0000000..ca66fc8 --- /dev/null +++ b/sdk-1/include/Core/System/DLCommon.h @@ -0,0 +1,1695 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DLCommon.h + * + * Description: + * Desktop Link Protocol(DLP) function id's, parameters, and frame + * structures. + * + * History: + * 6/7/95 vmk Created by Vitaly Marty Kruglikov + * 6/15/95 vmk Changed dlp/Read/Write/UserID to dlp/Read/Write/UserInfo and + * added the last sync PC id field to their arguments at Laura's request. + * 6/15/95 vmk Added option to dlpDeleteRecord to delete all records in DB. + * + *******************************************************************/ + + +#ifndef __DLCOMMON_H__ +#define __DLCOMMON_H__ + + +/************************************************************ + * DesktopLink function codes + *************************************************************/ + +// DlpFuncID -- function id's used in request blocks sent to +// the DesktopLink application on Pilot. The width of the function +// id base is 7 bits. The high order bit(the 8th bit) is used to +// distinguish requests from their responses -- it is cleared in request +// blocks and is set in response blocks (i.e., the response to a particular +// command will have the same function code base as the command and the +// high order bit set). See dlpFuncRespBit defined below. +// +typedef enum DlpFuncID { + + dlpReservedFunc = 0x0F, // range reserved for internal use + + dlpReadUserInfo, + + dlpWriteUserInfo, + + dlpReadSysInfo, + + dlpGetSysDateTime, + + dlpSetSysDateTime, + + dlpReadStorageInfo, + + dlpReadDBList, + + dlpOpenDB, + + dlpCreateDB, + + dlpCloseDB, + + dlpDeleteDB, + + dlpReadAppBlock, + + dlpWriteAppBlock, + + dlpReadSortBlock, + + dlpWriteSortBlock, + + dlpReadNextModifiedRec, + + dlpReadRecord, + + dlpWriteRecord, + + dlpDeleteRecord, + + dlpReadResource, + + dlpWriteResource, + + dlpDeleteResource, + + dlpCleanUpDatabase, + + dlpResetSyncFlags, + + dlpCallApplication, + + dlpResetSystem, + + dlpAddSyncLogEntry, + + //dlpUnused1, // was: for debugging -- just echoes received data + dlpReadOpenDBInfo, + + dlpMoveCategory, // was: dlpUpdateSyncStatus + + dlpProcessRPC, // remote procedure calls interface + + dlpOpenConduit, // this command is sent before each conduit is opened + + dlpEndOfSync, // ends the sync session + + dlpResetDBIndex, // resets "modified record" index + + dlpReadRecordIDList, + + dlpLastFunc // ***ALWAYS KEEP LAST*** + + } DlpFuncID; + + +// Desktop Link function error codes returned in the response errorCode +// field. +typedef enum DlpRespErrorCode { + dlpRespErrNone = 0, // reserve 0 for no error + dlpRespErrSystem, // general Pilot system error + dlpRespErrIllegalReq, // unknown function ID + dlpRespErrMemory, // insufficient memory + dlpRespErrParam, // invalid parameter + dlpRespErrNotFound, // database, record, or resource not found + dlpRespErrNoneOpen, // there are no open databases + dlpRespErrDatabaseOpen, // database is open by someone else + dlpRespErrTooManyOpenDatabases, // there are too many open databases + dlpRespErrAlreadyExists, // DB already exists + dlpRespErrCantOpen, // couldn't open DB + dlpRespErrRecordDeleted, // record is deleted + dlpRespErrRecordBusy, // record is in use by someone else + dlpRespErrNotSupported, // the requested operation is not supported + // on the given database type(record or resource) + dlpRespErrUnused1, // was dlpRespErrROMBased + dlpRespErrReadOnly, // caller does not have write access(or DB is in ROM) + dlpRespErrNotEnoughSpace, // not enough space for record/resource + dlpRespErrLimitExceeded, // size limit exceeded + dlpRespErrCancelSync, // cancel the sync + + dlpRespErrBadWrapper, // bad arg wrapper(for debugging) + dlpRespErrArgMissing, // required arg not found(for debugging) + dlpRespErrArgSize, // invalid argument size + + dlpRespErrLastReserved = 127 // last error code reserved for Palm + // *KEEP THIS ENTRY LAST* + } DlpRespErrorCode; + + +// Database flags +// NOTE: THESE *MUST* MATCH THE TOUCHDOWN DB ATTRIBUTES(AT LEAST IN THE FIRST VERSION). +// ANY CHANGES MUST BE REFLECTED IN "READ DB LIST" AND +#define dlpDBFlagResDB 0x0001 // resource DB if set; record DB if cleared +#define dlpDBFlagReadOnly 0x0002 // DB is read only if set; read/write if cleared +#define dlpDBFlagAppInfoDirty 0x0004 // resource DB if set; record DB if cleared +#define dlpDBFlagBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. +#define dlpDBFlagOpen 0x8000 // DB is open + +// Database record attributes +#define dlpRecAttrDeleted 0x80 // delete this record next sync +#define dlpRecAttrDirty 0x40 // archive this record next sync +#define dlpRecAttrBusy 0x20 // record currently in use +#define dlpRecAttrSecret 0x10 // "secret" record - password protected +#define dlpRecAttrArchived 0x08 // archived record + + +// Date/time will be described in the following format +// yr(2 bytes), mo(1 byte, 1-12), dy(1 byte, 1-31), +// hr(1 byte, 0-23), min(1 byte, 0-59), sec(1 byte, 0-59), +// unused(1 byte). + +typedef struct DlpDateTimeType { // OFFSET + Word year; // 0; year (high, low) + Byte month; // 2; month: 1-12 + Byte day; // 3; day: 1-31 + Byte hour; // 4; hour: 0-23 + Byte minute; // 5; minute: 0-59 + Byte second; // 6; second: 0-59 + Byte unused; // 7; unused -- set to null! + } DlpDateTimeType; // TOTAL: 8 bytes + + + +/************************************************************ + * Request and Response headers. + * + * Each DLP request and response data block begins with the + * corresponding header structure which identifies the function + * id, argument count, and error code(responses only). + *************************************************************/ + +// Request header: +// +typedef struct DlpReqHeaderType { + // OFFSET + Byte id; // 0; request function ID + Byte argc; // 2; count of args that follow this header + // TOTAL: 2 bytes + } DlpReqHeaderType; + +typedef DlpReqHeaderType* DlpReqHeaderPtr; + +typedef struct DlpReqType { + // OFFSET + DlpReqHeaderType header; // 0; request header + // FIXED SIZE: 2 bytes + Byte args[1]; // 2; request arguments -- var size + } DlpReqType; + +typedef DlpReqType* DlpReqPtr; + +// Response header: +// +typedef struct DlpRespHeaderType { + // OFFSET + Byte id; // 0; response function ID + Byte argc; // 1; count of arguments that follow this header + Word errorCode; // 2; error code + // TOTAL: 4 bytes + } DlpRespHeaderType; + +typedef DlpRespHeaderType* DlpRespHeaderPtr; + +typedef struct DlpRespType { + // OFFSET + DlpRespHeaderType header; // 0; response header + // FIXED SIZE: 4 bytes + Byte args[1]; // 4; response arguments -- var size + } DlpRespType; + +typedef DlpRespType* DlpRespPtr; + + +// Generic request/response body type(for utility routines) +// +typedef union DlpGenericBodyType { + Byte id; // request/response id + DlpReqType req; // request body + DlpRespType resp; // response body + } DlpGenericBodyType; + +typedef DlpGenericBodyType* DlpGenericBodyPtr; + + +// dlpFuncRespBit is used to form a function response ID from a +// function ID by or'ing it with the function ID. For example: if +// dlpFuncDeleteResource is the request ID, the correct response ID +// must be (dlpFuncDeleteResource | dlpFuncRespBit). +// +#define dlpFuncRespBit 0x80 + +// dlpFuncIDMask is used to mask out the function ID value +#define dlpFuncIDMask 0x7f + + + +/************************************************************ + * + * Argument headers used to "wrap" request and response arguments + * + * IMPORTANT: ARGUMENT WRAPPERS IN REQUESTS AND RESPONSES MUST + * ALWAYS START ON AN EVEN-BYTE BOUNDARY. The server + * implementation expects this to be the case. + * + *************************************************************/ + +// Maximum argument size which can be "wrapped" +#define dlpMaxArgSize 0xFFFF + + +// Small argument header for data sizes up to 255 bytes(optimization) +// +typedef struct DlpSmallArgWrapperType { + // OFFSET + Byte id; // 0; argument ID + Byte size; // 1; argument size (does NOT include this arg header) + // TOTAL: 2 bytes + } DlpSmallArgWrapperType; + +typedef struct DlpSmallArgType { + DlpSmallArgWrapperType wrapper; // 0; argument header + Byte data[1]; // 2; argument data -- var size + } DlpSmallArgType; + + +// Big argument header for data sizes above 255 bytes(*may also be used for +// smaller arguments when convenient*) +// +typedef struct DlpBigArgWrapperType { + // OFFSET + Byte id; // 0; argument ID + Byte unused; // 1; unused(for alignment) -- set to null! + Word size; // 2; argument size (does NOT include this arg header) + // TOTAL: 4 bytes + } DlpBigArgWrapperType; + +typedef struct DlpBigArgType { + DlpBigArgWrapperType wrapper; // 0; argument header + Byte data[1]; // 4; argument data -- var size + } DlpBigArgType; + + +// dlpBigArgBit is used to identify "big" argument headers by +// or'ing it with the argument id in argument header. +// +#define dlpBigArgBit 0x80 + +// dlpArgIDMask is used to mask out the argument id value +// +#define dlpArgIDMask 0x7f + + +// dlpFirstArgID is the value of the first argument ID to be defined for +// functions. Values below it are reserved. +// +#define dlpFirstArgID 0x20 + + +// Union of arg wrappers +typedef union DlpGenericArgWrapperType { + Byte id; // arg ID field + DlpSmallArgWrapperType small; // small arg header + DlpBigArgWrapperType big; // big arg header + } DlpGenericArgWrapperType; + +typedef DlpGenericArgWrapperType* DlpGenericArgWrapperPtr; + + +typedef union DlpGenericArgType { + Byte id; // arg id + DlpSmallArgType small; // "small" arg + DlpBigArgType big; // "big" arg + } DlpGenericArgType; + +typedef DlpGenericArgType* DlpGenericArgPtr; + + +/******************************************************************** + * Desktop Link Protocol Parameters + ********************************************************************/ + +// dlpCmdTimeoutSec -- this is the number of seconds to wait for a command +// to begin coming in before timing out +// +#define dlpCmdTimeoutSec 20 + + + +/************************************************************ + * DLP function argument structures + *************************************************************/ + + +////////////////////////////////////////////////////////////////////////// +// dlpReadUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: none +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadUserInfoRespArgID dlpFirstArgID + +typedef struct DlpReadUserInfoRespHdrType { + // OFFSET + DWord userID; // 0; user ID number (0 if none) +#ifdef INCLUDE_VIEWER_ID + DWord viewerID; // ?; id assigned to viewer by the desktop +#endif + DWord lastSyncPC; // 4; last sync PC id (0 if none) + DlpDateTimeType succSyncDate; // 8; last successful sync (year = 0 if none) + DlpDateTimeType lastSyncDate; // 16; last sync date(year = 0 if none) + Byte userNameLen; // 24; length of user name field, + // including null (0 = no user name) + Byte passwordLen; // 25; length of encrypted password + // (0 = no password set) + // TOTAL: 26 bytes + } DlpReadUserInfoRespHdrType; + +typedef struct DlpReadUserInfoRespType { + // OFFSET + DlpReadUserInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 26 bytes + Byte nameAndPassword[1]; // 26; user name -- var size + // User name begins at the nameAndPassword field and is null-terminated. + // The encrypted password follows the user name and is NOT null-terminated. + // The encrypted password may contain any byte values(0-255). + } DlpReadUserInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// user id (4 bytes) +// last sync PC id(4 bytes) +// user name +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpWriteUserInfoReqArgID dlpFirstArgID + +#define dlpMaxUserNameSize 41 // max user name size, including null byte + +typedef struct DlpWriteUserInfoReqHdrType { + // OFFSET + DWord userID; // 0; user ID number +#ifdef INCLUDE_VIEWER_ID + DWord viewerID; // ?; id assigned to viewer by the desktop +#endif + DWord lastSyncPC; // 4; last sync PC id + DlpDateTimeType lastSyncDate; // 8; last sync date(year = 0 if none) + Byte modFlags; // 16; flags indicating which values are being + // modified; see the dlpUserInfoMod... + // flags defined below + Byte userNameLen; // 17; user name length, including null + // TOTAL: 18 bytes + } DlpWriteUserInfoReqHdrType; + +// Flags indicating which values are being changed by the dlpWriteUserInfo +// request. These flags are used in the modFlags field of DlpWriteUserInfoReqHdrType. +// These flags are additive. +// +#define dlpUserInfoModUserID 0x80 // changing the user id +#define dlpUserInfoModSyncPC 0x40 // changing the last sync PC id +#define dlpUserInfoModSyncDate 0x20 // changing sync date +#define dlpUserInfoModName 0x10 // changing user name +#define dlpUserInfoModViewerID 0x08 // changing the viewer id + +typedef struct DlpWriteUserInfoReqType { + // OFFSET + DlpWriteUserInfoReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 10 bytes + Byte userName[1]; // 10; user name -- var size + // User name begins at the userName field and is null-terminated. + } DlpWriteUserInfoReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSysInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem +// +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadSysInfoRespArgID dlpFirstArgID + +typedef struct DlpReadSysInfoRespHdrType { + // OFFSET + DWord romSWVersion; // 0; ROM-based sys software version + DWord localizationID;// 4; localization ID + Byte unused; // 8; unused(for alignment) -- set to null! + Byte prodIDSize; // 9; size of productID/model field + // TOTAL: 10 bytes + } DlpReadSysInfoRespHdrType; + +typedef struct DlpReadSysInfoRespType { + // OFFSET + DlpReadSysInfoRespHdrType + header; // 0; fixed-size header + // FIXED SIZE: 14 bytes + Byte prodID[1]; // 14; productID/model text -- var size + } DlpReadSysInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpGetSysDateTime +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes: none + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpGetSysDateTimeRespArgID dlpFirstArgID + +typedef struct DlpGetSysDateTimeRespType { + // OFFSET + DlpDateTimeType dateTime; // 0; system date/time + // TOTAL: 8 bytes + } DlpGetSysDateTimeRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpSetSysDateTime +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// new system date/time +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrParam + +// Request argument structure: +// +#define dlpSetSysDateTimeReqArgID dlpFirstArgID + +typedef struct DlpSetSysDateTimeReqType { + // OFFSET + DlpDateTimeType dateTime; // 0; new system date/time + // TOTAL: 8 bytes + } DlpSetSysDateTimeReqType; + +typedef DlpSetSysDateTimeReqType* DlpSetSysDateTimeReqPtr; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadStorageInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +#define dlpReadStorageInfoReqArgID dlpFirstArgID + +typedef struct DlpReadStorInfoReqType { + // OFFSET + Byte startCardNo; // 0; card number to start at + // (0 = first) + Byte unused; // 1; unused -- set to null! + // TOTAL: 2 bytes + } DlpReadStorInfoReqType; + + +// Response argument structure: +// +#define dlpReadStorageInfoRespArgID dlpFirstArgID + +// Card info structure of variable size +typedef struct DlpCardInfoHdrType { + // OFFSET + Byte totalSize; // 0; total size of this card info + // *ROUNDED UP TO EVEN SIZE* + Byte cardNo; // 1; card number + Word cardVersion; // 2; card version + DlpDateTimeType crDate; // 4; creation date/time + DWord romSize; // 12; ROM size + DWord ramSize; // 16; RAM size + DWord freeRam; // 20; free RAM size + Byte cardNameSize; // 24; size of card name string + Byte manufNameSize; // 25; size of manuf. name string + // TOTAL: 26 bytes; + } DlpCardInfoHdrType; + +typedef struct DlpCardInfoType { + // OFFSET + DlpCardInfoHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 26 bytes; + Byte cardNameAndManuf[1]; + // 26; card name and manuf. text -- var size + // Card name is the cardNameSize bytes of text at cardNameAndManuf, + // followed immediately by manufNameSize bytes of manufacturer name. + } DlpCardInfoType; + + +typedef struct DlpReadStorInfoRespHdrType { + // OFFSET + Byte lastCardNo; // 0; card number of last card retrieved + Byte more; // 1; non-zero if there are more cards + Byte unused; // 2; unused -- set to null! + Byte actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadStorInfoRespHdrType; + +typedef struct DlpReadStorInfoRespType { + // OFFSET + DlpReadStorInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpCardInfoType cardInfo[1]; // 4; actCount of card info structures -- var size + } DlpReadStorInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadDBList +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +#define dlpReadDBListReqArgID dlpFirstArgID + +typedef struct DlpReadDBListReqType { + // OFFSET + Byte srchFlags; // 0; search flags + Byte cardNo; // 1; card number -- 0-based + Word startIndex; // 2; DB index to start at + // (0 = from beginning) + // TOTAL: 4 bytes + } DlpReadDBListReqType; + +#define dlpReadDBListFlagRAM 0x80 // Search for RAM-based +#define dlpReadDBListFlagROM 0x40 // Search for ROM-based + + +// Response argument structure: +// +#define dlpReadDBListRespArgID dlpFirstArgID + +// Database info structure of variable size +typedef struct DlpDBInfoHdrType { + // OFFSET + Byte totalSize; // 0; total size of the DB info + // *ROUNDED UP TO EVEN SIZE* + Byte unused; // 1; unused -- set to null! + Word dbFlags; // 2; DB flags: dlpDBFlagReadOnly, + // dlpDBFlagResDB, + // dlpDBFlagAppInfoDirty, dlpDBFlagOpen, + // dlpDBFlagBackup; + DWord type; // 4; database type + DWord creator; // 8; database creator + Word version; // 12; database version + DWord modNum; // 14; modification number + DlpDateTimeType crDate; // 18; creation date + DlpDateTimeType modDate; // 26; latest modification date + DlpDateTimeType backupDate; // 34; latest backup date + Word dbIndex; // 42; DB index + // TOTAL: 44 bytes; + } DlpDBInfoHdrType; + +typedef struct DlpDBInfoType { + // OFFSET + DlpDBInfoHdrType header; // 0; fixed-size header + // FIXED SIZE: 44 bytes; + Byte name[1]; // 44; databse name text -- var size and + // null-terminated + } DlpDBInfoType; + + +typedef struct DlpReadDBListRespHdrType { + // OFFSET + Word lastIndex; // 0; DB index of last entry retrieved + Byte flags; // 2; flags: dlpReadDBListRespFlagMore + Byte actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadDBListRespHdrType; + +// dlpReadDBListRespFlagMore flag: if set, indicates that there are more +// databases to list -- this enables the server to send the listing +// incrementally, reducing server memory requirements if necessary +#define dlpReadDBListRespFlagMore 0x80 + +typedef struct DlpReadDBListRespType { + // OFFSET + DlpReadDBListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpDBInfoType dbInfo[1]; // 4; actCount of DB info structures -- var size + } DlpReadDBListRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrTooManyOpenDatabases +// dlpRespErrCantOpen + +// Request argument structure: +// +#define dlpOpenDBReqArgID dlpFirstArgID + +typedef struct DlpOpenDBReqHdrType { + // OFFSET + Byte cardNo; // 0; memory module number + Byte mode; // 1; open mode + // TOTAL: 2 bytes; + } DlpOpenDBReqHdrType; + +#define dlpOpenDBModeRead 0x80 +#define dlpOpenDBModeWrite 0x40 +#define dlpOpenDBModeExclusive 0x20 +#define dlpOpenDBModeShowSecret 0x10 + + +typedef struct DlpOpenDBReqType { + // OFFSET + DlpOpenDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + Byte name[1]; // 2; databse name text -- var size + // zero-terminated + } DlpOpenDBReqType; + +typedef DlpOpenDBReqType* DlpOpenDBReqPtr; + + +// Response argument structure: +// +#define dlpOpenDBRespArgID dlpFirstArgID +// +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCreateDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrAlreadyExists, +// dlpRespErrCantOpen, +// dlpRespErrNotEnoughSpace, +// dlpRespErrTooManyOpenDatabases + +// Request argument structure: +// +#define dlpCreateDBReqArgID dlpFirstArgID + +typedef struct DlpCreateDBReqHdrType { + // OFFSET + DWord creator; // 0; DB creator + DWord type; // 4; DB type + Byte cardNo; // 8; memory module number + Byte unused; // 9; unused -- set to null + Word dbFlags; // 10; allowed flags: dlpDBFlagResDB, + // dlpDBFlagBackup + Word version; // 12; DB version # + // TOTAL: 14 bytes; + } DlpCreateDBReqHdrType; + +typedef struct DlpCreateDBReqType { + // OFFSET + DlpCreateDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + Byte name[1]; // 14; DB name text -- var size + // zero-terminated + } DlpCreateDBReqType; + +typedef DlpCreateDBReqType* DlpCreateDBReqPtr; + + +// Response argument structure: +// +#define dlpCreateDBRespArgID dlpFirstArgID + +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCloseDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrParam, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNoneOpen + +// Request argument structure: +// +typedef enum { + dlpCloseDBReqDBIDArgID = dlpFirstArgID, // close a specific database + dlpCloseDBReqAllArgID // close all databases + } DlpCloseDBReqArgID; + +// Argument structure to close a specific database(dlpCloseDBReqDBIDArgID): +// +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Argument structure to close all databases(dlpCloseDBReqAllArgID): +// +// This request argument contains no data + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrCantOpen, +// dlpRespErrDatabaseOpen + +// Request argument structure: +// +#define dlpDeleteDBReqArgID dlpFirstArgID + +typedef struct DlpDeleteDBReqHdrType { + // OFFSET + Byte cardNo; // 0; memory module number + Byte unused; // 1; unused -- set to null! + // TOTAL: 2 bytes; + } DlpDeleteDBReqHdrType; + + +typedef struct DlpDeleteDBReqType { + // OFFSET + DlpDeleteDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + Byte name[1]; // 2; databse name text -- var size + // zero-terminated + } DlpDeleteDBReqType; + +typedef DlpDeleteDBReqType* DlpDeleteDBReqPtr; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadOpenDBInfo +////////////////////////////////////////////////////////////////////////// +// Get information on an open database +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadOpenDBInfoArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +#define dlpReadOpenDBInfoRespArgID dlpFirstArgID + + +typedef struct DlpReadOpenDBInfoRespType { + // OFFSET + Word numRec; // 0; number of records or resources + // TOTAL: 2 bytes + } DlpReadOpenDBInfoRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpMoveCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam +// dlpRespErrNotSupported +// dlpRespErrReadOnly + +// Request argument structure: +// +#define dlpMoveCategoryReqArgID dlpFirstArgID + +typedef struct DlpMoveCategoryReqType { + // OFFSET + Byte dbID; // 0; database id + Byte fromCategory; // 1; id of the "from" category + Byte toCategory; // 2; id of the "to" category + Byte unused; // 3; unused -- set to null! + // TOTAL: 4 bytes; + } DlpMoveCategoryReqType; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadBlockReqArgID dlpFirstArgID + +typedef struct DlpReadBlockReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word offset; // 2; offset into the block + Word numBytes; // 4; number of bytes to read starting + // at offset(-1 = to the end) + // TOTAL: 6 bytes; + } DlpReadBlockReqType; + + +// Response argument structure: +// +#define dlpReadBlockRespArgID dlpFirstArgID + +typedef struct DlpReadBlockRespHdrType { + // OFFSET + Word blockSize; // 0; actual block size -- may be greater + // than the amount of data returned + // TOTAL: 2 bytes + } DlpReadBlockRespHdrType; + +typedef struct DlpReadBlockRespType { + // OFFSET + DlpReadBlockRespHdrType // + header; // 0; fixed size header + // FIXED SIZE: 2 bytes + Byte data[1]; // 2; block data -- var size + } DlpReadBlockRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly +// dlpRespErrNotEnoughSpace +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteBlockReqArgID dlpFirstArgID + +typedef struct DlpWriteBlockReqHdrType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word blockSize; // 2; total block size(0 = free existing block) + // TOTAL: 4 bytes; + } DlpWriteBlockReqHdrType; + + +typedef struct DlpWriteBlockReqType { + // OFFSET + DlpWriteBlockReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes; + Byte data[1]; // 4; block data -- var size + } DlpWriteBlockReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpReadAppBlock + + +// Response argument structure: +// +// see dlpReadAppBlock + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpWriteAppBlock + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextModifiedRec +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadRecord +// + +// Request argument structure: +// +#define dlpReadNextModRecReqArgID dlpFirstArgID +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// Response argument id = dlpReadRecordRespArgID + +// Response argument structure = DlpReadRecordRespType + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetDBIndex +////////////////////////////////////////////////////////////////////////// +// Resets the "next modified record" index to the beginning +// +// Possible error codes +// dlpRespErrParam +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetDBIndexReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrRecordBusy, +// dlpRespErrNoneOpen + +typedef enum { + dlpReadRecordIdArgID = dlpFirstArgID, + dlpReadRecordIndexArgID + } DlpReadRecordReqArgID; + +// dlpReadRecordIdArgID request argument structure: +// +typedef struct DlpReadRecordByIDReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + DWord recordID; // 2; unique record id + Word offset; // 6; offset into the record + Word numBytes; // 8; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 10 bytes; + } DlpReadRecordByIDReqType; + +// dlpReadRecordIndexArgID request argument structure: +// +typedef struct DlpReadRecordByIndexReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word index; // 2; record index + Word offset; // 4; offset into the record + Word numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadRecordByIndexReqType; + + +// Response argument structure: +// +#define dlpReadRecordRespArgID dlpFirstArgID + +typedef struct DlpReadRecordRespHdrType { + // OFFSET + DWord recordID; // 0; unique record id + Word index; // 4; record index + Word recSize; // 6; total record size in bytes + Byte attributes; // 8; record attributes + Byte category; // 9; record category index + // TOTAL: 10 bytes; + } DlpReadRecordRespHdrType; + +typedef struct DlpReadRecordRespType { + // OFFSET + DlpReadRecordRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + Byte data[1]; // 8; record data -- var size + } DlpReadRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecordIDList +////////////////////////////////////////////////////////////////////////// +// Returns a list of unique record id's. May need to call more than once +// to get the entire list. dlpRespErrNotFound is returned when "start" +// is out of bounds +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrNoneOpen + +#define dlpReadRecordIDListReqArgID dlpFirstArgID + +// dlpReadRecordIDListReqArgID request argument structure: +// +typedef struct DlpReadRecordIDListReqType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; request flags + Word start; // 2; starting record index (0-based) + Word maxEntries; // 4; maximum number of entries, or + // 0xFFFF to return as many as possible + // TOTAL: 6 bytes; + } DlpReadRecordIDListReqType; + +// dlpReadRecordIDListFlagSortDB: if set, DL Server will call the creator +// application to resort the database before returning the list. +#define dlpReadRecordIDListFlagSortDB 0x80 + + +// Response argument structure: +// +#define dlpReadRecordIDListRespArgID dlpFirstArgID + +typedef struct DlpReadRecordIDListRespHdrType { + // OFFSET + Word numEntries; // 0; number of entries returned + // TOTAL: 2 bytes; + } DlpReadRecordIDListRespHdrType; + +typedef struct DlpReadRecordIDListRespType { + // OFFSET + DlpReadRecordIDListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + DWord recID[1]; // 8; list of record id's -- var size + } DlpReadRecordIDListRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotEnoughSpace +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteRecordReqArgID dlpFirstArgID + +// dlpWriteRecordReqArgID -- required +typedef struct DlpWriteRecordReqHdrType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + DWord recordID; // 2; unique record id or null + Byte attributes; // 6; record attributes -- only + // dlpRecAttrSecret is allowed here + Byte category; // 7; record category + // TOTAL: 8 bytes; + } DlpWriteRecordReqHdrType; + +typedef struct DlpWriteRecordReqType { + // OFFSET + DlpWriteRecordReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + Byte data[1]; // 8; record data -- var size + } DlpWriteRecordReqType; + + +// Response argument structure: +// +#define dlpWriteRecordRespArgID dlpFirstArgID + +typedef struct DlpWriteRecordRespType { + // OFFSET + DWord recordID; // 0; record ID + // TOTAL: 4 bytes + } DlpWriteRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen +// + +// Request argument structure: +// +#define dlpDeleteRecordReqArgID dlpFirstArgID + +// Argument structure to delete by record ID(dlpDeleteRecordReqIDArgID): +typedef struct DlpDeleteRecordReqType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; flags (dlpDeleteRecFlagDeleteAll) + DWord recordID; // 2; unique record id + // TOTAL: 6 bytes; + } DlpDeleteRecordReqType; + +// dlpDeleteRecFlagDeleteAll: if this flag is set, the reocordID field +// is ignored and all database records will be deleted +#define dlpDeleteRecFlagDeleteAll 0x80 + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +typedef enum { + dlpReadResourceIndexArgID = dlpFirstArgID, + dlpReadResourceTypeArgID + } DlpReadResourceReqArgID; + +// dlpReadResourceIndexArgID request argument structure: +// +typedef struct DlpReadResourceByIndexReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word index; // 2; resource index + Word offset; // 4; offset into the resource + Word numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadResourceByIndexReqType; + +// dlpReadResourceTypeArgID request argument structure: +// +typedef struct DlpReadResourceByTypeReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + DWord type; // 2; resource type + Word id; // 6; resource id + Word offset; // 8; offset into the resource + Word numBytes; // 10; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 12 bytes; + } DlpReadResourceByTypeReqType; + + +// Response argument structure: +// +#define dlpReadResourceRespArgID dlpFirstArgID + +typedef struct DlpReadResourceRespHdrType { + // OFFSET + DWord type; // 0; resource type + Word id; // 4; resource id + Word index; // 6; resource index + Word resSize; // 8; total resource size in bytes + // TOTAL: 10 bytes; + } DlpReadResourceRespHdrType; + +typedef struct DlpReadResourceRespType { + // OFFSET + DlpReadResourceRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes; + Byte resData[1]; // 6; resource data -- var size + } DlpReadResourceRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteResourceReqArgID dlpFirstArgID + +typedef struct DlpWriteResourceReqHdrType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; inused -- set to null! + DWord type; // 2; resource type + Word id; // 6; resource id + Word resSize; // 8; total resource size + // TOTAL: 10 bytes; + } DlpWriteResourceReqHdrType; + +typedef struct DlpWriteResourceReqType { + // OFFSET + DlpWriteResourceReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 10 bytes; + Byte data[1]; // 10; resource data -- var size + } DlpWriteResourceReqType; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpDeleteResourceReqArgID dlpFirstArgID + +typedef struct DlpDeleteResourceReqType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; flags (dlpDeleteResFlagDeleteAll) + DWord type; // 2; resource type + Word id; // 6; resource id + // TOTAL: 8 bytes; + } DlpDeleteResourceReqType; + +// dlpDeleteResFlagDeleteAll: if set, all resources in the db will be deleted +#define dlpDeleteResFlagDeleteAll 0x80 + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCleanUpDatabase +////////////////////////////////////////////////////////////////////////// +// Deletes all records which are marked as archived or deleted in the +// record database +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly, +// dlpRespErrNotSupported +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpCleanUpDatabaseReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSyncFlags +////////////////////////////////////////////////////////////////////////// +// For record databases, reset all dirty flags. +// For both record and resource databases, set the last sync time to NOW +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam +// dlpRespErrReadOnly, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetSyncFlagsReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCallApplication +////////////////////////////////////////////////////////////////////////// +// Call an application entry point via an action code +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound + +// Request argument structure: +// +#define dlpCallApplicationReqArgID dlpFirstArgID + +typedef struct DlpCallApplicationReqHdrType { + // OFFSET + DWord creator; // 0; app DB creator id + Word action; // 4; action code + Word paramSize; // 6; custom param size + // TOTAL: 8 bytes + } DlpCallApplicationReqHdrType; + +typedef struct DlpCallApplicationReqType { + // OFFSET + DlpCallApplicationReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes + Byte paramData[1]; // 8; custom param data -- var size + } DlpCallApplicationReqType; + +// Response argument structure: +// +#define dlpCallApplicationRespArgID dlpFirstArgID + +typedef struct DlpCallApplicationRespHdrType { + // OFFSET + Word action; // 0; action code which was called + Word resultCode; // 2; result error code returned by action + Word resultSize; // 4; custom result data size + // TOTAL: 6 bytes + } DlpCallApplicationRespHdrType; + +typedef struct DlpCallApplicationRespType { + // OFFSET + DlpCallApplicationRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes + Byte resultData[1]; // 6; custom result data -- var size + } DlpCallApplicationRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSystem +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpAddSyncLogEntry +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrLimitExceeded, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpAddSyncLogEntryReqArgID dlpFirstArgID + +typedef struct DlpAddSyncLogEntryReqType { + // OFFSET + Byte text[1]; // 0; entry text -- var size and + // null-terminated + } DlpAddSyncLogEntryReqType; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpProcessRPC +////////////////////////////////////////////////////////////////////////// +// Remote Procedure Call interface +// +// Request arguments: +// RPC command block +// +// Response arguments: +// RPC reply block +// +// Possible error codes +// 0 on success; otherwise error code from the TouchDown +// RPC executor +// +// NOTE: this is a low-level system command which does not use arg wrappers. + +// Request argument structure: +// +// Block of RPC command data (no arg wrapper) + +// Response argument structure: +// +// Block of RPC reply data of same length as command block(no arg wrapper) + + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenConduit +////////////////////////////////////////////////////////////////////////// +// This command is sent before each conduit is opened by the desktop. +// If the viewer has a cancel pending, it will return dlpRespErrCancelSync +// in the response header's errorCode field. +// +// Request arguments: none. +// +// Response arguments: none. +// +// Possible error codes +// dlpRespErrCancelSync + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpEndOfSync +////////////////////////////////////////////////////////////////////////// +// This command is sent by the desktop to end the sync. +// +// Request arguments: termination code: 0 = normal termination; +// otherwise the client is aborting the sync +// +// Possible error codes +// 0 + +// Request argument structure: +// +#define dlpEndOfSyncReqArgID dlpFirstArgID + +typedef enum DlpSyncTermCode { + dlpTermCodeNormal = 0, // normal termination + dlpTermCodeOutOfMemory, // termination due to low memory on TD + dlpTermCodeUserCan, // user cancelled from desktop + dlpTermCodeOther // catch-all abnormal termination code + } DlpSyncTermCode; + + +typedef struct DlpEndOfSyncReqType { + // OFFSET + Word termCode; // 0; termination code + // TOTAL: 2 bytes + } DlpEndOfSyncReqType; + + +// Response argument structure: +// +// none. + + +/************************************************************ + * Macros + *************************************************************/ + + +#endif // __DLCOMMON_H__ + + diff --git a/sdk-1/include/Core/System/DLServer.h b/sdk-1/include/Core/System/DLServer.h new file mode 100644 index 0000000..8e808a9 --- /dev/null +++ b/sdk-1/include/Core/System/DLServer.h @@ -0,0 +1,254 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DLServer.h + * + * Description: + * Desktop Link Protocol(DLP) Server implementation definitions. + * + * History: + * 7/12/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __DL_SERVER_H__ +#define __DL_SERVER_H__ + +// Pilot common definitions +#include +#include // for DmOpenRef + + +// COMMENT OUT TO BUILD WITHOUT THE VIEWER ID OPTION +#define INCLUDE_VIEWER_ID + +/************************************************************ + * DLK result codes + * (dlkErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define dlkErrParam (dlkErrorClass | 1) // invalid parameter +#define dlkErrMemory (dlkErrorClass | 2) // memory allocation error +#define dlkErrNoSession (dlkErrorClass | 3) // could not establish a session + +#define dlkErrSizeErr (dlkErrorClass | 4) // reply length was too big + +#define dlkErrLostConnection (dlkErrorClass | 5) // lost connection +#define dlkErrInterrupted (dlkErrorClass | 6) // sync was interrupted (see sync state) +#define dlkErrUserCan (dlkErrorClass | 7) // cancelled by user + + +/******************************************************************** + * Desktop Link system preferences resource for user info + * id = sysResIDDlkUserInfo, defined in SystemMgr.rh + ********************************************************************/ +#define dlkMaxUserNameLength 40 +#define dlkUserNameBufSize (dlkMaxUserNameLength + 1) + +#define dlkMaxLogSize (2 * 1024) + +typedef enum DlkSyncStateType { + dlkSyncStateNeverSynced = 0, // never synced + dlkSyncStateInProgress, // sync is in progress + dlkSyncStateLostConnection, // connection lost during sync + dlkSyncStateLocalCan, // cancelled by local user on TD + dlkSyncStateRemoteCan, // cancelled by user from desktop + dlkSyncStateLowMemoryOnTD, // sync ended due to low memory on TD + dlkSyncStateAborted, // sync was aborted for some other reason + dlkSyncStateCompleted // sync completed normally + } DlkSyncStateType; + +typedef struct DlkUserInfoHdrType { + DWord userID; // user id +#ifdef INCLUDE_VIEWER_ID + DWord viewerID; // id assigned to viewer by the desktop +#endif + DWord lastSyncPC; // last sync PC id + ULong succSyncDate; // last successful sync date + ULong lastSyncDate; // last sync date + DlkSyncStateType lastSyncState; // last sync status + Byte userNameLen; // length of name field(including null) + UInt syncLogLen; // length of sync log(including null) + } DlkUserInfoHdrType; + +typedef struct DlkUserInfoType { + DlkUserInfoHdrType header; // fixed size header + Char nameAndLog[2]; // user name, followed by sync log; + // both null-terminated(for debugging) + } DlkUserInfoType; + +typedef DlkUserInfoType* DlkUserInfoPtr; // user info pointer + + + +/******************************************************************** + * DLK Session Structures + ********************************************************************/ + + +// DesktopLink event notification callback. If non-zero is returned, +// sync will be cancelled as soon as a safe point is reached. +typedef enum { + dlkEventOpeningConduit = 1, // conduit is being opened -- paramP + // is null; + + dlkEventDatabaseOpened, // client has opened a database -- paramP + // points to DlkEventDatabaseOpenedType; + + dlkEventCleaningUp, // last stage of sync -- cleaning up (notifying apps, etc) -- + // paramP is null + + dlkEventSystemResetRequested // system reset was requested by the desktop client + // (the normal action is to delay the reset until + // end of sync) -- paramP is null + } DlkEventType; + +// Prototype for the event notification callback +typedef Int (*DlkEventProcPtr)(DWord userRef, DlkEventType dlkEvent, + VoidPtr paramP); + +// Parameter structure for dlkEventDatabaseOpened +typedef struct DlkEventDatabaseOpenedType { + CharPtr dbNameP; // database name + ULong dbCreator; // database creator + } DlkEventDatabaseOpenedType; + + +// Prototype for the "user cancel" check callback function +typedef Int (*DlkUserCanProcPtr)(DWord userRef); + + +// +// List of modified database creators maintained by DLP Server +// +typedef struct DlkDBCreatorList { + UInt count; // number of entries in the list + Handle listH; // chunk handle of the creators list + } DlkDBCreatorList; + + +// +// DLP Server session information +// +typedef struct DlkServerSessionType { + // Information supplied by user + Byte sls; // session listenning socket + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + DWord userRef; // user reference value for event proc + DlkUserCanProcPtr canProcP; // ptr to user-cancel function + DWord canRef; // parameter for canProcP() + + // Current database information + Byte dlkDBID; // Desktop Link database id + DmOpenRef dbP; // TouchDown database access pointer -- if null, no current db + UInt cardNo; // memory module number + ULong dbCreator; // creator id + Char dbName[dmDBNameLength]; // DB name + UInt dbOpenMode; // database open mode + Boolean created; // true if the current db was created + Boolean isResDB; // set to true if resource database + Boolean ramBased; // true if the db is in RAM storage + Boolean readOnly; // true if the db is read-only + LocalID dbLocalID; // TouchDown LocalID of the database + ULong initialModNum; // initial DB modification number + ULong modRecIndex; // modified record index for + // dlpReadNextModifiedRec(0=beginning) + + // List of modified database creators maintained by DLP Server + DlkDBCreatorList creatorList; + + // Session status information + DlkSyncStateType syncState; // current sync state; + + Boolean complete; // set to true when completion request + // has been received + + Boolean conduitOpened; // set to true after the first coduit + // is opened by remote + + Boolean logCleared; // set to true after sync log has been + // cleared during the current session; + // The log will be cleared before any new entries are added or at + // the end of sync in case no new entries were added. + // (we do not clear the log at the beginning of sync in case the + // user cancels during the "identifying user" phase; in this + // event, the spec calls for preserving the original log) + + Boolean resetPending; // set to true if system reset is pending; + // the reset will be carried out at end + // of sync + + // Current request information + Boolean gotCommand; // set to true when got a request + Byte cmdTID; // current transaction ID + Word cmdLen; // size of data in request buffer + VoidPtr cmdP; // pointer to command + VoidHand cmdH; // handle of command buffer + Byte remoteSocket; // remote socket id + } DlkServerSessionType; + +typedef DlkServerSessionType* DlkServerSessionPtr; + + +// +// Parameter passed to DlkStartServer() +// +typedef struct DlkServerParamType { + Byte sls; // server listenning socket id for PAD + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + DWord userRef; // user reference value for event proc + Int cmdWaitSec; // maximum number of seconds to wait for + // a command (0=default, -1=forever) + DlkUserCanProcPtr canProcP; // ptr to user-cancel function + DWord canRef; // parameter for canProcP() + + } DlkServerParamType; + +typedef DlkServerParamType* DlkServerParamPtr; + + +/******************************************************************** + * DesktopLink Server Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// +// SERVER API +// + +// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam, +// * dlkErrNoSession, dlkErrLostConnection, dlkErrMemory, +// * dlkErrUserCan +Err DlkStartServer(DlkServerParamPtr paramP) + SYS_TRAP(sysTrapDlkStartServer); + +Err DlkGetSyncInfo(ULongPtr succSyncDateP, ULongPtr lastSyncDateP, + DlkSyncStateType* syncStateP, CharPtr nameBufP, + CharPtr logBufP, ULongPtr logLenP) + SYS_TRAP(sysTrapDlkGetSyncInfo); + +// DOLATER... this is a temporary function for debugging modem manager. +// remove it when done. +void DlkSetLogEntry(CharPtr textP, Int textLen, Boolean append) + SYS_TRAP(sysTrapDlkSetLogEntry); + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * DLK Macros + ********************************************************************/ + + + +#endif // __DL_SERVER_H__ diff --git a/sdk-1/include/Core/System/DLUtil.h b/sdk-1/include/Core/System/DLUtil.h new file mode 100644 index 0000000..d4fbbae --- /dev/null +++ b/sdk-1/include/Core/System/DLUtil.h @@ -0,0 +1,56 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DLUtil.h + * + * Description: + * Desktop Link Protocol(DLP) utility definitions. + * + * History: + * 8/12/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __DL_UTIL_H__ +#define __DL_UTIL_H__ + +// Pilot common definitions +#include + +// Desktop Link common definitions +#include + + +/******************************************************************** + * Utility Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +Int DlkUtilFillArgWrapper(DlpGenericArgWrapperPtr wrapperP, + Byte argID, Word argSize); + +Boolean DlkUtilGetArg(VoidPtr bodyBufP, Word bodySize, Byte argID, + VoidPtr* dataPP, WordPtr dataSizeP); + + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * Utility Macros + ********************************************************************/ + + + +#endif // __DL_UTIL_H__ diff --git a/sdk-1/include/Core/System/DataMgr.h b/sdk-1/include/Core/System/DataMgr.h new file mode 100644 index 0000000..b4476bc --- /dev/null +++ b/sdk-1/include/Core/System/DataMgr.h @@ -0,0 +1,432 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DataMgr.h + * + * Description: + * Header for the Data Manager + * + * History: + * 11/14/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __DATAMGR_H__ +#define __DATAMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + +// Other headers we depend on +#include + + +/************************************************************ + * Category equates + *************************************************************/ +#define dmRecAttrCategoryMask 0x0F // mask for category # +#define dmRecNumCategories 16 // number of categories +#define dmCategoryLength 16 // 15 chars + 1 null terminator + +#define dmAllCategories 0xff +#define dmUnfiledCategory 0 + +#define dmMaxRecordIndex 0xffff + + + +// Record Attributes +#define dmRecAttrDelete 0x80 // delete this record next sync +#define dmRecAttrDirty 0x40 // archive this record next sync +#define dmRecAttrBusy 0x20 // record currently in use +#define dmRecAttrSecret 0x10 // "secret" record - password protected + + + + +/************************************************************ + * Database Header equates + *************************************************************/ +#define dmDBNameLength 32 // 31 chars + 1 null terminator + +// Attributes of a Database +#define dmHdrAttrResDB 0x0001 // Resource database +#define dmHdrAttrReadOnly 0x0002 // Read Only database +#define dmHdrAttrAppInfoDirty 0x0004 // Set if Application Info block is dirty + // Optionally supported by an App's conduit +#define dmHdrAttrBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. +#define dmHdrAttrOpen 0x8000 // Database not closed properly + + + + +/************************************************************ + * Mode flags passed to DmOpenDatabase + *************************************************************/ +#define dmModeReadOnly 0x0001 // read access +#define dmModeWrite 0x0002 // write access +#define dmModeReadWrite 0x0003 // read & write access +#define dmModeLeaveOpen 0x0004 // leave open when app quits +#define dmModeExclusive 0x0008 // don't let anyone else open it +#define dmModeShowSecret 0x0010 // force show of secret records + +// Generic type used to represent an open Database +typedef VoidPtr DmOpenRef; + + +/************************************************************ + * Structure passed to DmGetNextDatabaseByTypeCreator and used + * to cache search information between multiple searches. + *************************************************************/ +typedef struct { + DWord info[8]; + } DmSearchStateType; +typedef DmSearchStateType* DmSearchStatePtr; + + + +/************************************************************ + * Database manager error codes + * the constant dmErrorClass is defined in SystemMgr.h + *************************************************************/ +#define dmErrMemError (dmErrorClass | 1) +#define dmErrIndexOutOfRange (dmErrorClass | 2) +#define dmErrInvalidParam (dmErrorClass | 3) +#define dmErrReadOnly (dmErrorClass | 4) +#define dmErrDatabaseOpen (dmErrorClass | 5) +#define dmErrCantOpen (dmErrorClass | 6) +#define dmErrCantFind (dmErrorClass | 7) +#define dmErrRecordInWrongCard (dmErrorClass | 8) +#define dmErrCorruptDatabase (dmErrorClass | 9) +#define dmErrRecordDeleted (dmErrorClass | 10) +#define dmErrRecordArchived (dmErrorClass | 11) +#define dmErrNotRecordDB (dmErrorClass | 12) +#define dmErrNotResourceDB (dmErrorClass | 13) +#define dmErrROMBased (dmErrorClass | 14) +#define dmErrRecordBusy (dmErrorClass | 15) +#define dmErrResourceNotFound (dmErrorClass | 16) +#define dmErrNoOpenDatabase (dmErrorClass | 17) +#define dmErrInvalidCategory (dmErrorClass | 18) +#define dmErrNotValidRecord (dmErrorClass | 19) +#define dmErrWriteOutOfBounds (dmErrorClass | 20) +#define dmErrSeekFailed (dmErrorClass | 21) +#define dmErrAlreadyOpenForWrites (dmErrorClass | 22) +#define dmErrOpenedByAnotherTask (dmErrorClass | 23) +#define dmErrUniqueIDNotFound (dmErrorClass | 24) +#define dmErrAlreadyExists (dmErrorClass | 25) +#define dmErrInvalidDatabaseName (dmErrorClass | 26) + + +/************************************************************ + * Values for the direction parameter of DmSeekRecordInCategory + *************************************************************/ +#define dmSeekForward 1 +#define dmSeekBackward -1 + + +/************************************************************ + * Data Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initialization +Err DmInit(void) + SYS_TRAP(sysTrapDmInit); + + +// Directory Lists +Err DmCreateDatabase(UInt cardNo, const CharPtr nameP, + ULong creator, ULong type, Boolean resDB) + SYS_TRAP(sysTrapDmCreateDatabase); + +Err DmCreateDatabaseFromImage(Ptr bufferP) + SYS_TRAP(sysTrapDmCreateDatabaseFromImage); + + +Err DmDeleteDatabase(UInt cardNo, LocalID dbID) + SYS_TRAP(sysTrapDmDeleteDatabase); + +UInt DmNumDatabases(UInt cardNo) + SYS_TRAP(sysTrapDmNumDatabases); + +LocalID DmGetDatabase(UInt cardNo, UInt index) + SYS_TRAP(sysTrapDmGetDatabase); + +LocalID DmFindDatabase(UInt cardNo, const CharPtr nameP) + SYS_TRAP(sysTrapDmFindDatabase); + +Err DmGetNextDatabaseByTypeCreator(Boolean newSearch, DmSearchStatePtr stateInfoP, + ULong type, ULong creator, Boolean onlyLatestVers, + UIntPtr cardNoP, LocalID* dbIDP) + SYS_TRAP(sysTrapDmGetNextDatabaseByTypeCreator); + + +// Database info +Err DmDatabaseInfo(UInt cardNo, LocalID dbID, const CharPtr nameP, + UIntPtr attributesP, UIntPtr versionP, ULongPtr crDateP, + ULongPtr modDateP, ULongPtr bckUpDateP, + ULongPtr modNumP, LocalID* appInfoIDP, + LocalID* sortInfoIDP, ULongPtr typeP, + ULongPtr creatorP) + SYS_TRAP(sysTrapDmDatabaseInfo); + +Err DmSetDatabaseInfo(UInt cardNo, LocalID dbID, const CharPtr nameP, + UIntPtr attributesP, UIntPtr versionP, ULongPtr crDateP, + ULongPtr modDateP, ULongPtr bckUpDateP, + ULongPtr modNumP, LocalID* appInfoIDP, + LocalID* sortInfoIDP, ULongPtr typeP, + ULongPtr creatorP) + SYS_TRAP(sysTrapDmSetDatabaseInfo); + +Err DmDatabaseSize(UInt cardNo, LocalID dbID, ULongPtr numRecordsP, + ULongPtr totalBytesP, ULongPtr dataBytesP) + SYS_TRAP(sysTrapDmDatabaseSize); + + +// Open Databases info +DmOpenRef DmOpenDatabase(UInt cardNo, LocalID dbID, UInt mode) + SYS_TRAP(sysTrapDmOpenDatabase); + +DmOpenRef DmOpenDatabaseByTypeCreator(ULong type, ULong creator, UInt mode) + SYS_TRAP(sysTrapDmOpenDatabaseByTypeCreator); + +Err DmCloseDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmCloseDatabase); + + +DmOpenRef DmNextOpenDatabase(DmOpenRef currentP) + SYS_TRAP(sysTrapDmNextOpenDatabase); + +Err DmOpenDatabaseInfo(DmOpenRef dbP, LocalID* dbIDP, + UIntPtr openCountP, UIntPtr modeP, UIntPtr cardNoP, + BooleanPtr resDBP) + SYS_TRAP(sysTrapDmOpenDatabaseInfo); + +LocalID DmGetAppInfoID (DmOpenRef dbP) + SYS_TRAP(sysTrapDmGetAppInfoID); + + +// Utility to unlock all records and clear busy bits +Err DmResetRecordStates(DmOpenRef dbP) + SYS_TRAP(sysTrapDmResetRecordStates); + + +// Error Query +Err DmGetLastErr(void) + SYS_TRAP(sysTrapDmGetLastErr); + + +//------------------------------------------------------------ +// Record based access routines +//------------------------------------------------------------ + +// Record Info +UInt DmNumRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumRecords); + +UInt DmNumRecordsInCategory(DmOpenRef dbP, UInt category) + SYS_TRAP(sysTrapDmNumRecordsInCategory); + +Err DmRecordInfo(DmOpenRef dbP, UInt index, + UIntPtr attrP, ULongPtr uniqueIDP, LocalID* chunkIDP) + SYS_TRAP(sysTrapDmRecordInfo); + +Err DmSetRecordInfo(DmOpenRef dbP, UInt index, + UIntPtr attrP, ULongPtr uniqueIDP) + SYS_TRAP(sysTrapDmSetRecordInfo); + + + +// Record attaching and detaching +Err DmAttachRecord(DmOpenRef dbP, UIntPtr atP, + Handle newH, Handle* oldHP) + SYS_TRAP(sysTrapDmAttachRecord); + +Err DmDetachRecord(DmOpenRef dbP, UInt index, + Handle* oldHP) + SYS_TRAP(sysTrapDmDetachRecord); + +Err DmMoveRecord(DmOpenRef dbP, UInt from, UInt to) + SYS_TRAP(sysTrapDmMoveRecord); + + + +// Record creation and deletion +VoidHand DmNewRecord(DmOpenRef dbP, UIntPtr atP, + ULong size) + SYS_TRAP(sysTrapDmNewRecord); + +Err DmRemoveRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmRemoveRecord); + +Err DmDeleteRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmDeleteRecord); + +Err DmArchiveRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmArchiveRecord); + +VoidHand DmNewHandle(DmOpenRef dbP, ULong size) + SYS_TRAP(sysTrapDmNewHandle); + +Err DmRemoveSecretRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmRemoveSecretRecords); + + +// Record viewing manipulation +Err DmFindRecordByID(DmOpenRef dbP, ULong uniqueID, UIntPtr indexP) + SYS_TRAP(sysTrapDmFindRecordByID); + +VoidHand DmQueryRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmQueryRecord); + +VoidHand DmGetRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmGetRecord); + +VoidHand DmQueryNextInCategory(DmOpenRef dbP, UIntPtr indexP, UInt category) + SYS_TRAP(sysTrapDmQueryNextInCategory); + +UInt DmPositionInCategory (DmOpenRef dbP, UInt index, UInt category) + SYS_TRAP(sysTrapDmPositionInCategory); + +Err DmSeekRecordInCategory (DmOpenRef dbP, UIntPtr indexP, Int offset, + Int direction, UInt category) + SYS_TRAP(sysTrapDmSeekRecordInCategory); + + +VoidHand DmResizeRecord(DmOpenRef dbP, UInt index, ULong newSize) + SYS_TRAP(sysTrapDmResizeRecord); + +Err DmReleaseRecord(DmOpenRef dbP, UInt index, Boolean dirty) + SYS_TRAP(sysTrapDmReleaseRecord); + +Int DmSearchRecord(VoidHand recH, DmOpenRef* dbPP) + SYS_TRAP(sysTrapDmSearchRecord); + + +// Category manipulation +Err DmMoveCategory (DmOpenRef dbP, UInt toCategory, UInt fromCategory, Boolean dirty) + SYS_TRAP(sysTrapDmMoveCategory); + + +// Validation for writing +Err DmWriteCheck(VoidPtr recordP, ULong offset, ULong bytes) + SYS_TRAP(sysTrapDmWriteCheck); + +// Writing +Err DmWrite(VoidPtr recordP, ULong offset, VoidPtr srcP, ULong bytes) + SYS_TRAP(sysTrapDmWrite); + +Err DmStrCopy(VoidPtr recordP, ULong offset, CharPtr srcP) + SYS_TRAP(sysTrapDmStrCopy); + +Err DmSet(VoidPtr recordP, ULong offset, ULong bytes, Byte value) + SYS_TRAP(sysTrapDmSet); + + + + +//------------------------------------------------------------ +// Resource based access routines +//------------------------------------------------------------ + +// High level access routines +VoidHand DmGetResource(ULong type, Int id) + SYS_TRAP(sysTrapDmGetResource); + +VoidHand DmGet1Resource(ULong type, Int id) + SYS_TRAP(sysTrapDmGet1Resource); + +Err DmReleaseResource(VoidHand resourceH) + SYS_TRAP(sysTrapDmReleaseResource); + +VoidHand DmResizeResource(VoidHand resourceH, ULong newSize) + SYS_TRAP(sysTrapDmResizeResource); + + +// Searching resource databases +DmOpenRef DmNextOpenResDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNextOpenResDatabase); + +Int DmFindResourceType(DmOpenRef dbP, ULong resType, Int typeIndex) + SYS_TRAP(sysTrapDmFindResourceType); + +Int DmFindResource(DmOpenRef dbP, ULong resType, Int resID, + VoidHand resH) + SYS_TRAP(sysTrapDmFindResource); + +Int DmSearchResource(ULong resType, Int resID, + VoidHand resH, DmOpenRef* dbPP) + SYS_TRAP(sysTrapDmSearchResource); + + +// Resource Info +UInt DmNumResources(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumResources); + +Err DmResourceInfo(DmOpenRef dbP, Int index, + ULongPtr resTypeP, IntPtr resIDP, + LocalID* chunkLocalIDP) + SYS_TRAP(sysTrapDmResourceInfo); + +Err DmSetResourceInfo(DmOpenRef dbP, Int index, + ULongPtr resTypeP, IntPtr resIDP) + SYS_TRAP(sysTrapDmSetResourceInfo); + + + +// Resource attaching and detaching +Err DmAttachResource(DmOpenRef dbP, VoidHand newH, + ULong resType, Int resID) + SYS_TRAP(sysTrapDmAttachResource); + +Err DmDetachResource(DmOpenRef dbP, Int index, + VoidHand* oldHP) + SYS_TRAP(sysTrapDmDetachResource); + + + +// Resource creation and deletion +VoidHand DmNewResource(DmOpenRef dbP, ULong resType, Int resID, + ULong size) + SYS_TRAP(sysTrapDmNewResource); + +Err DmRemoveResource(DmOpenRef dbP, Int index) + SYS_TRAP(sysTrapDmRemoveResource); + + + +// Resource manipulation +VoidHand DmGetResourceIndex(DmOpenRef dbP, Int index) + SYS_TRAP(sysTrapDmGetResourceIndex); + + +typedef Int DmComparF (void *, void *, Int other); + +Err DmQuickSort(const DmOpenRef dbP, DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmQuickSort); + +Err DmInsertionSort (const DmOpenRef dbR, DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmInsertionSort); + +UInt DmFindSortPosition(DmOpenRef dbP, VoidPtr newRecord, + DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmFindSortPosition); + + +#ifdef __cplusplus +} +#endif + +#endif // __DATAMGR_H__ + diff --git a/sdk-1/include/Core/System/DataPrv.h b/sdk-1/include/Core/System/DataPrv.h new file mode 100644 index 0000000..451a7ae --- /dev/null +++ b/sdk-1/include/Core/System/DataPrv.h @@ -0,0 +1,212 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DataPrv.h + * + * Description: + * Private Header for the Data Manager + * + * History: + * 8/10/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __DATAPRV_H__ +#define __DATAPRV_H__ + + + +/************************************************************ + * Structure of a Record entry + *************************************************************/ +typedef struct { + LocalID localChunkID; // local chunkID of a record + Byte attributes; // record attributes; + Byte uniqueID[3]; // unique ID of record; should + // not be 0 for a legal record. + } RecordEntryType; +typedef RecordEntryType* RecordEntryPtr; + + + +/************************************************************ + * Structure of a Resource entry + *************************************************************/ +typedef struct { + DWord type; // resource type + Word id; // resource id + LocalID localChunkID; // resource data chunk ID + } RsrcEntryType; +typedef RsrcEntryType* RsrcEntryPtr; + +// Attributes field +#define dmRsrcAttrUnused 0x0000 // to be defined... + + + +/************************************************************ + * Structure of a record list extension. This is used if all + * the database record/resource entries of a database can't fit into + * the database header. + *************************************************************/ +typedef struct { + LocalID nextRecordListID; // local chunkID of next list + Word numRecords; // number of records in this list + Word firstEntry; // array of Record/Rsrc entries + // starts here + } RecordListType; +typedef RecordListType* RecordListPtr; + + + + +/************************************************************ + * Structure of a Database Header + *************************************************************/ +typedef struct { + Byte name[dmDBNameLength]; // name of database + Word attributes; // database attributes + Word version; // version of database + + DWord creationDate; // creation date of database + DWord modificationDate; // latest modification date + DWord lastBackupDate; // latest backup date + DWord modificationNumber; // modification number of database + + LocalID appInfoID; // application specific info + LocalID sortInfoID; // app specific sorting info + + DWord type; // database type + DWord creator; // database creator + + DWord uniqueIDSeed; // used to generate unique IDs. + // Note that only the low order + // 3 bytes of this is used (in + // RecordEntryType.uniqueID). + // We are keeping 4 bytes for + // alignment purposes. + + RecordListType recordList; // first record list + } DatabaseHdrType; + +typedef DatabaseHdrType* DatabaseHdrPtr; +typedef DatabaseHdrPtr* DatabaseHdrHand; + + + + + +/************************************************************ + * Directory of all available databases - maintained by the + * Database Manager. This directory also includes resource + * databases. There is one of these directories for each store + * (either RAM or ROM store) in a memory card. + *************************************************************/ +typedef struct { + LocalID nextDatabaseListID; // continuation list, if any + Word numDatabases; // # of database ID's in this list + LocalID databaseID[1]; // ChunkID of each Database + } DatabaseDirType; + +typedef DatabaseDirType* DatabaseDirPtr; + + + + +/************************************************************ + * This structure is used to hold information on an open database + * It gets allocated as a non-movable chunk in the dynamic heap + * when a database is opened and caches database information that + * helps speed up performance. + *************************************************************/ +typedef struct { + VoidPtr next; // ptr to next access structure + UInt openCount; // incremented every time it's opened + ULong ownerTaskID; // taskID of owner + UInt exclusive : 1; // true if opened with exclusive access + UInt writeAccess : 1; // true if opened with write access + UInt resDB : 1; // true if resource database + LocalID hdrID; // local ID of database header + DatabaseHdrHand hdrH; // Database header handle + DatabaseHdrPtr hdrP; // Database header ptr for faster access + UInt cardNo; // card number of database + UInt numRecords; // cached here for better performance + Ptr hdrMasterP; // master ptr to header if ROM based + Ptr* handleTableP; // pointer to block of ROM handles + } DmOpenInfoType; + +typedef DmOpenInfoType* DmOpenInfoPtr; + + + +/************************************************************ + * This structure is used to hold client specific information for + * an open database. There is one of these allocated every time + * a database is opened, even if it's already open. This structure + * holds the open mode of the client and a pointer to the DmOpenInfoType + * of the database which contains the common database info for all + * clients. The SysAppInfoPtr, referenced off of the current A5, + * has a pointer to the first DmAccessType in the linked list. + *************************************************************/ +typedef struct DmAccessType { + struct DmAccessType* next; // ptr to next access structure + UInt mode; // mode it was opened in + DmOpenInfoPtr openP; // ptr to DmOpenInfoType for database + } DmAccessType; + +typedef DmAccessType* DmAccessPtr; + + + +/************************************************************ + * This structure is used to hold the results of a search + * in DmGetNextDatabaseByTypeCreator. It is the "real" structure + * of the generic type DmSearchStateType used by applications. + *************************************************************/ +typedef struct { + Int index; + UInt relIndex; + SByte cardNo; + SByte storeNo; + UInt storeEntries; + UInt storeStartIndex; + LocalID dirID; + } DmPrvSearchStateType; +typedef DmPrvSearchStateType* DmPrvSearchStatePtr; + + + +/************************************************************ + * The owner ID of chunks allocated by the Database Manager + *************************************************************/ +#define dmDynOwnerID 0x00 // Dynamic heap chunks +#define dmMgrOwnerID 0x01 // Management chunks +#define dmRecOwnerID 0x02 // Record chunks +#define dmOrphanOwnerID 0x03 // Orphaned record chunks + + +/************************************************************ + * Private Data Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err DmMoveOpenDBContext(DmAccessPtr* listHeadP, DmAccessPtr dbP) + SYS_TRAP(sysTrapDmMoveOpenDBContext); + + + +#ifdef __cplusplus +} +#endif + + +#endif // __DATAPRV_H__ +#endif //NON_PORTABLE + diff --git a/sdk-1/include/Core/System/DateTime.h b/sdk-1/include/Core/System/DateTime.h new file mode 100644 index 0000000..ee8ce5a --- /dev/null +++ b/sdk-1/include/Core/System/DateTime.h @@ -0,0 +1,209 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DateTime.h + * + * Description: + * Date and Time calculations + * + * History: + * 1/19/95 rsf - Created by Roger Flores + * + * + *******************************************************************/ + +#ifndef __DATETIME_H__ +#define __DATETIME_H__ + + +typedef DWord time_t; + +typedef struct { + SWord second; + SWord minute; + SWord hour; + SWord day; + SWord month; + SWord year; + SWord weekDay; // Days since Sunday (0 to 6) + } DateTimeType; + +typedef DateTimeType * DateTimePtr; + + +// This is the time format. Times are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + Byte hours; + Byte minutes; +} TimeType; + +typedef TimeType * TimePtr; + +#define noTime -1 // The entire TimeType is -1 if there isn't a time. + + +// This is the date format. Dates are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + Word year :7; // years since 1904 (MAC format) + Word month :4; + Word day :5; +} DateType; + +typedef DateType * DatePtr; + + +/************************************************************ + * Date Time Constants + *************************************************************/ + +// Maximum lengths of strings return by the date and time formating +// routine DateToAscii and TimeToAscii. +#define timeStringLength 9 +#define dateStringLength 9 +#define longDateStrLength 15 + + +#define firstYear 1904 +#define numberOfYears 128 +#define lastYear (firstYear + numberOfYears - 1) + + + +// Constants for time calculations +// Could change these from xIny to yPerX +#define minutesInSeconds 60 +#define hoursInMinutes 60 +#define hoursInSeconds (hoursInMinutes * minutesInSeconds) +#define hoursPerDay 24 +//#define daysInSeconds ((long)(hoursPerDay) * ((long)hoursInSeconds)) +#define daysInSeconds (0x15180) // cc bug + +#define daysInWeek 7 +#define daysInYear 365 +#define daysInLeapYear 366 +#define daysInFourYears (daysInLeapYear + 3 * daysInYear) + +#define monthsInYear 12 + +#define maxDays ((ULong) numberOfYears / 4 * daysInFourYears - 1) +#define maxSeconds ((ULong) maxDays * daysInSeconds) +#define maxTime 0x + +// Values returned by DayOfWeek routine. +#define sunday 0 +#define monday 1 +#define tuesday 2 +#define wednesday 3 +#define thursday 4 +#define friday 5 +#define saturday 6 + +// Months of the year +#define january 1 +#define february 2 +#define march 3 +#define april 4 +#define may 5 +#define june 6 +#define july 7 +#define august 8 +#define september 9 +#define october 10 +#define november 11 +#define december 12 + + +// Values returned by DoyOfMonth routine. +typedef enum { + dom1stSun, dom1stMon, dom1stTue, dom1stWen, dom1stThu, dom1stFri, dom1stSat, + dom2ndSun, dom2ndMon, dom2ndTue, dom2ndWen, dom2ndThu, dom2ndFri, dom2ndSat, + dom3rdSun, dom3rdMon, dom3rdTue, dom3rdWen, dom3rdThu, dom3rdFri, dom3rdSat, + dom4thSun, dom4thMon, dom4thTue, dom4thWen, dom4thThu, dom4thFri, dom4thSat, + domLastSun, domLastMon, domLastTue, domLastWen, domLastThu, domLastFri, + domLastSat + } DayOfWeekType; + + +//************************************************************ +//* Date and Time macros +//*********************************************************** + +// Convert a date in a DateType structure to an unsigned int. + #define DateToInt(date) (*(UInt *) &date) + + +// Convert a date in a DateType structure to an unsigned int. + #define TimeToInt(time) (*(Int *) &time) + + + +//************************************************************ +//* Date Time procedures +//************************************************************ +#ifdef __cplusplus +extern "C" { +#endif + + +void TimSecondsToDateTime(ULong seconds, DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimSecondsToDateTime); + +ULong TimDateTimeToSeconds(DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimDateTimeToSeconds); + +void TimAdjust(DateTimePtr dateTimeP, Long adjustment) + SYS_TRAP(sysTrapTimAdjust); + +void TimeToAscii(Byte hours, Byte minutes, TimeFormatType timeFormat, + CharPtr pString) + SYS_TRAP(sysTrapTimeToAscii); + + + +UInt DaysInMonth(UInt month, UInt year) + SYS_TRAP(sysTrapDaysInMonth); + +UInt DayOfWeek (UInt month, UInt day, UInt year) + SYS_TRAP(sysTrapDayOfWeek); + +UInt DayOfMonth (UInt month, UInt day, UInt year) + SYS_TRAP(sysTrapDayOfMonth); + + + +// Date routines. +void DateSecondsToDate (ULong seconds, DatePtr date) + SYS_TRAP(sysTrapDateSecondsToDate); + +void DateDaysToDate (ULong days, DatePtr date) + SYS_TRAP(sysTrapDateDaysToDate); + +ULong DateToDays (DateType date) + SYS_TRAP(sysTrapDateToDays); + +void DateAdjust (DatePtr dateP, Long adjustment) + SYS_TRAP(sysTrapDateAdjust); + +void DateToAscii(Byte months, Byte days, Word years, + DateFormatType dateFormat, CharPtr pString) + SYS_TRAP(sysTrapDateToAscii); + +void DateToDOWDMFormat(Byte months, Byte days, Word years, + DateFormatType dateFormat, CharPtr pString) + SYS_TRAP(sysTrapDateToDOWDMFormat); + + +#ifdef __cplusplus +} +#endif + + +#endif //__DATETIME_H__ diff --git a/sdk-1/include/Core/System/DebugMgr.h b/sdk-1/include/Core/System/DebugMgr.h new file mode 100644 index 0000000..6ddb210 --- /dev/null +++ b/sdk-1/include/Core/System/DebugMgr.h @@ -0,0 +1,80 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DebugMgr.h + * + * Description: + * Debugging functions + * + * History: + * 11/03/94 RM - Created by Ron Marianetti + * + * + *******************************************************************/ + + +#ifndef __DEBUGMGR_H__ +#define __DEBUGMGR_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +/************************************************************ + * Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Long DbgInit(Ptr spaceP, Ptr dispatchTableP[], Boolean openComm); + +#ifdef __GNUC__ +static inline +#endif +void DbgSrcBreak(void) + ONEWORD_INLINE(m68kTrapInstr+sysDbgTrapNum); + +void DbgSrcMessage(char* debugStr) + SYS_TRAP(sysTrapDbgSrcMessage); + +#if EMULATION_LEVEL == EMULATION_NONE +#ifdef __GNUC__ +static inline +#endif + void DbgBreak(void) ONEWORD_INLINE(m68kTrapInstr+sysDbgTrapNum); +#else + void DbgBreak(void); +#endif + +void DbgMessage(char* aStr) + SYS_TRAP(sysTrapDbgMessage); + +CharPtr DbgGetMessage(BytePtr bufferP, Long timeout) + SYS_TRAP(sysTrapDbgGetMessage); + +Err DbgCommSettings(ULongPtr baudP, ULongPtr flagsP) + SYS_TRAP(sysTrapDbgCommSettings); + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _DbgBreak \ + DC.W m68kTrapInstr+sysDbgTrapNum + + + +#endif // __DEBUGMGR_H__ + + diff --git a/sdk-1/include/Core/System/DebugPrv.h b/sdk-1/include/Core/System/DebugPrv.h new file mode 100644 index 0000000..928aa7d --- /dev/null +++ b/sdk-1/include/Core/System/DebugPrv.h @@ -0,0 +1,348 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DebugPrv.h + * + * Description: + * PrivatŽDebugging functions + * + * History: + * 8/10/95 RM - Created by Ron Marianetti + * + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __DEBUGPRV_H__ +#define __DEBUGPRV_H__ + + +/*********************************************************************** + * Debugger Constants + ***********************************************************************/ +#define dbgLoopsPerTick 0x0800 +#define dbgStackSize 0x0300 // DOLATER -- resize??? + +#define dbgNormalBreakpoints 5 +#define dbgTempBPIndex dbgNormalBreakpoints +#define dbgTotalBreakpoints (dbgTempBPIndex+1) + +#define dbgFlashCodeSpace sysInitStack // where we copy flash code +#define dbgFlashCodeSize 0x200 // size of flash code + +#define dbgTotalTrapBreaks 5 // up to this many trap breaks at a time + + + + +/*********************************************************************** + * Structure of Debugger Breakpoints + ***********************************************************************/ +typedef struct BreakpointType { + Ptr addr; // address of breakpoint + Boolean enabled; // true if enabled + Boolean installed; // for alignment + } BreakpointType; + + + + + +/*********************************************************************** + * Structure of Debugger Specific System Packet Type Bodies. + ***********************************************************************/ + +#define sysPktMaxNameLen 32 // Max length of a routine name + +//-------------------------------------------------------------- +// sysPktStateCmd +// - get processor state +//------------------------------------------------------------------ +// number of remote code words to send in the 'state response' packet +#define sysPktStateRspInstWords 15 + + +typedef struct SysPktStateCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktStateCmdCmdType; +typedef SysPktStateCmdCmdType* SysPktStateCmdCmdPtr; + + +// Packet Body structure for the state command response packet +typedef struct SysPktStateRspType { + _sysPktBodyCommon; // Common Body header + Boolean resetted; // true if target has just reset + Word exceptionId; // exception which caused the + // debugger to be entered. + M68KRegsType reg; // current remote registers. + Word inst[sysPktStateRspInstWords]; + // instruction buffer for + // code beginning at PC. + BreakpointType bp[dbgTotalBreakpoints]; // current breakpoints + + void* startAddr; // start address of routine + void* endAddr; // end address of routine + char name[sysPktMaxNameLen]; + // routine name (0 or more chars, + // no null), immediately + // follows the address range. + Byte trapTableRev; // rev of trap table. Used to determine + // when host's trap table cache is invalid + } SysPktStateRspType; +typedef SysPktStateRspType* SysPktStateRspPtr; + +//-------------------------------------------------------------------- +// sysPktGetRtnNameCmd +// - get routine name +//-------------------------------------------------------------------- +// The response packet body will contain start address(4 bytes), +// end address(4 bytes), followed by 0 or more bytes of the routine +// name (no null byte). +typedef struct SysPktRtnNameCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // -> address to query on + } SysPktRtnNameCmdType; +typedef SysPktRtnNameCmdType* SysPktRtnNameCmdPtr; + +typedef struct SysPktRtnNameRspType { + _sysPktBodyCommon; // Common Body header + void* address; // -> address to query on + void* startAddr; // <- start address of routine + void* endAddr; // <- end address of routine + char name[sysPktMaxNameLen]; // <- routine name, if any immediately + // follows the address range. + // The balance need not be sent. + } SysPktRtnNameRspType; +typedef SysPktRtnNameRspType* SysPktRtnNameRspPtr; + + +//-------------------------------------------------------------------- +// sysPktReadRegsCmd +// - read registers +//-------------------------------------------------------------------- +// Packet Body structure for the read regs command response packet +typedef struct SysPktReadRegsCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktReadRegsCmdType; +typedef SysPktReadRegsCmdType* SysPktReadRegsCmdPtr; + +typedef struct SysPktReadRegsRspType { + _sysPktBodyCommon; // Common Body header + //M68KRegsType reg; // <- return registers + } SysPktReadRegsRspType; +typedef SysPktReadRegsRspType* SysPktReadRegsRspPtr; + + + +//-------------------------------------------------------------------- +// sysPktWriteRegsCmd +// - write registers +//-------------------------------------------------------------------- +// Packet Body structure for the write regs command packet +typedef struct SysPktWriteRegsCmdType { + _sysPktBodyCommon; // Common Body header + M68KRegsType reg; // -> registers to write + } SysPktWriteRegsCmdType; +typedef SysPktWriteRegsCmdType* SysPktWriteRegsCmdPtr; + + +// Packet Body structure for the write regs command packet +typedef struct SysPktWriteRegsRspType { + _sysPktBodyCommon; // Common Body header + } SysPktWriteRegsRspType; +typedef SysPktWriteRegsRspType* SysPktWriteRegsRspPtr; + + +//-------------------------------------------------------------------- +// sysPktContinueCmd +// - continue +//-------------------------------------------------------------------- +// Packet Body structure for the continue command packet +typedef struct SysPktContinueCmdType { + _sysPktBodyCommon; // Common Body header + M68KRegsType regs; // registers + Boolean stepSpy; // set true to do step spy + DWord ssAddr; // step spy address + DWord ssCount; // # of bytes + DWord ssCheckSum; // checksum + } SysPktContinueCmdType; + +typedef SysPktContinueCmdType* SysPktContinueCmdPtr; + + +//-------------------------------------------------------------------- +// sysPktGetBreakPointsCmd +// +// - Get breakpoints +//-------------------------------------------------------------------- +typedef struct SysPktGetBreakpointsCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktGetBreakpointsCmdType; +typedef SysPktGetBreakpointsCmdType* SysPktGetBreakpointsCmdPtr; + +typedef struct SysPktGetBreakpointsRspType { + _sysPktBodyCommon; // Common Body header + //BreakpointType bp[dbgTotalBreakpoints]; + } SysPktGetBreakpointsRspType; +typedef SysPktGetBreakpointsRspType* SysPktGetBreakpointsRspPtr; + + +//-------------------------------------------------------------------- +// sysPktSetBreakPointsCmd +// +// - Set breakpoints +//-------------------------------------------------------------------- +typedef struct SysPktSetBreakpointsCmdType { + _sysPktBodyCommon; // Common Body header + //BreakpointType bp[dbgTotalBreakpoints]; + } SysPktSetBreakpointsCmdType; +typedef SysPktSetBreakpointsCmdType* SysPktSetBreakpointsCmdPtr; + +typedef struct SysPktSetBreakpointsRspType { + _sysPktBodyCommon; // Common Body header + } SysPktSetBreakpointsRspType; +typedef SysPktSetBreakpointsRspType* SysPktSetBreakpointsRspPtr; + + + + +//-------------------------------------------------------------------- +// sysPktDbgBreakToggleCmd +// - Enable/Disable DbgBreak's command +//-------------------------------------------------------------------- +typedef struct SysPktDbgBreakToggleCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktDbgBreakToggleCmdType; +typedef SysPktDbgBreakToggleCmdType* SysPktDbgBreakToggleCmdPtr; + +typedef struct SysPktDbgBreakToggleRspType { + _sysPktBodyCommon; // Common Body header + Boolean newState; + } SysPktDbgBreakToggleRspType; +typedef SysPktDbgBreakToggleRspType* SysPktDbgBreakToggleRspPtr; + + +//-------------------------------------------------------------------- +// sysPktFlashCmd +// Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns info on the flash in: +// manuf - manufacturer code +// device - device code +// width - width of FLASH +// ramSpaceP - buffer in RAM for flash sector +//-------------------------------------------------------------------- +typedef struct SysPktFlashWriteType { + _sysPktBodyCommon; // Common Body header + Word numBytes; // -> # of bytes in sector + DWord flashBase; // -> base address of FLASH, or 0 for default + DWord srcAddr; // -> source address of new data + DWord dstAddr; // -> dest address in flash memory + Byte manuf; // <- manufacturer + Byte device; // <- device + Byte width; // <- Flash memory width + Byte filler; + DWord ramSpaceP; // <- available space in RAM for sector + } SysPktFlashWriteType; +typedef SysPktFlashWriteType* SysPktFlashWritePtr; + + +//-------------------------------------------------------------------- +// sysPktGetTrapBreaksCmd +// +// - Get Trap Breaks +//-------------------------------------------------------------------- +typedef struct SysPktGetTrapBreaksCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktGetTrapBreaksCmdType; +typedef SysPktGetTrapBreaksCmdType* SysPktGetTrapBreaksCmdPtr; + +typedef struct SysPktGetTrapBreaksRspType { + _sysPktBodyCommon; // Common Body header + //Word trapBP[dbgTotalTrapBreaks]; + } SysPktGetTrapBreaksRspType; +typedef SysPktGetTrapBreaksRspType* SysPktGetTrapBreaksRspPtr; + + +//-------------------------------------------------------------------- +// sysPktSetTrapBreaksCmd +// +// - Set Trap Breaks +//-------------------------------------------------------------------- +typedef struct SysPktSetTrapBreaksCmdType { + _sysPktBodyCommon; // Common Body header + //Word trapBP[dbgTotalTrapBreaks]; + } SysPktSetTrapBreaksCmdType; +typedef SysPktSetTrapBreaksCmdType* SysPktSetTrapBreaksCmdPtr; + +typedef struct SysPktSetTrapBreaksRspType { + _sysPktBodyCommon; // Common Body header + } SysPktSetTrapBreaksRspType; +typedef SysPktSetTrapBreaksRspType* SysPktSetTrapBreaksRspPtr; + + + + + +// The following indicates how much space in debugger globals we've reserved for +// the SerialLibrary globals for the Debugger. Reserve 8 extra bytes for +// patching. +#define dbgSerRsvGlobalsSize 56 + + + + +/*********************************************************************** + * Stucture of Debugger Globals + ***********************************************************************/ +struct DbgGlobalsType { + // Saved registers + M68KRegsType reg; + + // Breakpoints and saved opcodes behind each one + Boolean romBP; + Boolean stepOverBP; // true if single-stepping over a BP + BreakpointType bp[dbgTotalBreakpoints]; + Word bpOpcode[dbgTotalBreakpoints]; + + // Current trap breaks + Word trapBreak[dbgTotalTrapBreaks]; + DWord oldDispatcher; // saved trap dispatcher + Boolean breakingOnATrap; // set by debugger trap dispatcher + + // Mode settings + Boolean ignoreDbgBreaks; // if true, ignore DbgBreak's + Boolean commOpened; // if true, comm library and socket have been + // opened. + + // Step spy support + Boolean stepSpy; // true if step spying. + DWord ssAddr; // address to step spy on + DWord ssValue; // saved value + + // Exception type + Word excType; // why we entered debugger + Byte reEntered; // true if we re-entered + Byte firstEntrance; // true first time we enter debugger + + // Debugger Serial Library globals + Byte serGlobals[dbgSerRsvGlobalsSize]; // Debugger Serial globals + + // Debugger Stack + Byte stack[dbgStackSize]; // Debugger stack + Word stackEnd; // End of stack + + }; + +typedef struct DbgGlobalsType DbgGlobalsType; + +typedef DbgGlobalsType* DbgGlobalsPtr; + + + +#endif // __DEBUGMGR_H__ +#endif // NON_PORTABLE + diff --git a/sdk-1/include/Core/System/EmuStubs.h b/sdk-1/include/Core/System/EmuStubs.h new file mode 100644 index 0000000..4fc7a25 --- /dev/null +++ b/sdk-1/include/Core/System/EmuStubs.h @@ -0,0 +1,122 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * EmuStubs.h + * + * Description: + * Stub routines used only when emulating. + * + * Note: All of these routines must be declared using generic + * C types so that this header file can be included in both + * Pilot source code and Mac or PC source code. + * + * The module that contains these routines "MacStubs.c" or + * "PCStubs.c" is the glue between the Pilot routines and the OS and + * does not include any Pilot headers. + * + * History: + * 11/03/94 RM - Created by Ron Marianetti + * + * + *******************************************************************/ + + +#ifndef __EMUSTUBS_H__ +#define __EMUSTUBS_H__ + + +/************************************************************ + * Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Screen Driver Stubs +void StubDrawNotify(void* srcWinP, short scrRowBytes, + short fromX, short fromY, short width, short height); + +// Console stubs +int StubConPutS(char* cstring); +int StubConGetS(char* cstring); + +// Debugger Stubs +void StubDbgSrcBreak(void); +void StubDbgSrcMessage(char* debugStr); +void StubDbgBreak(void); +void StubDbgMessage(char* aStr); + +// Time Manager Stubs +unsigned long StubTimGetTicks(void); +unsigned long StubTimGetSeconds(void); +void StubTimSetSeconds(unsigned long seconds); + + +// Event Manager Stubs +void StubProcessMacEvents(long timeout); +void StubEnqueuePenPosition(void); +void StubFlushEvents (void); + + +// Emulator Stubs +Boolean StubNilEventPending(); + + +// Error Manager stubs +void StubErrDisplayFileLineMsg(char* filename, unsigned int lineNo, char* msg); + + +// Sound Manager stubs +#define stubSndErrBadParam -1 +#define stubSndErrBadChannel -2 + +#define stubSndCmdFreqDurationAmp 1 + +short StubSndCommand(void* channelP, unsigned short defAmp, + unsigned short cmd, unsigned long param1, + unsigned short param2, unsigned short param3, + char noWait); + + +// Alarm Manager stubs +short StubAlmSetAlarm(unsigned long alarmType, + long (*callback)(), unsigned long alarmTime); +unsigned long StubAlmGetAlarm(unsigned long alarmType); +void StubAlmDisplayAlarm(void); + + +// Emulator Utility Functions +void StubEventTrace(void *eventP); // Pilot Emulator Event Trace call + + +// Resource Utility Functions +void** StubGet1Resource(unsigned long resType, int resID); + + +// Utility functions +unsigned int StubRandom(void); + + +// Key Manager stubs +unsigned long StubKeyCurrentState(void); + +#define stubKeyBitPower 0x0001 +#define stubKeyBitPageUp 0x0002 +#define stubKeyBitPageDown 0x0004 +#define stubKeyBitHard1 0x0008 +#define stubKeyBitHard2 0x0010 +#define stubKeyBitHard3 0x0020 +#define stubKeyBitHard4 0x0040 + +#ifdef __cplusplus +} +#endif + + +#endif // __EMUSTUBS_H__ + + diff --git a/sdk-1/include/Core/System/ErrorMgr.h b/sdk-1/include/Core/System/ErrorMgr.h new file mode 100644 index 0000000..32646e2 --- /dev/null +++ b/sdk-1/include/Core/System/ErrorMgr.h @@ -0,0 +1,261 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * ErrorMgr.h + * + * Description: + * Include file for Error Management + * + * History: + * 10/25/94 RM - Created by Ron Marianetti + * + *----------------------------------------------------------------------- + * Exception Handling + * + * This unit implements an exception handling mechanism that is similar + * to "real" C++ Exceptions. Our Exceptions are untyped, and there + * must be one and only one Catch block for each Try block. + * + * Try/Catch Syntax: + * + * ErrTry { + * // Do something which may fail. + * // Call ErrThrow() to signal failure and force jump + * // to the following Catch block. + * } + * + * ErrCatch(inErr) { + * // Recover or cleanup after a failure in the above Try block. + * // "inErr" is an ExceptionCode identifying the reason + * // for the failure. + * + * // You may call Throw() if you want to jump out to + * // the next Catch block. + * + * // The code in this Catch block does not execute if + * // the above Try block completes without a Throw. + * + * } ErrEndCatch + * + * You must structure your code exactly as above. You can't have a + * ErrTry { } without a ErrCatch { } ErrEndCatch, or vice versa. + * + * + * ErrThrow + * + * To signal failure, call ErrThrow() from within a Try block. The + * Throw can occur anywhere in the Try block, even within functions + * called from the Try block. A ErrThrow() will jump execution to the + * start of the nearest Catch block, even across function calls. + * Destructors for stack-based objects which go out of scope as + * a result of the ErrThrow() are called. + * + * You can call ErrThrow() from within a Catch block to "rethrow" + * the exception to the next nearest Catch block. + * + * + * Exception Codes + * + * An ExceptionCode is a 32-bit number. You will normally use + * Pilot error codes, which are 16-bit numbers. This allows + * plently of room for defining codes for your own kinds of errors. + * + * + * Limitations + * + * Try/Catch and Throw are based on setjmp/longjmp. At the + * beginning of a Try block, setjmp saves the machine registers. + * Throw calls longjmp, which restores the registers and jumps + * to the beginning of the Catch block. Therefore, any changes + * in the Try block to variables stored in registers will not + * be retained when entering the Catch block. + * + * The solution is to declare variables that you want to use + * in both the Try and Catch blocks as "volatile". For example: + * + * volatile long x = 1; // Declare volatile local variable + * ErrTry { + * x = 100; // Set local variable in Try + * ErrThrow(-1); + * } + * + * ErrCatch(inErr) { + * if (x > 1) { // Use local variable in Catch + * SysBeep(1); + * } + * } ErrEndCatch + * + * + *******************************************************************/ + +#ifndef __ERRORMGR_H__ +#define __ERRORMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +#if EMULATION_LEVEL != EMULATION_NONE +#include +#endif + +/************************************************************ + * Macros for Showing Errors + * + ********************************************************************/ + + +//------------------------------------------------------------ +// Full Error Checking +//------------------------------------------------------------ +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + +#define ErrFatalDisplayIf(condition, msg) \ + if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + +#define ErrNonFatalDisplayIf(condition, msg) \ + if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + + + + +//------------------------------------------------------------ +// Fatal Error Checking Only +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_PARTIAL + +#define ErrFatalDisplayIf(condition, msg) \ + if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + + + +//------------------------------------------------------------ +// No Error Checking +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_NONE + +#define ErrFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrDisplay(msg) + + +//------------------------------------------------------------ +// Not Defined... +//------------------------------------------------------------ +#else +#error ERROR: the compiler define 'ERROR_CHECK_LEVEL' must be defined! + +#endif // ERROR_CHECK_LEVEL + + + + +/******************************************************************** + * 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 + ********************************************************************/ +typedef long* ErrJumpBuf[12]; // D3-D7,PC,A2-A7 + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrJumpBuf jmp_buf +#endif + +// Structure used to store Try state. +typedef struct ErrExceptionType { + struct ErrExceptionType* nextP; // next exception type + ErrJumpBuf state; // setjmp/longjmp storage + Long err; // Error code + } ErrExceptionType; +typedef ErrExceptionType* ErrExceptionPtr; + + +// Try & Catch macros +#define ErrTry \ + { \ + ErrExceptionType _TryObject; \ + _TryObject.err = 0; \ + _TryObject.nextP = (ErrExceptionPtr)*ErrExceptionList(); \ + *ErrExceptionList() = (Ptr)&_TryObject; \ + if (ErrSetJump(_TryObject.state) == 0) { + + +#define ErrCatch(theErr) \ + *ErrExceptionList() = (Ptr)_TryObject.nextP; \ + } \ + else { \ + Long theErr = _TryObject.err; \ + *ErrExceptionList() = (Ptr)_TryObject.nextP; + + +#define ErrEndCatch \ + } \ + } + + + +/******************************************************************** + * Error Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrSetJump(buf) setjmp(buf) + #define ErrLongJump(buf,res) longjmp(buf,res) + +#else + Int ErrSetJump(ErrJumpBuf buf) + SYS_TRAP(sysTrapErrSetJump); + + void ErrLongJump(ErrJumpBuf buf, Int result) + SYS_TRAP(sysTrapErrLongJump); +#endif + +Ptr* ErrExceptionList(void) + SYS_TRAP(sysTrapErrExceptionList); + +void ErrThrow(Long err) + SYS_TRAP(sysTrapErrThrow); + +void ErrDisplayFileLineMsg(CharPtr filename, UInt lineno, CharPtr msg) + SYS_TRAP(sysTrapErrDisplayFileLineMsg); + +#ifdef __cplusplus +} +#endif + + + + +#endif // __ERRORMGR_H__ + + + + diff --git a/sdk-1/include/Core/System/FatalAlert.h b/sdk-1/include/Core/System/FatalAlert.h new file mode 100644 index 0000000..cadf81c --- /dev/null +++ b/sdk-1/include/Core/System/FatalAlert.h @@ -0,0 +1,26 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: window.h + * AUTHOR: Art Lamb: September 12, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines window structures and routines. + * + **********************************************************************/ +#ifndef __FATAL_ALERT_H__ +#define __FATAL_ALERT_H__ + +// Value retunred by FatalAlert +#define fatalContinue 0 +#define fatalReset 1 + +UInt SysFatalAlert (CharPtr msg) + SYS_TRAP(sysTrapSysFatalAlert); + +#endif + diff --git a/sdk-1/include/Core/System/FeatureMgr.h b/sdk-1/include/Core/System/FeatureMgr.h new file mode 100644 index 0000000..0c639f8 --- /dev/null +++ b/sdk-1/include/Core/System/FeatureMgr.h @@ -0,0 +1,74 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * FeatureMgr.h + * + * Description: + * Header for the Feature Manager + * + * History: + * 11/14/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __FEATUREMGR_H__ +#define __FEATUREMGR_H__ + + +#include + + + +/************************************************************ + * Feature manager error codes + * the constant ftrErrorClass is defined in SystemMgr.h + *************************************************************/ +#define ftrErrInvalidParam (ftrErrorClass | 1) +#define ftrErrNoSuchFeature (ftrErrorClass | 2) +#define ftrErrAlreadyExists (ftrErrorClass | 3) +#define ftrErrROMBased (ftrErrorClass | 4) +#define ftrErrInternalErr (ftrErrorClass | 5) + + +/************************************************************ + * Feature Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Init the feature Manager +Err FtrInit(void) + SYS_TRAP(sysTrapFtrInit); + + +// Get a feature +Err FtrGet(DWord creator, UInt featureNum, DWordPtr valueP) + SYS_TRAP(sysTrapFtrGet); + +// Set/Create a feature. +Err FtrSet(DWord creator, UInt featureNum, DWord newValue) + SYS_TRAP(sysTrapFtrSet); + +// Unregister a feature +Err FtrUnregister(DWord creator, UInt featureNum) + SYS_TRAP(sysTrapFtrUnregister); + +// Get a feature by index +Err FtrGetByIndex(UInt index, Boolean romTable, + DWordPtr creatorP, UIntPtr numP, DWordPtr valueP) + SYS_TRAP(sysTrapFtrGetByIndex); + + + +#ifdef __cplusplus +} +#endif + +#endif // __FEATUREMGR_H__ + diff --git a/sdk-1/include/Core/System/FeaturePrv.h b/sdk-1/include/Core/System/FeaturePrv.h new file mode 100644 index 0000000..6653095 --- /dev/null +++ b/sdk-1/include/Core/System/FeaturePrv.h @@ -0,0 +1,77 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * FeaturePrv.h + * + * Description: + * Private Header for the Feature Manager + * + * History: + * 8/9/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __FEATUREPRV_H__ +#define __FEATUREPRV_H__ + + + + +/************************************************************ + * Structure of a Feature Table + *************************************************************/ +typedef struct FtrFeatureType { + UInt num; // feature number + DWord value; // feature value + } FtrFeatureType; +typedef FtrFeatureType* FtrFeaturePtr; + +typedef struct FtrCreatorType { + DWord creator; // feature creator + UInt numEntries; // # of entries + FtrFeatureType feature[1]; // variable size array of Features + } FtrCreatorType; +typedef FtrCreatorType* FtrCreatorPtr; + +typedef struct FtrTableType { + UInt numEntries; // # of entries + FtrCreatorType creator[1]; // var. size array of Creators + } FtrTableType; +typedef FtrTableType* FtrTablePtr; +typedef FtrTablePtr* FtrTableHand; + + +/************************************************************ + * Structure of a Feature Manager Globals + *************************************************************/ +typedef struct FtrGlobalsType { + FtrTableHand romTableH; // ROM table of features + FtrTableHand ramTableH; // RAM table of features + } FtrGlobalsType; +typedef FtrGlobalsType* FtrGlobalsPtr; + + + +/************************************************************ + * Private structures + *************************************************************/ +// This structure created for temporary use within calls +typedef struct FtrCacheType { + FtrTableHand romTableH; // ROM table of features + FtrTableHand ramTableH; // RAM table of features + FtrTablePtr romTableP; + FtrTablePtr ramTableP; + } FtrCacheType; +typedef FtrCacheType* FtrCachePtr; + + + + + +#endif // __FEATUREPRV_H__ +#endif // NON_PORTABLE diff --git a/sdk-1/include/Core/System/FloatMgr.h b/sdk-1/include/Core/System/FloatMgr.h new file mode 100644 index 0000000..84c2c6a --- /dev/null +++ b/sdk-1/include/Core/System/FloatMgr.h @@ -0,0 +1,105 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * FloatMgr.h + * + * Description: + * Floating point routines + * + * History: + * 3/9/95 - Created by Ron Marianetti + * + *******************************************************************/ + + +#ifndef __FLOATMGR_H__ +#define __FLOATMGR_H__ + +#include + +/************************************************************************ + * Constants + ***********************************************************************/ +#define fMaxLong ((Long)0x7FFFFFFF); +#define fMinLong ((Long)0x80000000); + + +/************************************************************************ + * Floating point type + * An exponent of kExpInf represents infinity + ***********************************************************************/ +typedef struct { + DWord man; // unsigned 32 bit + SWord exp; // signed 16 bit + SByte sign; // +/- 1 + } FloatType; +#define kExpInf 16000 + + + +/******************************************************************* + * Floating pointer Library Errors + * The constant fplErrorClass is defined in SystemMgr.h + *******************************************************************/ +#define fplErrOutOfRange (fplErrorClass | 1) + + +/************************************************************ + * Floating point manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err FplInit(void) + SYS_TRAP(sysTrapFplInit); + +void FplFree(void) + SYS_TRAP(sysTrapFplFree); + +Err FplFToA(FloatType a, char* s) + SYS_TRAP(sysTrapFplFToA); + +FloatType FplAToF(char* s) + SYS_TRAP(sysTrapFplAToF); + +Err FplBase10Info(FloatType a, ULong* mantissaP, Int* exponentP, + Int* signP) + SYS_TRAP(sysTrapFplBase10Info); + +FloatType FplLongToFloat(Long x) + SYS_TRAP(sysTrapFplLongToFloat); + +Long FplFloatToLong(FloatType f) + SYS_TRAP(sysTrapFplFloatToLong); + +ULong FplFloatToULong(FloatType f) + SYS_TRAP(sysTrapFplFloatToULong); + + +FloatType FplMul(FloatType a, FloatType b) + SYS_TRAP(sysTrapFplMul); + +FloatType FplAdd(FloatType a, FloatType b) + SYS_TRAP(sysTrapFplAdd); + +FloatType FplSub(FloatType a, FloatType b) + SYS_TRAP(sysTrapFplSub); + +FloatType FplDiv(FloatType dividend, FloatType divisor) + SYS_TRAP(sysTrapFplDiv); + + +#ifdef __cplusplus +} +#endif + + +#endif //__FLOATMGR_H__ + + +/******************************************************************* * Pilot Software * * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved * *------------------------------------------------------------------- * FileName: * FloatMgr.h * * Description: * Floating point routines * * History: * 3/9/95 - Created by Ron Marianetti * *******************************************************************/ #ifndef __FLOATMGR_H__#define __FLOATMGR_H__#include /************************************************************************ * Constants ***********************************************************************/#define fMaxLong ((Long)0x7FFFFFFF);#define fMinLong ((Long)0x80000000);/************************************************************************ * Floating point type * An exponent of kExpInf represents infinity ***********************************************************************/typedef struct { DWord man; // unsigned 32 bit SWord exp; // signed 16 bit SByte diff --git a/sdk-1/include/Core/System/FloatPrv.h b/sdk-1/include/Core/System/FloatPrv.h new file mode 100644 index 0000000..0aed4f4 --- /dev/null +++ b/sdk-1/include/Core/System/FloatPrv.h @@ -0,0 +1,36 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * FloatPrv.h + * + * Description: + * Private Floating point header + * + * History: + * 3/9/95 - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __FLOATPRV_H__ +#define __FLOATPRV_H__ + + +/************************************************************************ + * Structure of Floating point Library globals + ***********************************************************************/ +typedef struct { + FloatType tenPowers[200]; // 10^-99 to 10^99 + } FplGlobalsType; +typedef FplGlobalsType* FplGlobalsPtr; + + + + +#endif //__FLOATPRV_H__ +#endif // NON_PORTABLE + diff --git a/sdk-1/include/Core/System/Globals.h b/sdk-1/include/Core/System/Globals.h new file mode 100644 index 0000000..74ea44a --- /dev/null +++ b/sdk-1/include/Core/System/Globals.h @@ -0,0 +1,286 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * globals.h + * + * Description: + * Structure definition of Pilot globals + * + * History: + * 10/26/94 RM - Created by Ron Marianetti + * 4/13/95 VMK Added Sound Manager globals + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __GLOBALS_H__ +#define __GLOBALS_H__ + +#include + +// The following indicates how much space in low memory we've reserved for +// the UI globals. The UI initialization code makes sure that we don't +// overrun this space by comparing the size of the structure UIGlobalsType +// with this constant. +#define sysUIRsvGlobalsSize 0xA0 + + + +/************************************************************ + * Structure of Fixed System Globals + *************************************************************/ +typedef struct FixedGlobalsType { + + // Memory Manager Globals + Byte memCardSlots; // number of memory card slots + Byte dbgWasEntered; // set true the first time debugger is entered + Ptr memCardInfoP; // pointer to array of CardInfoTypes stored + DWord memSemaphoreID; // Memory Manager semaphore + Word memDebugMode; // Current debug mode of Memory Manager + + // Data Manager Globals + Ptr dmOpenList; // Linked list of open databases (DmOpenInfoPtr) + + // Debugger/System Shared globals + Byte dbgInDebugger; // true if in debugger + Byte dbgTracing; // tracing in debugger + Ptr dbgGlobalsP; // pointer to dbgGlobals + Ptr dbgSerGlobalsP; // pointer to Debugger Serial globals + + + // System Manager Globals + Ptr sysAppInfoP; // pointer to SysAppInfoType for system + Ptr sysKernelDataP; // pointer to Kernel data + Ptr* sysDispatchTableP; // pointer to dispatch table + DWord sysOwnerIDsInUse; // 1 bit for each owner ID in use + Ptr sysAMXAppInfoP; // SysAppInfoType for AMX app. + DWord sysClockFreq; // processor clock frequency + DWordPtr sysHardKeyCreators; // ptr to array of App Creator types + + SWord sysBatteryCheckTimer; // # of ticks left before we check battery again + Byte sysBatteryMinThreshold; // System will shut down if battery falls below this + Byte hwrBatteryLevel; // current battery level + SWord sysNextBatteryAlertTimer; // # of ticks till next battery warning + Byte sysBatteryWarnThreshold; // If battery below this level, post low battery keyboard event + + Byte sysDispatchTableRev; // incremented every time a trap is patched. Used + // by host debugger to invalidate it's cache. + Word sysDispatchTableSize; // # of entries in dispatch table + Ptr sysLibTableP; // (SysLibTblEntryPtr) pointer to Library entries + Word sysLibTableEntries; // size of library table + Ptr sysConsoleStackChunkP; // pointer to console task stack chunk + Ptr sysUIShellAppInfoP; // AppInfoPtr for UIAppShell + + Long sysTimerID; // TimerID of timer used for periodic system stuff + ULong sysAutoOffEvtTicks; // Ticks of last event - used to support auto-off + Word sysAutoOffSeconds; // Auto-sleep timeout in seconds. + + Long sysRandomSeed; // Random # seed + + + + // Other Manager's globals + Ptr slkGlobalsP; // pointer to serial link globals + Ptr serGlobalsP; // pointer to serial manager globals + Ptr scrGlobalsP; // pointer to screen driver globals + Ptr fplGlobalsP; // pointer to Floating Point Library globals + Ptr penGlobalsP; // Pen manager globals ptr + Ptr sysEvtMgrGlobalsP; // System Event Manager Globals + Ptr sndGlobalsP; // Sound Manager globals + Ptr timGlobalsP; // Time Manager globals + Ptr almGlobalsP; // Alarm Manager globals + Ptr ftrGlobalsP; // pointer to feature manager globals + Ptr grfGlobalsP; // pointer to Graffiti globals + Ptr keyGlobalsP; // Key manager globals + + // UI Globals + Byte uiGlobals[sysUIRsvGlobalsSize]; // Basic UI Globals + Ptr uiExtensionsP; // for future use... + + + // Globals used by UIAppShell in order to manage the launching of UI Apps. + Ptr curUIAppInfoP; // SysAppInfoPtr of current UI App + DWord nextUIAppDBID; // Database LocalID of next UI App to launch + Word nextUIAppCmd; // Cmd for next UI App + Ptr nextUIAppCmdPBP; // Cmd ParamBlock Ptr for next UI App + Byte nextUIAppCardNo; // Card number of next UI App to launch + + + // Hardware Manager Globals + SByte hwrDataWELevel; // if > 0, Data area is write enabled + Word hwrWakeUp; // Bit mask of which peripherals need to be + // enabled when system wakes + Byte hwrCPUDutyCycle; // Desired Duty cycle of CPU in 31ths. + Byte hwrPenDown; // last state of pen-down + DWord hwrCurTicks; // Current hardware tickCount - + // maintained separately from AMX ticks for performance reasons. + DWord hwrTotalRAMSize; // total RAM Size, used by HwrMemWritable + DWord hwrDozeSubTicks; // # of subTicks we've dozed for since reset + // a sub-tick is 1/4096 seconds. + + // Pad server + Ptr padGlobalsP; // PAD Server globals + + // New System globals + Byte sysResetFlags; // Reset flags sysResetFlagXXXX + Byte sysBatteryKind; // SysBatteryKind enumerated type + + // New Memory Manager global for recording minimum heap free - used for debugging only + DWord memMinDynHeapFree; // Minimum free space in dynamic heap + + + // System Preferences flags + Word sysPrefFlags; // System Pref flags: sysPrefFlagXXXX + + + // This is a pointer to the System Manager variable size globals + Ptr sysGlobalsP; // pointer to System Globals + + // Miscellaneous System flags + Word sysMiscFlags; // System Misc flags: sysMiscFlagXXX + + + //----------------------------------------------------------------------- + // Put New globals here... + //----------------------------------------------------------------------- + // type newGlobal; + + + } FixedGlobalsType; + + +/************************************************************ + * This structure defines the start of the Low Memory Area. + * The complete structure of LowMemory is defined in SystemPrv.h + * and includes this low memory header followed by some variable + * size globals that may change from rev to rev of the System Software. + * + * When emulating under Windows, this structure ends up at some random + * place in memory and the global variable GlobalsP points to it. + * + * When running in the native environment, this structure starts at + * address sysGlobalsOffset. + * + * In order to simplify the source code, macros are defined for + * accessing commonly used globals in the optimim manner for + * each environment. + *************************************************************/ +typedef struct LowMemHdrType { + //--------------------------------------------------------------------------- + // Processor exception table + //--------------------------------------------------------------------------- + M68KExcTableType vectors; // Exception vectors, + // or Card header for RAM only cards + + //--------------------------------------------------------------------------- + // System Globals + //--------------------------------------------------------------------------- + FixedGlobalsType globals; // System Globals + + } LowMemHdrType; + + + +#if EMULATION_LEVEL == EMULATION_NONE + #define PilotGlobalsP 0 +#else + extern Ptr PilotGlobalsP; // pointer to start of Memory card 0 +#endif + + + + + +/************************************************************ + * Macros for accessing globals. + * When emulating, the globals are allocated in a memory chunk and our + * global variable Card0P points to this chunk. + * In native mode, Card0P is defined to be 0 at all times. + *************************************************************/ +#define GMemCardSlots (((LowMemHdrType*)PilotGlobalsP)->globals.memCardSlots) +#define GMemCardInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP) +#define GMemSemaphoreID (((LowMemHdrType*)PilotGlobalsP)->globals.memSemaphoreID) +#define GMemDebugMode (((LowMemHdrType*)PilotGlobalsP)->globals.memDebugMode) +#define GMemMinDynHeapFree (((LowMemHdrType*)PilotGlobalsP)->globals.memMinDynHeapFree) + +#define GDmOpenList (((LowMemHdrType*)PilotGlobalsP)->globals.dmOpenList) + +#define GDbgWasEntered (((LowMemHdrType*)PilotGlobalsP)->globals.dbgWasEntered) +#define GDbgInDebugger (((LowMemHdrType*)PilotGlobalsP)->globals.dbgInDebugger) +#define GDbgTracing (((LowMemHdrType*)PilotGlobalsP)->globals.dbgTracing) +#define GDbgGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.dbgGlobalsP) + +#define GSysAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysAppInfoP) +#define GSysKernelDataP (((LowMemHdrType*)PilotGlobalsP)->globals.sysKernelDataP) +#define GSysDispatchTableP (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableP) +#define GSysDispatchTableSize (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableSize) +#define GSysDispatchTableRev (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableRev) +#define GSysOwnerIDsInUse (((LowMemHdrType*)PilotGlobalsP)->globals.sysOwnerIDsInUse) +#define GSysAMXAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysAMXAppInfoP) +#define GSysClockFreq (((LowMemHdrType*)PilotGlobalsP)->globals.sysClockFreq) +#define GSysHardKeyCreators (((LowMemHdrType*)PilotGlobalsP)->globals.sysHardKeyCreators) +#define GSysNextBatteryAlertTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysNextBatteryAlertTimer) +#define GSysBatteryCheckTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryCheckTimer) +#define GSysBatteryWarnThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryWarnThreshold) +#define GHwrBatteryLevel (((LowMemHdrType*)PilotGlobalsP)->globals.hwrBatteryLevel) +#define GSysBatteryMinThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryMinThreshold) +#define GSysBatteryKind (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryKind) +#define GSysConsoleStackChunkP (((LowMemHdrType*)PilotGlobalsP)->globals.sysConsoleStackChunkP) +#define GSysUIShellAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysUIShellAppInfoP) +#define GSysTimerID (((LowMemHdrType*)PilotGlobalsP)->globals.sysTimerID) +#define GSysAutoOffEvtTicks (((LowMemHdrType*)PilotGlobalsP)->globals.sysAutoOffEvtTicks) +#define GSysAutoOffSeconds (((LowMemHdrType*)PilotGlobalsP)->globals.sysAutoOffSeconds) +#define GSysRandomSeed (((LowMemHdrType*)PilotGlobalsP)->globals.sysRandomSeed) +#define GSysResetFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysResetFlags) +#define GSysPrefFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysPrefFlags) +#define GSysMiscFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysMiscFlags) +#define GSysGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysGlobalsP) + + +#define GSlkGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.slkGlobalsP) +#define GSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.serGlobalsP) +#define GScrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.scrGlobalsP) +#define GFplGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.fplGlobalsP) +#define GPenGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.penGlobalsP) +#define GSysEvtMgrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysEvtMgrGlobalsP) +#define GSndGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sndGlobalsP) +#define GTimGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.timGlobalsP) +#define GAlmGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.almGlobalsP) +#define GFtrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.ftrGlobalsP) +#define GGrfGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.grfGlobalsP) +#define GKeyGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.keyGlobalsP) +#define GPADGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.padGlobalsP) + +#define GUIGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.uiGlobals) + +#define GNextUIAppDBID (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppDBID) +#define GNextUIAppCardNo (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCardNo) +#define GNextUIAppCmd (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCmd) +#define GNextUIAppCmdPBP (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCmdPBP) +#define GCurUIAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.curUIAppInfoP) + +#define GHwrDataWELevel (((LowMemHdrType*)PilotGlobalsP)->globals.hwrDataWELevel) +#define GHwrWakeUp (((LowMemHdrType*)PilotGlobalsP)->globals.hwrWakeUp) +#define GHwrCPUDutyCycle (((LowMemHdrType*)PilotGlobalsP)->globals.hwrCPUDutyCycle) +#define GHwrPenDown (((LowMemHdrType*)PilotGlobalsP)->globals.hwrPenDown) +#define GHwrCurTicks (((LowMemHdrType*)PilotGlobalsP)->globals.hwrCurTicks) +#define GHwrTotalRAMSize (((LowMemHdrType*)PilotGlobalsP)->globals.hwrTotalRAMSize) +#define GHwrDozeSubTicks (((LowMemHdrType*)PilotGlobalsP)->globals.hwrDozeSubTicks) + +#define GSysLibTableP (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableP) +#define GSysLibTableEntries (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableEntries) +#define GDbgSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.dbgSerGlobalsP) + + +#endif //__GLOBALS_H__ + +#endif // NON_PORTABLE + + + + diff --git a/sdk-1/include/Core/System/Graffiti.h b/sdk-1/include/Core/System/Graffiti.h new file mode 100644 index 0000000..12dffe9 --- /dev/null +++ b/sdk-1/include/Core/System/Graffiti.h @@ -0,0 +1,213 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Graffiti.h + * + * Description: + * Header for the Graffiti interface + * + * History: + * 6/30 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __GRAFFITI_H__ +#define __GRAFFITI_H__ + +#include + +#define grfNoShortCut 0xffff // Index which isn't a shortcut + +/*------------------------------------------------------------------------------ + * Match info structure. Returned by GrfMatch and GrfMatchGlyph + *-----------------------------------------------------------------------------*/ +typedef struct { + Byte glyphID; /* glyph ID of this match */ + Byte unCertainty; /* unCertainty of this match (0 most certain) */ + } GrfMatchType; + + +#define grfMaxMatches 4 +typedef struct { + Word numMatches; /* number of matches returned in this structure */ + GrfMatchType match[grfMaxMatches]; + } GrfMatchInfoType; +typedef GrfMatchInfoType* GrfMatchInfoPtr; + +#define grfNameLength 8 // eight letters possible (don't forget CR) +//#define grfTextLength 56 // Use + + +//---------------------------------------------------------------------------- +// Escape codes preceding special sequences in the dictionary or macros +//---------------------------------------------------------------------------- +// In dictionary or macros preceding virtual key event sequences. These are always +// 11 byte sequences that have ASCII encoded values for the ascii code, keyCode, +// and modifiers: +// grfVirtualSequence, ascii, keyCode, modifiers. +// 1 byte 4 bytes 4 bytes 2 byte +#define grfVirtualSequence 0x01 + +// In dictionary to tell us about temp shift state changes. +#define grfShiftSequence 0x02 + +// In dictionary/macros to hide special features +#define grfSpecialSequence 0x03 + +// Char indicating a seqeunce of characters to expand. +#define grfExpansionSequence '@' + +// Chars indicating what to expand into +#define expandDateChar 'D' +#define expandTimeChar 'T' +#define expandStampChar 'S' // This follows 'D' or 'T' for the sake + // of the mnemonic name. + +#define shortcutBinaryDataFlag 0x01 + + +// Determine if a string has a sequence +#define HasVirtualSequence(s) (s[0] == grfVirtualSequence) +#define HasSpecialSequence(s) (s[0] == grfSpecialSequence) +#define HasExpansionSequence(s) (s[0] == grfExpansionSequence) + + + +/*------------------------------------------------------------------------------ + * Temp shift states, returned by GrfGetState + *-----------------------------------------------------------------------------*/ +#define grfTempShiftPunctuation 1 +#define grfTempShiftExtended 2 +#define grfTempShiftUpper 3 +#define grfTempShiftLower 4 + + + +/************************************************************ + * Graffiti result codes + *************************************************************/ +#define grfErrBadParam (grfErrorClass | 1) +#define grfErrPointBufferFull (grfErrorClass | 2) +#define grfErrNoGlyphTable (grfErrorClass | 3) +#define grfErrNoDictionary (grfErrorClass | 4) +#define grfErrNoMapping (grfErrorClass | 5) +#define grfErrMacroNotFound (grfErrorClass | 6) +#define grfErrDepthTooDeep (grfErrorClass | 7) +#define grfErrMacroPtrTooSmall (grfErrorClass | 8) +#define grfErrNoMacros (grfErrorClass | 9) + +#define grfErrMacroIncomplete (grfErrorClass | 129) // (grfWarningOffset+1) +#define grfErrBranchNotFound (grfErrorClass | 130) // (grfWarningOffset+2) + + +/************************************************************ + * Graffiti interface procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err GrfInit (void) + SYS_TRAP(sysTrapGrfInit); + +Err GrfFree (void) + SYS_TRAP(sysTrapGrfFree); + +Err GrfProcessStroke(PointType* startPtP, PointType* endPtP, + Boolean upShift) + SYS_TRAP(sysTrapGrfProcessStroke); + +Err GrfFieldChange(Boolean resetState, UIntPtr characterToDelete) + SYS_TRAP(sysTrapGrfFieldChange); + +Err GrfGetState(Boolean* capsLockP, Boolean* numLockP, + WordPtr tempShiftP, Boolean* autoShiftedP) + SYS_TRAP(sysTrapGrfGetState); + +Err GrfSetState(Boolean capsLock, Boolean numLock, + Boolean upperShift) + SYS_TRAP(sysTrapGrfSetState); + + +//----------------------------------------------------------------- +// Mid Level Calls +//------------------------------------------------------------------ + +Err GrfFlushPoints (void) + SYS_TRAP(sysTrapGrfFlushPoints); + +Err GrfAddPoint (PointType* pt) + SYS_TRAP(sysTrapGrfAddPoint); + +Err GrfInitState(void) + SYS_TRAP(sysTrapGrfInitState); + +Err GrfCleanState(void) + SYS_TRAP(sysTrapGrfCleanState); + +Err GrfMatch (WordPtr flagsP, void* dataPtrP, WordPtr dataLenP, + WordPtr uncertainLenP, GrfMatchInfoPtr matchInfoP) + SYS_TRAP(sysTrapGrfMatch); + +Err GrfGetMacro(CharPtr nameP, BytePtr macroDataP, + WordPtr dataLenP) + SYS_TRAP(sysTrapGrfGetMacro); + +Err GrfGetAndExpandMacro(CharPtr nameP, BytePtr macroDataP, + WordPtr dataLenP) + SYS_TRAP(sysTrapGrfGetAndExpandMacro); + + +//----------------------------------------------------------------- +// Low Level Calls +//------------------------------------------------------------------ +Err GrfFilterPoints (void) + SYS_TRAP(sysTrapGrfFilterPoints); + +Err GrfGetNumPoints(WordPtr numPtsP) + SYS_TRAP(sysTrapGrfGetNumPoints); + +Err GrfGetPoint(Word index, PointType* pointP) + SYS_TRAP(sysTrapGrfGetPoint); + +Err GrfFindBranch(Word flags) + SYS_TRAP(sysTrapGrfFindBranch); + +Err GrfMatchGlyph (GrfMatchInfoPtr matchInfoP, + Word maxUnCertainty, Word maxMatches) + SYS_TRAP(sysTrapGrfMatchGlyph); + +Err GrfGetGlyphMapping (Word glyphID, WordPtr flagsP, + void* dataPtrP, WordPtr dataLenP, WordPtr uncertainLenP) + SYS_TRAP(sysTrapGrfGetGlyphMapping); + +Err GrfGetMacroName(Word index, CharPtr nameP) + SYS_TRAP(sysTrapGrfGetMacroName); + +Err GrfDeleteMacro(Word index) + SYS_TRAP(sysTrapGrfDeleteMacro); + +Err GrfAddMacro(CharPtr nameP, BytePtr macroDataP, + Word dataLen) + SYS_TRAP(sysTrapGrfAddMacro); + + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SYSEVTMGR_H__ + + + diff --git a/sdk-1/include/Core/System/GraffitiPrv.h b/sdk-1/include/Core/System/GraffitiPrv.h new file mode 100644 index 0000000..1a9c676 --- /dev/null +++ b/sdk-1/include/Core/System/GraffitiPrv.h @@ -0,0 +1,106 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * GraffitiPRV.h + * + * Description: + * Private Header for the Graffiti interface + * + * History: + * 6/30 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __GRAFFITIPRV_H__ +#define __GRAFFITIPRV_H__ + + + +#define DP3MachineMacintosh +#include + + +/************************************************************ + * Graffiti Constants + *************************************************************/ +// Bytes that follow the grfSpecialSequence byte in Graffiti dictionary +// or macros. These are used for special test code and debugging +#define grfSpecialToggleSplitMode 0x01 // Toggle split mode +#define grfSpecialNoAutoOff 0x02 // Disable auto-off +#define grfSpecialShowUserInfo 0x03 // Display user information +#define grfSpecialDeleteUserInfo 0x04 // Delete user name & id +#define grfSpecialSystemBuildDate 0x05 // Show System Build date +#define grfSpecialBatteryKind 0x06 // Change battery kind + +// Max # of keys returned from dictionary or macros +#define grfMaxKeys 100 + +// Resource type and ID of macros resource +#define grfMacrosResT 'macr' +#define grfMacrosResID 10000 +#define grfMacrosMinSize 10 // min size of macros resource + +// Version of Graffiti Macros database +#define grfMacrosDBVersion 0 // version word + + +// Constant used to translate internal Graffiti Warnings into Pilot error codes +#define grfWarningOffset 128 + + +/************************************************************ + * Graffiti Globals + *************************************************************/ +#define grfMaxMacroName 32 +typedef struct GrfGlobalsType { + TP3Data p3Data; + TP3DictState state; + Int uncertain; + Word glyphFlags; + Word shiftState; // temp shift state + + SWord macroNameLen; + Byte macroName[grfMaxMacroName]; + Byte lastChar; + + ULong globalsSize; + + + // Various flags + Word splitMode : 1; + Word restoreCaps : 1; + Word inMacro : 1; + Word wasAutoShifted : 1; + + // Glyph ID assigned to the up-stroke + Byte upShiftGlyphID; + + // Handle to P3 private globals + Handle globalsH; + + // Handle to template file + Handle templateH; + + // Handle to dictionary + Handle dictH; + + // Handle to macros resource + Handle macrosH; + // Database acccess pointer to macros database + DmOpenRef macrosDbP; + + } GrfGlobalsType; + +typedef GrfGlobalsType* GrfGlobalsPtr; + + +#endif //__GRAFFITIPRV_H__ +#endif // NON_PORTABLE + + + diff --git a/sdk-1/include/Core/System/KeyMgr.h b/sdk-1/include/Core/System/KeyMgr.h new file mode 100644 index 0000000..ff486c8 --- /dev/null +++ b/sdk-1/include/Core/System/KeyMgr.h @@ -0,0 +1,61 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * KeyMgr.h + * + * Description: + * Include file for Key manager + * + * History: + * 9/13/95 Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __KEYMGR_H__ +#define __KEYMGR_H__ + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Definition of bit field returned from KeyCurrentState + ********************************************************************/ +#define keyBitPower 0x01 // Power key +#define keyBitPageUp 0x02 // Page-up +#define keyBitPageDown 0x04 // Page-down +#define keyBitHard1 0x08 // App #1 +#define keyBitHard2 0x10 // App #2 +#define keyBitHard3 0x20 // App #3 +#define keyBitHard4 0x40 // App #4 +#define keyBitCradle 0x80 // Button on cradle + + + +/******************************************************************** + * Key manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Set/Get the auto-key repeat rate +Err KeyRates(Boolean set, WordPtr initDelayP, WordPtr periodP, + WordPtr doubleTapDelayP, BooleanPtr queueAheadP) + SYS_TRAP(sysTrapKeyRates); + +// Get the current state of the hardware keys +DWord KeyCurrentState(void) + SYS_TRAP(sysTrapKeyCurrentState); + +#ifdef __cplusplus +} +#endif + + +#endif //__KEYMGR_H__ diff --git a/sdk-1/include/Core/System/KeyPrv.h b/sdk-1/include/Core/System/KeyPrv.h new file mode 100644 index 0000000..f3ecd2c --- /dev/null +++ b/sdk-1/include/Core/System/KeyPrv.h @@ -0,0 +1,112 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * KeyPrv.h + * + * Description: + * Private Include file for Key manager + * + * History: + * 9/13/95 Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __KEYPRV_H +#define __KEYPRV_H + + +/******************************************************************** + * Key Manager Constants + ********************************************************************/ +#define keyMinUpTicks (sysTicksPerSecond/20) // Min# of ticks key must be up to recognize it + +#define keyBitMask 0x007F // Which bits in port D we use for keys + +/******************************************************************** + * Key Manager Globals + ********************************************************************/ +typedef struct KeyGlobalsType { + ULong lastKeyTicks; // GHwrCurTicks last time we enqueued + // a key event - cleared as soon as + // key is released. + + + Byte keyState; // current state of hardware keys - returned + // by KeyCurrentState + Byte keyUpCount; // # of consecutive times we've detected + // no keys down - used for debouncing + Byte initDelay; // key repeat init delay in ticks + Byte period; // key repeat period in ticks + + + // These variables used for sensing double-taps + ULong doubleTapTicks; // GHwrCurTicks last tiem we enqueued + // a key event - never cleared. + Word doubleTapDelay; // double-tap timeout in ticks + Byte doubleTapState; // state of hardware keys last time + + // Belongs next to 'period' but put here for alignment + Boolean queueAhead; // if true, enqueue auto-repeat keys even if + // queue is not empty. + } KeyGlobalsType; + +typedef KeyGlobalsType* KeyGlobalsPtr; + + + + + +/******************************************************************** + * Key manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Called early on during boot-up to get status of hard reset +// and debugger key options. Returns DWord with bits set for each +// key down. +DWord KeyBootKeys(void); + + +// Initializes the Key Manager and allocates it's globals +Err KeyInit(void) + SYS_TRAP(sysTrapKeyInit); + + +// Called as a result of a key-down interrupt or periodically by +// by timer task while key is down. Returns # of ticks before +// it should be called again by timer task. +ULong KeyHandleInterrupt(Boolean periodic, DWord status) + SYS_TRAP(sysTrapKeyHandleInterrupt); + + +// Called by SysEvtMgr when it gets a pen event in order to +// reset the key manager's double-tap detection. +Err KeyResetDoubleTap(void) + SYS_TRAP(sysTrapKeyResetDoubleTap); + + +// Called before system goes to sleep +Err KeySleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapKeySleep); + + +// Called when the system wakes up +Err KeyWake(void) + SYS_TRAP(sysTrapKeyWake); + + + +#ifdef __cplusplus +} +#endif + + +#endif //__KEYPRV_H +#endif // NON_PORTABLE diff --git a/sdk-1/include/Core/System/Keyboard.h b/sdk-1/include/Core/System/Keyboard.h new file mode 100644 index 0000000..a9e0bb4 --- /dev/null +++ b/sdk-1/include/Core/System/Keyboard.h @@ -0,0 +1,51 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Keyboard.h + * AUTHOR: Roger Flores: March 29, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the keyboard's structures + * and routines. + * + ***********************************************************************/ + + +#ifndef __KBD_H__ +#define __KBD_H__ + + + +#define kbdReturnKey linefeedChr +#define kbdTabKey tabChr +#define kbdBackspaceKey backspaceChr +#define kbdShiftKey 2 +#define kbdCapsKey 1 +#define kbdNoKey -1 + + + +/************************************************************ + * Keyboard procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// 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. + +extern void SysKeyboardDialog () + SYS_TRAP(sysTrapSysKeyboardDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __KBD_H__ diff --git a/sdk-1/include/Core/System/Launcher.h b/sdk-1/include/Core/System/Launcher.h new file mode 100644 index 0000000..c1ae244 --- /dev/null +++ b/sdk-1/include/Core/System/Launcher.h @@ -0,0 +1,71 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Launcher.h + * AUTHOR: Roger Flores: April 27, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * These are the routines for the launcher. + * + **********************************************************************/ +#ifndef __LAUNCHER_H__ +#define __LAUNCHER_H__ + +#include +#include +#include +#include +#include + +typedef struct { + Char name[dmDBNameLength]; + ULong creator; + UInt version; + LocalID dbID; + UInt cardNo; + BitmapPtr iconP; +} LauncherAppInfoType; + +typedef struct { + RectangleType bounds; + Int numItems; // numItems of applications available via the launcher + Int columns; + Int rows; + Int topItem; + VoidHand appInfoH; // an array is to be allocated + RectangleType frame; + WinHandle popupWin; + WinHandle savedBits; + WinHandle savedActiveWin; + WinHandle savedDrawWin; + TimeFormatType timeFormat; // Format to display time in + char timeString[timeStringLength]; + Boolean needToGetNamesAndIcons; + FormPtr savedForm; // the currently active dialog. +} LauncherType; + +typedef LauncherType * LauncherPtr; + + + +/************************************************************ + * Launcher procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +void SysAppLauncherDialog() + SYS_TRAP(sysTrapSysAppLauncherDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __LAUNCHER_H__ + diff --git a/sdk-1/include/Core/System/MemoryMgr.h b/sdk-1/include/Core/System/MemoryMgr.h new file mode 100644 index 0000000..0d605fd --- /dev/null +++ b/sdk-1/include/Core/System/MemoryMgr.h @@ -0,0 +1,341 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * MemoryMgr.h + * + * Description: + * Include file for Memory Manager + * + * History: + * 10/25/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + + +#ifndef __MEMORYMGR_H__ +#define __MEMORYMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +/************************************************************ + * Memory Manager Types + *************************************************************/ +typedef enum { memIDPtr, memIDHandle } LocalIDKind; + + + +/************************************************************ + * Flags accepted as parameter for MemNewChunk. + *************************************************************/ +#define memNewChunkFlagPreLock 0x0100 +#define memNewChunkFlagNonMovable 0x0200 +#define memNewChunkFlagAtStart 0x0400 // force allocation at front of heap +#define memNewChunkFlagAtEnd 0x0800 // force allocation at end of heap + + + +/************************************************************ + * Memory Manager Debug settings for the MemSetDebugMode function + *************************************************************/ +#define memDebugModeCheckOnChange 0x0001 +#define memDebugModeCheckOnAll 0x0002 +#define memDebugModeScrambleOnChange 0x0004 +#define memDebugModeScrambleOnAll 0x0008 +#define memDebugModeFillFree 0x0010 +#define memDebugModeAllHeaps 0x0020 +#define memDebugModeRecordMinDynHeapFree 0x0040 + + + + +/************************************************************ + * Memory Manager result codes + *************************************************************/ +#define memErrChunkLocked (memErrorClass | 1) +#define memErrNotEnoughSpace (memErrorClass | 2) +#define memErrInvalidParam (memErrorClass | 3) +#define memErrChunkNotLocked (memErrorClass | 4) +#define memErrCardNotPresent (memErrorClass | 5) +#define memErrNoCardHeader (memErrorClass | 6) +#define memErrInvalidStoreHeader (memErrorClass | 7) +#define memErrRAMOnlyCard (memErrorClass | 8) +#define memErrWriteProtect (memErrorClass | 9) +#define memErrNoRAMOnCard (memErrorClass | 10) +#define memErrNoStore (memErrorClass | 10) + + + +/******************************************************************** + * Memory Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err MemInit(void) + SYS_TRAP(sysTrapMemInit); + +Err MemKernelInit(void) + SYS_TRAP(sysTrapMemKernelInit); + +Err MemInitHeapTable(UInt cardNo) + SYS_TRAP(sysTrapMemInitHeapTable); + +//------------------------------------------------------------------- +// Card formatting and Info +//------------------------------------------------------------------- +UInt MemNumCards(void) + SYS_TRAP(sysTrapMemNumCards); + +Err MemCardFormat(UInt cardNo, CharPtr cardNameP, + CharPtr manufNameP, CharPtr ramStoreNameP) + SYS_TRAP(sysTrapMemCardFormat); + +Err MemCardInfo(UInt cardNo, + CharPtr cardNameP, CharPtr manufNameP, + UIntPtr versionP, ULongPtr crDateP, + ULongPtr romSizeP, ULongPtr ramSizeP, + ULongPtr freeBytesP) + SYS_TRAP(sysTrapMemCardInfo); + + +//------------------------------------------------------------------- +// Store Info +//------------------------------------------------------------------- +Err MemStoreInfo(UInt cardNo, UInt storeNumber, + UIntPtr versionP, UIntPtr flagsP, CharPtr nameP, + ULongPtr crDateP, ULongPtr bckUpDateP, + ULongPtr heapListOffsetP, ULongPtr initCodeOffset1P, + ULongPtr initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreInfo); + +Err MemStoreSetInfo(UInt cardNo, UInt storeNumber, + UIntPtr versionP, UIntPtr flagsP, CharPtr nameP, + ULongPtr crDateP, ULongPtr bckUpDateP, + ULongPtr heapListOffsetP, ULongPtr initCodeOffset1P, + ULongPtr initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreSetInfo); + + +//------------------------------------------------------------------- +// Heap Info & Utilities +//------------------------------------------------------------------- +UInt MemNumHeaps(UInt cardNo) + SYS_TRAP(sysTrapMemNumHeaps); + +UInt MemNumRAMHeaps(UInt cardNo) + SYS_TRAP(sysTrapMemNumRAMHeaps); + +UInt MemHeapID(UInt cardNo, UInt heapIndex) + SYS_TRAP(sysTrapMemHeapID); + +Boolean MemHeapDynamic(UInt heapID) + SYS_TRAP(sysTrapMemHeapDynamic); + +Err MemHeapFreeBytes(UInt heapID, ULongPtr freeP, ULongPtr maxP) + SYS_TRAP(sysTrapMemHeapFreeBytes); + +ULong MemHeapSize(UInt heapID) + SYS_TRAP(sysTrapMemHeapSize); + +UInt MemHeapFlags(UInt heapID) + SYS_TRAP(sysTrapMemHeapFlags); + + +// Heap utilities +Err MemHeapCompact(UInt heapID) + SYS_TRAP(sysTrapMemHeapCompact); + +Err MemHeapInit(UInt heapID, Int numHandles, Boolean initContents) + SYS_TRAP(sysTrapMemHeapInit); + +Err MemHeapFreeByOwnerID(UInt heapID, UInt ownerID) + SYS_TRAP(sysTrapMemHeapFreeByOwnerID); + + +//------------------------------------------------------------------- +// Low Level Allocation +//------------------------------------------------------------------- +VoidPtr MemChunkNew(UInt heapID, ULong size, UInt attr) + SYS_TRAP(sysTrapMemChunkNew); + +Err MemChunkFree(VoidPtr chunkDataP) + SYS_TRAP(sysTrapMemChunkFree); + + + +//------------------------------------------------------------------- +// Pointer (Non-Movable) based Chunk Routines +//------------------------------------------------------------------- +VoidPtr MemPtrNew(ULong size) + SYS_TRAP(sysTrapMemPtrNew); + +#define MemPtrFree( p) \ + MemChunkFree(p) + +// Getting Attributes +VoidHand MemPtrRecoverHandle(VoidPtr p) + SYS_TRAP(sysTrapMemPtrRecoverHandle); + +UInt MemPtrFlags(VoidPtr p) + SYS_TRAP(sysTrapMemPtrFlags); + +ULong MemPtrSize(VoidPtr p) + SYS_TRAP(sysTrapMemPtrSize); + +UInt MemPtrOwner(VoidPtr p) + SYS_TRAP(sysTrapMemPtrOwner); + +UInt MemPtrHeapID(VoidPtr p) + SYS_TRAP(sysTrapMemPtrHeapID); + +Boolean MemPtrDataStorage(VoidPtr p) + SYS_TRAP(sysTrapMemPtrDataStorage); + +UInt MemPtrCardNo(VoidPtr global) + SYS_TRAP(sysTrapMemPtrCardNo); + +LocalID MemPtrToLocalID(VoidPtr p) + SYS_TRAP(sysTrapMemPtrToLocalID); + +// Setting Attributes +Err MemPtrSetOwner(VoidPtr p, UInt owner) + SYS_TRAP(sysTrapMemPtrSetOwner); + +Err MemPtrResize(VoidPtr p, ULong newSize) + SYS_TRAP(sysTrapMemPtrResize); + +Err MemPtrResetLock(VoidPtr p) + SYS_TRAP(sysTrapMemPtrResetLock); + +Err MemPtrUnlock(VoidPtr p) + SYS_TRAP(sysTrapMemPtrUnlock); + + +//------------------------------------------------------------------- +// Handle (Movable) based Chunk Routines +//------------------------------------------------------------------- +VoidHand MemHandleNew(ULong size) + SYS_TRAP(sysTrapMemHandleNew); + +Err MemHandleFree(VoidHand h) + SYS_TRAP(sysTrapMemHandleFree); + +// Getting Attributes +UInt MemHandleFlags(VoidHand h) + SYS_TRAP(sysTrapMemHandleFlags); + +ULong MemHandleSize(VoidHand h) + SYS_TRAP(sysTrapMemHandleSize); + +UInt MemHandleOwner(VoidHand h) + SYS_TRAP(sysTrapMemHandleOwner); + +UInt MemHandleLockCount(VoidHand h) + SYS_TRAP(sysTrapMemHandleLockCount); + +UInt MemHandleHeapID(VoidHand h) + SYS_TRAP(sysTrapMemHandleHeapID); + +Boolean MemHandleDataStorage(VoidHand h) + SYS_TRAP(sysTrapMemHandleDataStorage); + +UInt MemHandleCardNo(VoidHand h) + SYS_TRAP(sysTrapMemHandleCardNo); + +LocalID MemHandleToLocalID(VoidHand h) + SYS_TRAP(sysTrapMemHandleToLocalID); + + +// Setting Attributes +Err MemHandleSetOwner( VoidHand h, UInt owner) + SYS_TRAP(sysTrapMemHandleSetOwner); + +Err MemHandleResize(VoidHand h, ULong newSize) + SYS_TRAP(sysTrapMemHandleResize); + +VoidPtr MemHandleLock(VoidHand h) + SYS_TRAP(sysTrapMemHandleLock); + +Err MemHandleUnlock(VoidHand h) + SYS_TRAP(sysTrapMemHandleUnlock); + +Err MemHandleResetLock(VoidHand h) + SYS_TRAP(sysTrapMemHandleResetLock); + + + + +//------------------------------------------------------------------- +// Local ID based routines +//------------------------------------------------------------------- +VoidPtr MemLocalIDToGlobal(LocalID local, UInt cardNo) + SYS_TRAP(sysTrapMemLocalIDToGlobal); + +LocalIDKind MemLocalIDKind(LocalID local) + SYS_TRAP(sysTrapMemLocalIDKind); + +VoidPtr MemLocalIDToPtr(LocalID local, UInt cardNo) + SYS_TRAP(sysTrapMemLocalIDToPtr); + +VoidPtr MemLocalIDToLockedPtr(LocalID local, UInt cardNo) + SYS_TRAP(sysTrapMemLocalIDToLockedPtr); + + +//------------------------------------------------------------------- +// Utilities +//------------------------------------------------------------------- +Err MemMove(VoidPtr dstP, VoidPtr srcP, ULong numBytes) + SYS_TRAP(sysTrapMemMove); + +Err MemSet(VoidPtr dstP, ULong numBytes, Byte value) + SYS_TRAP(sysTrapMemSet); + +Err MemSemaphoreReserve(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreReserve); + +Err MemSemaphoreRelease(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreRelease); + +//------------------------------------------------------------------- +// Debugging Support +//------------------------------------------------------------------- +Word MemDebugMode(void) + SYS_TRAP(sysTrapMemDebugMode); + +Err MemSetDebugMode(Word flags) + SYS_TRAP(sysTrapMemSetDebugMode); + +Err MemHeapScramble(UInt heapID) + SYS_TRAP(sysTrapMemHeapScramble); + +Err MemHeapCheck(UInt heapID) + SYS_TRAP(sysTrapMemHeapCheck); + + +#ifdef __cplusplus +} +#endif + + + + + +#endif // __MEMORYMGR_H__ + diff --git a/sdk-1/include/Core/System/MemoryPrv.h b/sdk-1/include/Core/System/MemoryPrv.h new file mode 100644 index 0000000..8bee49e --- /dev/null +++ b/sdk-1/include/Core/System/MemoryPrv.h @@ -0,0 +1,327 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * MemoryMgrPrv.h + * + * Description: + * Private includes for Memory Manager + * + * History: + * 7/20/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE + + +// SystemPrv.h must be included before this header file. SystemPrv.h will +// then in turn include this header. +#ifndef __SYSTEMPRV_H__ +#include +#endif + +#ifndef __MEMORYMGRPRV_H__ +#define __MEMORYMGRPRV_H__ + + + +/******************************************************************** + * Structure of a Master Pointer chunk + * The first master pointer chunk is always immediately following the + * heap header. As more movable chunks are created, new master + * pointer chunks are allocated dynamically and linked together through + * the nextTblOffset field and prevTblOffset field. + ********************************************************************/ +typedef struct { + Word numEntries; // number of master pointer entries + Word nextTblOffset; // offset from start of heap to next table + //Ptr mstrP[numEntries]; // array of pointers to movable chunks + } MstrPtrTableType; +typedef MstrPtrTableType* MstrPtrTablePtr; + + +/******************************************************************** + * Structure of a Heap + * + * A heap starts with a HeapHeader + * Followed by the offset table (numHandles) + * Followed by movable chunks + * Followed by non-movable chunks + ********************************************************************/ +typedef struct { + Word flags; // heap flags; + Word size; // size of heap - 0 means 64K; + MstrPtrTableType mstrPtrTbl; // Master pointer table + } HeapHeaderType; +typedef HeapHeaderType* HeapHeaderPtr; + +// Flags Field +#define memHeapFlagReadOnly 0x01 // heap is read-only (ROM based) + +#define memMstrPtrTableGrowBy 50 // # of entries to grow master pointer tables by +#define memMstrPtrTableInitSizeD 40 // # of entries to allocate initially for dynamic heap(s) +#define memMstrPtrTableInitSizeS 200 // # of entries to allocate initially for storage heap(s) + + + +/******************************************************************** + * Structure of a Chunk + * + ********************************************************************/ +typedef struct { + Word size; // size of block in bytes, including header + Byte lockOwner; // lock count in high nibble, owner in low + Byte flags; // flags, size adj in low nibble + SWord hOffset; // offset/2 to handle for movables + } ChunkHeaderType; +typedef ChunkHeaderType* ChunkHeaderPtr; + +// Definition of ChunkHeaderType.flags -------------------------------- +#define memChunkFlagFree 0x80 // free bit +#define memChunkFlagUnused1 0x40 // unused +#define memChunkFlagUnused2 0x20 // unused +#define memChunkFlagUnused3 0x10 // unused +#define memChunkFlagSizeAdj 0x0F // mask for size adjustment + + +// A non-movable chunk has 0xF as the lock count +#define memChunkLockMask 0xF0 +#define memChunkOwnerMask 0x0F + + + + + +/************************************************************ + * Structure of a Card Header. + * There is 1 card header for in every card that has ROM. The + * card header is stored at sysCardHeaderOffset into the card. + * + * RAM only cards will not have a card header + *************************************************************/ +#define memMaxNameLen 32 // size of name and manuf fields including null +typedef struct { + DWord initStack; // initial stack pointer + DWord resetVector; // reset vector + DWord signature; // must be sysCardSignature + Word hdrVersion; // header version + Word flags; // card flags; + Byte name[memMaxNameLen]; // card name + Byte manuf[memMaxNameLen]; // card manufacturer's name + Word version; // card version + DWord creationDate; // card creation date + Word numRAMBlocks; // number of RAM blocks on card + DWord blockListOffset; // offset to RAM block list + Byte reserved[164]; // to bring us to 0x100 alignment + } CardHeaderType; +typedef CardHeaderType* CardHeaderPtr; + +#define memCardHeaderFlagRAMOnly 0x0001 // RAM only card + + + +/************************************************************ + * Structure of a Storage Header. + * There is 1 of these for every "store" on a memory card. A + * "store" can be all the RAM on a card or all the ROM on a card. + * + * The RAM storage header is stored at sysRAMHeader offset into the + * card. and the ROM storage header is stored at sysROMHeader offset + * into the card. + *************************************************************/ +typedef struct { + DWord signature; // must be sysStoreSignature + Word version; // version of header + Word flags; // flags + Byte name[memMaxNameLen]; // name of store + DWord creationDate; // creation date + DWord backupDate; // last backup date + DWord heapListOffset; // offset to heap list for store + DWord initCodeOffset1; // init code for store, if any + DWord initCodeOffset2; // second init code for store, if any + LocalID databaseDirID; // local ID of database dir. + DWord rsvSpace; // where first heap starts. + DWord dynHeapSpace; // how big the dynamic heap area is + // (always 0 for ROM stores) + DWord firstRAMBlockSize; // Copy of firstRAMBlock size from cardinfo + // Used to determine if we're rebooting + // with a different amount of RAM. + + // The following fields are used to store non-volatile information that + // must be accessed by the system but that is not convenient to store + // in a database due to access time or frequency. It is only valid + // in the RAM STORE ON CARD #0!. + SysNVParamsType nvParams; + + // Filler bytes - reserved for future use. Size adjusted to + // keep total size of storage header at 0x100 bytes. + Byte reserved[176-sizeof(SysNVParamsType)]; + + // CRC value + DWord crc; // crc to check validity + } StorageHeaderType; +typedef StorageHeaderType* StorageHeaderPtr; + +#define memStoreHeaderFlagRAMOnly 0x0001 // RAM store + + +// A Heap list for each store on a card (either RAM or ROM) gives a list of +// heaps' starting offsets for that store +typedef struct { + Word numHeaps; // Number of heaps in store + DWord heapOffset[1]; // offset to heap + } HeapListType; + + + +/******************************************************************** + * CardInfo structure + * The Pilot globals has a pointer to an array of CardInfo structures. + * + * This array is initialized by the Boot code before the Memory Manager + * starts up. Among other things, it tells the Memory Manager where + * every card is and the size of each card. + ********************************************************************/ +typedef struct { + + // These fields are filled in by the boot code BEFORE + // MemInit() is called. + BytePtr baseP; // base address of card + DWord size; // address range of card + DWord firstRAMBlockSize; // size of RAM block at offset 0 + DWord targetROMShift; // used only under Emulation mode, must be + // added to emulated ROM pointers when calculating + // a LocalID for use in the device ROM. + + + DWord cardHeaderOffset; // offset to card header (usually in ROM) + // = 0 if RAM only card + + DWord rsvSpace; // reserve space in RAM before first heap + DWord dynHeapSpace; // how much space to reserve for dynamic heap(s) + StorageHeaderPtr ramStoreP; // pointer to RAM store header + // This location depends on how much space + // was reserved on the card for the dynamic + // heap. + + // These fields are copies of information in the card and storage headers + // they are cached here for quicker access by the Memory Manager. They + // are filled in by the Memory Manager during MemInit. + Word numRAMHeaps; // Number of RAM heaps - for quick access + DWordPtr ramHeapOffsetsP; // Table of RAM heap offsets - for quick access + Word numROMHeaps; // Number of RAM heaps - for quick access + DWordPtr romHeapOffsetsP; // Table of RAM heap offsets - for quick access + + } CardInfoType; +typedef CardInfoType* CardInfoPtr; + +// The constant hwrNumCardSlots, defined in Hardware.h defines the maximum number +// of cards supported by the hardware. + + + + +/************************************************************ + * Private Memory Manager Constants + *************************************************************/ +// Default size of the dynamic heap +#define memDynamicHeapSize (0x08000-sysLowMemSize) + + +// Private constant - # of dynamic heaps +#define memDynamicHeaps 1 + + + + +/************************************************************ + * Private Memory Manager Macros. These macros are not + * guaranteed to be compatible in the future and should + * only be used in system code, not applications. + * + * To use these, define NON_PORTABLE at the top of your + * source code module. + * + * WARNING: This macro must only be used on Locked chunks!!! + * When running with error checking, it will verify + * that the chunk is locked before it dereferences it. + *************************************************************/ + +#if MEMORY_FORCE_LOCK == MEMORY_FORCE_LOCK_ON + #define memHandleProtect(h) \ + ((VoidHand)((DWord)h | 0x80000000)) + #define memHandleUnProtect(h) \ + ((VoidHand)((DWord)h & 0x7FFFFFFF)) +#else + #define memHandleProtect(h) (h) + #define memHandleUnProtect(h) (h) +#endif + + +#if MEMORY_TYPE == MEMORY_LOCAL + #if ERROR_CHECK_LEVEL != ERROR_CHECK_NONE + #define MemDeref(h) \ + (MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : (*memHandleUnProtect(h))) + #else + #define MemDeref(h) \ + (*(memHandleUnProtect(h))) + #endif + +#else + #if ERROR_CHECK_LEVEL != ERROR_CHECK_NONE + #define MemDeref(h) \ + (MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : ((Ptr)ShlDWord(h))) + #else + #define MemDeref(h) \ + ((Ptr)ShlDWord(memHandleUnProtect(h))) + #endif +#endif + +#endif // NON_PORTABLE + + + +// Typecast access to the MemCardInfo Ptr +#define memCardInfoP(cardNo) \ + ( ((CardInfoPtr) ((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP) + cardNo) + + + +/******************************************************************** + * Memory Manager Private Routines + * These are used only by internal System code + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +HeapHeaderPtr MemHeapPtr(UInt heapID) + SYS_TRAP(sysTrapMemHeapPtr); + +Err MemStoreSearch(VoidPtr startP, DWord range, StorageHeaderPtr* storePP) + SYS_TRAP(sysTrapMemStoreSearch); + +Err MemStoreInit(DWord firstHeapSize, UInt firstHeapMstrPtrs, + UInt cardNo, Word numBlocks, DWordPtr blockInfoP, + StorageHeaderPtr storeP, Word numMstrPtrs) + SYS_TRAP(sysTrapMemStoreInit); + +Err MemNVParams(Boolean set, SysNVParamsPtr paramsP) + SYS_TRAP(sysTrapMemNVParams); + +#ifdef __cplusplus +} +#endif + + + + + + +#endif // __MEMORYMGRPRV_H__ + diff --git a/sdk-1/include/Core/System/ModemMgr.h b/sdk-1/include/Core/System/ModemMgr.h new file mode 100644 index 0000000..496b085 --- /dev/null +++ b/sdk-1/include/Core/System/ModemMgr.h @@ -0,0 +1,118 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * ModemMgr.h + * + * Description: + * Include file for Modem Manager + * + * History: + * 9/20/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __MODEM_MGR_H__ +#define __MODEM_MGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Modem Manager constants + *************************************************************/ + +#define mdmMaxStringSize 40 + +#define mdmCmdBufSize 81 // command buffer capacity (including null) +#define mdmRespBufSize 81 // reply buffer capacity (including null) +#define mdmCmdSize 8 // max storage needed for smartmodem command + +#define mdmDefCmdTimeOut 500000L // in micro-seconds + +#define mdmDefDTWaitSec 4 +#define mdmDefDCDWaitSec 70 +#define mdmDefSpeakerVolume 1 + +/************************************************************ + * Modem Manager data structures + *************************************************************/ +// Prototype for the "user cancel" check callback function +typedef Int (*MdmUserCanProcPtr)(DWord userRef); + +typedef struct MdmInfoType { + UInt serRefNum; // serial library reference number + ULong initialBaud; // initial baud rate to use + ULong cmdTimeOut; // number of Msec to wait after a cmd + Int dtWaitSec; // dialtone wait (sec) + Int dcdWaitSec; // dcd timeout wait (sec) + Int volume; // speaker volume + Boolean pulse; // pulse or tone dialing + Boolean hwHShake; // enable cts/rts handshaking + Boolean autoBaud; // enable/disable auto-baud to connected baud rate + MdmUserCanProcPtr canProcP; // ptr to user-cancel function + DWord userRef; // parameter for canProcP() + Char cmdBuf[mdmCmdBufSize]; // build all commands here + Char respBuf[mdmRespBufSize];// response buffer + ULong connectBaud; // baud at which connection was established + // (0 = unknown) + Boolean traceToLog; // RESERVED FOR INTERNAL USE: when true, + // modem commands and responses are traced + // to the Sync log. + } MdmInfoType; + +typedef MdmInfoType* MdmInfoPtr; + +/************************************************************ + * Modem Manager result codes + * (mdmErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define mdmErrNoTone (mdmErrorClass | 1) // no dial tone +#define mdmErrNoDCD (mdmErrorClass | 2) // no carrier / timeout +#define mdmErrBusy (mdmErrorClass | 3) // busy signal heard +#define mdmErrUserCan (mdmErrorClass | 4) // cancelled by user +#define mdmErrCmdError (mdmErrorClass | 5) // command error + + + +/******************************************************************** + * Modem Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +Err MdmDial(MdmInfoPtr modemP, CharPtr okDialP, CharPtr userInitP, CharPtr phoneNumP) + SYS_TRAP(sysTrapMdmDial); + +Err MdmHangUp(MdmInfoPtr modemP) + SYS_TRAP(sysTrapMdmHangUp); + + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Modem Manager Macros + *************************************************************/ + +#endif // __MODEM_MGR_H__ + diff --git a/sdk-1/include/Core/System/ModemPrv.h b/sdk-1/include/Core/System/ModemPrv.h new file mode 100644 index 0000000..f73db28 --- /dev/null +++ b/sdk-1/include/Core/System/ModemPrv.h @@ -0,0 +1,90 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * ModemPrv.h + * + * Description: + * Private Include file for Modem Manager + * + * History: + * 9/25/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __MODEM_PRV_H__ +#define __MODEM_PRV_H__ + +// Include elementary types +#include + + + +/************************************************************ + * Modem Manager constants + *************************************************************/ + + +/************************************************************ + * Modem Manager data structures + *************************************************************/ + +typedef struct MdmCommandsType { + Char csi[mdmCmdSize]; // command sequence introducer + Char eoc[mdmCmdSize]; // end-of-command character(s) + Char quietCmd[mdmCmdSize]; // Q cmd: send result codes + Char dialTone[mdmCmdSize]; // tone dial command + Char dialPulse[mdmCmdSize]; // pulse dial command + Char cmdEchoOff[mdmCmdSize]; // E cmd: echoes in command mode + Char verboseCmd[mdmCmdSize]; // V cmd: word or digit result codes + Char dtWait[mdmCmdSize]; // (S6) dialtone wait (sec) + Char dcdWait[mdmCmdSize]; // (S7) dcd timeout wait (sec) + Char basicxcmd[mdmCmdSize]; // sets result code level for "basic" smartmodem + Char advxcmd[mdmCmdSize]; // sets result code level for advanced clones + Char spkrMode[mdmCmdSize]; // speaker mode + Char volume[mdmCmdSize]; // speaker volume prefix + Char hupCmd[mdmCmdSize]; // hang up command + Char firmDTRDCD[mdmCmdSize]; // DTR on, DCD on + Char escape[mdmCmdSize]; // Escape sequence: +++ + Char reset[mdmCmdSize]; // Z cmd: reset the modem + Char factory[mdmCmdSize]; // recall factory config + } MdmCommandsType; + + +typedef enum MdmRespIDType { + mdmRespUnknown = 0, + mdmRespOK, + mdmRespConnect, + mdmRespNoCarrier, + mdmRespError, + mdmRespNoDialTone, + mdmRespBusy, + mdmRespRing, + + mdmRespReserved = -1 // reserve -1 for internal use + } MdmRespIDType; + +typedef struct MdmRespEntryType { + Char subStr[20]; // response substring + MdmRespIDType id; // id associated with substring + } MdmRespEntryType; + + +/************************************************************ + * Modem Manager result codes + * (mdmErrorClass is defined in SystemMgr.h) + *************************************************************/ +//#define mdmErrBadParam (mdmErrorClass | 1) + + + +/************************************************************ + * Modem Manager Macros + *************************************************************/ + +#endif // __MODEM_PRV_H__ + diff --git a/sdk-1/include/Core/System/PadCommn.h b/sdk-1/include/Core/System/PadCommn.h new file mode 100644 index 0000000..0f13710 --- /dev/null +++ b/sdk-1/include/Core/System/PadCommn.h @@ -0,0 +1,118 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PadCommn.h + * + * Description: + * Common Packet Assembly / Disassembly Protocol(PADP) definitions. + * + * History: + * 8/8/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __PAD_COMMON_H__ +#define __PAD_COMMON_H__ + +#include + + +/******************************************************************** + * PADP Packet Format + ********************************************************************/ + +// The PADP packets are used for transmitting data for the Pilot PADP protocol layer. +// The structure of the PADP packet is built into the data part of the SLP packet and is, +// therefore, constrained by the SLP packet data size limitations. + + +// Packet type values used in the PADP packet header's "type" field: +// +typedef enum PadType { + padData = 1, // PADP data packet + padAck = 2, // PADP ACK packet + padUnused = 3, // used to be PADP NACK packet + padTickle = 4 // PADP TICLE packet + } PadType; + + +// PADP packet header: +// +typedef struct PadHeaderType { + Byte type; // PADP packet type + Byte flags; // flags to signal special conditions + Word sizeOrOffset; // (high, low) -- + // in the 1st padData packet of the block, this field holds the + // total block data size; in the subsequent padData packets, + // this field holds the offset of data being sent; in padNack + // packets, this field indicates the offset of the expected + // data. + } PadHeaderType; // TOTAL: 4 bytes + +typedef PadHeaderType* PadHeaderPtr; + +// Flag values used in the PADP packet header's "flags" field. padHdrFlagFirst and +// padHdrFlagLast must both be set when the entire data block is being transmitted +// in a single PADP packet. +// +#define padHdrFlagFirst 0x80 // identifies the 1st padData packet + // of the block + +#define padHdrFlagLast 0x40 // identifies the last padData packet + // of the block + +#define padHdrFlagErrMemory 0x20 // signals remote memory error in + // padAck packets + + + +/******************************************************************** + * PADP Protocol Parameters + ********************************************************************/ + + +// This is the maximum amount of data(in bytes) which may be sent in a single +// PADP packet(not including the PADP packet header) +// +#define padMaxPktDataSize (1*1024) + + +// This is the maximum amount of data which may be sent in one PADP block +// +#define padMaxBlockSize ((64L * 1024L) - 1L) + + +// This is the maximum number of retries for resending a given data packet +// +#define padMaxRetries 10 + + +// This is the maximum number of seconds to wait for an acknowledgement after sending +// a data packet +// +#define padAckWaitSec 2 + + +// This is the maximum number of seconds to wait for the next data packet to begin arriving +// +#define padInterPktTimeOutSec 30 // large value for debugging + + +// default max sec. to wait for command/reply +// +#define padCmdWaitSec 30 +#define padReplyWaitSec 30 + + +/******************************************************************** + * Macros + ********************************************************************/ + + + +#endif // __PAD_COMMON_H__ diff --git a/sdk-1/include/Core/System/PadServer.h b/sdk-1/include/Core/System/PadServer.h new file mode 100644 index 0000000..fb21393 --- /dev/null +++ b/sdk-1/include/Core/System/PadServer.h @@ -0,0 +1,206 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PadServer.h + * + * Description: + * Packet Assembly/Disassembly server-side definitions + * + * History: + * 7/17/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __PAD_SERVER_H__ +#define __PAD_SERVER_H__ + +// Pilot common definitions +#include +#include + +// Data Manager definitions +#include // for DmOpenRef + +// Common Session Protocol definitions +#include + +#include + + +/******************************************************************** + * PAD Server Parameters + ********************************************************************/ +#define psrMaxPktBufSize ( sizeof(PadHeaderType) + \ + padMaxPktDataSize ) + +// psrMinSerRcvBufSize: minimum serial receive buffer size needed +// for PAD Server. The extra 32 bytes are for beginning/end of queue +// and other serial manager overhead +#define psrMinSerRcvBufSize ( sizeof(SlkPktHeaderType) + \ + psrMaxPktBufSize + \ + sizeof(SlkPktFooterType) + \ + 32 ) + +// psrCmdWaitIntervalSec: when waiting for the beginning of a command, +// the PAD receiver will wait up to this many seconds before before timing +// out on the first packet. The higher-level routine will perform +// its regular maintenance tasks (such as checking for user cancel) around +// calls to the PAD receiver. +#define psrCmdWaitIntervalSec 2 + + +/************************************************************ + * Session Protocol result codes + * (padErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define psrErrParam (padErrorClass | 1) // invalid parameter +#define psrErrTooManyRetries (padErrorClass | 2) // too many retries +#define psrErrTimeOut (padErrorClass | 4) // call timed out +#define psrErrInUse (padErrorClass | 5) // PAD Server/WS manager is in use +#define psrErrMemory (padErrorClass | 6) // not enough memory +#define psrErrUserCan (padErrorClass | 7) // cancelled by user +#define psrErrSizeErr (padErrorClass | 8) // reply block is too big +#define psrErrBlockFormat (padErrorClass | 9) // block format error + + + + +/******************************************************************** + * Session Manager Structures + ********************************************************************/ + + +// +// Packet Assembly/Disassembly structures +// + + +// PAD sender-specific parameters +typedef struct PsrSendParamType { + Byte remoteSocket; // remote socket id + Byte transID; // transaction ID to use on block packets + + // Send segments specification: + Int segCount; // number of segments to send + PmSegmentPtr segP; // ptr to array of segments + + // Statistical information for fine-tuning and debugging: + ULong numAttempted; // number of data packets we attempted to send + ULong numAcked; // number of packets which were acked + ULong retries; // number of retries + } PsrSendParamType; + + +// PAD receiver-specific parameters +typedef struct PsrRcvParamType { + Byte filterTransID; // tranasaction id to filter out + DmOpenRef dbP; // database reference for allocating memory + + // Set by PrvReceiveCmdBlock: + VoidPtr cmdP; // ptr to command in dynamic heap chunk + VoidHand cmdBufH; // handle of command buffer chunk in data heap; + ULong blockSize; // size of block + ULong rcvdLen; // amount of data received so far + Byte transID; // received transaction id + Byte remoteSocket; // source socket + Boolean gotTickle; // Set to true if Tickle had been received + } PsrRcvParamType; + + +// PAD parameter for PrvSendReplyBlock and PrvReceiveCmdBlock: +typedef struct PsrPadParamType { + Byte localSocket; // local socket + SlkPktHeaderPtr slkHdrBufP; // ptr to buffer for serial link header + PadHeaderPtr pktBufP; // ptr to packet buffer of psrMaxPktBufSize bytes + Int initTimeoutSec;// initial receiver timeout seconds + + PsrSendParamType send; // PAD sender-specific params + PsrRcvParamType rcv; // PAD receiver-specific params + } PsrPadParamType; + +typedef PsrPadParamType* PsrPadParamPtr; + + +// +// PAD Server globals +// + +// Prototype for the "user cancel" check callback function +typedef Int (*PsrUserCanProcPtr)(DWord userRef); + +// Server globals +typedef struct PsrGlobalsType { + //Boolean inUse; // true when session is in use + //Boolean open; // true when session is open + Byte serverSocket; // session listenning socket + Int cmdWaitSec; // max seconds to wait for commands + // (-1 = forever) + PsrUserCanProcPtr canProcP; // ptr to user-cancel function + DWord userRef; // parameter for cancelProcP() + SlkPktHeaderType slkHdrBuf; // Serial Link header buffer + // packet data buffer + Word pktBuf[(psrMaxPktBufSize+1)/2]; + Byte lastRcvdCmdTID; // transaction id of last command received + // (for duplicate filtration) + + PsrPadParamType pad; // PAD routines parameter + } PsrGlobalsType; + +typedef PsrGlobalsType* PsrGlobalsPtr; + + +/******************************************************************** + * Session Manager Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +// +// Server API +// + +// RETURNED: 0 on success; otherwise: psrErrParam, psrErrInUse, +// psrErrMemory +Err PsrInit(Byte serverSocket, PsrUserCanProcPtr canProcP, DWord userRef, + Int cmdWaitSec) + SYS_TRAP(sysTrapPsrInit); + +// MUST be called when done with the session to clean up server info +// if PsrInit() was successful +// +// * RETURNED: 0 on success; otherwise: psrErrParam +Err PsrClose(void) SYS_TRAP(sysTrapPsrClose); + +// * RETURNED: 0 on success; otherwise: psrErrParam, psrErrTimeOut, +// * psrErrBlockFormat, psrErrUserCan +Err PsrGetCommand(DmOpenRef refDBP, VoidPtr* cmdPP, VoidHand* cmdBufHP, + WordPtr rcvdCmdLenP, BytePtr tidP, BytePtr remoteSocketP) + SYS_TRAP(sysTrapPsrGetCommand); + +// * RETURNED: 0 on success; otherwise: psrErrParam, psrErrTooManyRetries, +// * psrErrSizeErr, psrErrUserCan +Err PsrSendReply(Byte remoteSocket, Byte refTID, PmSegmentPtr segP, Int segCount) + SYS_TRAP(sysTrapPsrSendReply); + + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * Session Protocol Macros + ********************************************************************/ + + + +#endif // __PAD_SERVER_H__ diff --git a/sdk-1/include/Core/System/PadUtil.h b/sdk-1/include/Core/System/PadUtil.h new file mode 100644 index 0000000..ef4027c --- /dev/null +++ b/sdk-1/include/Core/System/PadUtil.h @@ -0,0 +1,74 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PadUtil.h + * + * Description: + * Packet Assembly/Disassembly utility definitions + * + * History: + * 8/11/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __PAD_UTIL_H__ +#define __PAD_UTIL_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Pilot common definitions + #include "Common.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Pilot common definitions + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + +// The PmSegmentType structure enables the caller to +// specify the block's data in multiple non-contiguous segments. For example, when +// sending a record, DesktopLink will specify the function header, the argument wrapper, +// the fixed record info, and the record data as two or more segments(one or more segments +// for the fixed structures and one segment for the record data). In such an instance, +// it is not practical(and sometimes not possible) to allocate a single data buffer to +// contain all that information contiguously. +// +typedef struct PmSegmentType { + VoidPtr dataP; // ptr to segment data + Word dataSize; // segment data size in bytes + Boolean wordAlign; // if true, this segments data will be sent + // at an even offset from the start of the + // block, padding the previous segment's + // data with a null byte, if necessary + } PmSegmentType; + +typedef PmSegmentType* PmSegmentPtr; + + +#ifdef __cplusplus +extern "C" { +#endif + +ULong PmAddSegmentSizes(Int segCount, PmSegmentType seg[]); + +ULong PmCopyFromSegments(VoidPtr bufP, Int segCount, PmSegmentType seg[], + ULong blockOffset, ULong maxSize); + + +#ifdef __cplusplus +} +#endif + + +#endif // __PAD_UTIL_H__ diff --git a/sdk-1/include/Core/System/PadWS.h b/sdk-1/include/Core/System/PadWS.h new file mode 100644 index 0000000..cb97edd --- /dev/null +++ b/sdk-1/include/Core/System/PadWS.h @@ -0,0 +1,211 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PadWS.h + * + * Description: + * Packet Assembly/Disassembly workstation-side definitions + * + * History: + * 8/11/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __PAD_WS_H__ +#define __PAD_WS_H__ + + + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Pilot common definitions + #include "Common.h" + #include "SerLink.h" + + // PAD Protocol definitions + #include "PadCommn.h" + #include "PadUtil.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Pilot common definitions + #include + #include + + // PAD Protocol definitions + #include + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + +/******************************************************************** + * Session Manager Parameters + ********************************************************************/ +#define pmMaxPktBufSize ( sizeof(PadHeaderType) + \ + padMaxPktDataSize ) + +// pmReplyWaitIntervalSec: when waiting for the beginning of a reply, +// the PAD receiver will wait up to this many seconds before before timing +// out on the first packet. The higher-level routine will perform +// its regular maintenance tasks (such as checking for user cancel) around +// calls to the PAD receiver. +#define pmReplyWaitIntervalSec 2 + + +/************************************************************ + * Session Protocol result codes + * (padErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define pmErrParam (padErrorClass | 1) // invalid parameter +#define pmErrTooManyRetries (padErrorClass | 2) // too many retries +#define pmErrTimedOut (padErrorClass | 4) // call timed out +#define pmErrInUse (padErrorClass | 5) // PAD Server/WS manager is in use +#define pmErrMemory (padErrorClass | 6) // not enough memory +#define pmErrUserCan (padErrorClass | 7) // cancelled by user +#define pmErrSizeErr (padErrorClass | 8) // reply block is too big +#define pmErrBlockFormat (padErrorClass | 9) // block format error +#define pmErrBufTooSmall (padErrorClass | 10) // buffer is too small +#define pmErrRemoteMemory (padErrorClass | 11) // remote memory error + + + + +/******************************************************************** + * Session Manager Structures + ********************************************************************/ + + +// +// Packet Assembly/Disassembly structures +// + +// PAD sender-specific parameters +typedef struct PmSendParamType { + // Send segments specification: + Int segCount; // number of segments to send + PmSegmentPtr segP; // ptr to array of segments + + // Statistical information for fine-tuning and debugging: + ULong numAttempted; // number of data packets we attempted to send + ULong numSucceeded; // number of packets successfully sent + ULong retries; // number of retries + } PmSendParamType; + + +// PAD receiver-specific parameters +typedef struct PmRcvParamType { + VoidPtr rcvBufP; // ptr to receive buffer + ULong rcvBufSize; // receive buffer size + + // Set by PrvReceiveReplyBlock: + ULong blockSize; // size of block + ULong rcvdLen; // amount of data received so far + } PmRcvParamType; + + +// PAD parameter for PrvSendCommandBlock and PrvReceiveReplyBlock: +typedef struct PmPadParamType { + Byte localSocket; // local socket + Byte remoteSocket; // remote socket + SlkPktHeaderPtr slkHdrBufP; // ptr to buffer for serial link header + PadHeaderPtr pktBufP; // ptr to packet buffer of pmMaxPktBufSize bytes + Int initTimeoutSec;// initial receiver timeout seconds + Byte transID; // current command/reply transaction ID + + PmSendParamType send; // PAD sender-specific params + PmRcvParamType rcv; // PAD receiver-specific params + } PmPadParamType; + +typedef PmPadParamType* PmPadParamPtr; + + + +// +// PAD Manager Workstation-end globals +// + +// Prototype for the "user cancel" check callback function +typedef Int (*PmUserCanProcPtr)(DWord userRef); + +typedef struct PmWSGlobalsType { + Int replyWaitSec; // maximum number of seconds to + // wait for a command reply + + PmUserCanProcPtr canProcP; // ptr to user-cancel function + DWord userRef; // parameter for cancelProcP() + + SlkPktHeaderType slkHdrBuf; // serial link header buffer + // packet data buffer + Word pktBuf[(pmMaxPktBufSize+1)/2]; + + // Transaction id of last request which we originated + Byte lastTID; // last sent transaction id + + PmPadParamType pad; // PAD routines parameter + } PmWSGlobalsType; + +typedef PmWSGlobalsType* PmWSGlobalsPtr; + + + +/******************************************************************** + * Session Manager Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +// +// Workstation API +// + +// RETURNED: 0 on success; otherwise: pmErrParam, pmErrInUse, +// pmErrMemory +Err PmInitWS(Byte wsSocket, Byte serverSocket, PmUserCanProcPtr canProcP, + DWord userRef, Int replyWaitSec); + +// MUST be called when done with the session to clean up workstation info +// if PmInitWS() was successful +// +// * RETURNED: 0 on success +Err PmCloseWS(void); + +// * RETURNED: 0 on success; +Err PmSendTickle(void); + +// * RETURNED: 0 on success; otherwise: pmErrParam, pmErrTimedOut, +// * pmErrBlockFormat, pmErrUserCan, pmErrSizeErr, pmErrBufTooSmall +Err PmSendCommand(PmSegmentPtr cmdSegP, Int cmdSegCount, Int replyWaitSec, + VoidPtr replyBufP, ULong replyBufSize, WordPtr replyLenP, + WordPtr actRcvdLenP); + +// * RETURNED: 0 on success; otherwise: pmErrParam, pmErrTimedOut, +// * pmErrBlockFormat, pmErrUserCan, pmErrSizeErr, pmErrBufTooSmall +Err PmReceiveReply( Int replyWaitSec, Byte refTID, VoidPtr replyBufP, + ULong replyBufSize, WordPtr replyLenP, WordPtr actRcvdLenP); + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * Session Protocol Macros + ********************************************************************/ + + + +#endif // __PAD_WS_H__ diff --git a/sdk-1/include/Core/System/PenMgr.h b/sdk-1/include/Core/System/PenMgr.h new file mode 100644 index 0000000..566e7c5 --- /dev/null +++ b/sdk-1/include/Core/System/PenMgr.h @@ -0,0 +1,95 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PenMgr.h + * + * Description: + * Include file for Pen manager + * + * History: + * 6/5/96 Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __PEN_MGR_H +#define __PEN_MGR_H + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Pen Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ +#define penErrBadParam (penErrorClass | 1) + + + +/******************************************************************** + * Pen manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initializes the Pen Manager +Err PenOpen(void) + SYS_TRAP(sysTrapPenOpen); + +// Closes the Pen Manager and frees whatever memory it allocated +Err PenClose(void) + SYS_TRAP(sysTrapPenClose); + + +// Put pen to sleep +Err PenSleep(void) + SYS_TRAP(sysTrapPenSleep); + +// Wake pen +Err PenWake(void) + SYS_TRAP(sysTrapPenWake); + + +// Get the raw pen coordinates from the hardware. +Err PenGetRawPen(PointType* penP) + SYS_TRAP(sysTrapPenGetRawPen); + +// Reset calibration in preparation for setting it again +Err PenResetCalibration (void) + SYS_TRAP(sysTrapPenResetCalibration); + +// Set calibration settings for the pen +Err PenCalibrate (PointType* digTopLeftP, PointType* digBotRightP, + PointType* scrTopLeftP, PointType* scrBotRightP) + SYS_TRAP(sysTrapPenCalibrate); + +// Scale a raw pen coordinate into screen coordinates +Err PenRawToScreen(PointType* penP) + SYS_TRAP(sysTrapPenRawToScreen); + +// Scale a screen pen coordinate back into a raw coordinate +Err PenScreenToRaw(PointType* penP) + SYS_TRAP(sysTrapPenScreenToRaw); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _PenGetRawPen \ + ASM_SYS_TRAP(sysTrapPenGetRawPen) + + + +#endif //__PEN_MGR_H diff --git a/sdk-1/include/Core/System/PenPrv.h b/sdk-1/include/Core/System/PenPrv.h new file mode 100644 index 0000000..d8834c3 --- /dev/null +++ b/sdk-1/include/Core/System/PenPrv.h @@ -0,0 +1,67 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PenPrv.h + * + * Description: + * Private Include file for Pen manager + * + * History: + * 6/5/96 Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __PEN_PRV_H +#define __PEN_PRV_H + + +/******************************************************************** + * Pen Manager Constants + ********************************************************************/ +#define penCalibrateTop 10 +#define penCalibrateLeft 10 +#define penCalibrateBottom (hwrDisplayHeight-10) +#define penCalibrateRight (hwrDisplayWidth-10) + +#define penInitDelay 30 +#define penInitMaxDDZ 12 // max change allowed in dx or dy between + // 2 samples. + +/******************************************************************** + * Pen Manager Globals + ********************************************************************/ +typedef struct PenGlobalsType { + UInt xOffset, yOffset; + UInt xScale, yScale; + + // This variable is incremented every time we detect the pen up, + // until we've seen it enough times to believe it. + UInt penRising; + + // We keep this information around in order to throw out invalid + // points. Invalid points are most likey to occur as the pen is lifted + // and we filter them by throwing out points that show a drastic + // change in velocity in either the x or y direction + Int lastX; // x of last point (-1 if no previous point) + Int lastY; // y of last point + Int lastDX; // delta y of previous 2 points + Int lastDY; // delta x of previous 2 points + + + // Parameters for filter + UInt delay; // delay before reading A/D + UInt maxDDZ; // max 2nd derivative. + + } PenGlobalsType; + +typedef PenGlobalsType* PenGlobalsPtr; + + + +#endif //__PEN_MGR_H +#endif // NON_PORTABLE diff --git a/sdk-1/include/Core/System/Preferences.h b/sdk-1/include/Core/System/Preferences.h new file mode 100644 index 0000000..5046460 --- /dev/null +++ b/sdk-1/include/Core/System/Preferences.h @@ -0,0 +1,179 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Preferences.h + * + * Description: + * Header for the system preferences + * + * History: + * 2/31/95 rsf - Created by Roger Flores + * + *******************************************************************/ + +#ifndef __PREFERENCES_H__ +#define __PREFERENCES_H__ + + +/*********************************************************************** + * Constants + ***********************************************************************/ + +#define preferenceDataVersion 1 + +#define defaultAutoOffDuration 2 // minutes + +#define prefFileTData 'PREF' // Database file type + +#if EMULATION_LEVEL == EMULATION_NONE + #define defaultSysSoundLevel slOn + #define defaultAlarmSoundLevel slOn +#else // EMULATION_LEVEL != EMULATION_NONE + #define defaultSysSoundLevel slOff + #define defaultAlarmSoundLevel slOn +#endif + +// This is Marketing's official list of countries. I didn't make this +// up - kcr. +typedef enum { + Australia, + Austria, + BelgiumDutch, + BelgiumFrench, + Brazil, + CanadaEnglish, + CanadaFrench, + Denmark, + Finland, + France, + Germany, + Iceland, + Ireland, + Italy, + Japan, + Mexico, + Netherlands, + NewZealand, + Norway, + Portugal, + SouthKorea, + Spain, + Sweden, + SwitzerlandFrench, + SwitzerlandGerman, + SwitzerlandItalian, + Taiwan, + UnitedStates, + UnitedKingdom + } CountryType; + +typedef enum { + tfColon, + tfColonAMPM, + tfColon24h, + tfDot, + tfDotAMPM, + tfDot24h, + tfHoursAMPM, + tfHours24h + } TimeFormatType; + +// These sound levels must corrospond to positions in the popup lists +// used by the preferences app. +typedef enum { + slOn = 0, + slOff = 1 + } SoundLevelType; + + +// pass a TimeFormatType +#define Use24HourFormat(t) ((t) == tfColon24h || (t) == tfDot24h || (t) == tfHours24h) +#define TimeSeparator(t) ( t >= tfDot ? '.' : ':') + + +typedef enum { + dfMDYWithSlashes, // 12/31/95 + dfDMYWithSlashes, // 31/12/95 + dfDMYWithDots, // 31.12.95 + dfDMYWithDashes, // 31-12-95 + dfYMDWithSlashes, // 95/12/31 + dfYMDWithDots, // 95.12.31 + dfYMDWithDashes, // 95-12-31 + + dfMDYLongWithComma, // Dec 31, 1995 + dfDMYLong, // 31 Dec 1995 + dfDMYLongWithDot, // 31. Dec 1995 + dfDMYLongNoDay, // Dec 1995 + dfDMYLongWithComma, // 31 Dec, 1995 + dfYMDLongWithDot, // 1995.12.31 + + dfMYMed // Dec '95 + } DateFormatType; + + +// The number format (thousands separator and decimal point). +typedef enum { + nfCommaPeriod, + nfPeriodComma, + nfSpaceComma, + nfApostrophePeriod + } NumberFormatType; + + + + +typedef struct { + Word version; // Version of preference info + + // International preferences + CountryType country; // Country the device is in + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Byte weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + + // system preferences + Byte autoOffDuration; // Time period before shutting off + SoundLevelType sysSoundLevel; // High, Med, Low, Off - error beeps + SoundLevelType alarmSoundLevel; // High, Med, Low, Off - alarm only + Boolean hideSecretRecords; // True to not display records with + // their secret bit attribute set + Boolean deviceLocked; // Device locked until the system + // password is entered + Word sysPrefFlags; // Miscellaneous system pref flags + // copied into the global GSysPrefFlags + // at boot time. + SysBatteryKind sysBatteryKind; // The type of batteries installed. This + // is copied into the globals GSysbatteryKind + // at boot time. + + } SystemPreferencesType; + + + +typedef SystemPreferencesType * SystemPreferencesPtr; + + +extern DmOpenRef PrefOpenPreferenceDB (void) + SYS_TRAP(sysTrapPrefOpenPreferenceDB); + +extern void PrefGetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefGetPreferences); + +extern void PrefSetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefSetPreferences); + +extern Boolean PrefGetAppPreferences (ULong type, Int version, VoidPtr prefs, + Word prefsSize) + SYS_TRAP(sysTrapPrefGetAppPreferences); + +void PrefSetAppPreferences (ULong type, Int version, VoidPtr prefs, + Word prefsSize) + SYS_TRAP(sysTrapPrefSetAppPreferences); + +#endif // __PREFERENCES_H__ diff --git a/sdk-1/include/Core/System/SerialLib68328.h b/sdk-1/include/Core/System/SerialLib68328.h new file mode 100644 index 0000000..4f4b50e --- /dev/null +++ b/sdk-1/include/Core/System/SerialLib68328.h @@ -0,0 +1,59 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLib68328.h + * + * Description: + * Include file for 68328 Serial Library + * + * History: + * 2/7/95 Created by Ron Marianetti + * vmk 8/21/95 Added defQData field to serial globals + * + *******************************************************************/ + +#ifndef __SERIAL_LIB_68328_H +#define __SERIAL_LIB_68328_H + + +// Pilot common definitions +#include + + +/******************************************************************** + * Serial Globals + ********************************************************************/ +typedef struct SerGlobalsType { + UInt openCount; // # of times we've been opened + Int port; // DOLATER... NOT NEEDED ??? + SerSettingsType settings; + Word lineErrors; // line errors bitfield + + // Receive Queue. When the queue is empty, qStart == qEnd. When the queue + // is full, qStart = qEnd-1 (taking wrap-around into account if necessary). + Word qStart; // start offset of queue + Word qEnd; // end offset of queue + Word qSize; // size of queue + Ptr qData; // pointer to queue data + Ptr defQData; // pointer to default queue data + + // Receive Queue semaphore info + Word smSignalSize; // How much the semaphore is waiting for + Long smID; // semaphore ID + + DWord lastRcvTicks; // tick count of last received char + + // For debugging + Word numReceived; // # of chars received since serial manager opened + Word lastErrorStatus; // receiver status of last line error + Word numRcvErrors; // # of receive line errors since serial manager opened + } SerGlobalsType; +typedef SerGlobalsType* SerGlobalsPtr; + +#define serDefaultRcvBufferSize 0x200 + +#endif //__SERIAL_LIB_68328_H diff --git a/sdk-1/include/Core/System/SerialLib68681.h b/sdk-1/include/Core/System/SerialLib68681.h new file mode 100644 index 0000000..379e715 --- /dev/null +++ b/sdk-1/include/Core/System/SerialLib68681.h @@ -0,0 +1,58 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLib68328.h + * + * Description: + * Include file for 68328 Serial Library + * + * History: + * 2/7/95 Created by Ron Marianetti + * vmk 8/21/95 Added defQData field to serial globals + * + *******************************************************************/ + +#ifndef __SERIAL_LIB_68681_H +#define __SERIAL_LIB_68681_H + + +// Pilot common definitions +#include + + +/******************************************************************** + * Serial Globals + ********************************************************************/ +typedef struct SerGlobalsType { + UInt openCount; // # of times we've been opened + Int port; + SerSettingsType settings; + Word lineErrors; // line errors bitfield + + + VoidPtr chanP; // pointer to this channel base in UART + Boolean staticGlobals; // true when initialized for debugger only + + // Receive Queue. When the queue is empty, qStart == qEnd. When the queue + // is full, qStart = qEnd-1 (taking wrap-around into account if necessary). + Word qStart; // start offset of queue + Word qEnd; // end offset of queue + Word qSize; // size of queue + Ptr qData; // pointer to queue data + Ptr defQData; // pointer to default queue data + + // Receive Queue semaphore info + Word smSignalSize; // How much the semaphore is waiting for + Long smID; // semaphore ID + + Byte currentIMR; // current value of interrupt mask register + } SerGlobalsType; +typedef SerGlobalsType* SerGlobalsPtr; + +#define serDefaultRcvBufferSize 0x200 + +#endif //__SERIAL_LIB_68681_H diff --git a/sdk-1/include/Core/System/SerialLibMac.h b/sdk-1/include/Core/System/SerialLibMac.h new file mode 100644 index 0000000..7e13136 --- /dev/null +++ b/sdk-1/include/Core/System/SerialLibMac.h @@ -0,0 +1,46 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLibMac.h + * + * Description: + * Include file for Mac Serial Library + * + * History: + * 6/30/95 Created by Vitaly Kruglikov + * + *******************************************************************/ + +#ifndef __SERIAL_LIB_MAC_H +#define __SERIAL_LIB_MAC_H + + +// Pilot common definitions +#include "Common.h" +#include "SerialMgr.h" + + +/******************************************************************** + * Serial Globals + ********************************************************************/ +typedef struct SerMacGlobalsType { + UInt refNum; // port reference number + UInt openCount; // number of times we have been opened + UInt port; + SerSettingsType settings; + Word lineErrors; // line errors bitfield + + short inRefNum; // input driver reference number + short outRefNum; // output driver reference number + Ptr inBufP; // custom input buffer ptr + } SerMacGlobalsType; +typedef SerMacGlobalsType* SerMacGlobalsPtr; + +#define serDefaultRcvBufferSize (30*1024) + + +#endif //__SERIAL_LIB_MAC_H diff --git a/sdk-1/include/Core/System/SerialLinkMgr.h b/sdk-1/include/Core/System/SerialLinkMgr.h new file mode 100644 index 0000000..999e024 --- /dev/null +++ b/sdk-1/include/Core/System/SerialLinkMgr.h @@ -0,0 +1,432 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLinkMgr.c + * + * Description: + * Source for Serial Link Routines on Pilot + * + * History: + * 2/6/95 replaces DSerial.h from Debugger + * + *******************************************************************/ + +#ifndef __SERIAL_LINK_H +#define __SERIAL_LINK_H + + + +// Pilot common definitions +#include +#include + + + +//************************************************************************* +// Pre-defined, fixxed Socket ID's +//************************************************************************* +#define slkSocketDebugger 0 // Debugger Socket +#define slkSocketConsole 1 // Console Socket +#define slkSocketRemoteUI 2 // Remote UI Socket +#define slkSocketDLP 3 // Desktop Link Socket +#define slkSocketFirstDynamic 4 // first dynamic socket ID + + +//************************************************************************* +// Packet Types +//************************************************************************* +#define slkPktTypeSystem 0 // System packets +#define slkPktTypeUnused1 1 // used to be: Connection Manager packets +#define slkPktTypePAD 2 // PAD Protocol packets +#define slkPktTypeLoopBackTest 3 // Loop-back test packets + + + +//************************************************************************* +// +// Packet structure: +// header +// body (0-dbgMaxPacketBodyLength bytes of data) +// footer +// +//************************************************************************* + +//---------------------------------------------------------------------- +// packet header +// Fields marked with -> must be filled in by caller +// Fields marked with X will be filled in by SlkSendPacket. +//---------------------------------------------------------------------- + +typedef Byte SlkPktHeaderChecksum; + +typedef struct SlkPktHeaderType { + Word signature1; // X first 2 bytes of signature + Byte signature2; // X 3 and final byte of signature + Byte dest; // -> destination socket Id + Byte src; // -> src socket Id + Byte type; // -> packet type + Word bodySize; // X size of body + Byte transId; // -> transaction Id + // if 0 specified, it will be replaced + SlkPktHeaderChecksum checksum; // X check sum of header + } SlkPktHeaderType; + +typedef SlkPktHeaderType* SlkPktHeaderPtr; + +#define slkPktHeaderSignature1 0xBEEF +#define slkPktHeaderSignature2 0xED + +#define slkPktHeaderSigFirst 0xBE // First byte +#define slkPktHeaderSigSecond 0xEF // second byte +#define slkPktHeaderSigThird 0xED // third byte + +//---------------------------------------------------------------------- +// packet footer +//---------------------------------------------------------------------- +typedef struct SlkPktFooterType { + Word crc16; // header and body crc + } SlkPktFooterType; + +typedef SlkPktFooterType* SlkPktFooterPtr; + + +//************************************************************************* +// +// Write Data Structure passed to SlkSendPacket. This structure +// Tells SlkSendPacket where each of the chunks that comprise the body are +// and the size of each. SlkSendPacket accepts a pointer to an array +// of SlkWriteDataTypes, the last one has a size field of 0. +// +//************************************************************************* +typedef struct SlkWriteDataType { + Word size; // last one has size of 0 + void* dataP; // pointer to data + } SlkWriteDataType; +typedef SlkWriteDataType* SlkWriteDataPtr; + + + + +//************************************************************************* +// +// CPU-dependent macros for getting/setting values from/to packets +// +//************************************************************************* + +//-------------------------------------------------------------------- +// macros to get packet values +//-------------------------------------------------------------------- + +#define slkGetPacketByteVal(srcP) (*(BytePtr)(srcP)) + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketWordVal(srcP) \ + ( (Word) \ + ( \ + ((Word)((BytePtr)(srcP))[0] << 8) | \ + ((Word)((BytePtr)(srcP))[1]) \ + ) \ + ) +#else +#define slkGetPacketWordVal(srcP) \ + ( *((WordPtr)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketDWordVal(srcP) \ + ( (DWord) \ + ( \ + ((DWord)((BytePtr)(srcP))[0] << 24) | \ + ((DWord)((BytePtr)(srcP))[1] << 16) | \ + ((DWord)((BytePtr)(srcP))[2] << 8) | \ + ((DWord)((BytePtr)(srcP))[3]) \ + ) \ + ) +#else +#define slkGetPacketDWordVal(srcP) \ + ( *((DWordPtr)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#define slkGetPacketSignature1(sigP) \ + slkGetPacketWordVal(sigP) + +#define slkGetPacketSignature2(sigP) \ + slkGetPacketByteVal(sigP) + + +#define slkGetPacketDest(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketSrc(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketType(commandP) \ + slkGetPacketByteVal(commandP) + + +#define slkGetPacketBodySize(lengthP) \ + slkGetPacketWordVal(lengthP) + +#define slkGetPacketTransId(transIDP) \ + slkGetPacketByteVal(transIDP) + +#define slkGetPacketHdrChecksum(checksumP) \ + slkGetPacketByteVal(checksumP) + + +#define slkGetPacketTotalChecksum(checksumP) \ + slkGetPacketWordVal(checksumP) + + + + + + +//-------------------------------------------------------------------- +// macros to set packet values +//-------------------------------------------------------------------- + + +#define slkSetPacketByteVal(srcByteVal, destP) \ + ( *(BytePtr)(destP) = (Byte)(srcByteVal) ) + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketWordVal(srcWordVal, destP) \ + \ + do { \ + Word ___srcVal; \ + BytePtr ___srcValP; \ + \ + ___srcVal = (Word)(srcWordVal); \ + ___srcValP = (BytePtr)(&___srcVal); \ + \ + ((BytePtr)(destP))[0] = ___srcValP[1]; \ + ((BytePtr)(destP))[1] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketWordVal(srcWordVal, destP) \ + ( *((WordPtr)(destP)) = (Word)(srcWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + do { \ + DWord ___srcVal; \ + BytePtr ___srcValP; \ + \ + ___srcVal = (DWord)(srcDWordVal); \ + ___srcValP = (BytePtr)(&___srcVal); \ + \ + ((BytePtr)(destP))[0] = ___srcValP[3]; \ + ((BytePtr)(destP))[1] = ___srcValP[2]; \ + ((BytePtr)(destP))[2] = ___srcValP[1]; \ + ((BytePtr)(destP))[3] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + ( *((DWordPtr)(destP)) = (DWord)(srcDWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + + +#define slkSetPacketSignature1(magic, destP) \ + slkSetPacketWordVal(magic, destP) + +#define slkSetPacketSignature2(magic, destP) \ + slkSetPacketByteVal(magic, destP) + + +#define slkSetPacketDest(dest, destP) \ + slkSetPacketByteVal(dest, destP) + +#define slkSetPacketSrc(src, destP) \ + slkSetPacketByteVal(src, destP) + + +#define slkSetPacketType(type, destP) \ + slkSetPacketByteVal(type, destP) + + +#define slkSetPacketBodySize(numBytes, destP) \ + slkSetPacketWordVal(numBytes, destP) + + +#define slkSetPacketTransId(transID, destP) \ + slkSetPacketByteVal(transID, destP) + +#define slkSetPacketHdrChecksum(checksum, destP) \ + slkSetPacketByteVal(checksum, destP) + +#define slkSetPacketTotalChecksum(checksum, destP) \ + slkSetPacketWordVal(checksum, destP) + + + + + + +/******************************************************************* + * Serial Link Manager Errors + * the constant slkErrorClass is defined in SystemMgr.h + *******************************************************************/ +#define slkErrChecksum (slkErrorClass | 1) +#define slkErrFormat (slkErrorClass | 2) +#define slkErrBuffer (slkErrorClass | 3) +#define slkErrTimeOut (slkErrorClass | 4) +#define slkErrHandle (slkErrorClass | 5) +#define slkErrBodyLimit (slkErrorClass | 6) +#define slkErrTransId (slkErrorClass | 7) +#define slkErrResponse (slkErrorClass | 8) +#define slkErrNoDefaultProc (slkErrorClass | 9) +#define slkErrWrongPacketType (slkErrorClass | 10) +#define slkErrBadParam (slkErrorClass | 11) +#define slkErrAlreadyOpen (slkErrorClass | 12) +#define slkErrOutOfSockets (slkErrorClass | 13) +#define slkErrSocketNotOpen (slkErrorClass | 14) +#define slkErrWrongDestSocket (slkErrorClass | 15) +#define slkErrWrongPktType (slkErrorClass | 16) +#define slkErrBusy (slkErrorClass | 17) // called while sending a packet + // only returned on single-threaded + // emulation implementations +#define slkErrNotOpen (slkErrorClass | 18) + + + +/******************************************************************* + * Type definition for a Serial Link Socket Listener + * + *******************************************************************/ +typedef void (*SlkSocketListenerProcPtr) + (SlkPktHeaderPtr headerP, void* bodyP); + +typedef struct SlkSocketListenType { + SlkSocketListenerProcPtr listenerP; + SlkPktHeaderPtr headerBufferP; // App allocated buffer for header + void* bodyBufferP; // App allocated buffer for body + ULong bodyBufferSize; + } SlkSocketListenType; +typedef SlkSocketListenType* SlkSocketListenPtr; + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// Initializes the Serial Link Manager +//------------------------------------------------------------------- +Err SlkOpen(void) + SYS_TRAP(sysTrapSlkOpen); + +//------------------------------------------------------------------- +// Close down the Serial Link Manager +//------------------------------------------------------------------- +Err SlkClose(void) + SYS_TRAP(sysTrapSlkClose); + + + + +//------------------------------------------------------------------- +// Open up another Serial Link socket. The caller must have already +// opened the comm library and set it to the right settings. +//------------------------------------------------------------------- +Err SlkOpenSocket(UInt libRefNum, UIntPtr socketP, Boolean staticSocket) + SYS_TRAP(sysTrapSlkOpenSocket); + +//------------------------------------------------------------------- +// Close up a Serial Link socket. +// Warning: This routine is assymetrical with SlkOpenSocket because it +// WILL CLOSE the library for the caller (unless the refNum is the +// refNum of the debugger comm library). +//------------------------------------------------------------------- +Err SlkCloseSocket(UInt socket) + SYS_TRAP(sysTrapSlkCloseSocket); + + +//------------------------------------------------------------------- +// Get the library refNum for a particular Socket +//------------------------------------------------------------------- +Err SlkSocketRefNum(UInt socket, UIntPtr refNumP) + SYS_TRAP(sysTrapSlkSocketRefNum); + + +//------------------------------------------------------------------- +// Set the in-packet timeout for a socket +//------------------------------------------------------------------- +Err SlkSocketSetTimeout(UInt socket, Long timeout) + SYS_TRAP(sysTrapSlkSocketSetTimeout); + + + + + +//------------------------------------------------------------------- +// Flush a Socket +//------------------------------------------------------------------- +Err SlkFlushSocket(UInt socket, Long timeout) + SYS_TRAP(sysTrapSlkFlushSocket); + + +//------------------------------------------------------------------- +// Set up a Socket Listener +//------------------------------------------------------------------- +Err SlkSetSocketListener(UInt socket, SlkSocketListenPtr socketP) + SYS_TRAP(sysTrapSlkSetSocketListener); + + +//------------------------------------------------------------------- +// Sends a packet's header, body, footer. Stuffs the header's +// magic number and checksum fields. Expects all other +// header fields to be filled in by caller. +// errors returned: dseHandle, dseLine, dseIO, dseParam, dseBodyLimit, +// dseOther +//------------------------------------------------------------------- +Err SlkSendPacket(SlkPktHeaderPtr headerP, SlkWriteDataPtr writeList) + SYS_TRAP(sysTrapSlkSendPacket); + + +//------------------------------------------------------------------- +// Receives and validates an entire packet. +// errors returned: dseHandle, dseParam, dseLine, dseIO, dseFormat, +// dseChecksum, dseBuffer, dseBodyLimit, dseTimeOut, +// dseOther +//------------------------------------------------------------------- +Err SlkReceivePacket( UInt socket, Boolean andOtherSockets, + SlkPktHeaderPtr headerP, void* bodyP, UInt bodySize, + Long timeout) + SYS_TRAP(sysTrapSlkReceivePacket); + + +//------------------------------------------------------------------- +// Do Default processing of a System packet +//------------------------------------------------------------------- +Err SlkSysPktDefaultResponse(SlkPktHeaderPtr headerP, void* bodyP) + SYS_TRAP(sysTrapSlkSysPktDefaultResponse); + +//------------------------------------------------------------------- +// Do RPC call +//------------------------------------------------------------------- +Err SlkProcessRPC(SlkPktHeaderPtr headerP, void* bodyP) + SYS_TRAP(sysTrapSlkProcessRPC); + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIAL_LINK_H diff --git a/sdk-1/include/Core/System/SerialLinkPrv.h b/sdk-1/include/Core/System/SerialLinkPrv.h new file mode 100644 index 0000000..1edf984 --- /dev/null +++ b/sdk-1/include/Core/System/SerialLinkPrv.h @@ -0,0 +1,81 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLinkPrv.c + * + * Description: + * Private Serial Link includes + * + * History: + * 2/6/95 replaces DSerial.h from Debugger + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __SERIALLINKPRV_H +#define __SERIALLINKPRV_H + +#include + + +//************************************************************************* +// Misc Constants +//************************************************************************* +// Default timeout value once into receiving a packet in ticks +#define slkDefaultInPktTimeout (sysTicksPerSecond*2) + + + + +/******************************************************************* + * Serial Link Globals + * + *******************************************************************/ +#define slkMaxSockets 5 // max # of sockets +#define slkMaxRefNums slkMaxSockets // max # of refNums in use at any one time +#define slkAnySocket 0xFF + +#define slkEmptyRefNum 0xFF // used to track empty refInfos + +// We keep an array of these (slkMaxSockets in size) to track which +// librarie's we've received packet headers for. Since we can have up +// to slkMaxSockets unique refNums in use at any one time, we must make +// the array at least that size. +typedef struct SlkRefInfoType { + Byte refNum; // refNum of library, or 0xFF if empty + SByte destID; // dest socketID, or -1 if none + } SlkRefInfoType; +typedef SlkRefInfoType* SlkRefInfoPtr; + +typedef struct SlkGlobalsType { + UInt openCount; + + Byte socketRefNum[slkMaxSockets]; + Boolean socketOpen[slkMaxSockets]; + SlkSocketListenPtr socketListenP[slkMaxSockets]; + Word socketTimeout[slkMaxSockets]; // inPacket timeout + + + // We can keep track of packets coming in for up to slkMaxRefNums libraries. + // This array holds the destination socket ID for packets received from + // each library. + SlkRefInfoType refInfo[slkMaxRefNums]; + + Byte transId; // next transaction ID + Long xmitSemaphoreID; // Semaphore ID for transmitting + Word numReceived; // # of packets received since serial link + // was opened. + } SlkGlobalsType; + +typedef SlkGlobalsType* SlkGlobalsPtr; + + + +#endif //__SERIALLINKPRV_H + +#endif //NON_PORTABLE diff --git a/sdk-1/include/Core/System/SerialMgr.h b/sdk-1/include/Core/System/SerialMgr.h new file mode 100644 index 0000000..d9f3c31 --- /dev/null +++ b/sdk-1/include/Core/System/SerialMgr.h @@ -0,0 +1,192 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialMgr.h + * + * Description: + * Include file for Serial manager + * + * History: + * 2/7/95 Created by Ron Marianetti + * 7/6/95 vmk added serDefaultSettings + * + *******************************************************************/ + +#ifndef __SERIAL_MGR_H +#define __SERIAL_MGR_H + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Serial Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ +#define serErrBadParam (serErrorClass | 1) +#define serErrBadPort (serErrorClass | 2) +#define serErrNoMem (serErrorClass | 3) +#define serErrBadConnID (serErrorClass | 4) +#define serErrTimeOut (serErrorClass | 5) +#define serErrLineErr (serErrorClass | 6) +#define serErrAlreadyOpen (serErrorClass | 7) +#define serErrStillOpen (serErrorClass | 8) +#define serErrNotOpen (serErrorClass | 9) + + +/******************************************************************** + * Serial Settings Descriptor + ********************************************************************/ +typedef struct SerSettingsType { + ULong baudRate; // baud rate + ULong flags; // miscellaneous settings + Long ctsTimeout; // max # of ticks to wait for CTS to become asserted + // before transmitting; used only when + // configured with serSettingsFlagCTSAutoM. + } SerSettingsType; +typedef SerSettingsType* SerSettingsPtr; + +#define serSettingsFlagStopBitsM 0x00000001 // mask for stop bits field +#define serSettingsFlagStopBits1 0x00000000 // 1 stop bits +#define serSettingsFlagStopBits2 0x00000001 // 2 stop bits +#define serSettingsFlagParityOnM 0x00000002 // mask for parity on +#define serSettingsFlagParityEvenM 0x00000004 // mask for parity even +#define serSettingsFlagXonXoffM 0x00000008 // mask for Xon/Xoff flow control +#define serSettingsFlagRTSAutoM 0x00000010 // mask for RTS rcv flow control +#define serSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control +#define serSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char +#define serSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char +#define serSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char +#define serSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char +#define serSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char + + +// Default settings +#define serDefaultSettings (serSettingsFlagBitsPerChar8 | \ + serSettingsFlagStopBits1 | \ + serSettingsFlagRTSAutoM) + +#define serDefaultCTSTimeout (5*sysTicksPerSecond); + +// +// mask values for the lineErrors from SerGetStatus +// +#define serLineErrorParity 0x0001 // parity error +#define serLineErrorHWOverrun 0x0002 // HW overrun +#define serLineErrorFraming 0x0004 // framing error +#define serLineErrorBreak 0x0008 // break signal asserted +#define serLineErrorHShake 0x0010 // line hand-shake error +#define serLineErrorSWOverrun 0x0020 // HW overrun + + + + +/******************************************************************** + * Serial Library Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +// Acquires and opens a serial port with given baud and default settings. +Err SerOpen(UInt refNum, UInt port, ULong baud) + SYS_TRAP(sysLibTrapOpen); + +// Closes the serial connection previously opened with SerOpen. +Err SerClose(UInt refNum) + SYS_TRAP(sysLibTrapClose); + +// Puts serial library to sleep +Err SerSleep(UInt refNum) + SYS_TRAP(sysLibTrapSleep); + +// Wake Serial library +Err SerWake(UInt refNum) + SYS_TRAP(sysLibTrapWake); + +// Get attributes of the serial connection +Err SerGetSettings(UInt refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom); + +// Set attributes of the serial connection +Err SerSetSettings(UInt refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom+1); + +// Return status of serial connection +Word SerGetStatus(UInt refNum, BooleanPtr ctsOnP, + BooleanPtr dsrOnP) + SYS_TRAP(sysLibTrapCustom+2); + +// Reset error condition of serial connection +Err SerClearErr(UInt refNum) + SYS_TRAP(sysLibTrapCustom+3); + + + + +// Sends a buffer of data (may queue it up and return). +Err SerSend(UInt refNum, VoidPtr bufP, ULong size) + SYS_TRAP(sysLibTrapCustom+4); + +// Waits until the serial transmit buffer empties. +Err SerSendWait(UInt refNum, Long timeout) + SYS_TRAP(sysLibTrapCustom+5); + +// Returns how many characters are left in the send queue waiting +// for transmission +Err SerSendCheck(UInt refNum, ULongPtr numBytesP) + SYS_TRAP(sysLibTrapCustom+6); + +// Flushes the data out of the transmit buffer +Err SerSendFlush(UInt refNum) + SYS_TRAP(sysLibTrapCustom+7); + + + + +// Receives a buffer of data of the given size. +Err SerReceive(UInt refNum, VoidPtr bufP, ULong bytes, Long timeout) + SYS_TRAP(sysLibTrapCustom+8); + +// Waits for at least 'bytes' bytes of data to arrive at the serial input. +// but does not read them in +Err SerReceiveWait(UInt refNum, ULong bytes, Long timeout) + SYS_TRAP(sysLibTrapCustom+9); + +// Returns how many characters are in the receive queue +Err SerReceiveCheck(UInt refNum, ULongPtr numBytesP) + SYS_TRAP(sysLibTrapCustom+10); + +// Flushes any data coming into the serial port, discarding the data. +void SerReceiveFlush(UInt refNum, Long timeout) + SYS_TRAP(sysLibTrapCustom+11); + + +// Specify a new input buffer. To restore the original buffer, pass +// bufSize = 0. +Err SerSetReceiveBuffer(UInt refNum, VoidPtr bufP, UInt bufSize) + SYS_TRAP(sysLibTrapCustom+12); + + +// The receive character interrupt service routine, called by kernel when +// a UART interrupt is detected. DOLATER... generalize ISP's for multiple Serial libs +Boolean SerReceiveISP(void) + SYS_TRAP(sysTrapSerReceiveISP); + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIAL_MGR_H diff --git a/sdk-1/include/Core/System/SoundMgr.h b/sdk-1/include/Core/System/SoundMgr.h new file mode 100644 index 0000000..18236bc --- /dev/null +++ b/sdk-1/include/Core/System/SoundMgr.h @@ -0,0 +1,161 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SoundMgr.h + * + * Description: + * Include file for Sound Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __SOUNDMGR_H__ +#define __SOUNDMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Sound Manager constants + * + *************************************************************/ + +// Sound Manager max and default volume levels +#define sndMaxAmp 64 +//#define sndVolumeMask 0x0ff +#define sndDefaultAmp sndMaxAmp + + +/************************************************************ + * Sound Manager data structures + * + *************************************************************/ + +// +// Command numbers for SndCommandType's cmd field +// +typedef enum SndCmdIDType { + + sndCmdFreqDurationAmp = 1 // play a sound + // param1 = frequency in Hz + // param2 = duration in milliseconds + // param3 = amplitude (0 - sndMaxAmp) + + } SndCmdIDType; + +// +// SndCommandType: used by SndDoCmd() +// + +typedef struct SndCommandType { +SndCmdIDType cmd; // command id +Long param1; // first parameter +UInt param2; // second parameter +UInt param3; // third parameter +} SndCommandType; + +typedef SndCommandType* SndCommandPtr; + + +// +// Beep numbers used by SndSysBeep() +// + +typedef enum SndSysBeepType { + sndInfo = 1, + sndWarning, + sndError, + sndStartUp, + sndAlarm, + sndConfirmation, + sndClick + } SndSysBeepType; + + + +/************************************************************ + * Sound Manager result codes + * (sndErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define sndErrBadParam (sndErrorClass | 1) +#define sndErrBadChannel (sndErrorClass | 2) +#define sndErrMemory (sndErrorClass | 3) +#define sndErrOpen (sndErrorClass | 4) +#define sndErrQFull (sndErrorClass | 5) +#define sndErrQEmpty (sndErrorClass | 6) // internal + + + +/******************************************************************** + * Sound Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- + +// Initializes the Sound Manager. Should only be called by +// Pilot initialization code. +Err SndInit(void) SYS_TRAP(sysTrapSndInit); + +// Frees the Sound Manager. +//void SndFree(void) SYS_TRAP(sysTrapSndFree); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// Sets default sound volume levels +// +// Any parameter may be passed as NULL +void SndSetDefaultVolume(UIntPtr alarmAmpP, UIntPtr sysAmpP, UIntPtr defAmpP) + SYS_TRAP(sysTrapSndSetDefaultVolume); + +// Gets default sound volume levels +// +// Any parameter may be passed as NULL +void SndGetDefaultVolume(UIntPtr alarmAmpP, UIntPtr sysAmpP, UIntPtr defAmpP) + SYS_TRAP(sysTrapSndGetDefaultVolume); + +// Executes a sound command on the given sound channel (pass +// channelP = 0 to use the shared channel). +Err SndDoCmd(VoidPtr /*SndChanPtr*/ channelP, SndCommandPtr cmdP, Boolean noWait) + SYS_TRAP(sysTrapSndDoCmd); + +// Plays one of several defined system beeps/sounds (see sndSysBeep... +// constants). +void SndPlaySystemSound(SndSysBeepType beepID) + SYS_TRAP(sysTrapSndPlaySystemSound); + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Sound Manager Macros + * + *************************************************************/ + +#endif // __SOUND_MGR_H__ + diff --git a/sdk-1/include/Core/System/SoundPrv.h b/sdk-1/include/Core/System/SoundPrv.h new file mode 100644 index 0000000..6bb227c --- /dev/null +++ b/sdk-1/include/Core/System/SoundPrv.h @@ -0,0 +1,61 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SoundPrv.h + * + * Description: + * Private Include file for Sound Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __SOUNDPRV_H__ +#define __SOUNDPRV_H__ + + + +/************************************************************ + * Sound Manager constants + *************************************************************/ + +#define sndSamplingRate 8000 // 8 kHz + + +// DOLATER: determine appropriate values experimentally (TBD) +#define sndBeepDurationMSec 70 // msec +#define sndConfirmationDurationMSec 70 // msec +#define sndClickDurationMSec 9 // msec + +// These frequencies are more audible on the current hardware. +#define sndInfoFreq 500 // Hz +#define sndWarningFreq 500 // Hz +#define sndErrorFreq 500 // Hz +#define sndConfirmationFreq 500 // Hz +#define sndStartUpFreq 1000 // Hz +#define sndClickFreq 200 // Hz + + +/******************************************************************* + * Sound Manager Globals + * + *******************************************************************/ +typedef struct SndGlobalsType { + Long smID; // semaphore id for data access integrity + Byte sysAmp; // system sound amplitude(0-sndMaxVolume) + Byte alarmAmp; // alarm sound amplitude(0-sndMaxVolume) + Byte defAmp; // default amplitude for other sounds(0-sndMaxVolume) + } SndGlobalsType; + +typedef SndGlobalsType* SndGlobalsPtr; + + +#endif // __SOUNDPRV_H__ +#endif // NON_PORTABLE diff --git a/sdk-1/include/Core/System/StringMgr.h b/sdk-1/include/Core/System/StringMgr.h new file mode 100644 index 0000000..d93f1ac --- /dev/null +++ b/sdk-1/include/Core/System/StringMgr.h @@ -0,0 +1,74 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * StringMgr.h + * + * Description: + * String manipulation functions + * + * History: + * 11/09/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + + + +#ifndef __STRINGMGR_H__ +#define __STRINGMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +#ifdef __cplusplus +extern "C" { +#endif + +// String Manipulation routines +CharPtr StrCopy(CharPtr dst, CharPtr src) + SYS_TRAP(sysTrapStrCopy); + +CharPtr StrCat(CharPtr dst, CharPtr src) + SYS_TRAP(sysTrapStrCat); + +UInt StrLen(CharPtr src) + SYS_TRAP(sysTrapStrLen); + +Int StrCompare(CharPtr s1, CharPtr s2) + SYS_TRAP(sysTrapStrCompare); + +Int StrCaselessCompare(CharPtr s1, CharPtr s2) + SYS_TRAP(sysTrapStrCaselessCompare); + +CharPtr StrToLower(CharPtr dst, CharPtr src) + SYS_TRAP(sysTrapStrToLower); + +CharPtr StrIToA(CharPtr s, Long i) + SYS_TRAP(sysTrapStrIToA); + +CharPtr StrIToH(CharPtr s, ULong i) + SYS_TRAP(sysTrapStrIToH); + +CharPtr StrChr (CharPtr str, Int chr) + SYS_TRAP(sysTrapStrChr); + +CharPtr StrStr (CharPtr str, CharPtr token) + SYS_TRAP(sysTrapStrStr); + +Int StrAToI (CharPtr str) + SYS_TRAP(sysTrapStrAToI); + +#ifdef __cplusplus +} +#endif + + + + +#endif //__STRINGMGR_H diff --git a/sdk-1/include/Core/System/SysAll.h b/sdk-1/include/Core/System/SysAll.h new file mode 100644 index 0000000..ada2156 --- /dev/null +++ b/sdk-1/include/Core/System/SysAll.h @@ -0,0 +1,64 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysAll.h + * + * Description: + * Includes all system header files in order to help compiler + * do pre-compiled headers + * + * History: + * 11/17/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __SYSALL_H__ +#define __SYSALL_H__ + + +//********************************************************************* +// If not included from Pilot.h, as is the case when compiling UI modules, +// use the SysAll pre-compiled header file. +//********************************************************************* +#ifndef __Pilot_H__ +#ifndef __GNUC__ + #ifndef PILOT_PRECOMPILED_HEADERS_OFF + #if !__option(precompile) + #ifdef CMD_LINE_BUILD + #include "SysAll.h.obj.mpw" + #else + #include "SysAll.h.obj" + #endif + #define __INCLUDED_SYSALL_H_OBJ__ + #endif + #endif +#endif +#endif + + +// Fastest compilation speed is obtained by not including these +// headers when the pre-compiled header is used. +#ifndef __INCLUDED_SYSALL_H_OBJ__ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#endif + + +#endif // __SYSALL_H__ diff --git a/sdk-1/include/Core/System/SysAll.pch b/sdk-1/include/Core/System/SysAll.pch new file mode 100644 index 0000000..eaf9d8f --- /dev/null +++ b/sdk-1/include/Core/System/SysAll.pch @@ -0,0 +1,35 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysAll.pch + * + * Description: + * Source file used to generate pre-compiled headers for Pilot + * System Modules + * + * History: + * 6/6/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +// By including this module in your CodeWarrior project. You can automatically +// regenerate the pre-compiled header file used by the System modules called +// SysAll.h.obj +#ifdef EMULATION_LEVEL + #pragma precompile_target ":Obj:SysAll.h.obj.mpw" +#else + #pragma precompile_target ":Obj:SysAll.h.obj" +#endif + +// Define this so that SysAll.h doesn't try to include the pre-compiled header +// that we're currently building. +#define BUILDING_PRECOMPILED_HEADER + + +// These are the Pilot-only header files. +#include + diff --git a/sdk-1/include/Core/System/SysEvtMgr.h b/sdk-1/include/Core/System/SysEvtMgr.h new file mode 100644 index 0000000..31a131e --- /dev/null +++ b/sdk-1/include/Core/System/SysEvtMgr.h @@ -0,0 +1,169 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysEvtMgr.h + * + * Description: + * Header for the System Event Manager + * + * History: + * 3/22/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __SYSEVTMGR_H__ +#define __SYSEVTMGR_H__ + +#include + +/************************************************************ + * System Event Manager Errors + *************************************************************/ +#define evtErrParamErr (evtErrorClass | 1) +#define evtErrQueueFull (evtErrorClass | 2) +#define evtErrQueueEmpty (evtErrorClass | 3) + + +/************************************************************ + * System Event Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err EvtSysInit(void) + SYS_TRAP(sysTrapEvtSysInit); + +// Return next "System" event. This routine will send strokes to Graffiti as necessary +// and return a key event. Otherwise, it will return a simple pen down or pen +// up event, or put the processor to sleep for a max time of 'timeout' if +// no events are available. +void EvtGetSysEvent(EventPtr eventP, Long timeout) + SYS_TRAP(sysTrapEvtGetSysEvent); + + + +// Translate a stroke in the silk screen area to a key event +Err EvtProcessSoftKeyStroke(PointType* startPtP, PointType* endPtP) + SYS_TRAP(sysTrapEvtProcessSoftKeyStroke); + + +//----------------------------------------------------------------- +// Pen Queue Utilties +//------------------------------------------------------------------ + +// Replace current pen queue with another of the given size +Err EvtSetPenQueuePtr(Ptr penQueueP, ULong size) + SYS_TRAP(sysTrapEvtSetPenQueuePtr); + +// Return size of current pen queue in bytes +ULong EvtPenQueueSize(void) + SYS_TRAP(sysTrapEvtPenQueueSize); + +// Flush the pen queue +Err EvtFlushPenQueue(void) + SYS_TRAP(sysTrapEvtFlushPenQueue); + + +// Append a point to the pen queue. Passing -1 for x and y means +// pen-up (terminate the current stroke). Called by digitizer interrupt routine +Err EvtEnqueuePenPoint(PointType* ptP) + SYS_TRAP(sysTrapEvtEnqueuePenPoint); + + +// Return the stroke info for the next stroke in the pen queue. This MUST +// be the first call when removing a stroke from the queue +Err EvtDequeuePenStrokeInfo(PointType* startPtP, PointType* endPtP) + SYS_TRAP(sysTrapEvtDequeuePenStrokeInfo); + +// Dequeue the next point from the pen queue. Returns non-0 if no +// more points. The point returned will be (-1,-1) at the end +// of the stroke. +Err EvtDequeuePenPoint(PointType* retP) + SYS_TRAP(sysTrapEvtDequeuePenPoint); + + +// Flush the entire stroke from the pen queue and dispose it +Err EvtFlushNextPenStroke() + SYS_TRAP(sysTrapEvtFlushNextPenStroke); + + + + +//----------------------------------------------------------------- +// Key Queue Utilties +//------------------------------------------------------------------ + +// Replace current key queue with another of the given size. This routine will +// intialize the given key queue before installing it +Err EvtSetKeyQueuePtr(Ptr keyQueueP, ULong size) + SYS_TRAP(sysTrapEvtSetKeyQueuePtr); + +// Return size of current key queue in bytes +ULong EvtKeyQueueSize(void) + SYS_TRAP(sysTrapEvtKeyQueueSize); + +// Flush the key queue +Err EvtFlushKeyQueue(void) + SYS_TRAP(sysTrapEvtFlushKeyQueue); + + +// Append a key to the key queue. +Err EvtEnqueueKey(UInt ascii, UInt keycode, UInt modifiers) + SYS_TRAP(sysTrapEvtEnqueueKey); + +// Return true of key queue empty. +Boolean EvtKeyQueueEmpty(void) + SYS_TRAP(sysTrapEvtKeyQueueEmpty); + + +// Pop off the next key event from the key queue and fill in the given +// event record structure. Returns non-zero if there aren't any keys in the +// key queue. +Err EvtDequeueKeyEvent(EventPtr eventP) + SYS_TRAP(sysTrapEvtDequeueKeyEvent); + + +//----------------------------------------------------------------- +// General Utilities +//------------------------------------------------------------------ +// Force the system to wake-up. This will result in a null event being +// sent to the current app. +Err EvtWakeup(void) + SYS_TRAP(sysTrapEvtWakeup); + +// Reset the auto-off timer. This is called by the SerialLink Manager in order +// so we don't auto-off while receiving data over the serial port. +Err EvtResetAutoOffTimer(void) + SYS_TRAP(sysTrapEvtResetAutoOffTimer); + + +// Set Graffiti enabled or disabled. +void EvtEnableGraffiti(Boolean enable) + SYS_TRAP(sysTrapEvtEnableGraffiti); + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _EvtEnqueuePenPoint \ + ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint) + + + +#endif //__SYSEVTMGR_H__ + + + diff --git a/sdk-1/include/Core/System/SysEvtPrv.h b/sdk-1/include/Core/System/SysEvtPrv.h new file mode 100644 index 0000000..0e6c65b --- /dev/null +++ b/sdk-1/include/Core/System/SysEvtPrv.h @@ -0,0 +1,220 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysEvtPrv.h + * + * Description: + * Private Header for the System Event Manager + * + * History: + * 8/10/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __SYSEVTPRV_H__ +#define __SYSEVTPRV_H__ + + + + +/************************************************************ + * Structure of a Pen Capture Queue + * + * This structure is used to hold one or more pen strokes + * and is filled by the digitizer interrupt routine and emptied + * by application level code. + * + * A default size queue is allocated by the system and used to capture + * strokes for subsequent processing by the Graffiti recognizer + * or the hard icon recognizer. This queue pointer is stored in + * the System Event Manager Globals. + * + * Optionally, applications can replace the system pen queue with + * one of their own if it they need to hold larger strokes + * or more of them. + * + * + * Stroke data is stored in compressed form in this queue - refer + * to the comments on the routine EvtEnqueuPenPoint for the format + * of the queue data. + *************************************************************/ +typedef struct PenQueueType { + Int start; // start byte offset + Int end; // end byte offset + Int size; // size of queue in bytes + + UInt strokeCount; // # of complete strokes currently in pen queue + Boolean returnedPenDown; // set after we return a pen-down event for + // the next stroke in the queue. Cleared after + // we return the pen-up for the stroke. + + PointType addLast; // last point captured + Int addStrokeStart; // offset in queue to start of stroke + // currently being added to queue + // -1 : no stroke being captured + + + UInt strokesRemoved; // running count: # of strokes removed from queue. + UInt strokesAdded; // running count: # of strokes added to queue. + + Int rmvStrokeStage; // -1 : not started + // 0 : returned stroke info + // 1 : returned start point + + PointType rmvLast; // last point dequeued + PointType rmvStartPt; // copy of start point of stroke currently + // being removed. + + Byte data[1]; // 'size' bytes of data + } PenQueueType; +typedef PenQueueType* PenQueuePtr; + + + +/************************************************************ + * Structure of the Key Queue + * + * This structure is used to hold one or more keystrokes + * and is filled by numerous places including the low level + * hardware key interrupt routine, the Graffiti recognizer, and + * the digitizer buttons recognizer. + * + * A default size queue is allocated by the system. + * This queue pointer is stored in the System Event Manager globals. + * + * Optionally, applications can replace the system key queue with + * one of their own if it they need to hold more keys in the queue + * at one time. This may be necessary when processing large macro + * strings from Graffiti. + * + * Key data is stored in compressed form in this queue. Refer to + * the comments for the function EvtEnqueueKeyString for the format + * of the compressed data. + * + *************************************************************/ +typedef struct KeyQueueType { + UInt start; // start byte offset + UInt end; // end byte offset + UInt size; // size of queue in bytes + + Byte data[1]; // 'size' bytes of data + } KeyQueueType; +typedef KeyQueueType* KeyQueuePtr; + + + + + +/************************************************************ + * 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. + *************************************************************/ +typedef struct PenBtnInfoType { + RectangleType boundsR; // bounding rectangle of button + UInt asciiCode; // ascii code for key event + UInt keyCode; // virtual key code for key event + UInt modifiers; // modifiers for key event + } PenBtnInfoType; +typedef PenBtnInfoType* PenBtnInfoPtr; + + + + +/************************************************************ + * Key constants + *************************************************************/ +#define evtKeyStringEscape 0x01 // Escape byte for encoded key strings + // passed to EvtEnqueueKeyString or stored + // in key queue. + + +#define evtDefaultPenQSize 0x100 +#define evtDefaultKeyQSize 0x40 + +#define evtEffectiveKeyQStorage (evtDefaultKeyQSize - sizeof(KeyQueueType)) + + +// gremlinsFlags +#define grmGremlinsOn 0x01 +#define grmEventTraceOn 0x02 +#define grmGremlinsIdle 0x04 + +/************************************************************ + * Structure of System Event Manager Globals + *************************************************************/ +typedef struct SysEvtMgrGlobalsType { + Boolean sendNullEvent; // set by EvtWakeup + Boolean enableGraffiti; // If true, enable Graffiti translation + Boolean enableSoftKeys; // If true, enable digitizer button translation + + + Boolean removeTopStroke; // if true, remove top stroke from queue + // next time EvtGetSysEvent is called; + PenQueuePtr penQP; // pointer to current pen queue + UInt penQStrokesRemoved; // saved value of penQP->strokesRemoved. Used to + // determine if app removed stroke from penUp + // event or not. + + KeyQueuePtr keyQP; // pointer to current key queue + + RectangleType writingR; // enclosing rect for writing area + UInt appAreaBottom; // bottom coordinate of application area. + + UInt penX; // current pen location and state + UInt penY; + Boolean penDown; + Boolean displayingBatteryAlert; // to avoid re-entering battery dialog + + UInt lastPenX; // last pen location and state + UInt lastPenY; + Boolean lastPenDown; + + // This boolean is set by the Remote Screen Driver timer procedure periodically + // to force the event manager to call ScrSendUpdateArea which will send the update + // area of the screen to the host. + Boolean needRemoteScrUpdate; // If true, call ScrSendUpdateArea + + + Long smID; // Semaphore set by interrupt routines + // whenever a low level event is detected + + Byte gremlinsFlags; // flag to indicate if gremlins is running and + // if we'er doing an event trace. + + Boolean idle; + + } SysEvtMgrGlobalsType; + +typedef SysEvtMgrGlobalsType* SysEvtMgrGlobalsPtr; + + + + +/************************************************************ + * System Event Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + +// Return pointer to the pen based button list +PenBtnInfoPtr EvtGetPenBtnList(UIntPtr numButtons) + SYS_TRAP(sysTrapEvtGetPenBtnList); + +#ifdef __cplusplus +} +#endif + + +#endif //__SYSEVTPRV_H__ + +#endif // NON_PORTABLE + diff --git a/sdk-1/include/Core/System/SysTraps.h b/sdk-1/include/Core/System/SysTraps.h new file mode 100644 index 0000000..4a6ddd9 --- /dev/null +++ b/sdk-1/include/Core/System/SysTraps.h @@ -0,0 +1,849 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysTraps.h + * + * Description: + * Pilot Traps + * + * History: + * 6/13/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + + #ifndef __SYSTRAPS_H_ + #define __SYSTRAPS_H_ + +// Include elementary types +#include +#include + +// Regular traps start here and go up by 1's +#define sysTrapBase 0xA000 +typedef enum { + sysTrapMemInit = sysTrapBase, + sysTrapMemInitHeapTable, + sysTrapMemStoreInit, + sysTrapMemCardFormat, + sysTrapMemCardInfo, + sysTrapMemStoreInfo, + sysTrapMemStoreSetInfo, + sysTrapMemNumHeaps, + sysTrapMemNumRAMHeaps, + sysTrapMemHeapID, + sysTrapMemHeapPtr, + sysTrapMemHeapFreeBytes, + sysTrapMemHeapSize, + sysTrapMemHeapFlags, + sysTrapMemHeapCompact, + sysTrapMemHeapInit, + sysTrapMemHeapFreeByOwnerID, + sysTrapMemChunkNew, + sysTrapMemChunkFree, + sysTrapMemPtrNew, + sysTrapMemPtrRecoverHandle, + sysTrapMemPtrFlags, + sysTrapMemPtrSize, + sysTrapMemPtrOwner, + sysTrapMemPtrHeapID, + sysTrapMemPtrCardNo, + sysTrapMemPtrToLocalID, + sysTrapMemPtrSetOwner, + sysTrapMemPtrResize, + sysTrapMemPtrResetLock, + sysTrapMemHandleNew, + sysTrapMemHandleLockCount, + sysTrapMemHandleToLocalID, + sysTrapMemHandleLock, + sysTrapMemHandleUnlock, + sysTrapMemLocalIDToGlobal, + sysTrapMemLocalIDKind, + sysTrapMemLocalIDToPtr, + sysTrapMemMove, + sysTrapMemSet, + sysTrapMemStoreSearch, + sysTrapMemPtrDataStorage, + sysTrapMemKernelInit, + sysTrapMemHandleFree, + sysTrapMemHandleFlags, + sysTrapMemHandleSize, + sysTrapMemHandleOwner, + sysTrapMemHandleHeapID, + sysTrapMemHandleDataStorage, + sysTrapMemHandleCardNo, + sysTrapMemHandleSetOwner, + sysTrapMemHandleResize, + sysTrapMemHandleResetLock, + sysTrapMemPtrUnlock, + sysTrapMemLocalIDToLockedPtr, + sysTrapMemSetDebugMode, + sysTrapMemHeapScramble, + sysTrapMemHeapCheck, + sysTrapMemNumCards, + sysTrapMemDebugMode, + sysTrapMemSemaphoreReserve, + sysTrapMemSemaphoreRelease, + sysTrapMemHeapDynamic, + sysTrapMemNVParams, + + + sysTrapDmInit, + sysTrapDmCreateDatabase, + sysTrapDmDeleteDatabase, + sysTrapDmNumDatabases, + sysTrapDmGetDatabase, + sysTrapDmFindDatabase, + sysTrapDmDatabaseInfo, + sysTrapDmSetDatabaseInfo, + sysTrapDmDatabaseSize, + sysTrapDmOpenDatabase, + sysTrapDmCloseDatabase, + sysTrapDmNextOpenDatabase, + sysTrapDmOpenDatabaseInfo, + sysTrapDmResetRecordStates, + sysTrapDmGetLastErr, + sysTrapDmNumRecords, + sysTrapDmRecordInfo, + sysTrapDmSetRecordInfo, + sysTrapDmAttachRecord, + sysTrapDmDetachRecord, + sysTrapDmMoveRecord, + sysTrapDmNewRecord, + sysTrapDmRemoveRecord, + sysTrapDmDeleteRecord, + sysTrapDmArchiveRecord, + sysTrapDmNewHandle, + sysTrapDmRemoveSecretRecords, + sysTrapDmQueryRecord, + sysTrapDmGetRecord, + sysTrapDmResizeRecord, + sysTrapDmReleaseRecord, + sysTrapDmGetResource, + sysTrapDmGet1Resource, + sysTrapDmReleaseResource, + sysTrapDmResizeResource, + sysTrapDmNextOpenResDatabase, + sysTrapDmFindResourceType, + sysTrapDmFindResource, + sysTrapDmSearchResource, + sysTrapDmNumResources, + sysTrapDmResourceInfo, + sysTrapDmSetResourceInfo, + sysTrapDmAttachResource, + sysTrapDmDetachResource, + sysTrapDmNewResource, + sysTrapDmRemoveResource, + sysTrapDmGetResourceIndex, + sysTrapDmQuickSort, + sysTrapDmQueryNextInCategory, + sysTrapDmNumRecordsInCategory, + sysTrapDmPositionInCategory, + sysTrapDmSeekRecordInCategory, + sysTrapDmMoveCategory, + sysTrapDmOpenDatabaseByTypeCreator, + sysTrapDmWrite, + sysTrapDmStrCopy, + sysTrapDmGetNextDatabaseByTypeCreator, + sysTrapDmWriteCheck, + sysTrapDmMoveOpenDBContext, + sysTrapDmFindRecordByID, + sysTrapDmGetAppInfoID, + sysTrapDmFindSortPosition, + sysTrapDmSet, + sysTrapDmCreateDatabaseFromImage, + + + sysTrapDbgSrcMessage, + sysTrapDbgMessage, + sysTrapDbgGetMessage, + sysTrapDbgCommSettings, + + sysTrapErrDisplayFileLineMsg, + sysTrapErrSetJump, + sysTrapErrLongJump, + sysTrapErrThrow, + sysTrapErrExceptionList, + + sysTrapSysBroadcastActionCode, + sysTrapSysUnimplemented, + sysTrapSysColdBoot, + sysTrapSysReset, + sysTrapSysDoze, + sysTrapSysAppLaunch, + sysTrapSysAppStartup, + sysTrapSysAppExit, + sysTrapSysSetA5, + sysTrapSysSetTrapAddress, + sysTrapSysGetTrapAddress, + sysTrapSysTranslateKernelErr, + sysTrapSysSemaphoreCreate, + sysTrapSysSemaphoreDelete, + sysTrapSysSemaphoreWait, + sysTrapSysSemaphoreSignal, + sysTrapSysTimerCreate, + sysTrapSysTimerWrite, + sysTrapSysTaskCreate, + sysTrapSysTaskDelete, + sysTrapSysTaskTrigger, + sysTrapSysTaskID, + sysTrapSysTaskUserInfoPtr, + sysTrapSysTaskDelay, + sysTrapSysTaskSetTermProc, + sysTrapSysUILaunch, + sysTrapSysNewOwnerID, + sysTrapSysSemaphoreSet, + sysTrapSysDisableInts, + sysTrapSysRestoreStatus, + sysTrapSysUIAppSwitch, + sysTrapSysCurAppInfoP, + sysTrapSysHandleEvent, + sysTrapSysInit, + sysTrapSysQSort, + sysTrapSysCurAppDatabase, + sysTrapSysFatalAlert, + sysTrapSysResSemaphoreCreate, + sysTrapSysResSemaphoreDelete, + sysTrapSysResSemaphoreReserve, + sysTrapSysResSemaphoreRelease, + sysTrapSysSleep, + sysTrapSysKeyboardDialog, + sysTrapSysAppLauncherDialog, + sysTrapSysSetPerformance, + sysTrapSysBatteryInfo, + sysTrapSysLibInstall, + sysTrapSysLibRemove, + sysTrapSysLibTblEntry, + sysTrapSysLibFind, + sysTrapSysBatteryDialog, + sysTrapSysCopyStringResource, + sysTrapSysKernelInfo, + sysTrapSysLaunchConsole, + sysTrapSysTimerDelete, + sysTrapSysSetAutoOffTime, + sysTrapSysFormPointerArrayToStrings, + sysTrapSysRandom, + sysTrapSysTaskSwitching, + sysTrapSysTimerRead, + + + sysTrapStrCopy, + sysTrapStrCat, + sysTrapStrLen, + sysTrapStrCompare, + sysTrapStrIToA, + sysTrapStrCaselessCompare, + sysTrapStrIToH, + sysTrapStrChr, + sysTrapStrStr, + sysTrapStrAToI, + sysTrapStrToLower, + + sysTrapSerReceiveISP, + + sysTrapSlkOpen, + sysTrapSlkClose, + sysTrapSlkOpenSocket, + sysTrapSlkCloseSocket, + sysTrapSlkSocketRefNum, + sysTrapSlkSocketSetTimeout, + sysTrapSlkFlushSocket, + sysTrapSlkSetSocketListener, + sysTrapSlkSendPacket, + sysTrapSlkReceivePacket, + sysTrapSlkSysPktDefaultResponse, + sysTrapSlkProcessRPC, + + + sysTrapConPutS, + sysTrapConGetS, + + sysTrapFplInit, + sysTrapFplFree, + sysTrapFplFToA, + sysTrapFplAToF, + sysTrapFplBase10Info, + sysTrapFplLongToFloat, + sysTrapFplFloatToLong, + sysTrapFplFloatToULong, + sysTrapFplMul, + sysTrapFplAdd, + sysTrapFplSub, + sysTrapFplDiv, + + sysTrapScrInit, + sysTrapScrCopyRectangle, + sysTrapScrDrawChars, + sysTrapScrLineRoutine, + sysTrapScrRectangleRoutine, + sysTrapScrScreenInfo, + sysTrapScrDrawNotify, + sysTrapScrSendUpdateArea, + sysTrapScrCompressScanLine, + sysTrapScrDeCompressScanLine, + + + sysTrapTimGetSeconds, + sysTrapTimSetSeconds, + sysTrapTimGetTicks, + sysTrapTimInit, + sysTrapTimSetAlarm, + sysTrapTimGetAlarm, + sysTrapTimHandleInterrupt, + sysTrapTimSecondsToDateTime, + sysTrapTimDateTimeToSeconds, + sysTrapTimAdjust, + sysTrapTimSleep, + sysTrapTimWake, + + sysTrapCategoryCreateList, + sysTrapCategoryFreeList, + sysTrapCategoryFind, + sysTrapCategoryGetName, + sysTrapCategoryEdit, + sysTrapCategorySelect, + sysTrapCategoryGetNext, + sysTrapCategorySetTriggerLabel, + sysTrapCategoryTruncateName, + + sysTrapClipboardAddItem, + sysTrapClipboardCheckIfItemExist, + sysTrapClipboardGetItem, + + sysTrapCtlDrawControl, + sysTrapCtlEraseControl, + sysTrapCtlHideControl, + sysTrapCtlShowControl, + sysTrapCtlGetValue, + sysTrapCtlSetValue, + sysTrapCtlGetLabel, + sysTrapCtlSetLabel, + sysTrapCtlHandleEvent, + sysTrapCtlHitControl, + sysTrapCtlSetEnabled, + sysTrapCtlSetUsable, + sysTrapCtlEnabled, + + + sysTrapEvtInitialize, + sysTrapEvtAddEventToQueue, + sysTrapEvtCopyEvent, + sysTrapEvtGetEvent, + sysTrapEvtGetPen, + sysTrapEvtSysInit, + sysTrapEvtGetSysEvent, + sysTrapEvtProcessSoftKeyStroke, + sysTrapEvtGetPenBtnList, + sysTrapEvtSetPenQueuePtr, + sysTrapEvtPenQueueSize, + sysTrapEvtFlushPenQueue, + sysTrapEvtEnqueuePenPoint, + sysTrapEvtDequeuePenStrokeInfo, + sysTrapEvtDequeuePenPoint, + sysTrapEvtFlushNextPenStroke, + sysTrapEvtSetKeyQueuePtr, + sysTrapEvtKeyQueueSize, + sysTrapEvtFlushKeyQueue, + sysTrapEvtEnqueueKey, + sysTrapEvtDequeueKeyEvent, + sysTrapEvtWakeup, + sysTrapEvtResetAutoOffTimer, + sysTrapEvtKeyQueueEmpty, + sysTrapEvtEnableGraffiti, + + + sysTrapFldCopy, + sysTrapFldCut, + sysTrapFldDrawField, + sysTrapFldEraseField, + sysTrapFldFreeMemory, + sysTrapFldGetBounds, + sysTrapFldGetTextPtr, + sysTrapFldGetSelection, + sysTrapFldHandleEvent, + sysTrapFldPaste, + sysTrapFldRecalculateField, + sysTrapFldSetBounds, + sysTrapFldSetText, + sysTrapFldGetFont, + sysTrapFldSetFont, + sysTrapFldSetSelection, + sysTrapFldGrabFocus, + sysTrapFldReleaseFocus, + sysTrapFldGetInsPtPosition, + sysTrapFldSetInsPtPosition, + sysTrapFldSetScrollPosition, + sysTrapFldGetScrollPosition, + sysTrapFldGetTextHeight, + sysTrapFldGetTextAllocatedSize, + sysTrapFldGetTextLength, + sysTrapFldScrollField, + sysTrapFldScrollable, + sysTrapFldGetVisibleLines, + sysTrapFldGetAttributes, + sysTrapFldSetAttributes, + sysTrapFldSendChangeNotification, + sysTrapFldCalcFieldHeight, + sysTrapFldGetTextHandle, + sysTrapFldCompactText, + sysTrapFldDirty, + sysTrapFldWordWrap, + sysTrapFldSetTextAllocatedSize, + sysTrapFldSetTextHandle, + sysTrapFldSetTextPtr, + sysTrapFldGetMaxChars, + sysTrapFldSetMaxChars, + sysTrapFldSetUsable, + sysTrapFldInsert, + sysTrapFldDelete, + sysTrapFldUndo, + sysTrapFldSetDirty, + sysTrapFldSendHeightChangeNotification, + sysTrapFldMakeFullyVisible, + + + sysTrapFntGetFont, + sysTrapFntSetFont, + sysTrapFntGetFontPtr, + sysTrapFntBaseLine, + sysTrapFntCharHeight, + sysTrapFntLineHeight, + sysTrapFntAverageCharWidth, + sysTrapFntCharWidth, + sysTrapFntCharsWidth, + sysTrapFntDescenderHeight, + sysTrapFntCharsInWidth, + sysTrapFntLineWidth, + + + + sysTrapFrmInitForm, + sysTrapFrmDeleteForm, + sysTrapFrmDrawForm, + sysTrapFrmEraseForm, + sysTrapFrmGetActiveForm, + sysTrapFrmSetActiveForm, + sysTrapFrmGetActiveFormID, + sysTrapFrmGetUserModifiedState, + sysTrapFrmSetNotUserModified, + sysTrapFrmGetFocus, + sysTrapFrmSetFocus, + sysTrapFrmHandleEvent, + sysTrapFrmGetFormBounds, + sysTrapFrmGetWindowHandle, + sysTrapFrmGetFormId, + sysTrapFrmGetFormPtr, + sysTrapFrmGetNumberOfObjects, + sysTrapFrmGetObjectIndex, + sysTrapFrmGetObjectId, + sysTrapFrmGetObjectType, + sysTrapFrmGetObjectPtr, + sysTrapFrmHideObject, + sysTrapFrmShowObject, + sysTrapFrmGetObjectPosition, + sysTrapFrmSetObjectPositon, + sysTrapFrmGetControlValue, + sysTrapFrmSetControlValue, + sysTrapFrmGetControlGroupSelection, + sysTrapFrmSetControlGroupSelection, + sysTrapFrmCopyLabel, + sysTrapFrmSetLabel, + sysTrapFrmGetLabel, + sysTrapFrmSetCategoryLabel, + sysTrapFrmGetTitle, + sysTrapFrmSetTitle, + sysTrapFrmAlert, + sysTrapFrmDoDialog, + sysTrapFrmCustomAlert, + sysTrapFrmHelp, + sysTrapFrmUpdateScrollers, + sysTrapFrmGetFirstForm, + sysTrapFrmVisible, + sysTrapFrmGetObjectBounds, + sysTrapFrmCopyTitle, + sysTrapFrmGotoForm, + sysTrapFrmPopupForm, + sysTrapFrmUpdateForm, + sysTrapFrmReturnToForm, + sysTrapFrmSetEventHandler, + sysTrapFrmDispatchEvent, + sysTrapFrmCloseAllForms, + sysTrapFrmSaveAllForms, + sysTrapFrmGetGadgetData, + sysTrapFrmSetGadgetData, + sysTrapFrmSetCategoryTrigger, + + + sysTrapUIInitialize, + sysTrapUIReset, + + sysTrapInsPtInitialize, + sysTrapInsPtSetLocation, + sysTrapInsPtGetLocation, + sysTrapInsPtEnable, + sysTrapInsPtEnabled, + sysTrapInsPtSetHeight, + sysTrapInsPtGetHeight, + sysTrapInsPtCheckBlink, + + sysTrapLstSetDrawFunction, + sysTrapLstDrawList, + sysTrapLstEraseList, + sysTrapLstGetSelection, + sysTrapLstGetSelectionText, + sysTrapLstHandleEvent, + sysTrapLstSetHeight, + sysTrapLstSetSelection, + sysTrapLstSetListChoices, + sysTrapLstMakeItemVisible, + sysTrapLstGetNumberOfItems, + sysTrapLstPopupList, + sysTrapLstSetPosition, + + sysTrapMenuInit, + sysTrapMenuDispose, + sysTrapMenuHandleEvent, + sysTrapMenuDrawMenu, + sysTrapMenuEraseStatus, + sysTrapMenuGetActiveMenu, + sysTrapMenuSetActiveMenu, + + + sysTrapRctSetRectangle, + sysTrapRctCopyRectangle, + sysTrapRctInsetRectangle, + sysTrapRctOffsetRectangle, + sysTrapRctPtInRectangle, + sysTrapRctGetIntersection, + + + sysTrapTblDrawTable, + sysTrapTblEraseTable, + sysTrapTblHandleEvent, + sysTrapTblGetItemBounds, + sysTrapTblSelectItem, + sysTrapTblGetItemInt, + sysTrapTblSetItemInt, + sysTrapTblSetItemStyle, + sysTrapTblUnhighlightSelection, + sysTrapTblSetRowUsable, + sysTrapTblGetNumberOfRows, + sysTrapTblSetCustomDrawProcedure, + sysTrapTblSetRowSelectable, + sysTrapTblRowSelectable, + sysTrapTblSetLoadDataProcedure, + sysTrapTblSetSaveDataProcedure, + sysTrapTblGetBounds, + sysTrapTblSetRowHeight, + sysTrapTblGetColumnWidth, + sysTrapTblGetRowID, + sysTrapTblSetRowID, + sysTrapTblMarkRowInvalid, + sysTrapTblMarkTableInvalid, + sysTrapTblGetSelection, + sysTrapTblInsertRow, + sysTrapTblRemoveRow, + sysTrapTblRowInvalid, + sysTrapTblRedrawTable, + sysTrapTblRowUsable, + sysTrapTblReleaseFocus, + sysTrapTblEditing, + sysTrapTblGetCurrentField, + sysTrapTblSetColumnUsable, + sysTrapTblGetRowHeight, + sysTrapTblSetColumnWidth, + sysTrapTblGrabFocus, + sysTrapTblSetItemPtr, + sysTrapTblFindRowID, + sysTrapTblGetLastUsableRow, + sysTrapTblGetColumnSpacing, + sysTrapTblFindRowData, + sysTrapTblGetRowData, + sysTrapTblSetRowData, + sysTrapTblSetColumnSpacing, + + + + sysTrapWinCreateWindow, + sysTrapWinCreateOffscreenWindow, + sysTrapWinDeleteWindow, + sysTrapWinInitializeWindow, + sysTrapWinAddWindow, + sysTrapWinRemoveWindow, + sysTrapWinSetActiveWindow, + sysTrapWinSetDrawWindow, + sysTrapWinGetDrawWindow, + sysTrapWinGetActiveWindow, + sysTrapWinGetDisplayWindow, + sysTrapWinGetFirstWindow, + sysTrapWinEnableWindow, + sysTrapWinDisableWindow, + sysTrapWinGetWindowFrameRect, + sysTrapWinDrawWindowFrame, + sysTrapWinEraseWindow, + sysTrapWinSaveBits, + sysTrapWinRestoreBits, + sysTrapWinCopyRectangle, + sysTrapWinScrollRectangle, + sysTrapWinGetDisplayExtent, + sysTrapWinGetWindowExtent, + sysTrapWinDisplayToWindowPt, + sysTrapWinWindowToDisplayPt, + sysTrapWinGetClip, + sysTrapWinSetClip, + sysTrapWinResetClip, + sysTrapWinClipRectangle, + sysTrapWinDrawLine, + sysTrapWinDrawGrayLine, + sysTrapWinEraseLine, + sysTrapWinInvertLine, + sysTrapWinFillLine, + sysTrapWinDrawRectangle, + sysTrapWinEraseRectangle, + sysTrapWinInvertRectangle, + sysTrapWinDrawRectangleFrame, + sysTrapWinDrawGrayRectangleFrame, + sysTrapWinEraseRectangleFrame, + sysTrapWinInvertRectangleFrame, + sysTrapWinGetFramesRectangle, + sysTrapWinDrawChars, + sysTrapWinEraseChars, + sysTrapWinInvertChars, + sysTrapWinGetPattern, + sysTrapWinSetPattern, + sysTrapWinSetUnderlineMode, + sysTrapWinDrawBitmap, + sysTrapWinModal, + sysTrapWinGetWindowBounds, + sysTrapWinFillRectangle, + sysTrapWinDrawInvertedChars, + + + + sysTrapPrefOpenPreferenceDB, + sysTrapPrefGetPreferences, + sysTrapPrefSetPreferences, + sysTrapPrefGetAppPreferences, + sysTrapPrefSetAppPreferences, + + + sysTrapSndInit, + sysTrapSndSetDefaultVolume, + sysTrapSndGetDefaultVolume, + sysTrapSndDoCmd, + sysTrapSndPlaySystemSound, + + + sysTrapAlmInit, + sysTrapAlmCancelAll, + sysTrapAlmAlarmCallback, + sysTrapAlmSetAlarm, + sysTrapAlmGetAlarm, + sysTrapAlmDisplayAlarm, + sysTrapAlmEnableNotification, + + + sysTrapHwrGetRAMMapping, + sysTrapHwrMemWritable, + sysTrapHwrMemReadable, + sysTrapHwrDoze, + sysTrapHwrSleep, + sysTrapHwrWake, + sysTrapHwrSetSystemClock, + sysTrapHwrSetCPUDutyCycle, + sysTrapHwrLCDInit, + sysTrapHwrLCDSleep, + sysTrapHwrTimerInit, + sysTrapHwrCursor, + sysTrapHwrBatteryLevel, + sysTrapHwrDelay, + sysTrapHwrEnableDataWrites, + sysTrapHwrDisableDataWrites, + sysTrapHwrLCDBaseAddr, + sysTrapHwrLCDDrawBitmap, + sysTrapHwrTimerSleep, + sysTrapHwrTimerWake, + sysTrapHwrLCDWake, + sysTrapHwrIRQ1Handler, + sysTrapHwrIRQ2Handler, + sysTrapHwrIRQ3Handler, + sysTrapHwrIRQ4Handler, + sysTrapHwrIRQ5Handler, + sysTrapHwrIRQ6Handler, + sysTrapHwrDockSignals, + sysTrapHwrPluggedIn, + + + sysTrapCrc16CalcBlock, + + + sysTrapSelectDay, + sysTrapSelectTime, + + sysTrapDayDrawDaySelector, + sysTrapDayHandleEvent, + sysTrapDayDrawDays, + sysTrapDayOfWeek, + sysTrapDaysInMonth, + sysTrapDayOfMonth, + + sysTrapDateDaysToDate, + sysTrapDateToDays, + sysTrapDateAdjust, + sysTrapDateSecondsToDate, + sysTrapDateToAscii, + sysTrapDateToDOWDMFormat, + sysTrapTimeToAscii, + + + sysTrapFind, + sysTrapFindStrInStr, + sysTrapFindSaveMatch, + sysTrapFindGetLineBounds, + sysTrapFindDrawHeader, + + sysTrapPenOpen, + sysTrapPenClose, + sysTrapPenGetRawPen, + sysTrapPenCalibrate, + sysTrapPenRawToScreen, + sysTrapPenScreenToRaw, + sysTrapPenResetCalibration, + sysTrapPenSleep, + sysTrapPenWake, + + + sysTrapResLoadForm, + sysTrapResLoadMenu, + + sysTrapFtrInit, + sysTrapFtrUnregister, + sysTrapFtrGet, + sysTrapFtrSet, + sysTrapFtrGetByIndex, + + + + sysTrapGrfInit, + sysTrapGrfFree, + sysTrapGrfGetState, + sysTrapGrfSetState, + sysTrapGrfFlushPoints, + sysTrapGrfAddPoint, + sysTrapGrfInitState, + sysTrapGrfCleanState, + sysTrapGrfMatch, + sysTrapGrfGetMacro, + sysTrapGrfFilterPoints, + sysTrapGrfGetNumPoints, + sysTrapGrfGetPoint, + sysTrapGrfFindBranch, + sysTrapGrfMatchGlyph, + sysTrapGrfGetGlyphMapping, + sysTrapGrfGetMacroName, + sysTrapGrfDeleteMacro, + sysTrapGrfAddMacro, + sysTrapGrfGetAndExpandMacro, + sysTrapGrfProcessStroke, + sysTrapGrfFieldChange, + + + sysTrapGetCharSortValue, + sysTrapGetCharAttr, + sysTrapGetCharCaselessValue, + + + sysTrapPwdExists, + sysTrapPwdVerify, + sysTrapPwdSet, + sysTrapPwdRemove, + + sysTrapGsiInitialize, + sysTrapGsiSetLocation, + sysTrapGsiEnable, + sysTrapGsiEnabled, + sysTrapGsiSetShiftState, + + sysTrapKeyInit, + sysTrapKeyHandleInterrupt, + sysTrapKeyCurrentState, + sysTrapKeyResetDoubleTap, + sysTrapKeyRates, + sysTrapKeySleep, + sysTrapKeyWake, + + + sysTrapCmBroadcast, + + sysTrapDlkStartServer, + sysTrapDlkGetSyncInfo, + sysTrapDlkSetLogEntry, + + sysTrapPsrInit, + sysTrapPsrClose, + sysTrapPsrGetCommand, + sysTrapPsrSendReply, + + sysTrapAbtShowAbout, + + sysTrapMdmDial, + sysTrapMdmHangUp, + + sysTrapDmSearchRecord, + + sysTrapSysInsertionSort, + sysTrapDmInsertionSort, + + sysTrapLstSetTopItem, + + // WARNING!! LEAVE THIS ONE AT THE END + sysTrapLastTrapNumber + } SysTrapNumber; + +#define sysNumTraps (sysTrapLastTrapNumber - sysTrapBase) + + + +//-------------------------------------------------------------------- +// Define Library Trap Numbers +//-------------------------------------------------------------------- +// Library traps start here and go up by 1's +#define sysLibTrapBase 0xA800 +typedef enum { + sysLibTrapName = sysLibTrapBase, + sysLibTrapOpen, + sysLibTrapClose, + sysLibTrapSleep, + sysLibTrapWake, + sysLibTrapCustom + } SysLibTrapNumber; + + + + +/************************************************************ + * Pilot specific TRAP instruction numbers + *************************************************************/ +#define sysDbgBreakpointTrapNum 0 // For soft breakpoints +#define sysDbgTrapNum 8 // For compiled breakpoints +#define sysDispatchTrapNum 15 // Trap dispatcher + +#ifdef __GNUC__ +#define SYS_TRAP(trapNum) \ + __attribute__ ((systrap (trapNum))) +#else +#define SYS_TRAP(trapNum) \ + TWOWORD_INLINE(m68kTrapInstr+sysDispatchTrapNum,trapNum) +#endif + +#define ASM_SYS_TRAP(trapNum) \ + DC.W m68kTrapInstr+sysDispatchTrapNum; \ + DC.W trapNum + + +#endif //__SYSTRAPS_H_ + + diff --git a/sdk-1/include/Core/System/SysUtils.h b/sdk-1/include/Core/System/SysUtils.h new file mode 100644 index 0000000..55d6fd7 --- /dev/null +++ b/sdk-1/include/Core/System/SysUtils.h @@ -0,0 +1,72 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: SysUtils.h + * AUTHOR: Roger Flores: April 27, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * These are miscellaneous routines. + * + **********************************************************************/ +#ifndef __SYSUTILS_H__ +#define __SYSUTILS_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +//typedef Int _comparF (const void *, const void *, Int other); +typedef Int _comparF (VoidPtr, VoidPtr, Long other); +typedef _comparF * CmpFuncPtr; + + +/************************************************************ + * Constants + *************************************************************/ +#define sysRandomMax 0x7FFF // Max value returned from SysRandom() + + +/************************************************************ + * Macros + *************************************************************/ +#define Abs(a) ((a >= 0) ? a : (-a)) + +/************************************************************ + * procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +void SysInsertionSort (VoidPtr baseP, Int numOfElements, Int width, + _comparF *comparF, const Long other) + SYS_TRAP(sysTrapSysInsertionSort); + +void SysQSort (VoidPtr baseP, Int numOfElements, Int width, + _comparF *comparF, const Long other) + SYS_TRAP(sysTrapSysQSort); + +void SysCopyStringResource (CharPtr string, UInt theID) + SYS_TRAP(sysTrapSysCopyStringResource); + +VoidHand SysFormPointerArrayToStrings(CharPtr c, Int stringCount) + SYS_TRAP(sysTrapSysFormPointerArrayToStrings); + + +// Return a random number ranging from 0 to sysRandomMax. +// Normally, 0 is passed unless you want to start with a new seed. +Int SysRandom(ULong newSeed) + SYS_TRAP(sysTrapSysRandom); + +#ifdef __cplusplus +} +#endif + +#endif // __SYSUTILS_H__ + diff --git a/sdk-1/include/Core/System/SystemMgr.h b/sdk-1/include/Core/System/SystemMgr.h new file mode 100644 index 0000000..b952ae6 --- /dev/null +++ b/sdk-1/include/Core/System/SystemMgr.h @@ -0,0 +1,457 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SystemMgr.h + * + * Description: + * Pilot system equates + * + * History: + * 10/27/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + + #ifndef __SYSTEMMGR_H__ + #define __SYSTEMMGR_H__ + +// Include elementary types +#include +#include // Trap Numbers. + +// Other types +#include // Resource definitions. + + +// UI Headers +#include +#include +#include +#include +#include +#include +#include +#include // for DmOpenRef + + + +/************************************************************ + * System Constants + *************************************************************/ +// Define the number of ticks/second +#if EMULATION_LEVEL == EMULATION_MAC + #define sysTicksPerSecond 60 // 60/sec on Macintosh +#elif EMULATION_LEVEL == EMULATION_NONE + #define sysTicksPerSecond 100 // 100/sec on Pilot +#elif EMULATION_LEVEL == EMULATION_WINDOWS + #define sysTicksPerSecond 1000 // 1000/sec on Windows PC +#else + #error +#endif + + + + +/************************************************************ + * Action Codes + *************************************************************/ +// SysAppLaunch Commands +#define sysAppLaunchCmdNormalLaunch 0 // Normal Launch +#define sysAppLaunchCmdFind 1 // Find string +#define sysAppLaunchCmdGoTo 2 // Launch and go to a particular record +#define sysAppLaunchCmdSyncNotify 3 // Sent to apps whose databases changed during + // HotSync after the sync has been completed +#define sysAppLaunchCmdTimeChange 4 // The system time has changed +#define sysAppLaunchCmdSystemReset 5 // Sent after System hard resets +#define sysAppLaunchCmdAlarmTriggered 6 // Schedule next alarm +#define sysAppLaunchCmdDisplayAlarm 7 // Display given alarm dialog +#define sysAppLaunchCmdCountryChange 8 // The country has changed +#define sysAppLaunchCmdSyncRequest 9 // The "HotSync" button was pressed +#define sysAppLaunchCmdSaveData 10 // Sent to running app before sysAppLaunchCmdFind + // or other action codes that will cause + // data searches or manipulation. +#define sysAppLaunchCmdInitDatabase 11 // Initialize a database; sent by DesktopLink + // server to the app whose creator ID matches + // that of the database created in response to + // the "create db" request. +#define sysAppLaunchCmdSyncCallApplication 12 // Used by DesktopLink Server command "call application" + + + +// SysAppLaunch flags +#define sysAppLaunchFlagNewThread 0x01 // create a new thread for application + // - implies sysAppLaunchFlagNewStack +#define sysAppLaunchFlagNewStack 0x02 // create separate stack for application +#define sysAppLaunchFlagNewGlobals 0x04 // create new globals world for application + // - implies new owner ID for Memory chunks +#define sysAppLaunchFlagUIApp 0x08 // notifies launch routine that this is a UI app being + // launched. +#define sysAppLaunchFlagSubCall 0x10 // notifies launch routine that the app is calling it's + // entry point as a subroutine call. This tells the launch + // code that it's OK to keep the A5 (globals) pointer valid + // through the call. + +//------------------------------------------------------------------- +// Parameter blocks for action codes +// NOTE: The parameter block for the sysAppLaunchCmdFind and sysAppLaunchCmdGoTo +// action codes are defined in "Find.h"; +//--------------------------------------------------------------------------- + +// For sysAppLaunchCmdSaveData +typedef struct { + Boolean uiComing; // true if system dialog will be put up + // before coming action code arrives. + } SysAppLaunchCmdSaveDataType; + +// For sysAppLaunchCmdSystemReset +typedef struct { + Boolean hardReset; // true if system was hardReset. + Boolean createDefaultDB; // true if app should create default database. + } SysAppLaunchCmdSystemResetType; + + +// For sysAppLaunchCmdInitDatabase +typedef struct SysAppLaunchCmdInitDatabaseType { + DmOpenRef dbP; // database reference + ULong creator; // datatase creator + ULong type; // database type + UInt version; // database version + } SysAppLaunchCmdInitDatabaseType; + + +// For sysAppLaunchCmdSyncCallApplication +typedef struct SysAppLaunchCmdSyncCallApplicationType { + Word action; // call action id (app-specific) + Word paramSize; // parameter size + VoidPtr paramP; // ptr to parameter + Byte remoteSocket; // remote socket id + Byte tid; // command transaction id + Boolean handled; // if handled, MUST be set true by the app + } SysAppLaunchCmdSyncCallApplicationType; + + + +/************************************************************ + * Function prototype for libraries + *************************************************************/ +typedef struct SysLibTblEntryType { + Ptr* dispatchTblP; // pointer to library dispatch table + void* globalsP; // Library globals + } SysLibTblEntryType; +typedef SysLibTblEntryType* SysLibTblEntryPtr; + + +typedef Err (*SysLibEntryProcPtr)(UInt refNum, SysLibTblEntryPtr entryP); + +// This library refNum is reserved for the Debugger comm library +#define sysDbgCommLibraryRefNum 0 + + + +/************************************************************ + * Function prototype for Kernel + *************************************************************/ +// Task termination procedure prototype for use with SysTaskSetTermProc +typedef void (*SysTermProcPtr)(ULong taskID, Long reason); + +// Timer procedure for use with SysTimerCreate +typedef void (*SysTimerProcPtr)(Long timerID, Long param); + + + + +/************************************************************ + * Error Classes for each manager + *************************************************************/ +#define memErrorClass 0x0100 // Memory Manager +#define dmErrorClass 0x0200 // Data Manager +#define serErrorClass 0x0300 // Serial Manager +#define slkErrorClass 0x0400 // Serial Link Manager +#define sysErrorClass 0x0500 // System Manager +#define fplErrorClass 0x0600 // Floating Point Library +#define evtErrorClass 0x0700 // System Event Manager +#define sndErrorClass 0x0800 // Sound Manager +#define almErrorClass 0x0900 // Alarm Manager +#define timErrorClass 0x0A00 // Time Manager +#define penErrorClass 0x0B00 // Pen Manager +#define ftrErrorClass 0x0C00 // Feature Manager +#define cmpErrorClass 0x0D00 // Connection Manager +#define dlkErrorClass 0x0E00 // Desktop Link Manager +#define padErrorClass 0x0F00 // PAD Manager +#define grfErrorClass 0x1000 // Graffiti Manager +#define mdmErrorClass 0x1100 // Modem Manager + + +/************************************************************ + * System Errors + *************************************************************/ +#define sysErrTimeout (sysErrorClass | 1) +#define sysErrParamErr (sysErrorClass | 2) +#define sysErrNoFreeResource (sysErrorClass | 3) +#define sysErrNoFreeRAM (sysErrorClass | 4) +#define sysErrNotAllowed (sysErrorClass | 5) +#define sysErrSemInUse (sysErrorClass | 6) +#define sysErrInvalidID (sysErrorClass | 7) +#define sysErrOutOfOwnerIDs (sysErrorClass | 8) +#define sysErrNoFreeLibSlots (sysErrorClass | 9) +#define sysErrLibNotFound (sysErrorClass | 10) + + +/************************************************************ + * System Features + *************************************************************/ +#define sysFtrCreator sysFileCSystem // Feature Creator +#define sysFtrNumROMVersion 1 // ROM Version + // 0xMMmfsbbb, where MM is major version, m is minor version + // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development, + // bbb is build number for non-releases + // V1.12b3 would be: 0x01122003 + // V2.00a2 would be: 0x02001002 + // V1.01 would be: 0x01013000 +#define sysFtrNumProductID 2 // Product id + // 0xMMMMRRRR, where MMMM is the model and RRRR + // is the revision. + + + + +/************************************************************ + * System Types + *************************************************************/ + +// Types of batteries installed. +typedef enum { + sysBatteryKindAlkaline=0, + sysBatteryKindNiCad, + sysBatteryKindLithium + } SysBatteryKind; + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Prototype for Pilot applications entry point +DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags); + + +void SysUnimplemented(void) + SYS_TRAP(sysTrapSysUnimplemented); + +void SysColdBoot(Ptr card0P, ULong card0Size, + Ptr card1P, ULong card1Size, + DWord sysCardHeaderOffset) + SYS_TRAP(sysTrapSysColdBoot); + +void SysInit(void) + SYS_TRAP(sysTrapSysInit); + +void SysReset(void) + SYS_TRAP(sysTrapSysReset); + +void SysPowerOn(Ptr card0P, ULong card0Size, + Ptr card1P, ULong card1Size, + DWord sysCardHeaderOffset, Boolean reFormat); + + +void SysDoze(Boolean onlyNMI) + SYS_TRAP(sysTrapSysDoze); + +Err SysSetPerformance(ULongPtr sysClockP, UIntPtr cpuDutyP) + SYS_TRAP(sysTrapSysSetPerformance); + +void SysSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapSysSleep); + +UInt SysBatteryInfo(Boolean set, UIntPtr warnThresholdP, UIntPtr criticalThresholdP, + UIntPtr maxTicksP, SysBatteryKind* kindP, Boolean* pluggedIn) + SYS_TRAP(sysTrapSysBatteryInfo); + +UInt SysSetAutoOffTime(UInt seconds) + SYS_TRAP(sysTrapSysSetAutoOffTime); + +Err SysLaunchConsole(void) + SYS_TRAP(sysTrapSysLaunchConsole); + +Boolean SysHandleEvent(EventPtr eventP) + SYS_TRAP(sysTrapSysHandleEvent); + +void SysUILaunch(void) + SYS_TRAP(sysTrapSysUILaunch); + +Err SysUIAppSwitch(UInt cardNo, LocalID dbID, Word cmd, Ptr cmdPBP) + SYS_TRAP(sysTrapSysUIAppSwitch); + +Err SysCurAppDatabase(UIntPtr cardNoP, LocalID* dbIDP) + SYS_TRAP(sysTrapSysCurAppDatabase); + +Err SysBroadcastActionCode(Word cmd, Ptr cmdPBP) + SYS_TRAP(sysTrapSysBroadcastActionCode); + +Err SysAppLaunch(UInt cardNo, LocalID dbID, UInt launchFlags, + Word cmd, Ptr cmdPBP, DWord* resultP) + SYS_TRAP(sysTrapSysAppLaunch); + +UInt SysNewOwnerID(void) + SYS_TRAP(sysTrapSysNewOwnerID); + +DWord SysSetA5(DWord newValue) + SYS_TRAP(sysTrapSysSetA5); + + +Ptr SysCardImageInfo(UInt cardNo, ULongPtr sizeP); + +void SysCardImageDeleted(UInt cardNo); + +// System Dialogs +void SysBatteryDialog(void) + SYS_TRAP(sysTrapSysBatteryDialog); + +// Utilities +Err SysSetTrapAddress(UInt trapNum, VoidPtr procP) + SYS_TRAP(sysTrapSysSetTrapAddress); + +VoidPtr SysGetTrapAddress(UInt trapNum) + SYS_TRAP(sysTrapSysGetTrapAddress); + +Word SysDisableInts(void) + SYS_TRAP(sysTrapSysDisableInts); + +void SysRestoreStatus(Word status) + SYS_TRAP(sysTrapSysRestoreStatus); + + +// Library Management +Err SysLibInstall(SysLibEntryProcPtr libraryP, UIntPtr refNumP) + SYS_TRAP(sysTrapSysLibInstall); + +Err SysLibRemove(UInt refNum) + SYS_TRAP(sysTrapSysLibRemove); + +Err SysLibFind(CharPtr nameP, UIntPtr refNumP) + SYS_TRAP(sysTrapSysLibFind); + +SysLibTblEntryPtr SysLibTblEntry(UInt refNum) + SYS_TRAP(sysTrapSysLibTblEntry); + +// Generic Library calls +Err SysLibOpen(UInt refNum) + SYS_TRAP(sysLibTrapOpen); +Err SysLibClose(UInt refNum) + SYS_TRAP(sysLibTrapClose); +Err SysLibSleep(UInt refNum) + SYS_TRAP(sysLibTrapSleep); +Err SysLibWake(UInt refNum) + SYS_TRAP(sysLibTrapWake); + + +//----------------------------------------------------- +// Kernel Prototypes +//----------------------------------------------------- +Err SysTranslateKernelErr(Err err) + SYS_TRAP(sysTrapSysTranslateKernelErr); + +Err SysTaskCreate(ULongPtr taskIDP, LongPtr creator, ProcPtr codeP, + Ptr stackP, ULong stackSize, ULong attr, Long priority, + ULong tSlice) + SYS_TRAP(sysTrapSysTaskCreate); + +Err SysTaskDelete(ULong taskID, Long priority) + SYS_TRAP(sysTrapSysTaskDelete); + +Err SysTaskTrigger(ULong taskID) + SYS_TRAP(sysTrapSysTaskTrigger); + +ULong SysTaskID() + SYS_TRAP(sysTrapSysTaskID); + +Err SysTaskDelay(Long delay) + SYS_TRAP(sysTrapSysTaskDelay); + +Err SysTaskSetTermProc(ULong taskID, SysTermProcPtr termProcP) + SYS_TRAP(sysTrapSysTaskSetTermProc); + +Err SysTaskSwitching(Boolean enable) + SYS_TRAP(sysTrapSysTaskSwitching); + + +// Counting Semaphores +Err SysSemaphoreCreate(LongPtr smIDP, LongPtr tagP, Long initValue) + SYS_TRAP(sysTrapSysSemaphoreCreate); + +Err SysSemaphoreDelete(Long smID) + SYS_TRAP(sysTrapSysSemaphoreDelete); + +Err SysSemaphoreWait(Long smID, Long priority, Long timeout) + SYS_TRAP(sysTrapSysSemaphoreWait); + +Err SysSemaphoreSignal(Long smID) + SYS_TRAP(sysTrapSysSemaphoreSignal); + +Err SysSemaphoreSet(Long smID) + SYS_TRAP(sysTrapSysSemaphoreSet); + + +// Resource Semaphores +Err SysResSemaphoreCreate(LongPtr smIDP, LongPtr tagP) + SYS_TRAP(sysTrapSysResSemaphoreCreate); + +Err SysResSemaphoreDelete(Long smID) + SYS_TRAP(sysTrapSysResSemaphoreDelete); + +Err SysResSemaphoreReserve(Long smID, Long priority, Long timeout) + SYS_TRAP(sysTrapSysResSemaphoreReserve); + +Err SysResSemaphoreRelease(Long smID) + SYS_TRAP(sysTrapSysResSemaphoreRelease); + + + +// Timers +Err SysTimerCreate(LongPtr timerIDP, LongPtr tagP, + SysTimerProcPtr timerProc, Long periodicDelay, + Long param) + SYS_TRAP(sysTrapSysTimerCreate); + +Err SysTimerDelete(Long timerID) + SYS_TRAP(sysTrapSysTimerDelete); + +Err SysTimerWrite(Long timerID, ULong value) + SYS_TRAP(sysTrapSysTimerWrite); + +Err SysTimerRead(Long timerID, ULong* valueP) + SYS_TRAP(sysTrapSysTimerRead); + + +// Information +Err SysKernelInfo(VoidPtr paramP) + SYS_TRAP(sysTrapSysKernelInfo); + + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _SysSemaphoreSignal \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSignal) + +#define _SysSemaphoreSet \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSet) + +#define _SysDoze \ + ASM_SYS_TRAP(sysTrapSysDoze) + + +#endif //__SYSTEMMGR_H__ diff --git a/sdk-1/include/Core/System/SystemMgr.rh b/sdk-1/include/Core/System/SystemMgr.rh new file mode 100644 index 0000000..c03718a --- /dev/null +++ b/sdk-1/include/Core/System/SystemMgr.rh @@ -0,0 +1,165 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SystemMgr.rh + * + * Description: + * Include file for both PilotRez 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: + * 2/27/95 Created by Ron Marianetti + * 8/4/95 vmk Added system resource id for Desktop Link user info + * + *******************************************************************/ + +#ifndef __SYSTEMMGR_RH__ +#define __SYSTEMMGR_RH__ + +//----------------------------------------------------------- +// This section is common to both the C and Resource Compiler +//----------------------------------------------------------- + +//................................................................ +// File types and creators +// +// Each database shall have a creator ID and a type. +// +// The creator ID shall establish which application, patch, or extension +// a particular database is associated with. The creator ID should identify +// the application/patch/extension, NOT who created it. +// +// The type will determine which part of an application, +// patch, or extension a particular database is. +// +// There can be only one database per application, patch, or extension +// which has type 'application', 'patch', or 'extension'. +// +// Creators: +// +// ROM-based applications created by Palm Computing have all-lower case +// creator ID's. Third-party applications have creator ID's which +// are either all caps, or mixed case. The same requirements go for +// system patches and extensions. +// +// All applications, system patches and extensions shall have unique creator +// ID's. +// +// Types: +// +// 'Application', 'Extension', and 'Patch' file/database types for ROM-based +// apps shall be all-lower case (they are defined below). Other +// file/database types must be mixed-case, +// or all caps. These other types are internal to the applications, and +// therefore the system is unconcerned with their exact values. +//................................................................ +#define sysFileCSystem 'psys' // Creator type for System files +#define sysFileCGraffiti 'graf' // Creator type for Graffiti databases +#define sysFileCSystemPatch 'ptch' // Creator for System resource file patches + +#define sysFileCCalculator 'calc' // Creator type for Calculator App +#define sysFileCSecurity 'secr' // Creator type for Security App +#define sysFileCFirstApp 'pref' // Creator type for First App after reset +#define sysFileCDefaultApp 'memr' // Creator type for Default app + +#define sysFileCAddress 'addr' +#define sysFileCToDo 'todo' +#define sysFileCDatebook 'date' +#define sysFileCMemo 'memo' +#define sysFileCSync 'sync' +#define sysFileCSecurity 'secr' + +#define sysFileTSystem 'rsrc' // File type for Main System File +#define sysFileTSystemPatch 'ptch' // File type for System resource file patches +#define sysFileTKernel 'krnl' // File type for System Kernel (AMX) +#define sysFileTUIAppShell 'uish' // File type for UI Application Shell +#define sysFileTExtension 'extn' // File type for System Extensions +#define sysFileTApplication 'appl' // File type for applications + +#define sysFileTGraffitiMacros 'macr' // Graffiti Macros database + + +//................................................................ +// Resource types and IDs +//................................................................ +#define sysResTBootCode 'boot' // Resource type of boot resources +#define sysResIDBootReset 10000 // Reset code +#define sysResIDBootInitCode 10001 // Init code +#define sysResIDBootSysCodeStart 10100 // System code resources start here +#define sysResIDBootSysCodeMin 10102 // IDs 'Start' to this must exist!! +#define sysResIDBootUICodeStart 10200 // UI code resources start here +#define sysResIDBootUICodeMin 10203 // IDs 'Start' to this must exist!! + +#define sysResTAppPrefs 'pref' // Resource type of App preferences resources + +#define sysResTAppCode 'code' // Resource type of App code resources +#define sysResTAppGData 'data' // Resource type of App global data resources + +#define sysResTExtensionCode 'extn' // Resource type of Extensions code + +#define sysResTFeatures 'feat' // Resource type of System features table +#define sysResIDFeatures 10000 // Resource ID of System features table + +#define sysResTLibrary 'libr' // Resource type of System Libraries + +#define sysResTGrfTemplate 'tmpl' // Graffiti templates "file" +#define sysResIDGrfTemplate 10000 // Graffiti templates "file" ID +#define sysResTGrfDictionary 'dict' // Graffiti dictionary "file" +#define sysResIDGrfDictionary 10000 // Graffiti dictionary "file" ID +#define sysResIDGrfDefaultMacros 10000 // sysResTDefaultDB resource with Graffiti Macros database + +#define sysResTDefaultDB 'dflt' // Default database resource type +#define sysResIDDefaultDB 1 // resource ID of sysResTDefaultDB in each app + +// System Preferences +#define sysResTSysPref sysFileCSystem +#define sysResIDSysPrefMain 0 // Main preferences +#define sysResIDSysPrefPassword 1 // Password +#define sysResIDSysPrefFindStr 2 // Find string +#define sysResIDSysPrefCalibration 3 // Digitizer calibration. +#define sysResIDDlkUserInfo 4 // Desktop Link user information. + + +//----------------------------------------------------------- +// This section is only valid when running the resource compiler +//----------------------------------------------------------- +#ifdef RESOURCE_COMPILER + +// Definition of the Pilot Preferences Resource. This must match +// the definition of the structure SysAppPrefs in SystemMgr.h +resdef { + word priority; // AMX task priority + long stackSize; // required stack size + long minHeapSpace; // min required free space in heap + } sysResTAppPrefs; + + +// Definition of the ROM - Based Feature table +resdef { + word featureNum; // Feature number + long featureValue; // Feature value + } 'FITM'; + +resdef { + long creator; // creator type + word len(featureItems); + resource 'FITM' featureItems[]; + } 'CITM'; + +resdef { + word len(creatorItems); + resource 'CITM' creatorItems[]; + } sysResTFeatures; + + +#endif + + +#endif //__SYSTEMMGR_RH__ + diff --git a/sdk-1/include/Core/System/SystemPkt.h b/sdk-1/include/Core/System/SystemPkt.h new file mode 100644 index 0000000..2bc78e3 --- /dev/null +++ b/sdk-1/include/Core/System/SystemPkt.h @@ -0,0 +1,389 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SystemPkt.h + * + * Description: + * Structure of System Packets for the Serial Link Manager. These + * packets are used by the Debugger, Console, and Remote UI modules + * for communication with the host computer. + * + * History: + * 6/26/95 RM - Created by Ron Marianetti + * + * + *******************************************************************/ + + +#ifndef __SYSTEM_PKT_H__ +#define __SYSTEM_PKT_H__ + +#include + + +//************************************************************************* +// Constants for System Packets +// +//************************************************************************* + +// Max # of bytes we can read/write at a time with the ReadMem and WriteMem +// commands; +#define sysPktMaxMemChunk 256 + +// Maximum body size for System Packets. This is big enough to have +// 256 bytes of data for the Read and Write Mem command plus whatever other +// parameters are in the body for these commands. +#define sysPktMaxBodySize (sysPktMaxMemChunk+16) + + +// Default nitial timeout value for packet receive routines in ticks +#define sysPktInitialTimeout (sysTicksPerSecond*10) + + + +//************************************************************************* +// Packet Body Structure +//************************************************************************* + +// Common fields at the start of every body +#define _sysPktBodyCommon \ + Byte command; \ + Byte _filler + + +// Generic System Packet Body +typedef struct SysPktBodyType { + _sysPktBodyCommon; + Byte data[sysPktMaxBodySize-2]; + } SysPktBodyType; +typedef SysPktBodyType* SysPktBodyPtr; + + + +//************************************************************************* +// The max size of the array of SlkWriteDataTypes used by System Packet +// assembly routines in order to minimize stack usage. +//************************************************************************* +#define sysPktMaxBodyChunks 3 + + + +//************************************************************************* +// packet commands +//************************************************************************* + +//-------------------------------------------------------------------- +// get state command +//-------------------------------------------------------------------- +#define sysPktStateCmd 0x00 +#define sysPktStateRsp 0x80 + +//-------------------------------------------------------------------- +// read memory command +//-------------------------------------------------------------------- +#define sysPktReadMemCmd 0x01 +#define sysPktReadMemRsp 0x81 + +typedef struct SysPktReadMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to read + Word numBytes; // # of bytes to read + } SysPktReadMemCmdType; +typedef SysPktReadMemCmdType* SysPktReadMemCmdPtr; + +typedef struct SysPktReadMemRspType { + _sysPktBodyCommon; // Common Body header + // Byte data[?]; // variable size + } SysPktReadMemRspType; +typedef SysPktReadMemRspType* SysPktReadMemRspPtr; + + +//-------------------------------------------------------------------- +// write memory command +//-------------------------------------------------------------------- +#define sysPktWriteMemCmd 0x02 +#define sysPktWriteMemRsp 0x82 + +typedef struct SysPktWriteMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to write + Word numBytes; // # of bytes to write + // Byte data[?]; // variable size data + } SysPktWriteMemCmdType; +typedef SysPktWriteMemCmdType* SysPktWriteMemCmdPtr; + +typedef struct SysPktWriteMemRspType { + _sysPktBodyCommon; // Common Body header + } SysPktWriteMemRspType; +typedef SysPktWriteMemRspType* SysPktWriteMemRspPtr; + + +//-------------------------------------------------------------------- +// single-step command +//-------------------------------------------------------------------- +#define sysPktSingleStepCmd 0x03 +// no response + +//-------------------------------------------------------------------- +// get routine name command +//-------------------------------------------------------------------- +#define sysPktGetRtnNameCmd 0x04 +#define sysPktGetRtnNameRsp 0x84 + +//-------------------------------------------------------------------- +// read registers command +//-------------------------------------------------------------------- +#define sysPktReadRegsCmd 0x05 +#define sysPktReadRegsRsp 0x85 + + +//-------------------------------------------------------------------- +// write registers command +//-------------------------------------------------------------------- +#define sysPktWriteRegsCmd 0x06 +#define sysPktWriteRegsRsp 0x86 + +//-------------------------------------------------------------------- +// continue command +//-------------------------------------------------------------------- +#define sysPktContinueCmd 0x07 +// no response + + +//-------------------------------------------------------------------- +// Remote Procedure call +//-------------------------------------------------------------------- +#define sysPktRPCCmd 0x0A +#define sysPktRPCRsp 0x8A + +typedef struct SysPktRPCParamInfo { + Byte byRef; // true if param is by reference + Byte size; // # of Words of paramData + Word data[1]; // variable length array of paramData + } SysPktRPCParamType; + +typedef struct SysPktRPCType { + _sysPktBodyCommon; // Common Body header + Word trapWord; // which trap to execute + DWord resultD0; // result from D0 placed here + DWord resultA0; // result from A0 placed here + Word numParams; // how many parameters follow + // Following is a variable length array ofSlkRPCParamInfo's + SysPktRPCParamType param[1]; + } SysPktRPCType; + + +//-------------------------------------------------------------------- +// Set/Get breakpoints +//-------------------------------------------------------------------- +#define sysPktGetBreakpointsCmd 0x0B +#define sysPktGetBreakpointsRsp 0x8B +#define sysPktSetBreakpointsCmd 0x0C +#define sysPktSetBreakpointsRsp 0x8C + + +//-------------------------------------------------------------------- +// Remote UI Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktRemoteUIUpdCmd 0x0C + +typedef struct SysPktRemoteUIUpdCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from traget to host after drawing operations + Word rowBytes; // rowbytes of update area + Word fromY; // top of update rect + Word fromX; // left of update rect + Word toY; // top of screen rect + Word toX; // left of screen rect + Word height; // bottom of update rect + Word width; // right of update rect + + // The actual pixels of the update area follow + Word pixels; // variable length... + + } SysPktRemoteUIUpdCmdType; + + +#define sysPktRemoteEvtCmd 0x0D + +typedef struct SysPktRemoteEvtCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from host to target to feed pen and keyboard + // events. They do not require a response. + Boolean penDown; // true if pen down + SWord penX; // X location of pen + SWord penY; // Y location of pen + + Boolean keyPress; // true if key event follows + Word keyModifiers; // keyboard modifiers + Word keyAscii; // key ascii code + Word keyCode; // key virtual code + + } SysPktRemoteEvtCmdType; + + +//-------------------------------------------------------------------- +// Enable/Disable DbgBreak's command +//-------------------------------------------------------------------- +#define sysPktDbgBreakToggleCmd 0x0D +#define sysPktDbgBreakToggleRsp 0x8D + + +//-------------------------------------------------------------------- +// Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns info on the flash in: +// manuf - manufacturer code +// device - device code +//-------------------------------------------------------------------- +#define sysPktFlashCmd 0x0E +#define sysPktFlashRsp 0x8E + + +//-------------------------------------------------------------------- +// Get/Set communication parameters +//-------------------------------------------------------------------- +#define sysPktCommCmd 0x0F +#define sysPktCommRsp 0x8F + +typedef struct SysPktCommCmdType { + _sysPktBodyCommon; // Common Body header + Boolean set; // true to change parameters + ULong baudRate; // new baud rate + ULong flags; // new flags + } SysPktCommCmdType; +typedef SysPktCommCmdType* SysPktCommCmdPtr; + +typedef struct SysPktCommRspType { + _sysPktBodyCommon; // Common Body header + ULong baudRate; // current baud rate + ULong flags; // current flags + } SysPktCommRspType; +typedef SysPktCommRspType* SysPktCommRspPtr; + + +//-------------------------------------------------------------------- +// Get/Set Trap Breaks +//-------------------------------------------------------------------- +#define sysPktGetTrapBreaksCmd 0x10 +#define sysPktGetTrapBreaksRsp 0x90 +#define sysPktSetTrapBreaksCmd 0x11 +#define sysPktSetTrapBreaksRsp 0x91 + + +//-------------------------------------------------------------------- +// Gremlins Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktGremlinsCmd 0x12 + +typedef struct SysPktGremlinsCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from target to host to send Gremlins stuff + Word action; + Byte data[32]; + + } SysPktGremlinsCmdType; + +// Gremlins action codes +#define sysPktGremlinsIdle 1 +#define sysPktGremlinsEvent 2 + + +//-------------------------------------------------------------------- +// Find data - searches a range of addresses for data +//-------------------------------------------------------------------- +#define sysPktFindCmd 0x13 +#define sysPktFindRsp (sysPktFindCmd | 0x80) + +typedef struct SysPktFindCmdType { + _sysPktBodyCommon; // Common Body header + + DWord firstAddr; // first address to search + DWord lastAddr; // last address to begin searching + Word numBytes; // number of data bytes to match + Boolean caseInsensitive; // if true, perform a case-insensitive search + } SysPktFindCmdType; +typedef SysPktFindCmdType* SysPktFindCmdPtr; + +typedef struct SysPktFindRspType { + _sysPktBodyCommon; // Common Body header + + DWord addr; // address where data was found + Boolean found; // true if data was found + + } SysPktFindRspType; +typedef SysPktFindRspType* SysPktFindRspPtr; + + +//-------------------------------------------------------------------- +// message from remote unit +//-------------------------------------------------------------------- +#define sysPktRemoteMsgCmd 0x7f + + +//-------------------------------------------------------------------- +// sysPktRemoteMsg +// Send a text message +//-------------------------------------------------------------------- +typedef struct SysPktRemoteMsgCmdType { + _sysPktBodyCommon; // Common Body header + //Byte text; // variable length text goes here + } SysPktRemoteMsgCmdType; +typedef SysPktRemoteMsgCmdType* SysPktRemoteMsgCmdPtr; + + + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//================================================================ +// +// Host Only Routines. +// +//================================================================ +#if (EMULATION_LEVEL != EMULATION_NONE) + + + //------------------------------------------------------------------- + // RPC + //------------------------------------------------------------------ + // Init preparate on an RPC packet header and body. + Err SlkRPCInitPacket(SlkPktHeaderType* headerP, UInt dstSocket, + SysPktRPCType* bodyP, UInt trapWord); + + + // Stuff a parameter into an RPC packet body + VoidPtr SlkRPCStuffParam(SysPktRPCType* bodyP, void* dataP, + Int dataSize, Boolean byRef); + + // Send RPC packet and wait for response. + Err SlkRPCExecute(SlkPktHeaderPtr headerP, SysPktRPCType* bodyP, + Boolean async); + +#endif // (EMULATION_LEVEL != EMULATION_NONE) + + +#ifdef __cplusplus +} +#endif + + + + +#endif //__SYSTEM_PKT_H__ diff --git a/sdk-1/include/Core/System/SystemPrv.h b/sdk-1/include/Core/System/SystemPrv.h new file mode 100644 index 0000000..8197191 --- /dev/null +++ b/sdk-1/include/Core/System/SystemPrv.h @@ -0,0 +1,379 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SystemPrv.h + * + * Description: + * Private Pilot system equates + * + * History: + * 8/9/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __SYSTEMPRV_H__ +#define __SYSTEMPRV_H__ + +// Include fixed global type +#include + + +/************************************************************ + * Common Equates between Native and Emulation mode + *************************************************************/ +#define sysCardSignature 0xFEEDBEEFL // card signature long word +#define sysStoreSignature 0xFEEDFACEL // store signature long word + + +// This should be set to sizeof(LowMemType) for the final version, but +// until then we'll make it bigger than LowMemType so that we can +// add more globals without having to re-format memory cards. +#define sysLowMemSize 0x1200 // size of Low Memory Area +#define sysInitStack (sysLowMemSize+0x1000) // stack ptr during boot + + + +// The location of the Card Header (start of ROM) is plugged in at run +// time to the global variable GSysCardHeaderOffset. This MUST be done +// by the startup code. We make this a run-time variable so that the same +// executable ROM image can be run from ROM or RAM. +// #define sysCardHeaderOffset someConstant +#define sysRAMOnlyCardHeaderOffset 0x0000000L // RAM only card header created here +#define sysCardHeaderSize 0x0100 // size of card header + + +// Offset to ROM storage header from card header +#define sysROMStoreRelOffset sysCardHeaderSize +#define sysStoreHeaderSize 0x0100 // size of storage header + + +// This equate tells us how large of a heap info table to reserve in the +// globals for each card +#define sysMaxHeapsPerCard 128 // max # of heaps per card + + +// This equtes tells us the initial size of the Library table as held in +// the Low Memory area +#define sysDefaultLibraries 2 // default size of library table + + +// The default port number and baud rate for the serial port +#if HW_TARGET == HW_TARGET_TD1 +#define sysDefaultSerPort 0 // Use port #0 +#define sysDefaultSerBaud 57600 // baud rate +#else +#define sysDefaultSerPort 1 // Use port #1 +#define sysDefaultSerBaud 57600 // baud rate +#endif + + + +/************************************************************ + * Structure of the PREF resource in applications. Note, this + * structure must mirror the structure of the PREF resource + * as defined in the PilotRez include file. + *************************************************************/ +typedef struct SysAppPrefs { + Word priority; // task priority + DWord stackSize; // required stack space + DWord minHeapSpace; // minimum heap space required + } SysAppPrefsType; +typedef SysAppPrefsType* SysAppPrefsPtr; + + + +/************************************************************ + * 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 handle of the + * app, the code handle, the stack chunk pointer, the owner ID, etc. + *************************************************************/ +typedef struct SysAppInfoType { + Int cmd; // command code for app + Ptr cmdPBP; // cmd ParamBlock + UInt launchFlags; // launch flags + + Long taskID; // AMX task ID of task that app runs in + Handle codeH; // code handle of the main code segment + DmOpenRef dbP; // Application database access ptr of App + Ptr stackP; // stack chunk for the App + Ptr globalsChunkP; // globals chunk for the App + + UInt memOwnerID; // owner ID for Memory Manager chunks + Ptr dmAccessP; // pointer to linked list of opened DB's + SWord dmLastErr; // Last error from Data Manager + Ptr errExceptionP; // ErrTry,Catch exception list + } SysAppInfoType; +typedef SysAppInfoType* SysAppInfoPtr; + + +/************************************************************ + * Structure of the user info in the TCB of a task. This structure + * is stored in the xtcbuser fields of the AMX TCB for a task and + * must not exceed 4 DWords in length (the size reserved by AMX for + * user info). + *************************************************************/ +typedef struct SysTCBUserInfoType { + SysAppInfoPtr tmpAppInfoP; // used to pass appInfo to nested launches + SysAppInfoPtr rootAppInfoP; // App info for the root application on this task + DWord initialA5; // Inital value for A5 globals ptr + } SysTCBUserInfoType; +typedef SysTCBUserInfoType* SysTCBUserInfoPtr; + + +//***************************************************************** +// Structure of ParamBlock for the SysKernelInfo call +//***************************************************************** + +// Selector codes +typedef enum { + sysKernelInfoSelCurTaskInfo, + sysKernelInfoSelTaskInfo, + sysKernelInfoSelSemaphoreInfo, + sysKernelInfoSelTimerInfo + } SysKernelInfoSelector; + +typedef struct SysKernelInfoType { + SysKernelInfoSelector selector; // Which info to get + DWord id; // which object to get info on + + union { + struct task { + DWord id; // ID of task + DWord nextID; // ID of next task + + DWord tag; // task tag + DWord status; // task status + DWord timer; // # ticks left if task's timeout + DWord timeSlice; // task's time slice + SWord priority; // task priority + Word attributes; // task attributes + SWord pendingCalls; // # of pending calls + DWord senderTaskID; // task ID of message sender + DWord msgExchangeID; // task's message exchange ID, if any + + DWord tcbP; // pointer to TCB + DWord stackP; // stack pointer of task + DWord stackStart; // top of task stack (where it started). + DWord stackSize; // size of stack + } task; + + struct semaphore { + DWord id; + DWord nextID; // ID of next semaphore + + DWord tag; // semaphore tag + SWord initValue; // semaphore initial value + // >= 0 for counting, -1 for resource + SWord curValue; // semaphore current value + // >0 available + // 0 not available + // -n not available, n tasks waiting + SWord nestLevel; // 0 for counting, >= 0 for resource + DWord ownerID; // owner ID + // 0 for counting or resource free + } semaphore; + + struct timer { + DWord id; + DWord nextID; // ID of next timer + + DWord tag; // timer tag + DWord ticksLeft; // ticks left till timer runs + DWord period; // timer period, if periodic + DWord proc; // timer procedure + } timer; + } param; + + } SysKernelInfoType; + + +typedef SysKernelInfoType* SysKernelInfoPtr; + + + + +//----------------------------------------------------------------- +// Bits for status field in task info parameter block +//------------------------------------------------------------------ +#define sysTaskStatusTriggerWait 0x01 // (CJ_MATSWTR) Task idle (waiting for trigger) +#define sysTaskStatusSuspended 0x02 // (CJ_MATSWSUS) Task suspended (waiting for resume) +#define sysTaskStatusWaiting 0x04 // (CJ_MATSWAIT) Task waiting (see other bits) +#define sysTaskStatusHalted 0x80 // (CJ_MATSWHLT) Task halted + +// If sysTaskStatusWaiting set, these bits tell why.... +#define sysTaskStatusWaitSemaphore 0x00100 // (CJ_MATSWSM) waiting on semaphore +#define sysTaskStatusWaitEvent 0x00200 // (CJ_MATSWEV) waiting on event group +#define sysTaskStatusWaitMailbox 0x00400 // (CJ_MATSWMB) waiting on mailbox +#define sysTaskStatusWaitMsgExchange 0x00800 // (CJ_MATSWMX) waiting on message exchange +#define sysTaskStatusWaitBuffer 0x01000 // (CJ_MATSWBUF) waiting on buffer +#define sysTaskStatusWaitTimer 0x08000 // (CJ_MATSWTM) waiting on timer + +#define sysTaskStatusWaitMailboxAck 0x00010000L // (CJ_MATSWMBAK) mailbox ack +#define sysTaskStatusWaitMsgXAck 0x00020000L // (CJ_MATSWMXAK) msg exchange ack +#define sysTaskStatusWaitTaskSig 0x00040000L // (CJ_MATSWSIG) task signal wait + +//----------------------------------------------------------------- +// Bits for attributes field in task info parameter block +//------------------------------------------------------------------ +#define sysTaskAttrNoHalt 0x02 // (CJ_MATAHLT) Task cannot be halted +#define sysTaskAttrMsgStack 0x08 // (CJ_MATAMSG) receives msgs on stack +#define sysTaskAttrMsgByRef 0x10 // (CJ_MATAPBR) messages passed by reference +#define sysTaskAttrMsgOnStack 0x4000 // (CJ_MATAMRDY) message ready on stack +#define sysTaskAttrMsgSenderWaiting 0x8000 // (CJ_MATAMSW) msg sender waiting for ack + + + +/************************************************************ + * This structure defines a section within the RAM storage header + * on Card#0 used to hold non-volatile System information. We store + * System information that can not be conveniently stored or accessed + * from a Database in this area because: + * 1.) it can be accessed earlier during the boot-up process and + * 2.) It can be accessed from an interrupt routine. + *************************************************************/ +typedef struct SysNVParamsType { + DWord rtcHours; // Real-Time clock hours - add to value + // in DragonBall RTC register to get + // actual date & time. + DWord rtcHourMinSecCopy; // Copy of latest value in rtcHourMinSec reg of + // DBall. Used as default RTC value on Reset. + } SysNVParamsType; +typedef SysNVParamsType* SysNVParamsPtr; + + + +/************************************************************ + * Structure of the System Globals. This is where we place + * variable size globals that the System Manager uses. This + * is currently not used but a pointer for it is reserved + * in the low memory globals + *************************************************************/ +/* +typedef struct SysGlobalsType { + } SysGlobalsType; +typedef SysGlobalsType* SysGlobalsPtr; +*/ + + + +/************************************************************ + * This structure defines the entire the Low Memory Area + * and includes the low memory header defined in Globals.h, + * followed by some variable size globals that may change + * from rev to rev of the System Software. + * + * When emulating under Windows, this structure ends up at some random + * place in memory and the global variable GlobalsP points to it. + * + * When running in the native environment, this structure starts at + * address sysGlobalsOffset. + * + * In order to simplify the source code, macros are defined for + * accessing commonly used globals in the optimim manner for + * each environment. + *************************************************************/ +#include +#include +#include +#include +#include +typedef struct LowMemType { + + + // Fixed size globals, defined in Globals.h + LowMemHdrType fixed; + + + //--------------------------------------------------------------------------- + // These structures are always placed at the end of the LowMem area so + // that other globals don't generally have to move when their sizes change + //--------------------------------------------------------------------------- + CardInfoType memCardInfo[hwrNumCardSlots]; // Memory Card Info Array + + SlkGlobalsType slkGlobals; // Serial Link Mgr globals + + DbgGlobalsType dbgGlobals; // Debugger globals + + SysAppInfoType sysAppInfo; // SysAppInfoType for system + + Ptr sysDispatchTable[sysNumTraps]; // trap table + + } LowMemType; + + +// Access to variable size globals +#define GMemCardInfo (((LowMemType*)PilotGlobalsP)->memCardInfo) +#define GSlkGlobals (((LowMemType*)PilotGlobalsP)->slkGlobals) +#define GDbgGlobals (((LowMemType*)PilotGlobalsP)->dbgGlobals) +#define GSysAppInfo (((LowMemType*)PilotGlobalsP)->sysAppInfo) +#define GSysLibTable (((LowMemType*)PilotGlobalsP)->sysLibTable) +#define GSysDispatchTable (((LowMemType*)PilotGlobalsP)->sysDispatchTable) + + +// Flags for the GSysResetFlags global +#define sysResetFlagHardReset 0x01 // HardReset +#define sysResetFlagCreateDefaultDBs 0x02 // create default databases +#define sysResetFlagNoExtensions 0x04 // don't execute extensions + + +// Flags for the GSysPrefFlags global +#define sysPrefFlagTaxiDisable 0x0001 // Disable Taxi car - insurance policy + // (saved in preferences). +#define sysPrefFlagTaxiDisIdle 0x8000 // Disable Idle Taxi temporarily, + // (not saved in preferences) +#define sysPrefFlagTaxiDisIdleTime 0x4000 // Copy of the 16th bit of the system + // time when sysPrefFlagTaxiDisIdle bit + // was set (not saved in preferences). +// Flags for the GSysMiscFlags global +#define sysMiscFlagInFatalAlert 0x0001 // Currently displaying fatal alert + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +SysTCBUserInfoPtr SysTaskUserInfoPtr(ULong taskID) + SYS_TRAP(sysTrapSysTaskUserInfoPtr); + +Err SysAppStartup(SysAppInfoPtr* appInfoPP, Ptr* prevGlobalsP, + Ptr* globalsPtrP) + SYS_TRAP(sysTrapSysAppStartup); + +Err SysAppExit(SysAppInfoPtr appInfoP, Ptr prevGlobalsP, Ptr globalsP) + SYS_TRAP(sysTrapSysAppExit); + +SysAppInfoPtr SysCurAppInfoP(void) + SYS_TRAP(sysTrapSysCurAppInfoP); + + +#ifdef __cplusplus +} +#endif + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _SysFatalAlert \ + ASM_SYS_TRAP(sysTrapSysFatalAlert) + +#define _SysReset \ + ASM_SYS_TRAP(sysTrapSysReset) + + + +#endif //__SYSTEMPRV_H__ + +#endif // NON_PORTABLE + diff --git a/sdk-1/include/Core/System/TimeMgr.h b/sdk-1/include/Core/System/TimeMgr.h new file mode 100644 index 0000000..518edf0 --- /dev/null +++ b/sdk-1/include/Core/System/TimeMgr.h @@ -0,0 +1,77 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * TimeMgr.h + * + * Description: + * Time manager functions + * + * History: + * 1/19/95 roger - Created by Roger Flores + * + * + *******************************************************************/ + + +#ifndef __TIMEMGR_H__ +#define __TIMEMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Time Manager result codes + * (timErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define timErrMemory (timErrorClass | 1) + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err TimInit(void) SYS_TRAP(sysTrapTimInit); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// seconds since 1/1/1904 +ULong TimGetSeconds(void) + SYS_TRAP(sysTrapTimGetSeconds); + +// seconds since 1/1/1904 +void TimSetSeconds(ULong seconds) + SYS_TRAP(sysTrapTimSetSeconds); + +// ticks since power on +ULong TimGetTicks(void) + SYS_TRAP(sysTrapTimGetTicks); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __TIMEMGR_H__ + + diff --git a/sdk-1/include/Core/System/TimePrv.h b/sdk-1/include/Core/System/TimePrv.h new file mode 100644 index 0000000..3f56d7a --- /dev/null +++ b/sdk-1/include/Core/System/TimePrv.h @@ -0,0 +1,127 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * TimePrv.h + * + * Description: + * Private Time manager functions + * + * History: + * 1/19/95 roger - Created by Roger Flores + * + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __TIMEPRV_H__ +#define __TIMEPRV_H__ + + +/******************************************************************* + * Private Time Manager Constants + * + *******************************************************************/ + +// Alarm repeat interval -- once an alarm is triggered, it will +// repeat every timAlarmRepeatSeconds until it is canceled or +// replaced with a new alarm by the Alarm Manager. This ensures +// that an alarm will not be missed by the Alarm Manager code which +// is executed on some app's UI thread. +#define timAlarmRepeatSeconds 10 + +// Alarm delta interval -- if the difference between the alarm time and the current time +// is less than this interval, the alarm will be triggered immediately. This eliminates +// a race condition which occurs when the alarm time is TOO close to the current time. +#define timAlarmMinDeltaSeconds 2 + + + +/******************************************************************* + * Time Manager Globals + * + *******************************************************************/ +typedef struct TimGlobalsType { + + ULong rtcHours; // Added to DragonBall hours to get actual time + ULong alarmSeconds; // alarm time in seconds since 1/1/1904; + // 0 = none + + //------------------------------------------------------------------------------- + // The following fields are used exclusively to work around a bug in the 0G58E version + // of the DragonBall. This bug causes the rtcHourMinSec register in the DragonBall to + // occasionally be "out of date" when read and also prevents alarms from going off + // if we're in sleep mode. To get around this bug, we use the 1 minute interrupt while + // we're in sleep mode to wake up periodically and see if any alarms need to go off and + // we use the 1 second interrupt when we're awake to update our own copy of the hours, + // minutes and seconds. + //------------------------------------------------------------------------------- + Boolean rtcBugWorkaround; // true to work around bug in 0G58E version + // of dragonball. + Boolean rtcBugAsleep; // true if we're in sleep mode + + // Our copy of the time that we maintain through the 1 second and minute interrupts + ULong rtcBugAlarm; // when alarm should be triggerred. + ULong rtcBugSeconds; // seconds since 1/1/1904 + // IMPORTANT: The boolean rtcBugFastMinuteCalc MUST + // be cleared whenever rtcBugSeconds is changed!!!!!!! + ULong rtcBugLastSeconds; // seconds after last 1 sec. or min. interrupt. + Boolean rtcBugFastMinuteCalc; // true when current time is on a minute + // boundary. Used by TimHandleInterrupt speed up + // the next minute calculation. + } TimGlobalsType; + +typedef TimGlobalsType* TimGlobalsPtr; + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// +// IMPORTANT: TimSetAlarm() and TimGetAlarm() are reserved for use by the +// Alarm Manager! +// + +// set an alarm in seconds since 1/1/1904 +// (reserved for Alarm Manager use only) +ULong TimSetAlarm(ULong seconds) + SYS_TRAP(sysTrapTimSetAlarm); + +// get the current alarm setting in seconds since 1/1/1904 +// (reserved for Alarm Manager use only) +ULong TimGetAlarm(void) + SYS_TRAP(sysTrapTimGetAlarm); + +Err TimSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapTimSleep); + +Err TimWake(void) + SYS_TRAP(sysTrapTimWake); + + +//------------------------------------------------------------------- +// Interrupt Service routine +//------------------------------------------------------------------- +void TimHandleInterrupt(Boolean periodicUpdate) + SYS_TRAP(sysTrapTimHandleInterrupt); + + +#ifdef __cplusplus +} +#endif + + + + +#endif // __TIMEMGR_H__ + + +#endif // NON_PORTABLE diff --git a/sdk-1/include/Core/UI/AboutBox.h b/sdk-1/include/Core/UI/AboutBox.h new file mode 100644 index 0000000..f3dde47 --- /dev/null +++ b/sdk-1/include/Core/UI/AboutBox.h @@ -0,0 +1,23 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: AboutBox.h + * AUTHOR: Christopher Raff: October 25th, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines About Box routines + * + ***********************************************************************/ +#ifndef __ABOUTBOX_H__ +#define __ABOUTBOX_H__ + + +extern void AbtShowAbout (DWord creator) + SYS_TRAP(sysTrapAbtShowAbout); + + +#endif // __ABOUTBOX_H__ diff --git a/sdk-1/include/Core/UI/Category.h b/sdk-1/include/Core/UI/Category.h new file mode 100644 index 0000000..e6901de --- /dev/null +++ b/sdk-1/include/Core/UI/Category.h @@ -0,0 +1,59 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Category.h + * AUTHOR: Art Lamb: March 7, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines category structures and routines. + * + ***********************************************************************/ +#ifndef __CATEGORY_H__ +#define __CATEGORY_H__ + + +typedef struct { + Word renamedCategories; + Char categoryLabels [dmRecNumCategories] [dmCategoryLength]; + Byte categoryUniqIDs[dmRecNumCategories]; + Byte lastUniqID; // Uniq IDs generated by the device are between + // 0 - 127. Those from the PC are 128 - 255. +} AppInfoType; + + + +extern void CategoryCreateList (DmOpenRef db, ListPtr lst, + Word currentCategory, Boolean showAllCategoryCreateList) + SYS_TRAP(sysTrapCategoryCreateList); + +extern void CategoryFreeList (DmOpenRef db, ListPtr lst) + SYS_TRAP(sysTrapCategoryFreeList); + +extern Word CategoryFind (DmOpenRef db, CharPtr name) + SYS_TRAP(sysTrapCategoryFind); + +extern void CategoryGetName (DmOpenRef db, Word index, CharPtr name) + SYS_TRAP(sysTrapCategoryGetName); + +extern Boolean CategoryEdit (DmOpenRef db, WordPtr category) + SYS_TRAP(sysTrapCategoryEdit); + +extern Boolean CategorySelect (DmOpenRef db, FormPtr frm, Word ctlID, + Word lstID, Boolean title, WordPtr categoryP, CharPtr categoryName) + SYS_TRAP(sysTrapCategorySelect); + +extern Word CategoryGetNext (DmOpenRef db, Word index) + SYS_TRAP(sysTrapCategoryGetNext); + +extern void CategorySetTriggerLabel (ControlPtr ctl, CharPtr name) + SYS_TRAP(sysTrapCategorySetTriggerLabel); + +extern void CategoryTruncateName (CharPtr name, Word maxWidth) + SYS_TRAP(sysTrapCategoryTruncateName); + + +#endif // __CATEGORY_H__ diff --git a/sdk-1/include/Core/UI/CharAttr.h b/sdk-1/include/Core/UI/CharAttr.h new file mode 100644 index 0000000..88667e5 --- /dev/null +++ b/sdk-1/include/Core/UI/CharAttr.h @@ -0,0 +1,60 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: CharAttr.h + * AUTHOR: Art Lamb: April 21, 1995 + * + * DECLARER: Toolbox + * + * DESCRIPTION: + * This file defines character classification and character + * conversion macros + * + **********************************************************************/ + +#ifndef _CHAR_ATTR_H +#define _CHAR_ATTR_H + +// Character attribute code bits +#define _XA 0x200 // extra alphabetic +#define _XS 0x100 // extra space +#define _BB 0x80 // BEL, BS, etc. +#define _CN 0x40 // CR, FF, HT, NL, VT +#define _DI 0x20 // '0'-'9' +#define _LO 0x10 // 'a'-'z' and lowercase extended chars. +#define _PU 0x08 // punctuation +#define _SP 0x04 // space +#define _UP 0x02 // 'A'-'Z' and uppercase extended chars. +#define _XD 0x01 // '0'-'9', 'A'-'F', 'a'-'f' + + +// Character classification macros. +// If these are used to test characters from events (keyDownEvent) +// IsAscii should be used first. +#define IsAscii(c) (c <= 255) +#define IsAlNum(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_UP|_XA)) +#define IsAlpha(attr,c) (attr[(Byte)(c)] & (_LO|_UP|_XA)) +#define IsCntrl(attr,c) (attr[(Byte)(c)] & (_BB|_CN)) +#define IsDigit(attr,c) (attr[(Byte)(c)] & _DI) +#define IsGraph(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_PU|_UP|_XA)) +#define IsLower(attr,c) (attr[(Byte)(c)] & _LO) +#define IsPrint(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_PU|_SP|_UP|_XA)) +#define IsPunct(attr,c) (attr[(Byte)(c)] & _PU) +#define IsSpace(attr,c) (attr[(Byte)(c)] & (_CN|_SP|_XS)) +#define IsUpper(attr,c) (attr[(Byte)(c)] & _UP) +#define IsHex(attr,c) (attr[(Byte)(c)] & _XD) +#define IsDelim(attr,c) (attr[(Byte)(c)] & _SP|_PU) + + +WordPtr GetCharAttr (void) + SYS_TRAP(sysTrapGetCharAttr); + +BytePtr GetCharSortValue (void) + SYS_TRAP(sysTrapGetCharSortValue); + +BytePtr GetCharCaselessValue (void) + SYS_TRAP(sysTrapGetCharCaselessValue); + +#endif /* _CHAR_ATTR_H */ diff --git a/sdk-1/include/Core/UI/Chars.h b/sdk-1/include/Core/UI/Chars.h new file mode 100644 index 0000000..d0393dd --- /dev/null +++ b/sdk-1/include/Core/UI/Chars.h @@ -0,0 +1,255 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Chars.h + * AUTHOR: Roger Flores: November 3, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the characters in fonts. + * + **********************************************************************/ +#ifndef __CHARS_H__ +#define __CHARS_H__ + + +// Special characters +#define downArrowChr 0x1F +#define upArrowChr 0x1E +#define leftArrowChr 0x1C +#define rightArrowChr 0x1D + + +// The hardware arrow buttons generate the following Chr codes. +#define pageUpChr 0x0B +#define pageDownChr 0x0C + + +// The following are key codes used for virtual events, like +// low battery warnings, etc. These keyboard events MUST +// have the commandKeyMask bit set in the modifiers in order +// to be recognized. +#define lowBatteryChr 0x0101 // Display low battery dialog +#define enterDebuggerChr 0x0102 // Enter Debugger +#define nextFieldChr 0x0103 // Go to next field in form +#define startConsoleChr 0x0104 // Startup console task +#define menuChr 0x0105 // Ctl-A +#define commandChr 0x0106 // Ctl-C +#define confirmChr 0x0107 // Ctl-D +#define launchChr 0x0108 // Ctl-E +#define keyboardChr 0x0109 // Ctl-F +#define findChr 0x010A +#define calcChr 0x010B +#define prevFieldChr 0x010C +#define alarmChr 0x010D // sent before displaying an alarm + + + +// The Application launching buttons generate the following +// key codes and will also set the commandKeyMask bit in the +// modifiers field +#define hardKeyMin 0x0200 +#define hardKeyMax 0x02FF +#define hard1Chr 0x0204 +#define hard2Chr 0x0205 +#define hard3Chr 0x0206 +#define hard4Chr 0x0207 +#define hardPowerChr 0x0208 +#define hardCradleChr 0x0209 // Button on cradle pressed + +#define ChrIsHardKey(c) ((c >= hardKeyMin) && (c <= hardKeyMax)) + +// Characters from all text fonts. Resource ID's 9000, 9001, 9002 +#define nullChr 0x00 +#define backspaceChr 0x08 +#define tabChr 0x09 +#define linefeedChr 0x0A +#define crChr 0x0D +#define colonChr ':' +#define periodChr '.' +#define commaChr ',' +#define quoteChr '"' + +#define returnChr 0x0D +#define escapeChr 0x1B +#define spaceChr 0x20 +#define lastAsciiChr 0xFF + +#define numericSpaceChr 0x80 + +#define cutChr 0x12D // Ctl-X +#define copyChr 0x12E // Ctl-C +#define pasteChr 0x12F // Ctl-V + + +// Extended characters for Windows Code Page 1252 +#define lowSingleCommaQuoteChr 0x82 +#define scriptFChr 0x83 +#define lowDblCommaQuoteChr 0x84 +#define horizEllipsisChr 0x85 +#define daggerChr 0x86 +#define dblDaggerChr 0x87 +#define circumflexChr 0x88 +#define perMilleChr 0x89 +#define upSHacekChr 0x8A +#define leftSingleGuillemetChr 0x8B +#define upOEChr 0x8C +#define diamondChr 0x8D // These 4 are not actually in the + // windows code page, but we like 'em + // anyway. +#define clubChr 0x8E +#define heartChr 0x8F +#define spadeChr 0x90 +#define singleOpenCommaQuoteChr 0x91 +#define singleCloseCommaQuoteChr 0x92 +#define dblOpenCommaQuoteChr 0x93 +#define dblCloseCommaQuoteChr 0x94 +#define bulletChr 0x95 +#define enDashChr 0x96 +#define emDashChr 0x97 +#define spacingTildeChr 0x98 +#define trademarkChr 0x99 +#define lowSHacekChr 0x9A +#define rightSingleGuillemetChr 0x9B +#define lowOEChr 0x9C +#define upYDiaeresisChr 0x9F +#define nonBreakSpaceChr 0xA0 +#define invertedExclamationChr 0xA1 +#define centChr 0xA2 +#define poundChr 0xA3 +#define currencyChr 0xA4 +#define yenChr 0xA5 +#define brokenVertBarChr 0xA6 +#define sectionChr 0xA7 +#define spacingDiaeresisChr 0xA8 +#define copyrightChr 0xA9 +#define feminineOrdinalChr 0xAA +#define leftGuillemetChr 0xAB +#define notChr 0xAC +#define softHyphenChr 0xAD +#define registeredChr 0xAE +#define spacingMacronChr 0xAF +#define degreeChr 0xB0 +#define plusMinusChr 0xB1 +#define superscript2Chr 0xB2 +#define superscript3Chr 0xB3 +#define spacingAcuteChr 0xB4 +#define microChr 0xB5 +#define paragraphChr 0xB6 +#define middleDotChr 0xB7 +#define spacingCedillaChr 0xB8 +#define superscript1Chr 0xB9 +#define masculineOrdinalChr 0xBA +#define rightGuillemetChr 0xBB +#define fractOneQuarterChr 0xBC +#define fractOneHalfChr 0xBD +#define fractThreeQuartersChr 0xBE +#define invertedQuestionChr 0xBF +#define upAGraveChr 0xC0 +#define upAAcuteChr 0xC1 +#define upACircumflexChr 0xC2 +#define upATildeChr 0xC3 +#define upADiaeresisChr 0xC4 +#define upARingChr 0xC5 +#define upAEChr 0xC6 +#define upCCedillaChr 0xC7 +#define upEGraveChr 0xC8 +#define upEAcuteChr 0xC9 +#define upECircumflexChr 0xCA +#define upEDiaeresisChr 0xCB +#define upIGraveChr 0xCC +#define upIAcuteChr 0xCD +#define upICircumflexChr 0xCE +#define upIDiaeresisChr 0xCF +#define upEthChr 0xD0 +#define upNTildeChr 0xD1 +#define upOGraveChr 0xD2 +#define upOAcuteChr 0xD3 +#define upOCircumflexChr 0xD4 +#define upOTildeChr 0xD5 +#define upODiaeresisChr 0xD6 +#define multiplyChr 0xD7 +#define upOSlashChr 0xD8 +#define upUGraveChr 0xD9 +#define upUAcuteChr 0xDA +#define upUCircumflexChr 0xDB +#define upUDiaeresisChr 0xDC +#define upYAcuteChr 0xDD +#define upThorn 0xDE +#define lowSharpSChr 0xDF +#define lowAGraveChr 0xE0 +#define lowAAcuteChr 0xE1 +#define lowACircumflexChr 0xE2 +#define lowATildeChr 0xE3 +#define lowADiaeresisChr 0xE4 +#define lowARingChr 0xE5 +#define lowAEChr 0xE6 +#define lowCCedillaChr 0xE7 +#define lowEGraveChr 0xE8 +#define lowEAcuteChr 0xE9 +#define lowECircumflexChr 0xEA +#define lowEDiaeresisChr 0xEB +#define lowIGraveChr 0xEC +#define lowIAcuteChr 0xED +#define lowICircumflexChr 0xEE +#define lowIDiaeresisChr 0xEF +#define lowEthChr 0xF0 +#define lowNTildeChr 0xF1 +#define lowOGraveChr 0xF2 +#define lowOAcuteChr 0xF3 +#define lowOCircumflexChr 0xF4 +#define lowOTildeChr 0xF5 +#define lowODiaeresisChr 0xF6 +#define divideChr 0xF7 +#define lowOSlashChr 0xF8 +#define lowUGraveChr 0xF9 +#define lowUAcuteChr 0xFA +#define lowUCircumflexChr 0xFB +#define lowUDiaeresisChr 0xFC +#define lowYAcuteChr 0xFD +#define lowThorn 0xFE +#define lowYDiaeresisChr 0xFF + + +// Characters in the 9 point symbol font. Resource ID 9003 +enum symbolChars { + symbolLeftArrow = 3, + symbolRightArrow, + symbolUpArrow, + symbolDownArrow, + symbolSmallDownArrow, + symbolSmallUpArrow, + symbolMemo = 9, + symbolHelp, + symbolNote, + symbolNoteSelected, + symbolCapsLock, + symbolNumLock, + symbolShiftUpper, + symbolShiftPunc, + symbolShiftExt, + symbolShiftNone, + symbolNoTime + }; + +// Character in the 7 point symbol font. Resource ID 9005 +enum symbol7Chars { + symbol7ScrollUp = 1, + symbol7ScrollDown, + symbol7ScrollUpDisabled, + symbol7ScrollDownDisabled + }; + +// Characters in the 11 point symbol font. Resource ID 9004 +enum symbol11Chars { + symbolCheckboxOff = 0, + symbolCheckboxOn, + symbol11LeftArrow, + symbol11RightArrow + }; + + +#endif // __CHARS_H__ diff --git a/sdk-1/include/Core/UI/ClipBoard.h b/sdk-1/include/Core/UI/ClipBoard.h new file mode 100644 index 0000000..e506f28 --- /dev/null +++ b/sdk-1/include/Core/UI/ClipBoard.h @@ -0,0 +1,45 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: clipBoard.h + * AUTHOR: Art Lamb: September 1, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines clipboard structures and routines. + * + ***********************************************************************/ + +#ifndef __CLIPBOARD_H__ +#define __CLIPBOARD_H__ + + +#define numClipboardForamts 3 +#define cbdMaxTextLength 1000 + + +// Clipboard standard formats +enum clipboardFormats { clipboardText, clipboardInk, clipboardBitmap }; + +typedef enum clipboardFormats ClipboardFormatType; + +typedef struct { + VoidHand item; + Word length; +} ClipboardItem; + +//---------------------------------------------------------- +// Clipboard Functions +//---------------------------------------------------------- + +extern void ClipboardAddItem + (ClipboardFormatType format, VoidPtr ptr, Word length) + SYS_TRAP(sysTrapClipboardAddItem); + +extern VoidHand ClipboardGetItem (ClipboardFormatType format, WordPtr length) + SYS_TRAP(sysTrapClipboardGetItem); + +#endif // __CLIPBOARD_H__ diff --git a/sdk-1/include/Core/UI/Control.h b/sdk-1/include/Core/UI/Control.h new file mode 100644 index 0000000..d6dc22b --- /dev/null +++ b/sdk-1/include/Core/UI/Control.h @@ -0,0 +1,110 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Control.h + * AUTHOR: Art Lamb: August 29, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines check box structures and routines. + * + ***********************************************************************/ +#ifndef __CONTROL_H__ +#define __CONTROL_H__ + + + +typedef struct { + Byte usable :1; // set if part of ui + Byte enabled :1; // set if interactable (not grayed out) + Byte visible :1; // set if drawn (set internally) + Byte on :1; // set if on (checked) + Byte leftAnchor :1; // set if bounds expand to the right + // clear if bounds expand to the left + Byte frame :3; +} ControlAttrType; + + +enum controlStyles {buttonCtl, pushButtonCtl, checkboxCtl, popupTriggerCtl, + selectorTriggerCtl, repeatingButtonCtl}; +typedef enum controlStyles ControlStyleType; + +enum buttonFrames {noButtonFrame, standardButtonFrame, boldButtonFrame, + rectangleButtonFrame}; +typedef enum buttonFrames ButtonFrameType; + + +typedef struct { + Word id; + RectangleType bounds; + CharPtr text; + ControlAttrType attr; + ControlStyleType style; + FontID font; + Byte group; +} ControlType; + + +typedef ControlType * ControlPtr; + + + +//---------------------------------------------------------- +// Control Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CtlDrawControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlDrawControl); + +extern void CtlEraseControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlEraseControl); + +extern void CtlHideControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlHideControl); + +extern void CtlShowControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlShowControl); + +extern Boolean CtlEnabled (ControlPtr pControl) + SYS_TRAP(sysTrapCtlEnabled); + +extern void CtlSetEnabled (ControlPtr pControl, Boolean usable) + SYS_TRAP(sysTrapCtlSetEnabled); + +extern void CtlSetUsable (ControlPtr pControl, Boolean usable) + SYS_TRAP(sysTrapCtlSetUsable); + +extern SWord CtlGetValue (ControlPtr pControl) + SYS_TRAP(sysTrapCtlGetValue); + +extern void CtlSetValue (ControlPtr pControl, SWord newValue) + SYS_TRAP(sysTrapCtlSetValue); + +extern CharPtr CtlGetLabel (ControlPtr pControl) + SYS_TRAP(sysTrapCtlGetLabel); + +extern void CtlSetLabel (ControlPtr pControl, CharPtr newLabel) + SYS_TRAP(sysTrapCtlSetLabel); + +extern void CtlHitControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlHitControl); + +extern Boolean CtlHandleEvent (ControlPtr pControl, EventPtr pEvent) + SYS_TRAP(sysTrapCtlHandleEvent); + +#ifdef __cplusplus +} +#endif + + +#endif //__CONTROL_H__ + + + diff --git a/sdk-1/include/Core/UI/Day.h b/sdk-1/include/Core/UI/Day.h new file mode 100644 index 0000000..f7ff4b1 --- /dev/null +++ b/sdk-1/include/Core/UI/Day.h @@ -0,0 +1,43 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Day.h + * AUTHOR: Roger Flores: May 31, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the date picker month object's structures + * and routines. + * + ***********************************************************************/ +#ifndef __DAY_H__ +#define __DAY_H__ + + +#include + +typedef struct { + RectangleType bounds; + Boolean visible; + SWord visibleMonth; // month actually displayed + SWord visibleYear; // year actually displayed + DateTimeType selected; +} DaySelectorType; + +typedef DaySelectorType * DaySelectorPtr; + + +void DayDrawDaySelector (DaySelectorPtr pSelector) + SYS_TRAP(sysTrapDayDrawDaySelector); + +Boolean DayHandleEvent (DaySelectorPtr pSelector, EventPtr pEvent) + SYS_TRAP(sysTrapDayHandleEvent); + +void DayDrawDays (DaySelectorPtr pSelector) + SYS_TRAP(sysTrapDayDrawDays); + + +#endif //__DAY_H__ diff --git a/sdk-1/include/Core/UI/Event.h b/sdk-1/include/Core/UI/Event.h new file mode 100644 index 0000000..593b4a8 --- /dev/null +++ b/sdk-1/include/Core/UI/Event.h @@ -0,0 +1,267 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Event.h + * AUTHOR: Art Lamb: September 26, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines window structures and routines. + * + **********************************************************************/ + +#ifndef __EVENT_H__ +#define __EVENT_H__ + + +// Types of events +enum events { + nilEvent = 0, + penDownEvent, + penUpEvent, + penMoveEvent, + keyDownEvent, + winEnterEvent, + winExitEvent, + ctlEnterEvent, + ctlExitEvent, + ctlSelectEvent, + ctlRepeatEvent, + lstEnterEvent, + lstSelectEvent, + lstExitEvent, + popSelectEvent, + fldEnterEvent, + fldHeightChangedEvent, + fldChangedEvent, + tblEnterEvent, + tblSelectEvent, + daySelectEvent, + menuEvent, + appStopEvent, + frmLoadEvent, + frmOpenEvent, + frmGotoEvent, + frmUpdateEvent, + frmSaveEvent, + frmCloseEvent, + tblExitEvent, + firstUserEvent = 32767 +}; + +// keyDownEvent modifers +#define shiftKeyMask 0x0001 +#define capsLockMask 0x0002 +#define numLockMask 0x0004 +#define commandKeyMask 0x0008 +#define optionKeyMask 0x0010 +#define controlKeyMask 0x0020 +#define autoRepeatKeyMask 0x0040 // True if generated due to auto-repeat +#define doubleTapKeyMask 0x0080 // True if this is a double-tap event +#define poweredOnKeyMask 0x0100 // True if this is a double-tap event + + +// Event timeouts +#define evtWaitForever -1 + + +// The event record. +typedef struct { + enum events eType; + Boolean penDown; + SWord screenX; + SWord screenY; + union data { + struct generic { + Word data1; + Word data2; + Word data3; + Word data4; + Word data5; + Word data6; + Word data7; + Word data8; + } generic; + + struct { + PointType start; // display coord. of stroke start + PointType end; // display coord. of stroke start + } penUp; + + struct { + Word chr; // ascii code + Word keyCode; // virtual key code + Word modifiers; + } keyDown; + + struct winEnter { + WinHandle enterWindow; + WinHandle exitWindow; + } winEnter; + + struct winExit { + WinHandle enterWindow; + WinHandle exitWindow; + } winExit; + + struct ctlEnter { + Word controlID; + void * pControl; + } ctlEnter; + + struct ctlSelect { + Word controlID; + void * pControl; + Boolean on; + } ctlSelect; + + struct ctlRepeat { + Word controlID; + void * pControl; + DWord time; + } ctlRepeat; + + struct fldEnter { + Word fieldID; + void * pField; + } fldEnter; + + struct fldHeightChanged { + Word fieldID; + void * pField; + Word newHeight; + Word currentPos; + } fldHeightChanged; + + struct fldChanged { + Word fieldID; + void * pField; + } fldChanged; + + struct fldExit { + Word fieldID; + void * pField; + } fldExit; + + struct lstEnter { + Word listID; + void * pList; + Word selection; + } lstEnter; + + struct lstExit { + Word listID; + void * pList; + } lstExit; + + struct lstSelect { + Word listID; + void * pList; + Word selection; + } lstSelect; + + struct tblEnter { + Word tableID; + void * pTable; + Word row; + Word column; + } tblEnter; + + struct tblExit { + Word tableID; + void * pTable; + Word row; + Word column; + } tblExit; + + struct tblSelect { + Word tableID; + void * pTable; + Word row; + Word column; + } tblSelect; + + struct frmLoad { + Word formID; + } frmLoad; + + struct frmOpen { + Word formID; + } frmOpen; + + struct frmGoto { + Word formID; + Word recordNum; // index of record that contain a match + Word matchPos; // postion in record of the match. + Word matchLen; // length of match. + Word matchFieldNum; // field number string was found int + DWord matchCustom; // application specific info + } frmGoto; + + struct frmClose { + Word formID; + } frmClose; + + struct frmUpdate { + Word formID; + Word updateCode; // Application specific + } frmUpdate; + + struct daySelect { + void * pSelector; + Word selection; + Boolean useThisDate; + } daySelect; + + struct menu { + Word itemID; + } menu; + + struct popSelect { + Word controlID; + void * controlP; + Word listID; + void * listP; + Word selection; + Word priorSelection; + } popSelect; + + + } data; +} EventType; + +typedef EventType * EventPtr; + +//--------------------------------------------------------------------- +// Event Functions +//--------------------------------------------------------------------- + +extern void EvtInitialize (void) + SYS_TRAP(sysTrapEvtInitialize); + +extern void EvtAddEventToQueue (EventPtr event) + SYS_TRAP(sysTrapEvtAddEventToQueue); + +extern void EvtCopyEvent (EventPtr source, EventPtr dest) + SYS_TRAP(sysTrapEvtCopyEvent); + +extern void EvtGetEvent (EventPtr event, SDWord timeout) + SYS_TRAP(sysTrapEvtGetEvent); + +void EvtGetPen(SWord *pScreenX, SWord *pScreenY, Boolean *pPenDown) + SYS_TRAP(sysTrapEvtGetPen); + +// For Compatibility.. DOLATER... source modules should use EvtGetPen instead. +#define PenGetPoint(a,b,c) EvtGetPen(a,b,c) + + +#endif // __EVENT_H__ + + + + + + diff --git a/sdk-1/include/Core/UI/Field.h b/sdk-1/include/Core/UI/Field.h new file mode 100644 index 0000000..6dea14b --- /dev/null +++ b/sdk-1/include/Core/UI/Field.h @@ -0,0 +1,245 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: field.h + * AUTHOR: Art Lamb: August 29, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines field structures and routines. + * + ***********************************************************************/ +#ifndef __FIELD_H__ +#define __FIELD_H__ + +#define maxFieldTextLen 0x7fff + +// Maximun number of line the a dynamicly sizing field will expand to. +#define maxFieldLines 11 + + +// kind alignment values +#define leftAlign 0 +#define centerAlign 1 +#define rightAlign 2 + + +#define undoBufferSize 100 + +typedef enum { undoNone, undoTyping, undoBackspace, undoDelete, + undoPaste, undoCut } UndoMode; + +typedef struct { + UndoMode mode; + Word start; + Word end; + Word bufferLen; + CharPtr buffer; + } FieldUndoType; + + +typedef struct { + Word usable :1; // Set if part of ui + Word visible :1; // Set if drawn, used internally + Word editable :1; // Set if editable + Word singleLine :1; // Set if only a single line is displayed + Word hasFocus :1; // Set if the field has the focus + Word dynamicSize :1; // Set if height expands as text is entered + Word insPtVisible :1; // Set if the ins pt is scolled into view + Word dirty :1; // Set if user modified + Word underlined :2; // text underlined mode + Word justification :2; // text alignment +} FieldAttrType; + +typedef FieldAttrType * FieldAttrPtr; + +typedef struct { + Word start; // position in text string of first char. + Word length; // number of character in the line +} LineInfoType; + +typedef LineInfoType * LineInfoPtr; + + +typedef struct { + Word id; + RectangleType rect; + FieldAttrType attr; + CharPtr text; // pointer to the start of text string + VoidHand textHandle; // block the contains the text string + LineInfoPtr lines; + Word textLen; + Word textBlockSize; + Word maxChars; + Word selFirstPos; + Word selLastPos; + Word insPtXPos; + Word insPtYPos; + FontID fontID; +} FieldType; + + +typedef FieldType * FieldPtr; + +//--------------------------------------------------------------------- +// Field Functions +//--------------------------------------------------------------------- + +extern void FldCopy (FieldPtr fld) + SYS_TRAP(sysTrapFldCopy); + +extern void FldCut (FieldPtr fld) + SYS_TRAP(sysTrapFldCut); + +extern void FldDrawField (FieldPtr fld) + SYS_TRAP(sysTrapFldDrawField); + +extern void FldEraseField (FieldPtr fld) + SYS_TRAP(sysTrapFldEraseField); + +extern void FldFreeMemory (FieldPtr fld) + SYS_TRAP(sysTrapFldFreeMemory); + +extern void FldGetBounds (FieldPtr fld, RectanglePtr rect) + SYS_TRAP(sysTrapFldGetBounds); + +extern FontID FldGetFont (FieldPtr fld) + SYS_TRAP(sysTrapFldGetFont); + +extern void FldGetSelection (FieldPtr fld, WordPtr startPosition, + WordPtr endPosition) + SYS_TRAP(sysTrapFldGetSelection); + +extern Handle FldGetTextHandle (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextHandle); + +extern CharPtr FldGetTextPtr (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextPtr); + +extern Boolean FldHandleEvent (FieldPtr fld, EventPtr pEvent) + SYS_TRAP(sysTrapFldHandleEvent); + +extern void FldPaste (FieldPtr fld) + SYS_TRAP(sysTrapFldPaste); + +extern void FldRecalculateField (FieldPtr fld, Boolean redraw) + SYS_TRAP(sysTrapFldRecalculateField); + +extern void FldSetBounds (FieldPtr fld, RectanglePtr rect) + SYS_TRAP(sysTrapFldSetBounds); + +extern void FldSetFont (FieldPtr fld, FontID fontID) + SYS_TRAP(sysTrapFldSetFont); + +extern void FldSetText (FieldPtr fld, VoidHand textHandle, Word offset, + Word size) + SYS_TRAP(sysTrapFldSetText); + +extern void FldSetTextHandle (FieldPtr fld, Handle textHandle) + SYS_TRAP(sysTrapFldSetTextHandle); + +extern void FldSetTextPtr (FieldPtr fld, CharPtr textP) + SYS_TRAP(sysTrapFldSetTextPtr); + +extern void FldSetUsable (FieldPtr fld, Boolean usable) + SYS_TRAP(sysTrapFldSetUsable); + +extern void FldSetSelection (FieldPtr fld, Word startPosition, + Word endPosition) + SYS_TRAP(sysTrapFldSetSelection); + +extern void FldGrabFocus (FieldPtr fld) + SYS_TRAP(sysTrapFldGrabFocus); + +extern void FldReleaseFocus (FieldPtr fld) + SYS_TRAP(sysTrapFldReleaseFocus); + + +extern Word FldGetInsPtPosition (FieldPtr fld) + SYS_TRAP(sysTrapFldGetInsPtPosition); + +extern void FldSetInsPtPosition (FieldPtr fld, Word pos) + SYS_TRAP(sysTrapFldSetInsPtPosition); + +extern Word FldGetScrollPosition (FieldPtr fld) + SYS_TRAP(sysTrapFldGetScrollPosition); + +extern void FldSetScrollPosition (FieldPtr fld, Word pos) + SYS_TRAP(sysTrapFldSetScrollPosition); + +extern Word FldGetTextLength (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextLength); + +extern void FldScrollField (FieldPtr fld, Word linesToScroll, + DirectionType direction) + SYS_TRAP(sysTrapFldScrollField); + +extern Boolean FldScrollable (FieldPtr fld, DirectionType direction) + SYS_TRAP(sysTrapFldScrollable); + +extern Word FldGetVisibleLines (FieldPtr fld) + SYS_TRAP(sysTrapFldGetVisibleLines); + +extern Word FldGetTextHeight (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextHeight); + +extern Word FldCalcFieldHeight (CharPtr chars, Word maxWidth) + SYS_TRAP(sysTrapFldCalcFieldHeight); + +Word FldWordWrap (CharPtr chars, Word maxWidth) + SYS_TRAP(sysTrapFldWordWrap); + +extern void FldCompactText (FieldPtr fld) + SYS_TRAP(sysTrapFldCompactText); + +extern Boolean FldDirty (FieldPtr fld) + SYS_TRAP(sysTrapFldDirty); + +extern void FldSetDirty (FieldPtr fld, Boolean dirty) + SYS_TRAP(sysTrapFldSetDirty); + +extern Word FldGetMaxChars (FieldPtr fld) + SYS_TRAP(sysTrapFldGetMaxChars); + +extern void FldSetMaxChars (FieldPtr fld, Word maxChars) + SYS_TRAP(sysTrapFldSetMaxChars); + +extern Boolean FldInsert (FieldPtr fld, CharPtr insertChars, Word insertLen) + SYS_TRAP(sysTrapFldInsert); + +extern void FldDelete (FieldPtr fld, Word start, Word end) + SYS_TRAP(sysTrapFldDelete); + +extern void FldUndo (FieldPtr fld) + SYS_TRAP(sysTrapFldUndo); + +extern Word FldGetTextAllocatedSize (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextAllocatedSize); + +extern void FldSetTextAllocatedSize (FieldPtr fld, Word allocatedSize) + SYS_TRAP(sysTrapFldSetTextAllocatedSize); + +extern void FldGetAttributes (FieldPtr fld, FieldAttrPtr attrP) + SYS_TRAP(sysTrapFldGetAttributes); + +extern void FldSetAttributes (FieldPtr fld, FieldAttrPtr attrP) + SYS_TRAP(sysTrapFldSetAttributes); + +extern void FldSendChangeNotification (FieldPtr fld) + SYS_TRAP(sysTrapFldSendChangeNotification); + +extern void FldSendHeightChangeNotification (FieldPtr fld, Word pos, + Short numLines) + SYS_TRAP(sysTrapFldSendHeightChangeNotification); + +extern Boolean FldMakeFullyVisible (FieldPtr fld) + SYS_TRAP(sysTrapFldMakeFullyVisible); + + +#endif // __FIELD_H__ + + + diff --git a/sdk-1/include/Core/UI/Find.h b/sdk-1/include/Core/UI/Find.h new file mode 100644 index 0000000..79026e9 --- /dev/null +++ b/sdk-1/include/Core/UI/Find.h @@ -0,0 +1,105 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: field.h + * AUTHOR: Art Lamb: August 29, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines field structures and routines. + * + ***********************************************************************/ +#ifndef __FIND_H__ +#define __FIND_H__ + +#define maxFinds 9 +#define maxFindStrLen 16 + +typedef struct { + Word appCardNo; // card number of the application + LocalID appDbID; // LocalID of the application + Boolean foundInCaller; // true if found in app that called Find + + Word dbCardNo; // card number of the database record was found in + LocalID dbID; // LocalID of the database record was found in + Word recordNum; // index of record that contain a match + Word matchPos; // postion in record of the match. + Word matchFieldNum; // field number + DWord matchCustom; // app specific data + } FindMatchType; + +typedef FindMatchType * FindMatchPtr; + +typedef struct { + + // These fields are used by the applications. + Word dbAccesMode; // read mode and maybe show secret + Word recordNum; // index of last record that contained a match + Boolean more; // true of more matches to display + Char strAsTyped [maxFindStrLen+1]; // search string as entered + Char strToFind [maxFindStrLen+1]; // search string is lower case + + + // These fields are private to the Find routine and should NOT be accessed by + // applications. + Word numMatches; // # of matches + Word lineNumber; // next line in the results tabel + Boolean continuation; // true if contining search of same app + Boolean searchedCaller; // true after we've searched app that initiated the find + + LocalID callerAppDbID; // dbID of app that initiated search + Word callerAppCardNo; // cardNo of app that initiated search + + LocalID appDbID; // dbID of app that we're currently searching + Word appCardNo; // card number of app that we're currently searching + + Boolean newSearch; // true for first search + DmSearchStateType searchState; // search state + FindMatchType match [maxFinds]; +} FindParamsType; + +typedef FindParamsType * FindParamsPtr; + + +// Param Block passsed with the sysAppLaunchCmdGoto Command +typedef struct { + Word searchStrLen; // length of search string. + Word dbCardNo; // card number of the database + LocalID dbID; // LocalID of the database + Word recordNum; // index of record that contain a match + Word matchPos; // postion in record of the match. + Word matchFieldNum; // field number string was found int + DWord matchCustom; // application specific info + } GoToParamsType; + +typedef GoToParamsType * GoToParamsPtr; + + +//---------------------------------------------------------- +// Find Functions +//---------------------------------------------------------- + +void Find (GoToParamsPtr goToP) + SYS_TRAP(sysTrapFind); + + +Boolean FindStrInStr (CharPtr strToSearch, CharPtr strToFind, + WordPtr posP) + SYS_TRAP(sysTrapFindStrInStr); + +Boolean FindSaveMatch (FindParamsPtr findParams, Word recordNum, + Word pos, Word fieldNum, DWord appCustom, Word cardNo, LocalID dbID) + SYS_TRAP(sysTrapFindSaveMatch); + +void FindGetLineBounds (FindParamsPtr findParams, RectanglePtr r) + SYS_TRAP(sysTrapFindGetLineBounds); + +Boolean FindDrawHeader (FindParamsPtr findParams, CharPtr title) + SYS_TRAP(sysTrapFindDrawHeader); + + + +#endif __FIND_H__ diff --git a/sdk-1/include/Core/UI/Font.h b/sdk-1/include/Core/UI/Font.h new file mode 100644 index 0000000..b232039 --- /dev/null +++ b/sdk-1/include/Core/UI/Font.h @@ -0,0 +1,109 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: font.h + * AUTHOR: Art Lamb: September 13, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines font structures and routines. + * + ***********************************************************************/ + +#ifndef __FONT_H__ +#define __FONT_H__ + + +typedef struct +{ + SByte offset; + SByte width; +} FontCharInfoType; + +typedef struct{ + SWord fontType; // font type + SWord firstChar; // ASCII code of first character + SWord lastChar; // ASCII code of last character + SWord maxWidth; // maximum character width + SWord kernMax; // negative of maximum character kern + SWord nDescent; // negative of descent + SWord fRectWidth; // width of font rectangle + SWord fRectHeight; // height of font rectangle + SWord owTLoc; // offset to offset/width table + SWord ascent; // ascent + SWord descent; // descent + SWord leading; // leading + SWord rowWords; // row width of bit image / 2 +} FontType; + +typedef FontType * FontPtr; + +enum fontID { stdFont, boldFont, largeFont, symbolFont, symbol11Font, + symbol7Font, ledFont }; + +#define checkboxFont symbol11Font + + +typedef enum fontID FontID; + + +//-------------------------------------------------------------------- +// +// Font Function +// +//-------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern FontID FntGetFont (void) + SYS_TRAP(sysTrapFntGetFont); + +extern FontID FntSetFont (FontID font) + SYS_TRAP(sysTrapFntSetFont); + +extern FontPtr FntGetFontPtr (void) + SYS_TRAP(sysTrapFntGetFontPtr); + +extern SWord FntBaseLine (void) + SYS_TRAP(sysTrapFntBaseLine); + +extern SWord FntCharHeight (void) + SYS_TRAP(sysTrapFntCharHeight); + +extern SWord FntLineHeight (void) + SYS_TRAP(sysTrapFntLineHeight); + +extern SWord FntAverageCharWidth (void) + SYS_TRAP(sysTrapFntAverageCharWidth); + +extern SWord FntCharWidth (Char ch) + SYS_TRAP(sysTrapFntCharWidth); + +extern SWord FntCharsWidth (Char *chars, Word len) + SYS_TRAP(sysTrapFntCharsWidth); + +extern void FntCharsInWidth(CharPtr string, SWord *stringWidthP, + SWord *stringLengthP, Boolean *fitWithinWidth) + SYS_TRAP(sysTrapFntCharsInWidth); + +extern SWord FntDescenderHeight (void) + SYS_TRAP(sysTrapFntDescenderHeight); + +extern SWord FntLineWidth (CharPtr pChars, Word length) + SYS_TRAP(sysTrapFntLineWidth); + + +#ifdef __cplusplus +} +#endif + + +#endif // __FONT_H__ + + + diff --git a/sdk-1/include/Core/UI/Form.h b/sdk-1/include/Core/UI/Form.h new file mode 100644 index 0000000..2de35ad --- /dev/null +++ b/sdk-1/include/Core/UI/Form.h @@ -0,0 +1,364 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Form.h + * AUTHOR: Art Lamb: September 6, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines dialog box structures and routines. + * + ***********************************************************************/ + +#ifndef __FORM_H__ +#define __FORM_H__ + +#define noFocus 0xffff + +// Update code send as part of a frmUpdate event. +#define frmRedrawUpdateCode 0x8000 + + +// Alert constants and structures +enum alertTypes { + informationAlert, + confirmationAlert, + warningAlert, + errorAlert }; +typedef enum alertTypes AlertType; + +typedef struct { + Word alertType; + Word helpRscID; + Word numButtons; + Word defaultButton; +} AlertTemplateType; + + +// Types of object in a dialog box +enum formObjects { + frmFieldObj, + frmControlObj, + frmListObj, + frmTableObj, + frmBitmapObj, + frmLineObj, + frmFrameObj, + frmRectangleObj, + frmLabelObj, + frmTitleObj, + frmPopupObj, + frmGraffitiStateObj, + frmGadgetObj }; +typedef enum formObjects FormObjectKind; + + +typedef struct { + Word usable :1; // Set if part of ui +} FormObjAttrType; + + +typedef struct { + FormObjAttrType attr; + PointType pos; + Word rscID; +} FormBitmapType; + + +typedef struct { + FormObjAttrType attr; + PointType point1; + PointType point2; +} FormLineType; + + +typedef struct { + Word id; + FormObjAttrType attr; + RectangleType rect; + Word frameType; +} FormFrameType; + + +typedef struct { + FormObjAttrType attr; + RectangleType rect; +} FormRectangleType; + + +typedef struct { + Word id; + PointType pos; + FormObjAttrType attr; + FontID fontID; + Char * text; +} FormLabelType; + + +typedef struct { + RectangleType rect; + Char * text; +} FormTitleType; + + +typedef struct { + Word controlID; + Word listID; +} FormPopupType; + + +typedef struct { + PointType pos; +} FrmGraffitiStateType; + + +typedef struct { + Word id; + FormObjAttrType attr; + RectangleType rect; + VoidPtr data; +} FormGadgetType; + + +typedef union { + void * ptr; + FieldType * field; + ControlType * control; + ListType * list; + TableType * table; + FormBitmapType * bitmap; +// FormLineType * line; +// FormFrameType * frame; +// FormRectangleType * rectangle; + FormLabelType * label; + FormTitleType * title; + FormPopupType * popup; + FrmGraffitiStateType * grfState; + FormGadgetType * gadget; +} FormObjectType; + +// typedef FormObjectType * FormObjectPtr; + + +typedef struct { + FormObjectKind objectType; + FormObjectType object; +} FormObjListType; + + +typedef struct { + Word usable :1; // Set if part of ui + Word enabled :1; // Set if interactable (not grayed out) + Word visible :1; // Set if drawn, used internally + Word dirty :1; // Set if dialog has been modified + Word saveBehind :1; // Set if bits behind form are save when form ids drawn + Word graffitiShift :1; // Set if graffiti shift indicator is supported + Word reserved :11; +} FormAttrType; + + +typedef Boolean FormEventHandlerType (EventPtr eventP); + +typedef FormEventHandlerType * FormEventHandlerPtr; + +typedef struct { + WindowType window; + Word formId; + FormAttrType attr; + WinHandle bitsBehindForm; + FormEventHandlerPtr handler; + Word focus; + Word defaultButton; + Word helpRscId; + Word menuRscId; + Word numObjects; + FormObjListType * objects; +} FormType; + + +typedef FormType * FormPtr; + + +//-------------------------------------------------------------------- +// +// Form Function +// +//-------------------------------------------------------------------- + +extern FormPtr FrmInitForm (Word rscID) + SYS_TRAP(sysTrapFrmInitForm); + +extern void FrmDeleteForm (FormPtr frm) + SYS_TRAP(sysTrapFrmDeleteForm); + +extern void FrmDrawForm (FormPtr frm) + SYS_TRAP(sysTrapFrmDrawForm); + +extern void FrmEraseForm (FormPtr frm) + SYS_TRAP(sysTrapFrmEraseForm); + +extern FormPtr FrmGetActiveForm (void) + SYS_TRAP(sysTrapFrmGetActiveForm); + +extern void FrmSetActiveForm (FormPtr frm) + SYS_TRAP(sysTrapFrmSetActiveForm); + +extern Word FrmGetActiveFormID (void) + SYS_TRAP(sysTrapFrmGetActiveFormID); + +extern Boolean FrmGetUserModifiedState (FormPtr frm) + SYS_TRAP(sysTrapFrmGetUserModifiedState); + +extern void FrmSetNotUserModified (FormPtr frm) + SYS_TRAP(sysTrapFrmSetNotUserModified); + +extern Word FrmGetFocus (FormPtr frm) + SYS_TRAP(sysTrapFrmGetFocus); + +extern void FrmSetFocus (FormPtr frm, Word fieldIndex) + SYS_TRAP(sysTrapFrmSetFocus); + +extern Boolean FrmHandleEvent (FormPtr frm, EventPtr eventP) + SYS_TRAP(sysTrapFrmHandleEvent); + +extern void FrmGetFormBounds (FormPtr frm, RectanglePtr r) + SYS_TRAP(sysTrapFrmGetFormBounds); + +extern WinHandle FrmGetWindowHandle (FormPtr frm) + SYS_TRAP(sysTrapFrmGetWindowHandle); + +extern Word FrmGetFormId (FormPtr frm) + SYS_TRAP(sysTrapFrmGetFormId); + +extern FormPtr FrmGetFormPtr (Word formId) + SYS_TRAP(sysTrapFrmGetFormPtr); + +extern FormPtr FrmGetFirstForm (void) + SYS_TRAP(sysTrapFrmGetFirstForm); + +extern Word FrmGetNumberOfObjects (FormPtr frm) + SYS_TRAP(sysTrapFrmGetNumberOfObjects); + +extern Word FrmGetObjectIndex (FormPtr frm, Word objID) + SYS_TRAP(sysTrapFrmGetObjectIndex); + +extern Word FrmGetObjectId (FormPtr, Word objIndex) + SYS_TRAP(sysTrapFrmGetObjectId); + +extern FormObjectKind FrmGetObjectType (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmGetObjectType); + +extern void * FrmGetObjectPtr (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmGetObjectPtr); + +extern void FrmGetObjectBounds (FormPtr frm, Word pObjIndex, RectanglePtr r) + SYS_TRAP(sysTrapFrmGetObjectBounds); + +extern void FrmHideObject (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmHideObject); + +extern void FrmShowObject (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmShowObject); + +extern void FrmGetObjectPosition (FormPtr frm, Word objIndex, + SWordPtr x, SWordPtr y) + SYS_TRAP(sysTrapFrmGetObjectPosition); + +extern void FrmSetObjectPositon (FormPtr frm, Word objIndex, + SWord x, SWord y) + SYS_TRAP(sysTrapFrmSetObjectPositon); + + + + +extern SWord FrmGetControlValue (FormPtr frm, Word controlID) + SYS_TRAP(sysTrapFrmGetControlValue); + +extern void FrmSetControlValue (FormPtr frm, Word controlID, SWord newValue) + SYS_TRAP(sysTrapFrmSetControlValue); + +extern Byte FrmGetControlGroupSelection (FormPtr frm, Byte groupNum) + SYS_TRAP(sysTrapFrmGetControlGroupSelection); + +extern void FrmSetControlGroupSelection (FormPtr frm, Byte groupNum, + Word controlID) + SYS_TRAP(sysTrapFrmSetControlGroupSelection); + +extern void FrmCopyLabel (FormPtr frm, Word lableID, CharPtr newLable) + SYS_TRAP(sysTrapFrmCopyLabel); + +extern CharPtr FrmGetLabel (FormPtr frm, Word lableID) + SYS_TRAP(sysTrapFrmGetLabel); + +extern void FrmSetCategoryLabel (FormPtr frm, Word objIndex, CharPtr newLabel) + SYS_TRAP(sysTrapFrmSetCategoryLabel); + +extern CharPtr FrmGetTitle (FormPtr frm) + SYS_TRAP(sysTrapFrmGetTitle); + +extern void FrmSetTitle (FormPtr frm, CharPtr newTitle) + SYS_TRAP(sysTrapFrmSetTitle); + +extern void FrmCopyTitle (FormPtr frm, CharPtr newTitle) + SYS_TRAP(sysTrapFrmCopyTitle); + +extern VoidPtr FrmGetGadgetData (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmGetGadgetData); + +extern void FrmSetGadgetData (FormPtr frm, Word objIndex, VoidPtr data) + SYS_TRAP(sysTrapFrmSetGadgetData); + + + +extern Word FrmDoDialog (FormPtr frm) + SYS_TRAP(sysTrapFrmDoDialog); + +extern Word FrmAlert (Word alertId) + SYS_TRAP(sysTrapFrmAlert); + +extern Word FrmCustomAlert (Word alertId, CharPtr s1, CharPtr s2, CharPtr s3) + SYS_TRAP(sysTrapFrmCustomAlert); + +extern void FrmHelp (Word helpMsgId) + SYS_TRAP(sysTrapFrmHelp); + +extern void FrmUpdateScrollers (FormPtr frm, Word upIndex, Word downIndex, + Boolean scrollableUp, Boolean scrollabledown) + SYS_TRAP(sysTrapFrmUpdateScrollers); + +extern Boolean FrmVisible (FormPtr frm) + SYS_TRAP(sysTrapFrmVisible); + +extern void FrmSetEventHandler (FormPtr frm, FormEventHandlerPtr) + SYS_TRAP(sysTrapFrmSetEventHandler); + +extern Boolean FrmDispatchEvent (EventPtr eventP) + SYS_TRAP(sysTrapFrmDispatchEvent); + + + + +extern void FrmPopupForm (Word formId) + SYS_TRAP(sysTrapFrmPopupForm); + +extern void FrmGotoForm (Word formId) + SYS_TRAP(sysTrapFrmGotoForm); + +extern void FrmUpdateForm (Word formId, Word updateCode) + SYS_TRAP(sysTrapFrmUpdateForm); + +extern void FrmReturnToForm (Word formId) + SYS_TRAP(sysTrapFrmReturnToForm); + +extern void FrmCloseAllForms (void) + SYS_TRAP(sysTrapFrmCloseAllForms); + +extern void FrmSaveAllForms (void) + SYS_TRAP(sysTrapFrmSaveAllForms); + + + +#endif __FORM_H__ diff --git a/sdk-1/include/Core/UI/GraffitiShift.h b/sdk-1/include/Core/UI/GraffitiShift.h new file mode 100644 index 0000000..c8b6dcf --- /dev/null +++ b/sdk-1/include/Core/UI/GraffitiShift.h @@ -0,0 +1,54 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: GriffitifShift.h + * AUTHOR: Art Lamb: Aug 24, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines Griffiti shift state indicator routines. + * + **********************************************************************/ + +#ifndef __GRFSHIFTIND_H__ +#define __GRFSHIFTIND_H__ + + +// Graffiti lock flags +#define glfCapsLock 0x01 +#define glfNumLock 0x02 + + +typedef enum { gsiShiftNone, // no indicator + gsiNumLock, // numeric lock + gsiCapsLock, // capital lock + gsiShiftPunctuation, // punctuation shift + gsiShiftExtended, // extented punctuation shift + gsiShiftUpper, // alpha upper case shift + gsiShiftLower // alpha lower case + } GsiShiftState; + + + +extern void GsiInitialize (void) + SYS_TRAP(sysTrapGsiInitialize); + +extern void GsiSetLocation (SWord x, SWord y) + SYS_TRAP(sysTrapGsiSetLocation); + +extern void GsiEnable (Boolean enableIt) + SYS_TRAP(sysTrapGsiEnable); + +extern Boolean GsiEnabled (void) + SYS_TRAP(sysTrapGsiEnabled); + +extern void GsiSetShiftState (Word lockFlags, Word tempShift) + SYS_TRAP(sysTrapGsiSetShiftState); + + +#endif __GRFSHIFTIND_H__ + + diff --git a/sdk-1/include/Core/UI/GraffitiUI.h b/sdk-1/include/Core/UI/GraffitiUI.h new file mode 100644 index 0000000..dedf29f --- /dev/null +++ b/sdk-1/include/Core/UI/GraffitiUI.h @@ -0,0 +1,25 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Touchdown + * FILE: GraffitifUI.h + * AUTHOR: Roger Flores: Sep 15, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines Graffiti UI routines. + * + **********************************************************************/ + +#ifndef __GRFUI_H__ +#define __GRFUI_H__ + + +extern void SysGrfShortCutListDialog () + SYS_TRAP(sysTrapSysGrfShortCutListDialog); + + +#endif __GRFUI_H__ + diff --git a/sdk-1/include/Core/UI/Init.h b/sdk-1/include/Core/UI/Init.h new file mode 100644 index 0000000..9bb48d3 --- /dev/null +++ b/sdk-1/include/Core/UI/Init.h @@ -0,0 +1,25 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Init.h + * AUTHOR: Art Lamb: Jan 25, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines UI initialization routines. + * + **********************************************************************/ + +#ifndef __INIT_H__ +#define __INIT_H__ + +extern void UIInitialize (void) + SYS_TRAP(sysTrapUIInitialize); + +extern void UIReset (void) + SYS_TRAP(sysTrapUIReset); + +#endif __INIT_H__ diff --git a/sdk-1/include/Core/UI/InsPoint.h b/sdk-1/include/Core/UI/InsPoint.h new file mode 100644 index 0000000..f5111a2 --- /dev/null +++ b/sdk-1/include/Core/UI/InsPoint.h @@ -0,0 +1,48 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: InsPoint.h + * AUTHOR: Art Lamb: Jan 25, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines insertion point routines. + * + **********************************************************************/ + +#ifndef __INSPOINT_H__ +#define __INSPOINT_H__ + +// Blink interval is half of a second +#define insPtBlinkInterval 30 +#define insPtWidth 2 + +extern void InsPtInitialize (void) + SYS_TRAP(sysTrapInsPtInitialize); + +extern void InsPtSetLocation (SWord x, SWord y) + SYS_TRAP(sysTrapInsPtSetLocation); + +extern void InsPtGetLocation (SWordPtr x, SWordPtr y) + SYS_TRAP(sysTrapInsPtGetLocation); + +extern void InsPtEnable (Boolean enableIt) + SYS_TRAP(sysTrapInsPtEnable); + +extern Boolean InsPtEnabled (void) + SYS_TRAP(sysTrapInsPtEnabled); + +extern void InsPtSetHeight (SWord height) + SYS_TRAP(sysTrapInsPtSetHeight); + +extern SWord InsPtGetHeight (void) + SYS_TRAP(sysTrapInsPtGetHeight); + +extern void InsPtCheckBlink (void) + SYS_TRAP(sysTrapInsPtCheckBlink); + + +#endif __INSPOINT_H__ diff --git a/sdk-1/include/Core/UI/List.h b/sdk-1/include/Core/UI/List.h new file mode 100644 index 0000000..becd89c --- /dev/null +++ b/sdk-1/include/Core/UI/List.h @@ -0,0 +1,104 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: list.h + * AUTHOR: Roger Flores: November 3, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines list structures and routines. + * + ***********************************************************************/ + +#ifndef __LIST_H__ +#define __LIST_H__ + + +#define noListSelection 0x0ffff + +//------------------------------------------------------------------- +// List structures +//------------------------------------------------------------------- + +typedef struct { + Word usable :1; // set if part of ui + Word enabled :1; // set if interactable (not grayed out) + Word visible :1; // set if drawn + Word poppedUp :1; // set if choices displayed in popup win. + Word reserved :4; +} ListAttrType; + + +// Load data callback routine prototype +typedef void ListDrawDataFuncType (Word itemNum, RectanglePtr bounds, + CharPtr *itemsText); + +typedef ListDrawDataFuncType * ListDrawDataFuncPtr; + + +typedef struct { + Word id; + RectangleType bounds; + ListAttrType attr; + CharPtr *itemsText; + Word numItems; // number of choices in the list + Word currentItem; // currently display choice + Word topItem; // top item visible when poped up + FontID font; // font used to draw list + WinHandle popupWin; // used only by popup lists + ListDrawDataFuncPtr drawItemsCallback; // 0 indicates no function +} ListType; + +typedef ListType * ListPtr; + + +//------------------------------------------------------------------- +// List routines +//------------------------------------------------------------------- +extern void LstDrawList (ListPtr list) + SYS_TRAP(sysTrapLstDrawList); + +extern void LstEraseList (ListPtr list) + SYS_TRAP(sysTrapLstEraseList); + +extern Word LstGetSelection (ListPtr list) + SYS_TRAP(sysTrapLstGetSelection); + +extern CharPtr LstGetSelectionText (ListPtr list, Word itemNum) + SYS_TRAP(sysTrapLstGetSelectionText); + +extern Boolean LstHandleEvent (ListPtr list, EventPtr event) + SYS_TRAP(sysTrapLstHandleEvent); + +extern void LstSetHeight (ListPtr pList, Word visibleItems) + SYS_TRAP(sysTrapLstSetHeight); + +extern void LstSetPosition (ListPtr pList, SWord x, SWord y) + SYS_TRAP(sysTrapLstSetPosition); + +extern void LstSetSelection (ListPtr list, Word itemNum) + SYS_TRAP(sysTrapLstSetSelection); + +extern void LstSetListChoices (ListPtr list, Char ** itemsText, + Word numItems) + SYS_TRAP(sysTrapLstSetListChoices); + +extern void LstSetDrawFunction (ListPtr pList, ListDrawDataFuncPtr func) + SYS_TRAP(sysTrapLstSetDrawFunction); + +extern void LstSetTopItem (ListPtr pList, Word itemNum) + SYS_TRAP(sysTrapLstSetTopItem); + +extern void LstMakeItemVisible (ListPtr pList, Word itemNum) + SYS_TRAP(sysTrapLstMakeItemVisible); + +extern Word LstGetNumberOfItems (ListPtr pList) + SYS_TRAP(sysTrapLstGetNumberOfItems); + +extern SWord LstPopupList (ListPtr list) + SYS_TRAP(sysTrapLstPopupList); + +#endif // __LIST_H__ diff --git a/sdk-1/include/Core/UI/Menu.h b/sdk-1/include/Core/UI/Menu.h new file mode 100644 index 0000000..4c0ef0b --- /dev/null +++ b/sdk-1/include/Core/UI/Menu.h @@ -0,0 +1,97 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: menu.h + * AUTHOR: Roger Flores: November 18, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines menu structures and routines. + * + ***********************************************************************/ + +#ifndef __MENU_H__ +#define __MENU_H__ + + +#define noMenuSelection -1 +#define noMenuItemSelection -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. +#define MenuSeparatorChar '-' + + + +typedef struct { + Word id; // id of the menu item + Char command; // command key + CharPtr itemStr; // string to be displayed +} MenuItemType; + + +typedef struct { + WinHandle menuWin; // window of pull-down menu + RectangleType bounds; // bounds of the pulldown + WinHandle bitsBehind; // saving bits behind pull-down menu + RectangleType titleBounds; // bounds of the title in menu bar + CharPtr title; // menu title displayed in menu bar + Word numItems; // number of items in the menu + MenuItemType * items; // array of menu items +} MenuPullDownType; + +typedef MenuPullDownType * MenuPullDownPtr; + +typedef struct { + Word visible :1; // Set if menu bar is drawn + Word commandPending :1; // Set if next key is a command + Word insPtEnabled :1; // Set if insPt was on when menu was drawn +} MenuBarAttrType; + + +typedef struct { + WinHandle barWin; // window of menu bar + WinHandle bitsBehind; // saving bits behind menu bar + WinHandle savedActiveWin; + WinHandle bitsBehindStatus; + MenuBarAttrType attr; + SWord curMenu; // current menu or -1 if none + SWord curItem; // current item in curMenu, -1 if none + SDWord commandTick; // + SWord numMenus; // number of menus + MenuPullDownPtr menus; // array of menus +} MenuBarType; + +typedef MenuBarType * MenuBarPtr; + + + +extern MenuBarPtr MenuInit (Word resourceId) + SYS_TRAP(sysTrapMenuInit); + +extern MenuBarPtr MenuGetActiveMenu (void) + SYS_TRAP(sysTrapMenuGetActiveMenu); + +extern MenuBarPtr MenuSetActiveMenu (MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuSetActiveMenu); + +extern void MenuDispose (MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuDispose); + +extern Boolean MenuHandleEvent (MenuBarPtr pMenu, EventPtr event, + WordPtr error) + SYS_TRAP(sysTrapMenuHandleEvent); + +extern void MenuDrawMenu (MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuDrawMenu); + +extern void MenuEraseStatus (MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuEraseStatus); + + + +#endif //__MENU_H__ diff --git a/sdk-1/include/Core/UI/Rect.h b/sdk-1/include/Core/UI/Rect.h new file mode 100644 index 0000000..c263b6c --- /dev/null +++ b/sdk-1/include/Core/UI/Rect.h @@ -0,0 +1,71 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Rect.h + * AUTHOR: Roger Flores: November 3, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines rectangle structures and routines. + * + ***********************************************************************/ + +#ifndef __RECT_H__ +#define __RECT_H__ + +typedef struct { + SWord left; + SWord top; + SWord right; + SWord bottom; +} AbsRectType; + + +typedef struct { + SWord x; + SWord y; +} PointType; + + +typedef struct { + PointType topLeft; + PointType extent; +} RectangleType; + +typedef RectangleType * RectanglePtr; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void RctSetRectangle (RectanglePtr r, SWord left, SWord top, + SWord width, SWord height) + SYS_TRAP(sysTrapRctSetRectangle); + +extern void RctCopyRectangle (RectanglePtr srcRect, RectanglePtr dstRect) + SYS_TRAP(sysTrapRctCopyRectangle); + +extern void RctInsetRectangle (RectanglePtr r, SWord insetAmt) + SYS_TRAP(sysTrapRctInsetRectangle); + +extern void RctOffsetRectangle (RectanglePtr r, SWord deltaX, SWord deltaY) + SYS_TRAP(sysTrapRctOffsetRectangle); + +extern Boolean RctPtInRectangle (SWord x, SWord y, RectanglePtr r) + SYS_TRAP(sysTrapRctPtInRectangle); + +extern void RctGetIntersection (RectanglePtr r1, RectanglePtr r2, RectanglePtr r3) + SYS_TRAP(sysTrapRctGetIntersection); + + +#ifdef __cplusplus +} +#endif + + +#endif //__RECT_H__ diff --git a/sdk-1/include/Core/UI/ScrDriver.h b/sdk-1/include/Core/UI/ScrDriver.h new file mode 100644 index 0000000..65b15cb --- /dev/null +++ b/sdk-1/include/Core/UI/ScrDriver.h @@ -0,0 +1,161 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1995 -- All Rights Reserved + * + * PROJECT: Pilot [EMULATOR] + * + * FILE: ScrDriver.h + * + * AUTHOR: Ain McKendrick + * + * DECLARER: + * + * DESCRIPTION: Screen driver function prototypes. For use by TD applications. + * + * REVISION HISTORY: + * Name Date Description + * ---- ---- ----------- + * Ain 1/25/95 Initial creation + * Ain 2/3/95 Revised to use new WinPtr type due to name + * changes in window.h + * + **********************************************************************/ + +#ifndef __SCRDRIVER_H__ +#define __SCRDRIVER_H__ + +#include + + +/************************************************************************** + * Internal constants + ***************************************************************************/ +#define scrMaxLineBytes 32 // Max # of bytes in a scan line + // used in compression/decompression calls + + + +/************************************************************************** + * Internal Drawing info structure used by Screen Driver + ***************************************************************************/ +//typedef enum {scrCopy, scrAND, scrANDNOT, scrXOR, scrOR, scrCopyNOT} ScrOperation; + + + + +typedef struct ScrBltInfoType { + + // Common fields. + ScrOperation op; // which bit operation to do + SWord height; // height of blit operation + + WordPtr dstBaseP; // base address of window we're blitting to + Word dstRowBytes; // rowBytes of window + + WordPtr srcBaseP; // base address of window we're blitting from + Word srcRowBytes; // rowBytes of window + + + // Info for each line + Word leftMask; // mask for leftmost byte of row + Word rightMask; // mask for rightmost byte of row + SWord midWords; // # of words between left and right mask + + SWord dstRowDelta; // delta bytes from row to row + WordPtr dstP; // byte address of first dst line + + SWord srcRowDelta; // delta bytes from row to row + WordPtr srcP; // byte address of first source line + + + + // These fields only used for drawing operations. + Word* patternP; // pointer to pattern to use + Word solidPat; // color word if no pattern + //DOLATER.. used to byte byte + Boolean simple; // true if scrCopy with solid pattern + CustomPatternType pattern; // copy of modified pattern + + } ScrBltInfoType; +typedef ScrBltInfoType* ScrBltInfoPtr; + + + + +/************************************************************************** + * Structure of Screen Driver globals + ***************************************************************************/ +typedef struct ScrGlobalsType { + Word width; // width of display in pixels + Word height; // height of display in pixels + Word rowBytes; // rowBytes of display + Ptr baseAddr; // base address of display + CustomPatternType grayPat; // Gray pattern + Boolean doDrawNotify; // call ScrDrawNotify after drawing + AbsRectType updateR; // update rect when in remote mode + SDWord lastUpdate; // Tickcount of last update + } ScrGlobalsType; +typedef ScrGlobalsType* ScrGlobalsPtr; + + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Initialization +void ScrInit(void) + SYS_TRAP(sysTrapScrInit); + + +// BitBlt Functions +Err ScrCopyRectangle(WinPtr sourceWindow, WinPtr destWindow, + SWord fromX, SWord fromY, SWord toX, SWord toY, + SWord bitCount, SWord lineCount) + SYS_TRAP(sysTrapScrCopyRectangle); + + + +// Character Functions +void ScrDrawChars(WinPtr pWindow, SWord xLoc, SWord yLoc, SWord xExtent, SWord yExtent, + SWord clipTop, SWord clipLeft, SWord clipBottom, SWord clipRight, + CharPtr chars, Word len, FontPtr fontPtr) + SYS_TRAP(sysTrapScrDrawChars); + +// Line Draw Functions +void ScrLineRoutine(WinPtr pWindow, SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapScrLineRoutine); + +void ScrRectangleRoutine(WinPtr pWindow, SWord x, SWord y, SWord extentX, + SWord extentY) + SYS_TRAP(sysTrapScrRectangleRoutine); + +// Utility Functions +void ScrScreenInfo (WinPtr pWindow) + SYS_TRAP(sysTrapScrScreenInfo); + +void ScrDrawNotify(SWord updLeft, SWord updTop, SWord updWidth, SWord updHeight) + SYS_TRAP(sysTrapScrDrawNotify); + +void ScrSendUpdateArea(Boolean force) + SYS_TRAP(sysTrapScrSendUpdateArea); + +Word ScrCompressScanLine(BytePtr lineP, BytePtr prevLineP, Word width, + BytePtr dstParamP, Boolean firstLine) + SYS_TRAP(sysTrapScrCompressScanLine); + +Word ScrDeCompressScanLine(BytePtr srcP, BytePtr dstP, Word width) + SYS_TRAP(sysTrapScrDeCompressScanLine); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __SCRDRIVER_H__ diff --git a/sdk-1/include/Core/UI/SelDay.h b/sdk-1/include/Core/UI/SelDay.h new file mode 100644 index 0000000..b892edf --- /dev/null +++ b/sdk-1/include/Core/UI/SelDay.h @@ -0,0 +1,30 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: SelDay.h + * AUTHOR: Roger Flores: November 10, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the date picker month object's structures + * and routines. + * + ***********************************************************************/ +#ifndef __SELDAY_H__ +#define __SELDAY_H__ + +#include + +#define daySelectorMinYear firstYear +#define daySelectorMaxYear lastYear + + + +extern Boolean SelectDay (SWord *month, SWord *day, SWord *year, CharPtr title) + SYS_TRAP(sysTrapSelectDay); + + +#endif //__SELDAY_H__ diff --git a/sdk-1/include/Core/UI/SelTime.h b/sdk-1/include/Core/UI/SelTime.h new file mode 100644 index 0000000..99887c8 --- /dev/null +++ b/sdk-1/include/Core/UI/SelTime.h @@ -0,0 +1,38 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: selTime.h + * AUTHOR: Roger Flores: December 6, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines select time structures and routines. + * + ***********************************************************************/ + +#ifndef __SELTIME_H__ +#define __SELTIME_H__ + +#define NumericSpaceChar 0x80 + +//------------------------------------------------------------------- +// structures +//------------------------------------------------------------------- + + + +typedef struct { + Byte hours; + Byte minutes; + Byte seconds; +} HMSTime; + + +extern Boolean SelectTime (TimePtr startTimeP, TimePtr EndTimeP, + Boolean untimed, CharPtr title, SWord startOfDay) + SYS_TRAP(sysTrapSelectTime); + +#endif // __SELTIME_H__ diff --git a/sdk-1/include/Core/UI/Table.h b/sdk-1/include/Core/UI/Table.h new file mode 100644 index 0000000..47c082c --- /dev/null +++ b/sdk-1/include/Core/UI/Table.h @@ -0,0 +1,262 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: field.h + * AUTHOR: Art Lamb: September 1, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines table structures and routines. + * + ***********************************************************************/ +#ifndef __TABLE_H__ +#define __TABLE_H__ + +//------------------------------------------------------------------- +// Table structures +//------------------------------------------------------------------- + +#define tableDefaultColumnSpacing 1 +#define tableNoteIndicatorWidth 7 +#define tableNoteIndicatorHeight 11 + +// Display style of a table item +// +enum tableItemStyles { checkboxTableItem, + customTableItem, + dateTableItem, + labelTableItem, + numericTableItem, + popupTriggerTableItem, + textTableItem, + textWithNoteTableItem, + timeTableItem}; +typedef enum tableItemStyles TableItemStyleType; + + +typedef struct { + TableItemStyleType itemType; + FontID fontID; // font for drawing text + Word intValue; + CharPtr ptr; +} TableItemType; +typedef TableItemType * TableItemPtr; + + +// Draw item callback routine prototype, used only by customTableItem. +typedef void TableDrawItemFuncType + (VoidPtr table, Word row, Word column, RectanglePtr bounds); + +typedef TableDrawItemFuncType * TableDrawItemFuncPtr; + + +// Load data callback routine prototype +typedef Err TableLoadDataFuncType + (VoidPtr table, Word row, Word column, Boolean editable, + VoidHand * dataH, WordPtr dataOffset, WordPtr dataSize); + +typedef TableLoadDataFuncType * TableLoadDataFuncPtr; + + +// Save data callback routine prototype +typedef Boolean TableSaveDataFuncType + (VoidPtr table, Word row, Word column); + +typedef TableSaveDataFuncType * TableSaveDataFuncPtr; + + +typedef struct { + Word width; // width in pixels + Boolean usable; + Word spacing; // space after column + TableDrawItemFuncPtr drawCallback; + TableLoadDataFuncPtr loadDataCallback; + TableSaveDataFuncPtr saveDataCallback; + +} TableColumnAttrType; + + +typedef struct { + Word id; + Word height; // row height in pixels + DWord data; + Boolean usable; + Boolean selectable; + Boolean invalid; // true if redraw needed +} TableRowAttrType; + + +typedef struct { + Word visible:1; // Set if drawn, used internally + Word editable:1; // Set if editable + Word editing:1; // Set if in edit mode + Word selected:1; // Set if the current item is selected +} TableAttrType; + + +typedef struct { + Word id; + RectangleType bounds; + TableAttrType attr; + Word numColumns; + Word numRows; + Word currentRow; + Word currentColumn; + Word topRow; + TableColumnAttrType * columnAttrs; + TableRowAttrType * rowAttrs; + TableItemPtr items; + FieldType currentField; +} TableType; + +typedef TableType * TablePtr; + + +//------------------------------------------------------------------- +// Table routines +//------------------------------------------------------------------- + +extern void TblDrawTable (TablePtr table) + SYS_TRAP(sysTrapTblDrawTable); + +extern void TblRedrawTable (TablePtr table) + SYS_TRAP(sysTrapTblRedrawTable); + +extern void TblEraseTable (TablePtr table) + SYS_TRAP(sysTrapTblEraseTable); + +extern Boolean TblHandleEvent (TablePtr table, EventPtr event) + SYS_TRAP(sysTrapTblHandleEvent); + +extern void TblGetItemBounds (TablePtr table, Word row, Word column, + RectanglePtr r) + SYS_TRAP(sysTrapTblGetItemBounds); + +extern void TblSelectItem (TablePtr table, Word row, Word column) + SYS_TRAP(sysTrapTblSelectItem); + +extern Word TblGetItemInt (TablePtr table, Word row, Word column) + SYS_TRAP(sysTrapTblGetItemInt); + +extern void TblSetItemInt (TablePtr table, Word row, Word column, Word value) + SYS_TRAP(sysTrapTblSetItemInt); + +extern void TblSetItemPtr (TablePtr table, Word row, Word column, VoidPtr value) + SYS_TRAP(sysTrapTblSetItemPtr); + +extern void TblSetItemStyle (TablePtr table, Word row, Word column, + TableItemStyleType type) + SYS_TRAP(sysTrapTblSetItemStyle); + +extern void TblUnhighlightSelection (TablePtr table) + SYS_TRAP(sysTrapTblUnhighlightSelection); + +extern Boolean TblRowUsable (TablePtr table, Word row) + SYS_TRAP(sysTrapTblRowUsable); + +extern void TblSetRowUsable (TablePtr table, Word row, Boolean usable) + SYS_TRAP(sysTrapTblSetRowUsable); + +extern Word TblGetLastUsableRow (TablePtr table) + SYS_TRAP(sysTrapTblGetLastUsableRow); + + +extern void TblSetColumnUsable (TablePtr table, Word row, Boolean usable) + SYS_TRAP(sysTrapTblSetColumnUsable); + +extern void TblSetRowSelectable (TablePtr table, Word row, Boolean selectable) + SYS_TRAP(sysTrapTblSetRowSelectable); + +extern Boolean TblRowSelectable (TablePtr table, Word row) + SYS_TRAP(sysTrapTblRowSelectable); + +extern Word TblGetNumberOfRows (TablePtr table) + SYS_TRAP(sysTrapTblGetNumberOfRows); + +extern void TblSetCustomDrawProcedure + (TablePtr table, Word column, TableDrawItemFuncPtr drawCallback) + SYS_TRAP(sysTrapTblSetCustomDrawProcedure); + +extern void TblSetLoadDataProcedure + (TablePtr table, Word column, TableLoadDataFuncPtr loadDataCallback) + SYS_TRAP(sysTrapTblSetLoadDataProcedure); + +extern void TblSetSaveDataProcedure + (TablePtr table, Word column, TableSaveDataFuncPtr saveDataCallback) + SYS_TRAP(sysTrapTblSetSaveDataProcedure); + + +extern void TblGetBounds (TablePtr table, RectanglePtr r) + SYS_TRAP(sysTrapTblGetBounds); + +extern Word TblGetRowHeight (TablePtr table, Word row) + SYS_TRAP(sysTrapTblGetRowHeight); + +extern void TblSetRowHeight (TablePtr table, Word row, Word height) + SYS_TRAP(sysTrapTblSetRowHeight); + +extern Word TblGetColumnWidth (TablePtr table, Word column) + SYS_TRAP(sysTrapTblGetColumnWidth); + +extern void TblSetColumnWidth (TablePtr table, Word column, Word width) + SYS_TRAP(sysTrapTblSetColumnWidth); + +extern Word TblGetColumnSpacing (TablePtr table, Word column) + SYS_TRAP(sysTrapTblGetColumnSpacing); + +extern void TblSetColumnSpacing (TablePtr table, Word column, Word spacing) + SYS_TRAP(sysTrapTblSetColumnSpacing); + +extern Boolean TblFindRowID (TablePtr table, Word id, WordPtr rowP) + SYS_TRAP(sysTrapTblFindRowID); + +extern Boolean TblFindRowData (TablePtr table, DWord data, WordPtr rowP) + SYS_TRAP(sysTrapTblFindRowData); + +extern Word TblGetRowID (TablePtr table, Word row) + SYS_TRAP(sysTrapTblGetRowID); + +extern void TblSetRowID (TablePtr table, Word row, Word id) + SYS_TRAP(sysTrapTblSetRowID); + +extern DWord TblGetRowData (TablePtr table, Word row) + SYS_TRAP(sysTrapTblGetRowData); + +extern void TblSetRowData (TablePtr table, Word row, DWord data) + SYS_TRAP(sysTrapTblSetRowData); + +extern Boolean TblRowInvalid (TablePtr table, Word row) + SYS_TRAP(sysTrapTblRowInvalid); + +extern void TblMarkRowInvalid (TablePtr table, Word row) + SYS_TRAP(sysTrapTblMarkRowInvalid); + +extern void TblMarkTableInvalid (TablePtr table) + SYS_TRAP(sysTrapTblMarkTableInvalid); + +extern Boolean TblGetSelection (TablePtr table, WordPtr rowP, WordPtr columnP) + SYS_TRAP(sysTrapTblGetSelection); + +extern void TblInsertRow (TablePtr table, Word row) + SYS_TRAP(sysTrapTblInsertRow); + +extern void TblRemoveRow (TablePtr table, Word row) + SYS_TRAP(sysTrapTblRemoveRow); + +extern void TblReleaseFocus (TablePtr table) + SYS_TRAP(sysTrapTblReleaseFocus); + +extern Boolean TblEditing (TablePtr table) + SYS_TRAP(sysTrapTblEditing); + +extern FieldPtr TblGetCurrentField (TablePtr table) + SYS_TRAP(sysTrapTblGetCurrentField); + +extern void TblGrabFocus (TablePtr table, Word row, Word column) + SYS_TRAP(sysTrapTblGrabFocus); + + +#endif //__TABLE_H__ diff --git a/sdk-1/include/Core/UI/UIAll.h b/sdk-1/include/Core/UI/UIAll.h new file mode 100644 index 0000000..63422a3 --- /dev/null +++ b/sdk-1/include/Core/UI/UIAll.h @@ -0,0 +1,32 @@ +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef __cplusplus +} +#endif + diff --git a/sdk-1/include/Core/UI/UICommon.h b/sdk-1/include/Core/UI/UICommon.h new file mode 100644 index 0000000..30c9948 --- /dev/null +++ b/sdk-1/include/Core/UI/UICommon.h @@ -0,0 +1,225 @@ +#ifndef __UICOMMON_H__ +#define __UICOMMON_H__ + +enum justifications { leftAlign, centerAlign, rightAlign }; +typedef enum justifications JustificationType; + +//------------------------------------------------------------ +// System functions +//------------------------------------------------------------ +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define max(a, b) (((a) > (b)) ? (a) : (b)) + + + +//------------------------------------------------------------ +// Temporary resource routines +//------------------------------------------------------------ + +#define strRsc 'tSTR' +#define ainRsc 'tAIN' +#define iconType 'tAIB' +#define bitmapRsc 'Tbmp' +#define alertRscType 'Talt' +#define kbdRscType 'tkbd' +#define MenuRscType 'MBAR' +#define fontRscType 'NFNT' +#define verRsc 'tver' +#define appInfoStringsRsc 'tAIS' + + +// Application version string ID +#define appVersionID 1 +#define ainID 1000 + +// System version string ID - this is hidden in +// the SystemVersion.rsrc resource, because the 'system' resources +// don't have ResEdit formats. +#define systemVersionID 10000 + +// System bitmaps +#define palmLogoBitmap 10000 +#define keyboardBackspaceBitmap 10001 +#define keyboardTabBitmap 10002 +#define keyboardReturnBitmap 10003 +#define InformationAlertBitmap 10004 +#define ConfirmationAlertBitmap 10005 +#define WarningAlertBitmap 10006 +#define ErrorAlertBitmap 10007 +#define keyboardShiftBitmap 10008 +#define keyboardCapBitmap 10009 + + +// System string resources +#define daysOfWeekStrID 10000 +#define dayFullNamesStrID 10001 +#define monthNamesStrID 10002 +#define monthFullNamesStrID 10003 +#define categoryAllStrID 10004 +#define categoryEditStrID 10005 +#define menuCommandStrID 10006 +#define launcherBatteryStrID 10007 +#define systemNameStrID 10008 + + +// System Alerts +#define RenameCategoryAlert 10000 +#define RenameCategoryYes 0 +#define RenameCategoryNo 1 + +#define RemoveCategoryAlert 10001 +#define RemoveCategoryYes 0 +#define RemoveCategoryNo 1 + +#define LowBatteryAlert 10002 +#define VeryLowBatteryAlert 10003 +#define UndoAlert 10004 +#define UndoCancelButton 1 + +#define MergeCategoryAlert 10005 +#define MergeCategoryYes 0 +#define MergeCategoryNo 1 + +#define privateRecordInfoAlert 10006 + +#define ClipboardLimitAlert 10007 + +#define CategoryExistsAlert 10012 + +#define DeviceFullAlert 10013 + + +// System Menu Bar and Menus +#define sysEditMenuID 10000 +#define sysEditMenuUndoCmd 10000 +#define sysEditMenuCutCmd 10001 +#define sysEditMenuCopyCmd 10002 +#define sysEditMenuPasteCmd 10003 +#define sysEditMenuSelectAllCmd 10004 +#define sysEditMenuSeparator 10005 +#define sysEditMenuKeyboardCmd 10006 + + +// Keyboard Menu Bar and Menus +#define sysKeyboardMenuID 10100 +#define sysKeyboardEditUndoCmd 100 +#define sysKeyboardEditCutCmd 101 +#define sysKeyboardEditCopyCmd 102 +#define sysKeyboardEditPasteCmd 103 +#define sysKeyboardEditSelectAllCmd 104 + + +// Note View Menu Bar and Menus +#define noteMenuID 10200 +#define noteUndoCmd 10000 +#define noteCutCmd 10001 +#define noteCopyCmd 10002 +#define notePasteCmd 10003 +#define noteSelectAllCmd 10004 +#define noteSeparator 10005 +#define noteKeyboardCmd 10006 +#define noteTopOfPageCmd 10200 +#define noteBottomOfPageCmd 10201 + + +// System Keyboard Dialog +#define SystemKeyboardID 10000 + + +// Categories Edit Dialog +#define CategoriesEditForm 10000 +#define CategoriesEditDoneButton 10002 +#define CategoriesEditFirstField 10004 + + +// Date Selector Dialog +#define DateSelectorForm 10100 +#define DateSelectorYearLabel 10102 +#define DateSelectorPriorYearButton 10103 +#define DateSelectorNextYearButton 10104 +#define DateSelectorTodayButton 10118 +#define DateSelectorCancelButton 10119 +#define DateSelectorDayGadget 10120 + + +// Time Selector Dialog +#define TimeSelectorForm 10200 +#define TimeSelectorStartTimeButton 10204 +#define TimeSelectorEndTimeButton 10205 +#define TimeSelectorHourList 10206 +#define TimeSelectorMinuteList 10207 +#define TimeSelectorOKButton 10208 +#define TimeSelectorCancelButton 10209 +#define TimeSelectorNoTimeButton 10210 + + +// Onscreen Keyboard +#define KeyboardForm 10300 +#define KeyboardGadget 10310 + +// Help Dialog +#define HelpForm 10400 +#define HelpField 10402 +#define HelpDoneButton 10403 +#define HelpUpButton 10404 +#define HelpDownButton 10405 + + +// Find Dialog +#define FindDialog 10500 +#define FindStrField 10503 +#define FindOKButton 10504 + + +// Find Results Dialog +#define FindResultsDialog 10600 +#define FindResultsMsgLabel 10602 +#define FindResultsTable 10603 +#define FindResultsGoToButton 10604 +#define FindResultsCancelButton 10605 +#define FindResultsMoreButton 10606 +#define FindResultsSearchingStr 10607 +#define FindResultsMatchesStr 10608 +#define FindResultsNoMatchesStr 10609 +#define FindResultsContinueStr 10610 + + +// Note View (used by Datebook, To Do, and Address apps) +#define NoteView 10900 +#define NoteField 10901 +#define NoteDoneButton 10902 +#define NoteSmallFontButton 10903 +#define NoteLargeFontButton 10904 +#define NoteDeleteButton 10905 +#define NoteUpButton 10906 +#define NoteDownButton 10907 +#define NoteFontGroup 1 + +// About Box - used by Datebook, Memo, Address, To Do, & others +#define aboutDialog 11000 +#define aboutNameLabel 11001 +#define aboutVersionLabel 11002 +#define aboutErrorStr 11003 + +//------------------------------------------------------------ +// Temporary resource routines +//------------------------------------------------------------ + +void* ResLoadForm (Word rscID) + SYS_TRAP(sysTrapResLoadForm); + +void* ResLoadMenu (Word rscID) + SYS_TRAP(sysTrapResLoadMenu); + + +CharPtr ResLoadString (Word rscID); + + + +//------------------------------------------------------------ +// Temporary debugging routines +//------------------------------------------------------------ +extern Boolean HeapDump (void); + + +#endif //__UICOMMON_H__ diff --git a/sdk-1/include/Core/UI/UIGlobals.h b/sdk-1/include/Core/UI/UIGlobals.h new file mode 100644 index 0000000..8f8bc8a --- /dev/null +++ b/sdk-1/include/Core/UI/UIGlobals.h @@ -0,0 +1,126 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: Global.h + * AUTHOR: Art Lamb: September 12, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines global variables used by the UI routines. + * + **********************************************************************/ + +#ifndef __GLOBAL_H__ +#define __GLOBAL_H__ + + +#define UINumFonts 7 +#define eventQueueSize 10 + + +typedef struct UIGlobalsType { + + // Global variables used by the window routines. + WinHandle activeWindow; + WinHandle displayWindow; + WinHandle drawWindow; + WinHandle firstWindow; + WinHandle exitWindowID; + WinHandle enterWindowID; + WinHandle exitedWindowID; + GraphicStateType gState; + + + // Global variables used by the event routines. + EventType* eventQ; + Word eventQIndex; + Word eventQLength; + SWord lastScreenX; + SWord lastScreenY; + Boolean lastPenDown; + SDWord needNullTickCount; // We want a null Evt when ticks reaches this value + + + // Global variables used by the font routins. + FontPtr uiCurrentFontPtr; + FontPtr uiFontTable[UINumFonts]; + FontID uiCurrentFontID; + + + // Global variables used by the form routines. + FormPtr currentForm; + + + // Global variables used by the insertion point routines. + Boolean insPtIsEnabled; + Boolean insPtOn; + PointType insPtLoc; + SWord insPtHeight; + SDWord insPtLastTick; + WinHandle insPtBitsBehind; + + // Global variables used by the clipboard routines. + ClipboardItem clipboard[numClipboardForamts]; + + // Globals used by the Memory Manager + MenuBarPtr uiCurrentMenu; + + // Global variables used by the field routines. + FieldUndoType undoGlobals; + + // Global variables used by the Griffiti shift state indicator routines. + Byte gsiState; + Boolean gsiIsEnabled; + PointType gsiLocation; + + } UIGlobalsType; +typedef UIGlobalsType* UIGlobalsPtr; + + +#define ActiveWindow ((UIGlobalsPtr)GUIGlobalsP)->activeWindow +#define DisplayWindow ((UIGlobalsPtr)GUIGlobalsP)->displayWindow +#define DrawWindow ((UIGlobalsPtr)GUIGlobalsP)->drawWindow +#define FirstWindow ((UIGlobalsPtr)GUIGlobalsP)->firstWindow +#define ExitWindowID ((UIGlobalsPtr)GUIGlobalsP)->exitWindowID +#define EnterWindowID ((UIGlobalsPtr)GUIGlobalsP)->enterWindowID +#define ExitedWindowID ((UIGlobalsPtr)GUIGlobalsP)->exitedWindowID +#define GState ((UIGlobalsPtr)GUIGlobalsP)->gState + +#define EventQ ((UIGlobalsPtr)GUIGlobalsP)->eventQ +#define EventQIndex ((UIGlobalsPtr)GUIGlobalsP)->eventQIndex +#define EventQLength ((UIGlobalsPtr)GUIGlobalsP)->eventQLength +#define LastScreenX ((UIGlobalsPtr)GUIGlobalsP)->lastScreenX +#define LastScreenY ((UIGlobalsPtr)GUIGlobalsP)->lastScreenY +#define LastPenDown ((UIGlobalsPtr)GUIGlobalsP)->lastPenDown +#define NeedNullTickCount ((UIGlobalsPtr)GUIGlobalsP)->needNullTickCount + +#define UICurrentFontPtr ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentFontPtr +#define UIFontTable ((UIGlobalsPtr)GUIGlobalsP)->uiFontTable +#define UICurrentFontID ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentFontID + +#define CurrentForm ((UIGlobalsPtr)GUIGlobalsP)->currentForm + +#define InsPtIsEnabled ((UIGlobalsPtr)GUIGlobalsP)->insPtIsEnabled +#define InsPtOn ((UIGlobalsPtr)GUIGlobalsP)->insPtOn +#define InsPtLoc ((UIGlobalsPtr)GUIGlobalsP)->insPtLoc +#define InsPtHeight ((UIGlobalsPtr)GUIGlobalsP)->insPtHeight +#define InsPtLastTick ((UIGlobalsPtr)GUIGlobalsP)->insPtLastTick +#define InsPtBitsBehind ((UIGlobalsPtr)GUIGlobalsP)->insPtBitsBehind + +#define Clipboard ((UIGlobalsPtr)GUIGlobalsP)->clipboard + +#define UICurrentMenu ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentMenu + +#define UndoGlobals ((UIGlobalsPtr)GUIGlobalsP)->undoGlobals + +#define GsiState ((UIGlobalsPtr)GUIGlobalsP)->gsiState +#define GsiIsEnabled ((UIGlobalsPtr)GUIGlobalsP)->gsiIsEnabled +#define GsiLocation ((UIGlobalsPtr)GUIGlobalsP)->gsiLocation + + +#endif //__GLOBAL_H__ + + diff --git a/sdk-1/include/Core/UI/Window.h b/sdk-1/include/Core/UI/Window.h new file mode 100644 index 0000000..2558a19 --- /dev/null +++ b/sdk-1/include/Core/UI/Window.h @@ -0,0 +1,338 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1994 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: window.h + * AUTHOR: Art Lamb: September 12, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines window structures and routines. + * + **********************************************************************/ +#ifndef __WINDOW_H__ +#define __WINDOW_H__ + + +enum directions { up = 0, down, left, right }; +typedef enum directions DirectionType; + + +enum windowFormats { screenFormat = 0, genericFormat }; +typedef enum windowFormats WindowFormatType; + + +//enum graphicModes { drawMode = 0, eraseMode, invertMode, mergeMode}; +//typedef enum graphicModes GraphicModeType; +typedef enum {scrCopy, scrAND, scrANDNOT, scrXOR, scrOR, scrCopyNOT} ScrOperation; + + +enum patterns { blackPattern, whitePattern, grayPattern, customPattern }; +typedef enum patterns PatternType; + +#define grayHLinePattern 0xAA + +enum underlineModes { noUnderline, grayUnderline, solidUnderline }; +typedef enum underlineModes UnderlineModeType; + + + +typedef struct { + Word compressed:1; // Data format: 0=raw; 1=compressed + Word reserved :15; +} BitmapFlagsType; + + +typedef struct { + Word width; + Word height; + Word rowBytes; + BitmapFlagsType flags; + Word reserved [4]; +} BitmapType; + + + +typedef BitmapType * BitmapPtr; + +typedef Word CustomPatternType [4]; + +typedef struct { + ScrOperation grafMode; + Boolean patternMode; + PatternType pattern; + CustomPatternType customPtn; + FontID fontId; + FontPtr font; + UnderlineModeType underlineMode; +} GraphicStateType; + +typedef GraphicStateType * GraphicStatePtr; + + +typedef union { + struct { + Word cornerDiam : 8; // corner diameter, max 38 + Word reserved : 4; + Word shadowWidth : 2; // Width of shadow + Word width : 2; // Width frame + } bits; + Word word; +} FrameBitsType; + +typedef Word FrameType; + +// Standard Frame Types +#define noFrame 0 +#define simpleFrame 1 +#define rectangleFrame 1 +#define roundFrame 0x0401 // corner = 7, frame = 1 +#define boldRoundFrame 0x0702 // corner = 7, frame = 2 +#define popupFrame 0x0205 // corner = 2, frame = 1, shadow = 1 +#define dialogFrame 0x0302 // corner = 3, frame = 2 +#define menuFrame popupFrame + + +typedef struct { + Word format:1; // window format: 0=screen mode; 1=generic mode + Word offscreen:1; // offscreen flag: 0=onscreen ; 1=offscreen + Word modal:1; // modal flag: 0=modeless window; 1=modal window + Word focusable:1; // focusable flag: 0=non-focusable; 1=focusable + Word enabled:1; // enabled flag: 0=disabled; 1=enabled + Word visible:1; // visible flag: 0-invisible; 1=visible + Word dialog:1; // dialog flag: 0=non-dialog; 1=dialog + Word compressed:1; // compressed flag: 0=uncompressed; 1=compressed + Word reserved :8; +} WindowFlagsType; + + +typedef struct WinTypeStruct { + Word displayWidth; + Word displayHeight; + VoidPtr displayAddr; + WindowFlagsType windowFlags; + RectangleType windowBounds; + AbsRectType clippingBounds; + PointType viewOrigin; + FrameBitsType frameType; + GraphicStatePtr gstate; + struct WinTypeStruct * nextWindow; +} WindowType; + +typedef WindowType * WinPtr; +typedef WinPtr WinHandle; + + + + + +//----------------------------------------------- +// Macros +//----------------------------------------------- + +// For now, the window handle is a pointer to a window structure, +// this however may change, so use the following macros. + +#define WinGetWindowPointer(winHandle) ((WinPtr) winHandle) + +#define WinGetWindowHandle(winPtr) ((WinHandle) winPtr) + + +//----------------------------------------------- +// Routines relating to windows management +//----------------------------------------------- + +extern WinHandle WinCreateWindow (RectanglePtr bounds, FrameType frame, + Boolean modal, Boolean focusable, WordPtr error) + SYS_TRAP(sysTrapWinCreateWindow); + +extern WinHandle WinCreateOffscreenWindow (SWord width, SWord height, + WindowFormatType format, WordPtr error) + SYS_TRAP(sysTrapWinCreateOffscreenWindow); + +extern void WinDeleteWindow (WinHandle winHandle, Boolean eraseIt) + SYS_TRAP(sysTrapWinDeleteWindow); + +extern void WinInitializeWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinInitializeWindow); + +extern void WinAddWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinAddWindow); + +extern void WinRemoveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinRemoveWindow); + +extern void WinSetActiveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetActiveWindow); + +extern WinHandle WinSetDrawWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetDrawWindow); + +extern WinHandle WinGetDrawWindow (void) + SYS_TRAP(sysTrapWinGetDrawWindow); + +extern WinHandle WinGetActiveWindow (void) + SYS_TRAP(sysTrapWinGetActiveWindow); + +extern WinHandle WinGetDisplayWindow (void) + SYS_TRAP(sysTrapWinGetDisplayWindow); + +extern WinHandle WinGetFirstWindow (void) + SYS_TRAP(sysTrapWinGetFirstWindow); + +extern void WinEnableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinEnableWindow); + +extern void WinDisableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinDisableWindow); + +extern void WinGetWindowFrameRect (WinHandle winHandle, RectanglePtr r) + SYS_TRAP(sysTrapWinGetWindowFrameRect); + +extern void WinDrawWindowFrame (void) + SYS_TRAP(sysTrapWinDrawWindowFrame); + +extern void WinEraseWindow (void) + SYS_TRAP(sysTrapWinEraseWindow); + +extern WinHandle WinSaveBits (RectanglePtr source, WordPtr error) + SYS_TRAP(sysTrapWinSaveBits); + +extern void WinRestoreBits (WinHandle winHandle, SWord destX, SWord destY) + SYS_TRAP(sysTrapWinRestoreBits); + +extern void WinCopyRectangle (WinHandle srcWin, WinHandle dstWin, + RectanglePtr srcRect, SWord destX, SWord destY, ScrOperation mode) + SYS_TRAP(sysTrapWinCopyRectangle); + +extern void WinScrollRectangle + (RectanglePtr r, enum directions direction, SWord distance, + RectanglePtr vacated) + SYS_TRAP(sysTrapWinScrollRectangle); + +extern void WinGetDisplayExtent (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinGetDisplayExtent); + +extern void WinGetWindowBounds (RectanglePtr r) + SYS_TRAP(sysTrapWinGetWindowBounds); + +extern void WinGetWindowExtent (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinGetWindowExtent); + +extern void WinDisplayToWindowPt (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinDisplayToWindowPt); + +extern void WinWindowToDisplayPt (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinWindowToDisplayPt); + +extern void WinGetClip (RectanglePtr r) + SYS_TRAP(sysTrapWinGetClip); + +extern void WinSetClip (RectanglePtr r) + SYS_TRAP(sysTrapWinSetClip); + +extern void WinResetClip (void) + SYS_TRAP(sysTrapWinResetClip); + +extern void WinClipRectangle (RectanglePtr r) + SYS_TRAP(sysTrapWinClipRectangle); + +extern Boolean WinModal (WinHandle winHandle) + SYS_TRAP(sysTrapWinModal); + +//----------------------------------------------- +// Routines to draw shapes or frames shapes +//----------------------------------------------- + +extern void WinDrawLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinDrawLine); + +extern void WinDrawGrayLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinDrawGrayLine); + +extern void WinEraseLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinEraseLine); + +extern void WinInvertLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinInvertLine); + +extern void WinFillLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinFillLine); + +extern void WinDrawRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinDrawRectangle); + +extern void WinEraseRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinEraseRectangle); + +extern void WinInvertRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinInvertRectangle); + +extern void WinFillRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinFillRectangle); + +extern void WinDrawRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinDrawRectangleFrame); + +extern void WinDrawGrayRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinDrawGrayRectangleFrame); + +extern void WinEraseRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinEraseRectangleFrame); + +extern void WinInvertRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinInvertRectangleFrame); + +extern void WinGetFramesRectangle (FrameType frame, RectanglePtr r, + RectanglePtr obscuredRect) + SYS_TRAP(sysTrapWinGetFramesRectangle); + + + +//----------------------------------------------- +// Routines relating to characters +//----------------------------------------------- + +extern void WinDrawChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawChars); + +extern void WinDrawInvertedChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawInvertedChars); + +extern void WinEraseChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinEraseChars); + +extern void WinInvertChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinInvertChars); + +extern UnderlineModeType WinSetUnderlineMode (UnderlineModeType mode) + SYS_TRAP(sysTrapWinSetUnderlineMode); + + +//----------------------------------------------- +// Routines to control patterns +//----------------------------------------------- + +extern void WinGetPattern (CustomPatternType) + SYS_TRAP(sysTrapWinGetPattern); + +extern void WinSetPattern (CustomPatternType) + SYS_TRAP(sysTrapWinSetPattern); + +//extern void WinSetPatternXferMode (enum patternXferModes mode); + +//extern enum patternXferModes WinGetPatternXferMode (void); + + +//----------------------------------------------- +// Routines relating to bitmaps +//----------------------------------------------- +extern void WinDrawBitmap (BitmapPtr bitmapP, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawBitmap); + + +#endif //__WINDOW_H__ + + diff --git a/sdk-2/LicenseAgreement.txt b/sdk-2/LicenseAgreement.txt new file mode 100644 index 0000000..e6b24d8 --- /dev/null +++ b/sdk-2/LicenseAgreement.txt @@ -0,0 +1,184 @@ +IMPORTANT: Read Before Using The Accompanying Software + + +3COM PALM OS SOFTWARE DEVELOPMENT KIT +SOFTWARE LICENSE AGREEMENT + + +YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND +CONDITIONS BEFORE USING THE ACCOMPANYING SOFTWARE, +THE USE OF WHICH IS LICENSED BY PALM COMPUTING, INC., A +SUBSIDIARY OF 3COM CORPORATION (COLLECTIVELY, "3COM"), +TO ITS CUSTOMERS FOR THEIR USE ONLY AS SET FORTH +BELOW. IF YOU DO NOT AGREE TO THE TERMS AND +CONDITIONS OF THIS AGREEMENT, DO NOT USE THE +SOFTWARE. USING ANY PART OF THE SOFTWARE INDICATES +THAT YOU ACCEPT THESE TERMS. + +LICENSE: 3Com grants you a nonexclusive, royalty-free license to use the +accompanying software program(s) (the "Software") subject to the terms and +restrictions set forth in this License Agreement. Except as explicitly set forth +below, (i) you are not permitted to lease or rent (except under separate mutually +agreeable terms set forth in writing and signed by both parties), distribute or +sublicense the Software or to use the Software in a time-sharing arrangement or +in any other unauthorized manner; (ii) no license is granted to you in the human +readable code of the Software (source code); and (iii) this License Agreement +does not grant you any rights to patents, copyrights, trade secrets, trademarks, or +any other rights in respect to the Software. + +The Software is licensed to be used on any personal computer and/or any Palm +Computing platform product, provided that the Software is used only in +connection with your development of products for use with Palm Computing +platform products. The Software contains certain sample source code in the +form of example applications (including several conduits) and code fragments +(both in the source code files and documentation provided hereunder), and may +include a tutorial application (collectively, "Sample Source Code"). You may +use the Sample Source Code internally to develop products for Palm Computing +platform products. You may distribute any such products built with the Sample +Source Code, provided that you include the following copyright notice within +your source code and in the location of your own copyright notice: "Portions +copyright c 1998 3Com Corporation or its subsidiaries. All rights reserved." + +Notwithstanding anything else in this License Agreement, you may not distribute +the conduit development kit header files included as part of the Software to +anyone for any reason. + +Except as described above, the Software and supporting documentation may be +copied only as essential for backup or archive purposes in support of your use of +the Software as permitted hereunder. You must reproduce and include all +copyright notices and any other proprietary rights notices appearing on the +Software on any copies that you make. + +NO ASSIGNMENT; NO REVERSE ENGINEERING: You may transfer the +Software and this License Agreement to another party if the other party agrees in +writing to accept the terms and conditions of this License Agreement. If you +transfer the Software, you must at the same time either transfer all copies of the +Software as well as the supporting documentation to the same party or destroy +any such materials not transferred. Except as set forth above, you may not +transfer or assign the Software or your rights under this License Agreement. + +Modification, reverse engineering, reverse compiling, or disassembly of the +Software is expressly prohibited. However, if you are a European Community +("EC") resident, information necessary to achieve interoperability of the +Software with other programs within the meaning of the EC Directive on the +Legal Protection of Computer Programs is available to you from 3Com upon +written request. + +EXPORT RESTRICTIONS: You agree that you will not export or re-export +the Software or accompanying documentation (or any copies thereof) or any +products utilizing the Software or such documentation in violation of any +applicable laws or regulations of the United States or the country in which you +obtained them. + +TRADE SECRETS; TITLE: You acknowledge and agree that the structure, +sequence and organization of the Software are the valuable trade secrets of +3Com and its suppliers. You agree to hold such trade secrets in confidence. +You further acknowledge and agree that ownership of, and title to, the Software +and all subsequent copies thereof regardless of the form or media are held by +3Com and its suppliers. + +UNITED STATES GOVERNMENT LEGEND: The Software is commercial +in nature and developed solely at private expense. The Software is delivered as +"Commercial Computer Software" as defined in DFARS 252.227-7014 (June +1995) or as a commercial item as defined in FAR 2.101(a) and as such is +provided with only such rights as are provided in this License Agreement, which +is 3Com's standard commercial license for the Software. Technical data is +provided with limited rights only as provided in DFAR 252.227-7015 (Nov. +1995) or FAR 52.227-14 (June 1987), whichever is applicable. + +TERM AND TERMINATION: This License Agreement is effective until +terminated. You may terminate it at any time by destroying the Software and +documentation together with all copies and merged portions in any form. It will +also terminate immediately if you fail to comply with any term or condition of +this License Agreement. Upon such termination you agree to destroy the +Software and documentation, together with all copies and merged portions in any +form. + +GOVERNING LAW: This License Agreement shall be governed by the laws +of the State of California as such laws are applied to agreements entered into and +to be performed entirely within California between California residents and by +the laws of the United States. You agree that the United Nations Convention on +Contracts for the International Sale of Goods (1980) is hereby excluded in its +entirety from application to this License Agreement. + +LIMITED WARRANTY: 3Com warrants the media containing the Software +for a period of ninety (90) days from the date of original purchase from 3Com or +its authorized retailer. Proof of date of purchase will be required. Any updates +to the Software provided by 3Com (which may be provided by 3Com at its sole +discretion) shall be governed by the terms of this License Agreement. The sole +obligation of 3Com with respect to this express warranty shall be (at the +discretion of 3Com) to refund the purchase price paid by you for the Software on +the defective media, or to replace the Software on new media. 3Com makes no +warranty or representation that its software products will meet your requirements +or will work in combination with any hardware or applications software products +provided by third parties, that the operation of the software products will be +uninterrupted or error free, or that all defects in the Software will be corrected. + +OBTAINING WARRANTY SERVICE: You must contact 3Com's Palm +Computing, Inc. Customer Service within the applicable warranty period to +obtain warranty service authorization. Dated proof of original purchase will be +required. 3Com is not responsible for your products or parts received without +warranty service authorization. + +WARRANTIES EXCLUSIVE: IF TH SOFTWARE MEDIA DOES NOT +OPERATE AS WARRANTED ABOVE, YOUR SOLE REMEDY FOR +BREACH OF THAT WARRANTY SHALL BE REPLACEMENT OF THE +SOFTWARE ON NEW MEDIA OR REFUND OF THE PURCHASE +PRICE PAID, AT THE OPTION OF 3COM AND DEPENDENT UPON +PRIOR AUTHORIZATION. TO THE FULL EXTENT ALLOWED BY +LAW, THE FOREGOING WARRANTIES AND REMEDIES ARE +EXCLUSIVE AND ARE IN LIEU OF ALL OTHER WARRANTIES, +TERMS, OR CONDITIONS, EXPRESS OR IMPLIED, EITHER IN FACT +OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, +INCLUDING WARRANTIES, TERMS, OR CONDITIONS OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +AND SATISFACTORY QUALITY. 3COM NEITHER ASSUMES NOR +AUTHORIZES ANY OTHER PERSON TO ASSUME FOR IT ANY +OTHER LIABILITY IN CONNECTION WITH THE SALE, +INSTALLATION, MAINTENANCE OR USE OF ITS PRODUCTS. + +3Com shall not be liable under this warranty if its testing and examination +disclose that the alleged defect in the product does not exist or was caused by +your or any third person's misuse, neglect, improper installation or testing, +unauthorized attempts to repair or modify, or any other cause beyond the range +of the intended use, or by accident, fire, lightning, or other hazards or acts of +God. This warranty does not apply when the malfunction results from the use of +this product in conjunction with accessories, other products, or ancillary or +peripheral equipment and 3Com determines that there is no fault with the +product itself. + +LIMITATION OF LIABILITY. TO THE FULL EXTENT ALLOWED +BY LAW 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS +ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT +(INCLUDING NEGLIGENCE), FOR INCIDENTAL, CONSEQUENTIAL, +INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF ANY KIND, OR +FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF +INFORMATION OR DATA, OR OTHER FINANCIAL LOSS ARISING +OUT OF OR IN CONNECTION WITH THE SALE, INSTALLATION, +MAINTENANCE, USE, PERFORMANCE, FAILURE, OR +INTERRUPTION OF THIS PRODUCT, EVEN IF 3COM OR ITS +AUTHORIZED RESELLER HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES, AND LIMITS ITS LIABILITY TO +REPLACEMENT OF THE SOFTWARE ON NEW MEDIA, OR REFUND +OF THE PURCHASE PRICE PAID, AT THE OPTION OF 3COM. THIS +DISCLAIMER OF LIABILITY FOR DAMAGES WILL NOT BE +AFFECTED IF ANY REMEDY PROVIDED HEREIN SHALL FAIL OF +ITS ESSENTIAL PURPOSE. +SEVERABILITY: In the event any provision of this License Agreement is +found to be invalid, illegal or unenforceable, the validity, legality and +enforceability of any of the remaining provisions shall not in any way be +affected or impaired and a valid, legal and enforceable provision of similar intent +and economic impact shall be substituted therefor. The headings used in this +Agreement are for convenience only and shall not be considered part of the +Agreement. + +ENTIRE AGREEMENT: This License Agreement sets forth the entire +understanding and agreement between you and 3Com, supersedes all prior +agreements, whether written or oral, with respect to the Software and subject +matter hereof, and may be amended only in a writing signed by both parties. + +Palm Computing, Inc., a subsidiary of 3Com Corporation +1565 Charleston Road +Mountain View, California 94043 +(650) 237-6000 + diff --git a/sdk-2/include/Core/AppBuildRules.h b/sdk-2/include/Core/AppBuildRules.h new file mode 100644 index 0000000..cde05e1 --- /dev/null +++ b/sdk-2/include/Core/AppBuildRules.h @@ -0,0 +1,35 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * AppBuildRules.h + * + * Description: + * This header file can be used as a template for + * application specific build options. To use, simple copy this file + * and place it into your local directory. + * + * Typically, the options specified in this file are used to build + * with different forms of error-checking, etc. and are not common to all projects. + * + * History: + * 6/6/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +// Run with error checking that forces all handles to be locked before +// they are accessed. Before alpha, all applications should be able to run with this +// option on. +#define MEMORY_FORCE_LOCK 1 + + +// Set these according to which Shell commands you want to +// link with. +#define SHELL_COMMAND_DB 0 // Not Available +#define SHELL_COMMAND_UI 0 // Not Available +#define SHELL_COMMAND_APP 0 // Not Available +#define SHELL_COMMAND_EMULATOR 1 // Available + diff --git a/sdk-2/include/Core/BuildRules.h b/sdk-2/include/Core/BuildRules.h new file mode 100644 index 0000000..ffab1cb --- /dev/null +++ b/sdk-2/include/Core/BuildRules.h @@ -0,0 +1,255 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * BuildRules.h + * + * Description: + * Build Rules for Pilot. This file is necessary for + * the CodeWarrior environment since it doesn't permit #defines + * in the "Makefile" (project settings). + * + * This file is included from within Common.h + * + * History: + * 12/13/94 RM - Created by Ron Marianetti + * 5/19/97 SL - Cleaned up CMD_LINE_BUILD and __PALMOS_TRAPS__ + * for other build environments + * + *******************************************************************/ + +#ifndef __BUILDRULES_H__ +#define __BUILDRULES_H__ + +/************************************************************ + * Compilation Control Options + *************************************************************/ + +// The makefile should set the define EMULATION_LEVEL to one of the following +// constants: +#define EMULATION_NONE 0 // native environment +#define EMULATION_WINDOWS 1 // emulate on Windows +#define EMULATION_DOS 2 // emulate on DOS +#define EMULATION_MAC 3 // emulate on Macintosh + + +// If emulation is not EMULATION_NONE, the following define controls +// whether we are talking to a touchdown device over the serial port, +// or if we are emulating a memory card in local RAM. +// +// The makefile should set the define MEMORY_TYPE to one of the following +// constants +#define MEMORY_LOCAL 0 // Emulate using local memory card image +#define MEMORY_REMOTE 1 // Pass calls through serial port to the device + + +// The makefile should set the define ENVIRONMENT to one of the following: +#define ENVIRONMENT_CW 0 // CodeWarrior compiler/linker (IDE or MPW) +#define ENVIRONMENT_MPW 1 // Apple's MPW compiler/linker + + +// The makefile should set the define ERROR_CHECK_LEVEL to one of the +// following constants: +#define ERROR_CHECK_NONE 0 // compile no error checking code +#define ERROR_CHECK_PARTIAL 1 // display for fatal errors only +#define ERROR_CHECK_FULL 2 // display fatal or non-fatal errors + + +// The makefile should set the define CPU_TYPE to one of the +// following constants: +#define CPU_68K 0 // Motorola 68K type +#define CPU_x86 1 // Intel x86 type + + +// The makefile should set the define HW_TARGET to one of the +// following constants: +#define HW_TARGET_NONE 0 // Emulating +#define HW_TARGET_302 1 // Motorola 302 ADS board +#define HW_TARGET_328EMU 2 // Motorola 328 Emulator ADS board +#define HW_TARGET_328 3 // Motorola 328 ADS board +#define HW_TARGET_TD1 4 // Pilot hardware + + +// The makefile should set the define MEMORY_FORCE_LOCK to one of the +// following. +#define MEMORY_FORCE_LOCK_OFF 0 // Don't force all handles to be locked +#define MEMORY_FORCE_LOCK_ON 1 // Force all handles to be locked before usage + + +// The makefile should set the define DEBUG_LEVEL to one of the +// following. THIS DEFINE IS ONLY USED BY A COUPLE MODULES SO WE +// DON'T GIVE IT A DEFAULT VALUE BELOW... +// ANY MODULE THAT USES THIS DEFINE SHOULD VERIFY THAT IT IS DEFINED!! +#define DEBUG_LEVEL_NONE 1 // None: Does not auto-launch Console or Debugger +#define DEBUG_LEVEL_PARTIAL 2 // Partial: Auto-Launches Console but skips debugger +#define DEBUG_LEVEL_FULL 3 // Full: Waits in debugger on reset + + +// The makefile should set the define CONSOLE_SERIAL_LIB to one of +// the following. THIS DEFINE IS ONLY USED BY A COUPLE MODULES SO WE +// DON'T GIVE IT A DEFAULT VALUE BELOW... +// ANY MODULE THAT USES THIS DEFINE SHOULD VERIFY THAT IT IS DEFINED!! +#define CONSOLE_SERIAL_LIB_68328 1 // SerialMgr68328 used by Console app +#define CONSOLE_SERIAL_LIB_68681 2 // SerialMgr68681 used by Console app + + +// The makefile should set the define COUNTRY to one of the +// following constants: +#define COUNTRY_UNITED_STATES 0 +#define COUNTRY_FRANCE 1 +#define COUNTRY_GERMANY 2 +#define COUNTRY_ITALY 3 +#define COUNTRY_SPAIN 4 + + +// The makefile should set the define LANGUAGE to one of the +// following constants: +#define LANGUAGE_ENGLISH 0 +#define LANGUAGE_FRENCH 1 +#define LANGUAGE_GERMAN 2 +#define LANGUAGE_ITALIAN 3 +#define LANGUAGE_SPANISH 4 + + + +// The makefile should set the define USER_MODE to one of the +// following constants: +#define USER_MODE_NORMAL 0 // normal operation +#define USER_MODE_DEMO 1 // demo mode - Graffiti and pop-up keyboard disabled + + +// The makefile should set the define INTERNAL_COMMANDS to one of the +// following constants: +#define INTERNAL_COMMANDS_EXCLUDE 0 +#define INTERNAL_COMMANDS_INCLUDE 1 // Include internal shell commands + +// The makefile should set the define INCLUDE_DES to one of the +// following constants: +#define INCLUDE_DES_OFF 0 +#define INCLUDE_DES_ON 1 // include it + + +/************************************************************ + * Include the following when running under the CodeWarrior + * IDE so that default build options can be overriden. The default + * version of this file is in the Incs: directory. If an app wishes + * to override the default options, it should create a copy of this + * include file in its own local directory. This include file + * is never used when building from MPW since MPW can specify compiler + * defines from the command line. + * + * Other environments can override all of these settings by simply + * pre-defining CMD_LINE_BUILD and any other desired settings. + *************************************************************/ + +#ifndef CMD_LINE_BUILD // typically pre-defined only from MPW + + #if !defined(__MWERKS__) && !defined(__PALMOS_TRAPS__) + + // assume other environments generally build only PalmOS executables + #define __PALMOS_TRAPS__ 1 + + #endif + + + #if __PALMOS_TRAPS__ // defined by CodeWarrior IDE or above + + // Settings to build a PalmOS executable + #define EMULATION_LEVEL EMULATION_NONE // building Pilot executable + #define USE_TRAPS 1 // use Pilot traps + + #endif + + + // Include default definitions - either from Incs: directory or from + // local project directory (if present, to override system defaults). + #include "AppBuildRules.h" + #include +#endif + + + +/************************************************************ + * Settings that can be overriden in the makefile (for MPW) + * OR (for CodeWarrior) in "AppBuildRules.h". If there is no + * local copy of "AppBuildRules.h" within the project directory, + * the one in the Incs directory will be used instead. + *************************************************************/ +#ifndef EMULATION_LEVEL + #define EMULATION_LEVEL EMULATION_MAC +#endif + +#if EMULATION_LEVEL == EMULATION_NONE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +#ifndef MEMORY_TYPE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +#ifndef ENVIRONMENT + #define ENVIRONMENT ENVIRONMENT_CW +#endif + +#ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL ERROR_CHECK_FULL +#endif + +#ifndef CPU_TYPE + #define CPU_TYPE CPU_68K +#endif + +#ifndef HW_TARGET + #define HW_TARGET HW_TARGET_NONE +#endif + +#ifndef MEMORY_FORCE_LOCK + #define MEMORY_FORCE_LOCK MEMORY_FORCE_LOCK_ON +#endif + +#ifndef COUNTRY + #define COUNTRY COUNTRY_UNITED_STATES +#endif + +#ifndef LANGUAGE + #define LANGUAGE LANGUAGE_ENGLISH +#endif + +#ifndef USER_MODE + #define USER_MODE USER_MODE_NORMAL +#endif + +#ifndef INTERNAL_COMMANDS + #define INTERNAL_COMMANDS INTERNAL_COMMANDS_EXCLUDE +#endif + +#ifndef INCLUDE_DES + #define INCLUDE_DES INCLUDE_DES_OFF +#endif + + +/********************************************************************** + * By putting these here (once), we don't need them in each :Src:ĹRsc.c + **********************************************************************/ +#if LANGUAGE == LANGUAGE_ENGLISH +#define RESOURCE_FILE_PREFIX "" + +#elif LANGUAGE == LANGUAGE_FRENCH +#define RESOURCE_FILE_PREFIX "Localized:Fr." + +#elif LANGUAGE == LANGUAGE_GERMAN +#define RESOURCE_FILE_PREFIX "Localized:Ge." + +#elif LANGUAGE == LANGUAGE_ITALIAN +#define RESOURCE_FILE_PREFIX "Localized:It." + +#elif LANGUAGE == LANGUAGE_SPANISH +#define RESOURCE_FILE_PREFIX "Localized:Sp." +#endif + + + +#endif // __BUILDRULES_H__ diff --git a/sdk-2/include/Core/Common.h b/sdk-2/include/Core/Common.h new file mode 100644 index 0000000..4714e83 --- /dev/null +++ b/sdk-2/include/Core/Common.h @@ -0,0 +1,257 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Common.h + * + * Description: + * Common header file for all Pilot routines. + * Contains elementary data types + * + * History: + * 10/19/94 RM - Created by Ron Marianetti + * 4/24/97 SL - Changes for PalmOS 2.0 SDK + * + *******************************************************************/ + + +#ifndef __COMMON_H__ +#define __COMMON_H__ + + +/************************************************************ + * Build Rules + *************************************************************/ +#include + + +/************************************************************ + * Metrowerks will substitute strlen and strcpy with inline + * 68K assembly code. Prevent this. + *************************************************************/ + +#if __MC68K__ +#define _NO_FAST_STRING_INLINES_ 0 +#endif + + +/************************************************************ + * Define whether or not we are direct linking, or going through + * traps. + * + * When eumulating we use directy linking. + * When running under native mode, we use traps EXCEPT for the + * modules that actually install the routines into the trap table. + * These modules will set the DIRECT_LINK define to 1 + *************************************************************/ +#ifndef EMULATION_LEVEL +#error "This should not happen!" +#endif + +#ifndef USE_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_TRAPS 1 // use Pilot traps + #else + #define USE_TRAPS 0 // direct link (Simulator) + #endif +#endif + +#if USE_TRAPS == 0 + +#define ONEWORD_INLINE(trapNum) +#define TWOWORD_INLINE(w1, w2) +#define THREEWORD_INLINE(w1, w2, w3) +#define FOURWORD_INLINE(w1, w2, w3, w4) +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) + +#else + +// Define the traps differently depending on the compiler + +#ifdef __GNUC__ +#define ASMWORD(W) asm("dc.w %c0"::"i"(W)); +#define ONEWORD_INLINE(trapNum) \ + {ASMWORD(trapNum)} +#define TWOWORD_INLINE(w1, w2) \ + {ASMWORD(w1)ASMWORD(w2)} +#define THREEWORD_INLINE(w1, w2, w3) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)} +#define FOURWORD_INLINE(w1, w2, w3, w4) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)} +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)} +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)} +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)} +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)} +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)} +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)ASMWORD(w10)} +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)ASMWORD(w10)ASMWORD(w11)} +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \ + {ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)ASMWORD(w10)ASMWORD(w11)ASMWORD(w12)} + +#else + +// Define the traps for Metrowerks IDE or MPW 68K compiler + +#define ONEWORD_INLINE(trapNum) \ + = trapNum +#define TWOWORD_INLINE(w1, w2) \ + = {w1,w2} +#define THREEWORD_INLINE(w1, w2, w3) \ + = {w1,w2,w3} +#define FOURWORD_INLINE(w1, w2, w3, w4) \ + = {w1,w2,w3,w4} +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) \ + = {w1,w2,w3,w4,w5} +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) \ + = {w1,w2,w3,w4,w5,w6} +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) \ + = {w1,w2,w3,w4,w5,w6,w7} +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) \ + = {w1,w2,w3,w4,w5,w6,w7,w8} +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9} +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10} +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11} +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12} + +#endif + +#endif + + +/******************************************************************** + * Elementary data types + ********************************************************************/ + + +// Fixed size data types +typedef char SByte; // 8 bits +#ifndef __TYPES__ // (Already defined in CW11) +typedef unsigned char Byte; +#endif + +typedef short SWord; // 16 bits +typedef unsigned short Word; + +typedef long SDWord; // 32 bits +typedef unsigned long DWord; + + +// Logical data types +#ifndef __TYPES__ // (Already defined in CW11) +typedef unsigned char Boolean; +#endif + +typedef char Char; // Used for character strings +typedef unsigned char UChar; + +typedef short Short; // >= Byte +typedef unsigned short UShort; + +typedef short Int; // >= Word (use short so MPW and CW agree) +typedef unsigned short UInt; + +typedef long Long; // >= DWord +typedef unsigned long ULong; + +typedef short Err; + +typedef DWord LocalID; // local (card relative) chunk ID + + + +/************************************************************ + * Pointer Types + *************************************************************/ +typedef void* VoidPtr; +typedef VoidPtr* VoidHand; + + +// Fixed size data types +typedef SByte* SBytePtr; +#ifndef __TYPES__ // (Already defined in CW11) +typedef Byte* BytePtr; +#endif + +typedef SWord* SWordPtr; +typedef Word* WordPtr; + +typedef SDWord* SDWordPtr; +typedef DWord* DWordPtr; + + +// Logical data types +typedef Boolean* BooleanPtr; + +typedef Char* CharPtr; +typedef UChar* UCharPtr; + +typedef Short* ShortPtr; +typedef UShort* UShortPtr; + +typedef Int* IntPtr; +typedef UInt* UIntPtr; + +typedef Long* LongPtr; +typedef ULong* ULongPtr; + +// Include the following typedefs if types.h wasn't read. +#ifndef __TYPES__ + +// Generic Pointer types used by Memory Manager +// We have to define Ptr as char* because that's what the Mac includes do. +typedef char* Ptr; // global pointer +typedef Ptr* Handle; // global handle + +// Function types +typedef Long (*ProcPtr)(); + +#endif /* __TYPES__ */ + + + +/************************************************************ + * Common constants + *************************************************************/ +#ifndef NULL +#define NULL 0 +#endif // NULL + +// Include the following typedefs if types.h wasn't read. +#ifndef __TYPES__ + #ifdef __MWERKS__ + #if !__option(bool) + #ifndef true + #define true 1 + #endif + #ifndef false + #define false 0 + #endif + #endif + #else + enum {false, true}; + #endif +#endif /* __TYPES__ */ + + +#endif //__COMMON_H__ diff --git a/sdk-2/include/Core/Hardware/Hardware.h b/sdk-2/include/Core/Hardware/Hardware.h new file mode 100644 index 0000000..8100ef6 --- /dev/null +++ b/sdk-2/include/Core/Hardware/Hardware.h @@ -0,0 +1,264 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Hardware.h + * + * Description: + * General Hardware Equates. This header file + * contains general hardware configuration equates that are not dependent on + * the version of the hardware we're running on. Equates specific to + * a certain component like the 68328, etc. is contained in separate + * header files. + * + * History: + * 4/27/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HARDWARE_H__ +#define __HARDWARE_H__ + + + + +/************************************************************************** + * General Equates + ***************************************************************************/ + +// Bits in the low memory global GHwrWakeUp +#define hwrWakeUpGeneral 0x0001 +#define hwrWakeUpPWM 0x0002 +#define hwrWakeUpFromKey 0x0004 // set if we woke from a key press +#define hwrWakeUpReturnToSleep 0x0008 // set if we woke from 24 hr. interrupt + // in which case we want to go right back to sleep + + +// Bits in the low memory global GHwrMiscFlags +#define hwrMiscFlagHasBacklight 0x0001 // set if backlight is present. + + +// Bits for the call HwrDockSignals +#define hwrDockInSyncButton 0x0001 // Dock button +#define hwrDockInGeneric1 0x0002 // General Purpose input #1 + +#define hwrDockOutGeneric0 0x0001 // General Purpose output #0 + + + +// Define # of card slots +#if EMULATION_LEVEL == EMULATION_NONE +#define hwrNumCardSlots 1 // 1 card slot +#else +#define hwrNumCardSlots 2 // 2 card slots for emulation +#endif + + +// Screen Dimensions +#define hwrDisplayWidth 160 // Width of display +#define hwrDisplayHeight 160 // Height of display + +// Screen refresh rate +#define hwrDisplayPeriod 12 // frame period in ms. + + +// Battery scaling: +// Voltage = (level + hwrVoltStepsOffset) / hwrStepsPerVolt +#define hwrStepsPerVolt 78 // 78 = 1 volt. +#define hwrVoltStepsOffset 0 // Add to level before scaling + +//---------------------------------------------------------------------------- +// Digitizer Dimensions +//---------------------------------------------------------------------------- +#define hwrSystemTop (hwrDisplayHeight+4) +#define hwrSystemHeight 56 + +// Graffiti Area +#define hwrGraffitiTop hwrSystemTop // Top coordinate of Graffiti area +#define hwrGraffitiLeft 27 // Left coordinate of Graffiti area +#define hwrGraffitiWidth 106 // Width of Graffiti area +#define hwrGraffitiHeight hwrSystemHeight // Height of Graffiti area +#define hwrGraffitiSplit (hwrGraffitiLeft+62) // Split mode dividing line + +// Launch Button +#define hwrLaunchBtnLeft 0 +#define hwrLaunchBtnTop hwrSystemTop +#define hwrLaunchBtnWidth 27 +#define hwrLaunchBtnHeight (hwrSystemHeight/2) + +// Menu Button +#define hwrMenuBtnLeft 0 +#define hwrMenuBtnTop (hwrSystemTop+hwrMenuBtnHeight) +#define hwrMenuBtnWidth 27 +#define hwrMenuBtnHeight (hwrSystemHeight/2) + +// Calculator Button +#define hwrCalcBtnLeft 133 +#define hwrCalcBtnTop hwrSystemTop +#define hwrCalcBtnWidth 27 +#define hwrCalcBtnHeight (hwrSystemHeight/2) + +// Find Button +#define hwrFindBtnLeft 133 +#define hwrFindBtnTop (hwrSystemTop+hwrCalcBtnHeight) +#define hwrFindBtnWidth 27 +#define hwrFindBtnHeight (hwrSystemHeight/2) + +// Keyboard Alpha Button +#define hwrKeyboardAlphaBtnLeft 27 +#define hwrKeyboardAlphaBtnTop (hwrSystemTop+hwrSystemHeight-hwrSystemHeight/4) +#define hwrKeyboardAlphaBtnWidth 18 +#define hwrKeyboardAlphaBtnHeight (hwrSystemHeight/4) + +// Keyboard Numeric Button +#define hwrKeyboardNumericBtnLeft (hwrFindBtnLeft-hwrKeyboardNumericBtnWidth) +#define hwrKeyboardNumericBtnTop hwrKeyboardAlphaBtnTop +#define hwrKeyboardNumericBtnWidth 18 +#define hwrKeyboardNumericBtnHeight hwrKeyboardAlphaBtnHeight + + + +/************************************************************************** + * Prototypes of functions used only when running on the real hardware + ***************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + // These routines are only accessed from the Debugger so they don't + // need traps. + void HwrPreRAMInit(void); + + void HwrPreDebugInit(void); + + void HwrInit(void); + + void HwrPostDebugInit(void); + + Err HwrFlashWriteSub(Ptr bodyP); + + void HwrResetNMI(void); + + DWord HwrGetRAMSize(UInt cardNo, DWord limit); + + void HwrDrawSplashScreen(void); + + void HwrDisableInts(void); + + void HwrShutDownPLL(void); + + void HwrLowBatteryHandler(void); + + + // These routines are for "general" use. + void HwrIRQ1Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ1Handler); + void HwrIRQ2Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ2Handler); + void HwrIRQ3Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ3Handler); + void HwrIRQ4Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ4Handler); + void HwrIRQ5Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ5Handler); + void HwrIRQ6Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ6Handler); + + + void HwrGetRAMMapping(Ptr /*CardInfoPtr*/ cardInfoP, UInt* numBlocksP, + DWordPtr physBlockInfoP, DWordPtr logBlockInfoP) + SYS_TRAP(sysTrapHwrGetRAMMapping); + + DWord HwrMemWritable(VoidPtr addr) + SYS_TRAP(sysTrapHwrMemWritable); + + DWord HwrMemReadable(VoidPtr addr) + SYS_TRAP(sysTrapHwrMemReadable); + + Err HwrCursor(Boolean set, Int* modeP, PointType* whereP, PointType* sizeP, + UInt* blinkP) + SYS_TRAP(sysTrapHwrCursor); + + void HwrDelay(ULong microseconds) + SYS_TRAP(sysTrapHwrDelay); + + void HwrDoze(Boolean onlyNMI) + SYS_TRAP(sysTrapHwrDoze); + + void HwrSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapHwrSleep); + + Err HwrWake(void) + SYS_TRAP(sysTrapHwrWake); + + Err HwrSetSystemClock(ULong* freqP) + SYS_TRAP(sysTrapHwrSetSystemClock); + + Err HwrSetCPUDutyCycle(UInt* dutyP) + SYS_TRAP(sysTrapHwrSetCPUDutyCycle); + + Err HwrLCDInit(UInt framePeriod, VoidPtr baseP, UInt width, + UInt height, UInt depth) + SYS_TRAP(sysTrapHwrLCDInit); + + Err HwrLCDBaseAddr(Ptr* newAddrP) + SYS_TRAP(sysTrapHwrLCDBaseAddr); + + Err HwrLCDDrawBitmap(UInt x, UInt y, Ptr bitmapP, Boolean clearFirst) + SYS_TRAP(sysTrapHwrLCDDrawBitmap); + + Err HwrLCDSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapHwrLCDSleep); + + Err HwrLCDWake(void) + SYS_TRAP(sysTrapHwrLCDWake); + + Err HwrTimerInit(UInt timer) + SYS_TRAP(sysTrapHwrTimerInit); + + Err HwrTimerSleep(UInt timer) + SYS_TRAP(sysTrapHwrTimerSleep); + + Err HwrTimerWake(UInt timer) + SYS_TRAP(sysTrapHwrTimerWake); + + UInt HwrBatteryLevel(void) + SYS_TRAP(sysTrapHwrBatteryLevel); + + Boolean HwrPluggedIn(void) + SYS_TRAP(sysTrapHwrPluggedIn); + + Boolean HwrBacklight(Boolean set, Boolean newState) + SYS_TRAP(sysTrapHwrBacklight); + + Boolean HwrEnableDataWrites(void) + SYS_TRAP(sysTrapHwrEnableDataWrites); + + void HwrDisableDataWrites(void) + SYS_TRAP(sysTrapHwrDisableDataWrites); + + Err HwrDockSignals(WordPtr inputsP, Word outputSet, Word outputClr) + SYS_TRAP(sysTrapHwrDockSignals); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _HwrWake \ + ASM_SYS_TRAP(sysTrapHwrWake) + + +#endif //__HARDWARE_H__ + +#endif // NON_PORTABLE diff --git a/sdk-2/include/Core/Hardware/HardwarePrv.h b/sdk-2/include/Core/Hardware/HardwarePrv.h new file mode 100644 index 0000000..f6dd66a --- /dev/null +++ b/sdk-2/include/Core/Hardware/HardwarePrv.h @@ -0,0 +1,174 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * HardwarePrv.h + * + * Description: + * Private Hardware Equates. This header file + * contains equates that are common across all platforms but that + * change value for each hardware rev and platform. + * + * History: + * 4/27/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HARDWAREPRV_H__ +#define __HARDWAREPRV_H__ + + +// This must be defined on the command line before using this header!! +#if HW_TARGET != HW_TARGET_NONE + #ifndef HW_REV + #error THE COMPILER VARIABLE HW_REV MUST BE DEFINED!! + #endif +#endif + + + +/*********************************************************************** + * Equates for Emulation Mode + ***********************************************************************/ +#if HW_TARGET == HW_TARGET_NONE + +#define hwrCardSize 0x10000000L // Size of each card slot + +// DOLATER.. take this out??? +// Under native mode, this mask can be used to convert a pointer to a card offse  +//#define hwrCardOffsetMask 0x0FFFFFFFL + + +#endif + + + +/*********************************************************************** + * First Rev of the Pilot Hardware + ***********************************************************************/ +#if HW_TARGET == HW_TARGET_TD1 + + +// Define location and setup for the 68328 Dragonball chip +#define hwr68328Base 0xFFFFF000L // Base address of 68328 + + + +// Define the base of card 0 and the size of each card slot. +#if HW_REV <= 3 +#define hwrCardBase0 0x00800000L // starts here +#define hwrCardSize 0x00800000L // Size of each card slot +#define hwrFlashBase 0x00F00000L // Base of Flash ROM +#define hwrFlashSize 0x00080000L // Size of Flash ROM +#define hwrCardOffsetMask 0x007FFFFFL // Used to convert a pointer to a card offset + +#else // HW_REV >= 4 +#define hwrCardBase0 0x10000000L // starts here +#define hwrCardSize 0x10000000L // Size of each card slot +#define hwrFlashBase 0x10C00000L // Base of Flash ROM +#define hwrFlashSize 0x00100000L // Size of Flash ROM +#define hwrCardOffsetMask 0x0FFFFFFFL // Used to convert a pointer to a card offset + +#endif + +// Define the Flash width +#define hwrROMWidth 2 + +// Define location and setup for the 68681 Duart +#define hwrDuartBase 0x10E00000 // Base address of DUART + +#define hwrDuartClock 3686400 // in Hertz (3.6864 MHz) + +// Setting of ACR register except for baud rate select +// Timer mode - Crystal clock /1 +#define hwrDuartACRReg 0x60 + + +#endif // HW_TARGET == HW_TARGET_TD1 + + + + +/*********************************************************************** + * Motorola 68302 Development board + ***********************************************************************/ +#if HW_TARGET == HW_TARGET_302 + +// Define # of card slots and base address of each slot +#define hwrNumCardSlots 1 // 1 card slot +#define hwrCardBase0 0x00000000L // starts at 0 +#define hwrCardSize 0x10000000L // Size of each card slot + +// Under native mode, this mask can be used to convert a pointer to a card offse  +#define hwrCardOffsetMask 0x0FFFFFFFL + + +// Define location and setup for the 68681 Duart +#define hwrDuartBase 0x00400000 // Base address of DUART + +#define hwrDuartClock 3686400 // in Hertz (3.6864 MHz) + +#define hwrDuartIntVec 25 // Interrupt vector number for DUART + + +// Setting of ACR register except for baud rate select +// Timer mode - Crystal clock /1 +#define hwrDuartACRReg 0x60 + + +// Define the Flash base address +#define hwrFlashBase 0x00200000L +#define hwrROMWidth 2 + + +#endif // HW_TARGET == HW_TARGET_302 + + + + +/*********************************************************************** + * Motorola 68328 Emulator Development board + ***********************************************************************/ +#if HW_TARGET == HW_TARGET_328EMU + + +// Define # of card slots and base address of each slot +#define hwrNumCardSlots 1 // 1 card slot +#define hwrCardBase0 0x00000000L // starts at 0 +#define hwrCardSize 0x10000000L // Size of each card slot + +// Under native mode, this mask can be used to convert a pointer to a card offse  +#define hwrCardOffsetMask 0x0FFFFFFFL + + +// Define location and setup for the 68681 Duart +#define hwrDuartBase 0x00F00000 // Base address of DUART + +#define hwrDuartClock 3686400 // in Hertz (3.6864 MHz) + +#define hwrDuartIntVec 25 // Interrupt vector number for DUART + + + +// Setting of ACR register except for baud rate select +// Timer mode - Crystal clock /1 +#define hwrDuartACRReg 0x60 + + + +// Define the Flash base address +#define hwrFlashBase 0x00400000L +#define hwrROMWidth 2 + + + +#endif // HW_TARGET == HW_TARGET_328EMU + + +#endif //__HARDWARE_H__ +#endif // NON_PORTABLE diff --git a/sdk-2/include/Core/Hardware/HardwareTD1.h b/sdk-2/include/Core/Hardware/HardwareTD1.h new file mode 100644 index 0000000..a92bf7e --- /dev/null +++ b/sdk-2/include/Core/Hardware/HardwareTD1.h @@ -0,0 +1,313 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * HardwareTD1.h + * + * Description: + * Hardware Equates for the TD1 platform. This header file + * contains equates specific to Hardware platform TD1. + * It is included only in the modules "ROMHardwareTD1.c" and + * "AMXHardwareTD1.c". + * + * History: + * 6/13/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HARDWARETD1_H__ +#define __HARDWARETD1_H__ + + + +#if HW_REV == 1 +/************************************************************************ + * Port F Bit settings + ************************************************************************/ +#define hwrTD1PortFPanelYPOff 0x01 // (L) Vcc to Y Panel +#define hwrTD1PortFPanelYMOn 0x02 // (H) Gnd to Y Panel +#define hwrTD1PortFPanelXPOff 0x04 // (L) Vcc to X Panel +#define hwrTD1PortFPanelXMOn 0x08 // (H) Gnd to X Panel +#define hwrTD1PortFUnused4 0x10 +#define hwrTD1PortFUnused5 0x20 +#define hwrTD1PortFUnused6 0x40 +#define hwrTD1PortFSerialOn 0x80 // (H) Serial driver Enable + + +// Configurations of the panel control bits +#define hwrTD1PortFPanelMask 0x0F // Panel control bits + +// Configure for lowest power +#define hwrTD1PortFPanelCfgOff (hwrTD1PortFPanelYPOff | \ + hwrTD1PortFPanelXPOff) + +// Configure to generate pen interrupt +#define hwrTD1PortFPanelCfgPenIRQ (hwrTD1PortFPanelXMOn | \ + hwrTD1PortFPanelYPOff | \ + hwrTD1PortFPanelXPOff) + +// Configure to Measure Y Position +#define hwrTD1PortFPanelCfgYMeas (hwrTD1PortFPanelXMOn | \ + hwrTD1PortFPanelYPOff) + +// Configure to Measure X Position +#define hwrTD1PortFPanelCfgXMeas (hwrTD1PortFPanelXPOff | \ + hwrTD1PortFPanelYMOn) + + + +/************************************************************************ + * Port J Bit Assignments + ************************************************************************/ +#define hwrTD1PortJADCSOff 0x02 // (L) A/D Chip select +#define hwrTD1PortJBattOff 0x10 // (L) Battery Voltage measure +#define hwrTD1PortJLCDEnableOn 0x20 // (H) LCD Display On +#define hwrTD1PortJLCDVccOff 0x40 // (L) LCD Vcc +#define hwrTD1PortJLCDVeeOn 0x80 // (H) LCD Vee + + +/************************************************************************ + * Port K Bit Assignments + ************************************************************************/ +#define hwrTD1PortKSelfRefOff 0x08 // (L) PSRAM Self Refresh mode +#define hwrTD1PortKSelfRefOffBit 3 + + +/************************************************************************ + * Port M Bit Assignments + ************************************************************************/ +#define hwrTD1PortMVccFail 0x04 // (L) Input indicates 3.3v is too low +#define hwrTD1PortMCardIRQ 0x08 // (L) IRQ3 input from card +#define hwrTD1PortMUnused4 0x10 // Unused (IRQ2) +#define hwrTD1PortMDockButton 0x20 // (L) Sync button from Serial Doc +#define hwrTD1PortMPenIO 0x40 // Pen input/output +#define hwrTD1PortMDockIn 0x80 // (L) Gen. Purpose input from Serial Doc + + + +/************************************************************************ + * SPIM Base Configuration + ************************************************************************/ +#define hwrTD1SPIMBaseControl (hwr328SPIMControlRateDiv32 | \ + hwr328SPIMControlIntEnable | \ + hwr328SPIMControlInvPolarity | \ + hwr328SPIMControlOppPhase | \ + 16-1) + + +/************************************************************************ + * Macros for turning write-protection on/off + * These are used in-line for MemSemaphoreReserve and MemSemaphoreRelease + * for performance reasons. + ************************************************************************/ +#define hwrWriteProtectOff() \ + { \ + HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \ + /* Word mask; */ \ + \ + /* DOLATER.. take this out.... */ \ + /* mask = baseP->csAGroupMask; */ \ + \ + /* Clr read-only bit in chip select register for storage area */ \ + baseP->csASelect1 &= ~(0x0008); \ + baseP->csASelect2 &= ~(0x0008); \ + \ + /* DOLATER.. take this out... */ \ + /* baseP->csAGroupMask = mask; */ \ + } + +#ifndef BUILD_OPTION_WP_OFF +#define hwrWriteProtectOn() \ + { \ + HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \ + /* Word mask; */ \ + \ + /* DOLATER.. take this out.... */ \ + /* mask = baseP->csAGroupMask; */ \ + \ + /* Set read-only bit in chip select register for storage area */ \ + baseP->csASelect1 |= (0x0008); \ + baseP->csASelect2 |= (0x0008); \ + \ + /* DOLATER.. take this out... */ \ + /* baseP->csAGroupMask = mask; */ \ + } +#else +#define hwrWriteProtectOn() +#endif + + +#elif HW_REV >= 2 +/************************************************************************ + * Port D Bit settings + ************************************************************************/ +#define hwrTD1PortDNoExtPower 0x80 // (L) External DC input + +/************************************************************************ + * Port E Bit settings + ************************************************************************/ +#define hwrTD1PortENoBacklight 0x80 // (H) high if no backlight present + +/************************************************************************ + * Port F Bit settings + ************************************************************************/ +#define hwrTD1PortFPanelYPOff 0x01 // (L) Vcc to Y Panel +#define hwrTD1PortFPanelYMOn 0x02 // (H) Gnd to Y Panel +#define hwrTD1PortFPanelXPOff 0x04 // (L) Vcc to X Panel +#define hwrTD1PortFPanelXMOn 0x08 // (H) Gnd to X Panel +#define hwrTD1PortFLCDEnableOn 0x10 // (H) LCD Display on +#define hwrTD1PortFLCDVccOff 0x20 // (L) LCD Vcc +#define hwrTD1PortFLCDVeeOn 0x40 // (H) LCD Vee +#define hwrTD1PortFADCSOff 0x80 // (L) A/D Chip Select + + +// Configurations of the panel control bits +#define hwrTD1PortFPanelMask 0x0F // Panel control bits + +// Configure for lowest power +#define hwrTD1PortFPanelCfgOff (hwrTD1PortFPanelYPOff | \ + hwrTD1PortFPanelXPOff) + +// Configure to generate pen interrupt +#define hwrTD1PortFPanelCfgPenIRQ (hwrTD1PortFPanelXMOn | \ + hwrTD1PortFPanelYPOff | \ + hwrTD1PortFPanelXPOff) + +// Configure to Measure Y Position +#define hwrTD1PortFPanelCfgYMeas (hwrTD1PortFPanelXMOn | \ + hwrTD1PortFPanelYPOff) + +// Configure to Measure X Position +#define hwrTD1PortFPanelCfgXMeas (hwrTD1PortFPanelXPOff | \ + hwrTD1PortFPanelYMOn) + + +/************************************************************************ + * Port G Bit Assignments + ************************************************************************/ +#define hwrTD1PortGSerialOn 0x08 // (H) Serial Driver Enable +#define hwrTD1PortGBattOff 0x10 // (L) Battery Voltage Measure +#define hwrTD1PortGRefreshOut 0x20 // (L) Timer 1 output to signal refresh +#define hwrTD1PortGSelfRefOff 0x40 // (L) PSRAM Self Refresh mode +#define hwrTD1PortGSelfRefOffBit 6 // Bit # for above +#define hwrTD1PortGBacklightOn 0x80 // (H) Turn on backlight + + +/************************************************************************ + * Port M Bit Assignments + ************************************************************************/ +#define hwrTD1PortMVccFail 0x04 // (L) Input indicates 3.3v is too low +#define hwrTD1PortMCardIRQ 0x08 // (L) IRQ3 input from card +#define hwrTD1PortMUnused4 0x10 // Unused (IRQ2) +#define hwrTD1PortMDockButton 0x20 // (L) Sync button from Serial Doc +#define hwrTD1PortMPenIO 0x40 // Pen input/output +#define hwrTD1PortMDockIn 0x80 // (L) Gen. Purpose input from Serial Doc + + + +/************************************************************************ + * SPIM Base Configuration + ************************************************************************/ +#define hwrTD1SPIMBaseControl (hwr328SPIMControlRateDiv16 | \ + hwr328SPIMControlIntEnable | \ + hwr328SPIMControlInvPolarity | \ + hwr328SPIMControlOppPhase | \ + 16-1) + + +/************************************************************************ + * Macros for turning write-protection on/off + * These are used in-line for MemSemaphoreReserve and MemSemaphoreRelease + * for performance reasons. + ************************************************************************/ +#define hwrWriteProtectOff() \ + { \ + HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \ + /* Word mask; */ \ + \ + /* DOLATER.. take this out.... */ \ + /* mask = baseP->csAGroupMask; */ \ + \ + /* Clr read-only bit in chip select register for storage area */ \ + baseP->csASelect1 &= ~(0x0008); \ + baseP->csASelect3 &= ~(0x0008); \ + \ + /* DOLATER.. take this out... */ \ + /*baseP->csAGroupMask = mask; */ \ + } + +#ifndef BUILD_OPTION_WP_OFF +#define hwrWriteProtectOn() \ + { \ + HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \ + /* Word mask; */ \ + \ + /* DOLATER.. take this out.... */ \ + /* mask = baseP->csAGroupMask; */ \ + \ + /* Set read-only bit in chip select register for storage area */ \ + baseP->csASelect1 |= (0x0008); \ + baseP->csASelect3 |= (0x0008); \ + \ + /* DOLATER.. take this out... */ \ + /*baseP->csAGroupMask = mask; */ \ + } +#else +#define hwrWriteProtectOn() +#endif + +#else // HW_REV==2 + #error "Compiler variable HW_REV not valid!!!" +#endif + + +/************************************************************************ + *Initial values for the PLL. We set the system clock to be VCO/2 so + * the system clock speed becomes: + * + * 32768 * ((hwrTD1FreqSelP + 1) * 14 + hwrTD1FreqSelQ + 1) + * -------------------------------------------------------- + * 2 + ************************************************************************/ +// NON-ASIC versions must run at 8 Mhz. +#if HW_REV < 4 +#define hwrTD1PLLControl (hwr328PLLControlClkEn | \ + hwr328PLLControlSysVCODiv2 | \ + hwr328PLLControlPixVCODiv2) +//#define hwrTD1FreqSelQ 0x05 +#define hwrTD1FreqSelQ 0x07 // vmk 11/20/95 tunes clock freq for 38400 baud, + // allowing standard baud rates 2400-57600 to function +//#define hwrTD1FreqSelP 0x23 +#define hwrTD1FreqSelP 0x24 +#define hwrTD1Frequency (32768*((hwrTD1FreqSelP+1)*14+hwrTD1FreqSelQ+1)/2) + +// OLD ASIC versions must run between 10 and 12.5 Mhz. +#elif HW_REV == 4 +#define hwrTD1PLLControl (hwr328PLLControlClkEn | \ + hwr328PLLControlSysVCODiv1 | \ + hwr328PLLControlPixVCODiv1) +#define hwrTD1FreqSelQ 0x05 +#define hwrTD1FreqSelP 0x19 +#define hwrTD1Frequency (32768*((hwrTD1FreqSelP+1)*14+hwrTD1FreqSelQ+1)/1) + + +// NEW ASIC versions run at 16.580608 Mhz +#else +#define hwrTD1PLLControl (hwr328PLLControlClkEn | \ + hwr328PLLControlSysVCODiv1 | \ + hwr328PLLControlPixVCODiv1) +#define hwrTD1FreqSelQ 0x01 +#define hwrTD1FreqSelP 0x23 +#define hwrTD1Frequency (32768*((hwrTD1FreqSelP+1)*14+hwrTD1FreqSelQ+1)/1) +#endif + + + +#endif //__HARDWARETD1_H__ + +#endif // NON_PORTABLE diff --git a/sdk-2/include/Core/Hardware/M68328Hwr.h b/sdk-2/include/Core/Hardware/M68328Hwr.h new file mode 100644 index 0000000..ae7cb3e --- /dev/null +++ b/sdk-2/include/Core/Hardware/M68328Hwr.h @@ -0,0 +1,638 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * M68328Hwr.h + * + * Description: + * Hardware Equates for the Motorola 68328 Dragonball chip + * + * History: + * 4/19/95 RM - Created by Ron Marianetti + * 5/15/95 VMK - Added macros for RTC bits + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So apps don't include this... + + +#ifndef __M68328HWR_H__ +#define __M68328HWR_H__ + + +#include // Touchdown includes + + +/*********************************************************************** + * Motorola 68328 registers + ***********************************************************************/ +typedef struct HwrDBallType { + + Byte scr; // $000: System Control Register + Byte ___filler1[0xFF]; + + Word csAGroupBase; // $100: Chip Select Group A Base Register + Word csBGroupBase; // $102: Chip Select Group B Base Register + Word csCGroupBase; // $104: Chip Select Group C Base Register + Word csDGroupBase; // $106: Chip Select Group D Base Register + + Word csAGroupMask; // $108: Chip Select Group A Mask Register + Word csBGroupMask; // $10A: Chip Select Group B Mask Register + Word csCGroupMask; // $10C: Chip Select Group C Mask Register + Word csDGroupMask; // $10E: Chip Select Group D Mask Register + + DWord csASelect0; // $110: Group A Chip Select 0 Register + DWord csASelect1; // $114: Group A Chip Select 1 Register + DWord csASelect2; // $118: Group A Chip Select 2 Register + DWord csASelect3; // $11C: Group A Chip Select 3 Register + + DWord csBSelect0; // $120: Group B Chip Select 0 Register + DWord csBSelect1; // $124: Group B Chip Select 1 Register + DWord csBSelect2; // $128: Group B Chip Select 2 Register + DWord csBSelect3; // $12C: Group B Chip Select 3 Register + + DWord csCSelect0; // $130: Group C Chip Select 0 Register + DWord csCSelect1; // $134: Group C Chip Select 1 Register + DWord csCSelect2; // $138: Group C Chip Select 2 Register + DWord csCSelect3; // $13C: Group C Chip Select 3 Register + + DWord csDSelect0; // $140: Group D Chip Select 0 Register + DWord csDSelect1; // $144: Group D Chip Select 1 Register + DWord csDSelect2; // $148: Group D Chip Select 2 Register + DWord csDSelect3; // $14C: Group D Chip Select 3 Register + + Word csDebug; // $150: Chip Select debug register + Byte ___filler2[0x200-0x152]; + + Word pllControl; // $200: PLL Control Register + Word pllFreqSel; // $202: PLL Frequency Select Register + Word pllTest; // $204: PLL Test Register + Byte __filler44; + Byte pwrControl; // $207: Power Control Register + + Byte ___filler3[0x300-0x208]; + + Byte intVector; // $300: Interrupt Vector Register + Byte ___filler4; + Word intControl; // $302: Interrupt Control Register + Word intMaskHi; // $304: Interrupt Mask Register/HIGH word + Word intMaskLo; // $306: Interrupt Mask Register/LOW word + Word intWakeupEnHi; // $308: Interrupt Wakeup Enable Register + Word intWakeupEnLo; // $30A: Interrupt Wakeup Enable Register + Word intStatusHi; // $30C: Interrupt Status Register/HIGH word + Word intStatusLo; // $30E: Interrupt Status Register/LOW word + Word intPendingHi; // $310: Interrupt Pending Register + Word intPendingLo; // $312: Interrupt Pending Register + + Byte ___filler4a[0x400-0x314]; + + Byte portADir; // $400: Port A Direction Register + Byte portAData; // $401: Port A Data Register + Byte ___filler5; + Byte portASelect; // $403: Port A Select Register + + Byte ___filler6[4]; + + Byte portBDir; // $408: Port B Direction Register + Byte portBData; // $409: Port B Data Register + Byte ___filler7; + Byte portBSelect; // $40B: Port B Select Register + + Byte ___filler8[4]; + + Byte portCDir; // $410: Port C Direction Register + Byte portCData; // $411: Port C Data Register + Byte ___filler9; + Byte portCSelect; // $413: Port C Select Register + + Byte ___filler10[4]; + + Byte portDDir; // $418: Port D Direction Register + Byte portDData; // $419: Port D Data Register + Byte portDPullupEn; // $41A: Port D Pull-up Enable + Byte ___filler11; + Byte portDPolarity; // $41C: Port D Polarity Register + Byte portDIntReqEn; // $41D: Port D Interrupt Request Enable + Byte ___filler12; + Byte portDIntEdge; // $41F: Port D IRQ Edge Register + + Byte portEDir; // $420: Port E Direction Register + Byte portEData; // $421: Port E Data Register + Byte portEPullupEn; // $422: Port E Pull-up Enable + Byte portESelect; // $423: Port E Select Register + + Byte ___filler14[4]; + + Byte portFDir; // $428: Port F Direction Register + Byte portFData; // $429: Port F Data Register + Byte portFPullupEn; // $42A: Port F Pull-up Enable + Byte portFSelect; // $42B: Port F Select Register + + Byte ___filler16[4]; + + Byte portGDir; // $430: Port G Direction Register + Byte portGData; // $431: Port G Data Register + Byte portGPullupEn; // $432: Port G Pull-up Enable + Byte portGSelect; // $433: Port G Select Register + + Byte ___filler18[4]; + + Byte portJDir; // $438: Port J Direction Register + Byte portJData; // $439: Port J Data Register + Byte ___filler19; + Byte portJSelect; // $43B: Port J Select Register + + Byte ___filler19a[4]; + + Byte portKDir; // $440: Port K Direction Register + Byte portKData; // $441: Port K Data Register + Byte portKPullupEn; // $442: Port K Pull-up Enable + Byte portKSelect; // $443: Port K Select Register + + Byte ___filler21[4]; + + Byte portMDir; // $448: Port M Direction Register + Byte portMData; // $449: Port M Data Register + Byte portMPullupEn; // $44A: Port M Pull-up Enable Register + Byte portMSelect; // $44B: Port M Select Register + + Byte ___filler22[4]; + + Byte ___filler23[0x500-0x450]; + + Word pwmControl; // $500: PWM Control Register + Word pwmPeriod; // $502: PWM Period Register + Word pwmWidth; // $504: PWM Width Register + Word pwmCounter; // $506: PWM Counter + + Byte ___filler24[0x600-0x508]; + + Word tmr1Control; // $600: Timer 1 Control Register + Word tmr1Prescaler; // $602: Timer 1 Prescaler Register + Word tmr1Compare; // $604: Timer 1 Compare Register + Word tmr1Capture; // $606: Timer 1 Capture Register + Word tmr1Counter; // $608: Timer 1 Counter Register + Word tmr1Status; // $60A: Timer 1 Status Register + + Word tmr2Control; // $60C: Timer 2 Control Register + Word tmr2Prescaler; // $60E: Timer 2 Prescaler Register + Word tmr2Compare; // $610: Timer 2 Compare Register + Word tmr2Capture; // $612: Timer 2 Capture Register + Word tmr2Counter; // $614: Timer 2 Counter Register + Word tmr2Status; // $616: Timer 2 Status Register + + Word wdControl; // $618: Watchdog Control Register + Word wdReference; // $61A: Watchdog Reference Register + Word wdCounter; // $61C: Watchdog Counter + + Byte ___filler25[0x700-0x61E]; + + Word spiSlave; // $700: SPI Slave Register + + Byte ___filler26[0x800-0x702]; + + Word spiMasterData; // $800: SPI Master Data Register + Word spiMasterControl; // $802: SPI Master Control Register + + Byte ___filler27[0x900-0x804]; + + Word uControl; // $900: Uart Control Register + Word uBaud; // $902: Uart Baud Control Register + Word uReceive; // $904: Uart Receive Register + Word uTransmit; // $906: Uart Transmit Register + Word uMisc; // $908: Uart Miscellaneous Register + + Byte ___filler28[0xA00-0x90A]; + + DWord lcdStartAddr; // $A00: Screen Starting Address Register + Byte ___filler29; + Byte lcdPageWidth; // $A05: Virtual Page Width Register + Byte ___filler30[2]; + Word lcdScreenWidth; // $A08: Screen Width Register + Word lcdScreenHeight; // $A0A: Screen Height Register + Byte ___filler31[0xA18-0xA0C]; + Word lcdCursorXPos; // $A18: Cursor X Position + Word lcdCursorYPos; // $A1A: Cursor Y Position + Word lcdCursorWidthHeight; // $A1C: Cursor Width and Height + Byte ___filler32; + Byte lcdBlinkControl; // $A1F: Blink Control Register + Byte lcdPanelControl; // $A20: Panel Interface Control Register + Byte lcdPolarity; // $A21: Polarity Config Register + Byte ___filler33; + Byte lcdACDRate; // $A23: ACD (M) Rate Control Register + Byte ___filler34; + Byte lcdPixelClock; // $A25: Pixel Clock Divider Register + Byte ___filler35; + Byte lcdClockControl; // $A27: Clocking Control Register + Byte ___filler36; + Byte lcdLastBufferAddr; // $A29: Last Buffer Address Register + Byte ___filler37; + Byte lcdOctetTermCount; // $A2B: Octet Terminal Count Register + Byte ___filler38; + Byte lcdPanningOffset; // $A2D: Panning Offset Register + Byte ___filler39[3]; + Byte lcdFrameRate; // $A31: Frame Rate Control Modulation Register + Word lcdGrayPalette; // $A32: Gray Palette Mapping Register + Byte lcdReserved; // $A34: Reserved + + Byte ___filler40[0xB00-0xA35]; + + DWord rtcHourMinSec; // $B00: RTC Hours, Minutes, Seconds Register + DWord rtcAlarm; // $B04: RTC Alarm Register + DWord rtcReserved; // $B08: RTC Reserved + Word rtcControl; // $B0C: RTC Control Register + Word rtcIntStatus; // $B0E: RTC Interrupt Status Register + Word rtcIntEnable; // $B10: RTC Interrupt Enable Register + Word stopWatch; // $B12: Stopwatch Minutes + + } HwrDBallType; + +typedef volatile HwrDBallType* HwrDBallPtr; + + +/************************************************************************ + * LCD Controller Bits + ************************************************************************/ +#define hwr328LcdCursorXPosCtlMask 0xC000 + #define hwr328LcdCursorXPosCtlTrans 0x0000 + #define hwr328LcdCursorXPosCtlBlack 0x4000 + #define hwr328LcdCursorXPosCtlReverse 0x8000 + +#define hwr328LcdBlinkControlEnable 0x80 + +#define hwr328LcdPanelControlBusMask 0x06 + #define hwr328LcdPanelControlBus1Bit 0x00 + #define hwr328LcdPanelControlBus2Bit 0x02 + #define hwr328LcdPanelControlBus4Bit 0x04 +#define hwr328LcdPanelControlGrayScale 0x01 + +#define hwr328LcdPolarityShiftClock 0x08 +#define hwr328LcdPolarityFLM 0x04 +#define hwr328LcdPolarityLP 0x02 +#define hwr328LcdPolarityPixel 0x01 + +#define hwr328LcdClockControlEnable 0x80 +#define hwr328LcdClockControl16WordBursts 0x40 +#define hwr328LcdClockControlBurstRateMask 0x30 +// Old dragonball allows up to 4 clocks/word +#if HW_REV < 3 + #define hwr328LcdClockControlBurstRate1 0x00 + #define hwr328LcdClockControlBurstRate2 0x10 + #define hwr328LcdClockControlBurstRate3 0x20 + #define hwr328LcdClockControlBurstRate4 0x30 +// New dragonball allows up to 16 clocks/word +#else + #define hwr328LcdClockControlBurstRate1 0x00 + #define hwr328LcdClockControlBurstRate2 0x04 + #define hwr328LcdClockControlBurstRate3 0x08 + #define hwr328LcdClockControlBurstRate4 0x0C + #define hwr328LcdClockControlBurstRate5 0x10 + #define hwr328LcdClockControlBurstRate6 0x14 + #define hwr328LcdClockControlBurstRate7 0x18 + #define hwr328LcdClockControlBurstRate8 0x1C + #define hwr328LcdClockControlBurstRate9 0x20 + #define hwr328LcdClockControlBurstRate10 0x24 + #define hwr328LcdClockControlBurstRate11 0x28 + #define hwr328LcdClockControlBurstRate12 0x2C + #define hwr328LcdClockControlBurstRate13 0x30 + #define hwr328LcdClockControlBurstRate14 0x34 + #define hwr328LcdClockControlBurstRate15 0x38 + #define hwr328LcdClockControlBurstRate16 0x3C +#endif +#define hwr328LcdClockControl8BitBus 0x02 +#define hwr328LcdClockControlPixelClkSrc 0x01 + + +/************************************************************************ + * Interrupt Controller Bits + ************************************************************************/ +// intMaskHi bits +#define hwr328IntHiNMI 0x0080 +#define hwr328IntHiTimer1 0x0040 +#define hwr328IntHiSPIS 0x0020 +#define hwr328IntHiPen 0x0010 +#define hwr328IntHiIRQ6 0x0008 +#define hwr328IntHiIRQ3 0x0004 +#define hwr328IntHiIRQ2 0x0002 +#define hwr328IntHiIRQ1 0x0001 + +//NOTE: Due to a bug in early rev's of the DragonBall, the clear bits for +/// IRQ1,2,3,6 are different than the indicator bits +#define hwr328IntHiIRQ6Clr 0x0001 +#define hwr328IntHiIRQ3Clr 0x0002 +#define hwr328IntHiIRQ2Clr 0x0004 +#define hwr328IntHiIRQ1Clr 0x0008 + +// intMaskLo bits +#define hwr328IntLoInt7 0x8000 +#define hwr328IntLoInt6 0x4000 +#define hwr328IntLoInt5 0x2000 +#define hwr328IntLoInt4 0x1000 +#define hwr328IntLoInt3 0x0800 +#define hwr328IntLoInt2 0x0400 +#define hwr328IntLoInt1 0x0200 +#define hwr328IntLoInt0 0x0100 +#define hwr328IntLoAllKeys 0xFF00 +#define hwr328IntLoInt0Bit 8 +#define hwr328IntLoPWM 0x0080 +#define hwr328IntLoPWMBit 7 +#define hwr328IntLoKbd 0x0040 +#define hwr328IntLoLCDC 0x0020 +#define hwr328IntLoRTC 0x0010 +#define hwr328IntLoRTCBit 4 +#define hwr328IntLoWDT 0x0008 +#define hwr328IntLoUART 0x0004 +#define hwr328IntLoUARTBit 2 +#define hwr328IntLoTimer2 0x0002 +#define hwr328IntLoTimer2Bit 1 +#define hwr328IntLoSPIM 0x0001 + +// intControl bits +// NOTE: These are different (at least in version 0G58E) that documented in the +// User's manual +#define hwr328IntCtlEdge1 0x0800 +#define hwr328IntCtlEdge2 0x0400 +#define hwr328IntCtlEdge3 0x0200 +#define hwr328IntCtlEdge6 0x0100 +#define hwr328IntCtlPol1 0x8000 +#define hwr328IntCtlPol2 0x4000 +#define hwr328IntCtlPol3 0x2000 +#define hwr328IntCtlPol6 0x1000 + + +/************************************************************************ + * Timer bits + ************************************************************************/ +#define hwr328TmrControlUnused 0xFE00 +#define hwr328TmrControlFreeRun 0x0100 +#define hwr328TmrControlCaptureEdgeMask 0x00C0 + #define hwr328TmrControlCaptureEdgeNone 0x0000 + #define hwr328TmrControlCaptureEdgeRising 0x0040 + #define hwr328TmrControlCaptureEdgeFalling 0x0080 + #define hwr328TmrControlCaptureEdgeBoth 0x00C0 +#define hwr328TmrControlOutputModeToggle 0x0020 +#define hwr328TmrControlEnInterrupt 0x0010 +#define hwr328TmrControlClkSrcMask 0x000E + #define hwr328TmrControlClkSrcStop 0x0000 + #define hwr328TmrControlClkSrcSys 0x0002 + #define hwr328TmrControlClkSrcSysBy16 0x0004 + #define hwr328TmrControlClkSrcTIN 0x0006 + #define hwr328TmrControlClkSrc32KHz 0x0008 +#define hwr328TmrControlEnable 0x0001 + +#define hwr328TmrStatusCapture 0x0002 +#define hwr328TmrStatusCaptureBit 1 +#define hwr328TmrStatusCompare 0x0001 +#define hwr328TmrStatusCompareBit 0 + + +/************************************************************************ + * 68328 Serial Port Register Bits + ************************************************************************/ +// uControl Register +#define hwr328UControlUARTEnable 0x8000 +#define hwr328UControlRxEnable 0x4000 +#define hwr328UControlTxEnable 0x2000 +#define hwr328UControlRxClock1x 0x1000 +#define hwr328UControlParityEn 0x0800 +#define hwr328UControlParityOdd 0x0400 +#define hwr328UControlStopBits2 0x0200 +#define hwr328UControlDataBits8 0x0100 +#define hwr328UControlGPIODeltaEn 0x0080 +#define hwr328UControlCTSDeltaEn 0x0040 +#define hwr328UControlRxFullEn 0x0020 +#define hwr328UControlRxHalfEn 0x0010 +#define hwr328UControlRxRdyEn 0x0008 +#define hwr328UControlTxEmptyEn 0x0004 +#define hwr328UControlTxHalfEn 0x0002 +#define hwr328UControlTxAvailEn 0x0001 + +#define hwr328UControlEnableAll (hwr328UControlUARTEnable | \ + hwr328UControlRxEnable | \ + hwr328UControlTxEnable) + +// uBaud Register +#define hwr328UBaudGPIODelta 0x8000 +#define hwr328UBaudGPIOData 0x4000 +#define hwr328UBaudGPIODirOut 0x2000 +#define hwr328UBaudGPIOSrcBaudGen 0x1000 +#define hwr328UBaudBaudSrcGPIO 0x0800 +#define hwr328UBaudDivider 0x0700 +#define hwr328UBaudPrescaler 0x003F + +#define hwr328UBaudDivideBitOffset 8 + + +// uReceive Register +#define hwr328UReceiveFIFOFull 0x8000 +#define hwr328UReceiveFIFOHalf 0x4000 +#define hwr328UReceiveDataRdy 0x2000 +#define hwr328UReceiveDataRdyBit 13 +#define hwr328UReceiveOverrunErr 0x0800 +#define hwr328UReceiveOverrunErrBit 11 +#define hwr328UReceiveFrameErr 0x0400 +#define hwr328UReceiveFrameErrBit 10 +#define hwr328UReceiveBreakErr 0x0200 +#define hwr328UReceiveBreakErrBit 9 +#define hwr328UReceiveParityErr 0x0100 +#define hwr328UReceiveParityErrBit 8 +#define hwr328UReceiveData 0x00FF + +#define hwr328UReceiveErrsMask (hwr328UReceiveOverrunErr | \ + hwr328UReceiveFrameErr | \ + hwr328UReceiveBreakErr | \ + hwr328UReceiveParityErr) + +// uTransmit Register +#define hwr328UTransmitFIFOEmpty 0x8000 +#define hwr328UTransmitFIFOHalf 0x4000 +#define hwr328UTransmitTxAvail 0x2000 +#define hwr328UTransmitSendBreak 0x1000 +#define hwr328UTransmitIgnoreCTS 0x0800 +#define hwr328UTransmitCTSStatus 0x0200 +#define hwr328UTransmitCTSDelta 0x0100 +#define hwr328UTransmitData 0x00FF + +// uMisc Register +#define hwr328UMiscClkSrcGPIO 0x4000 +#define hwr328UMiscForceParityErr 0x2000 +#define hwr328UMiscLoopback 0x1000 +#define hwr328UMiscReservedMask 0x8F00 +#define hwr328UMiscRTSThruFIFO 0x0080 +#define hwr328UMiscRTSOut 0x0040 +#define hwr328UMiscIRDAEn 0x0020 +#define hwr328UMiscLoopIRDA 0x0010 +#define hwr328UMiscUnused 0x000F + + + +/************************************************************************ + * PWM Bits + ************************************************************************/ +// PWM register bits of interest +#define hwr328PWMControlEnable 0x0010 +#define hwr328PWMControlEnableIRQ 0x4000 +#define hwr328PWMControlLoad 0x0100 +#define hwr328PWMIRQStatus 0x8000 +// PWM divider chain output selectors +#define hwr328PWMControlDivMask 0x0007 +#define hwr328PWMControlDivBy2 0x0 +#define hwr328PWMControlDivBy4 0x1 +#define hwr328PWMControlDivBy8 0x2 +#define hwr328PWMControlDivBy16 0x3 +#define hwr328PWMControlDivBy32 0x4 +#define hwr328PWMControlDivBy64 0x5 +#define hwr328PWMControlDivBy128 0x6 +#define hwr328PWMControlDivBy256 0x7 + + +/************************************************************************ + * PLL Bits + ************************************************************************/ +#define hwr328PLLControlDisable 0x0008 +#define hwr328PLLControlClkEn 0x0010 + +#define hwr328PLLControlSysVCODiv2 0x0000 +#define hwr328PLLControlSysVCODiv4 0x0100 +#define hwr328PLLControlSysVCODiv8 0x0200 +#define hwr328PLLControlSysVCODiv16 0x0300 +#define hwr328PLLControlSysVCODiv1 0x0400 + +#define hwr328PLLControlPixVCODiv2 0x0000 +#define hwr328PLLControlPixVCODiv4 0x080 +#define hwr328PLLControlPixVCODiv8 0x1000 +#define hwr328PLLControlPixVCODiv16 0x1800 +#define hwr328PLLControlPixVCODiv1 0x2000 + +/************************************************************************ + * Real Time Clock (RTC) Bits + ************************************************************************/ + +// RTC Control Register (RTCCTL) bits +#define hwr328RTCControlRTCEnable 0x80 +#define hwr328RTCControlRefSelMask 0x20 +#define hwr328RTCControlRefSel38400 0x20 // 38.4 kHz reference frequency +#define hwr328RTCControlRefSel32768 0x00 // 32.768 kHz reference frequency + +// RTC Interrupt Enable Register (RTCIENR) bits +#define hwr328RTCIntEnableSec 0x10 +#define hwr328RTCIntEnable24Hr 0x08 +#define hwr328RTCIntEnableAlarm 0x04 +#define hwr328RTCIntEnableMinute 0x02 +#define hwr328RTCIntEnableStopWatch 0x01 + +// RTC Interrupt Status Register bits +#define hwr328RTCIntStatusSec 0x10 +#define hwr328RTCIntStatus24Hr 0x08 +#define hwr328RTCIntStatusAlarm 0x04 +#define hwr328RTCIntStatusMinute 0x02 +#define hwr328RTCIntStatusStopWatch 0x01 + +// RTC Alarm register (RTCALRM) masks and offsets +#define hwr328RTCAlarmSecondsMask 0x0000003fL +#define hwr328RTCAlarmSecondsOffset 0 +#define hwr328RTCAlarmMinutesMask 0x003f0000L +#define hwr328RTCAlarmMinutesOffset 16 +#define hwr328RTCAlarmHoursMask 0x1f000000L +#define hwr328RTCAlarmHoursOffset 24 + +// RTC hours/minutes/seconds register (RTCHMS) masks and offsets +#define hwr328RTCHourMinSecSecondsMask 0x0000003fL +#define hwr328RTCHourMinSecSecondsOffset 0 +#define hwr328RTCHourMinSecMinutesMask 0x003f0000L +#define hwr328RTCHourMinSecMinutesOffset 16 +#define hwr328RTCHourMinSecHoursMask 0x1f000000L +#define hwr328RTCHourMinSecHoursOffset 24 + + +/************************************************************************ + * SPI Master bits + ************************************************************************/ +#define hwr328SPIMControlRateMask 0xE000 + #define hwr328SPIMControlRateDiv4 0x0000 + #define hwr328SPIMControlRateDiv8 0x2000 + #define hwr328SPIMControlRateDiv16 0x4000 + #define hwr328SPIMControlRateDiv32 0x6000 + #define hwr328SPIMControlRateDiv64 0x8000 + #define hwr328SPIMControlRateDiv128 0xA000 + #define hwr328SPIMControlRateDiv256 0xC000 + #define hwr328SPIMControlRateDiv512 0xE000 +#define hwr328SPIMControlEnable 0x0200 +#define hwr328SPIMControlExchange 0x0100 +#define hwr328SPIMControlIntStatus 0x0080 +#define hwr328SPIMControlIntEnable 0x0040 +#define hwr328SPIMControlOppPhase 0x0020 +#define hwr328SPIMControlInvPolarity 0x0010 +#define hwr328SPIMControlBitsMask 0x000F + + +/************************************************************************ + * I/O Port C pins + ************************************************************************/ +#define hwr328PortCMOClk 0x01 +#define hwr328PortCUDS 0x02 +#define hwr328PortCLDS 0x04 +#define hwr328PortCNMI 0x10 +#define hwr328PortCDTack 0x20 +#define hwr328PortCPcmciaWE 0x40 + + +/************************************************************************ + * I/O Port G pins + ************************************************************************/ +#define hwr328PortGUartTxD 0x01 +#define hwr328PortGUartRxD 0x02 +#define hwr328PortGPwmOut 0x04 +#define hwr328PortGTOut2 0x08 +#define hwr328PortGTIn2 0x10 +#define hwr328PortGTOut1 0x20 +#define hwr328PortGTIn1 0x40 +#define hwr328PortGRtcOut 0x80 + + +/************************************************************************ + * I/O Port K pins + ************************************************************************/ +#define hwr328PortKSpimTxD 0x01 +#define hwr328PortKSpimRxD 0x02 +#define hwr328PortKSpimClkO 0x04 +#define hwr328PortKSpisEn 0x08 +#define hwr328PortKSpisRxD 0x10 +#define hwr328PortKSpisClkI 0x20 +#define hwr328PortKPcmciaCE2 0x40 +#define hwr328PortKPcmciaCE1 0x80 + + +/************************************************************************ + * I/O Port M pins + ************************************************************************/ +#define hwr328PortMCTS 0x01 +#define hwr328PortMRTS 0x02 +#define hwr328PortMIRQ6 0x04 +#define hwr328PortMIRQ3 0x08 +#define hwr328PortMIRQ2 0x10 +#define hwr328PortMIRQ1 0x20 +#define hwr328PortMPenIRQ 0x40 +#define hwr328PortMUnused7 0x80 + + + + + +#endif // __M68328_H__ + +#endif // NON_PORTABLE + + + + + + + + + + + diff --git a/sdk-2/include/Core/Hardware/M68681Hwr.h b/sdk-2/include/Core/Hardware/M68681Hwr.h new file mode 100644 index 0000000..fca50dd --- /dev/null +++ b/sdk-2/include/Core/Hardware/M68681Hwr.h @@ -0,0 +1,202 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * M68681Hwr.h + * + * Description: + * Hardware Equates for the Motorola 68681 Duart + * + * History: + * 1/18/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + + +#include // Touchdown includes + + +/*********************************************************************** + * Motorola 68681 DUART registers + ***********************************************************************/ + +#if (HW_TARGET == HW_TARGET_302 || HW_TARGET == HW_TARGET_328EMU) +typedef union HwrDuartType { + + // Read Registers + struct { + Byte u0; + Byte mra; // Mode registers 1A and 2A + Byte u2; + Byte sra; // Status register A + Byte u4; + Byte doNotAccess1; // Do Not Access + Byte u6; + Byte rba; // Receive Buffer A + Byte u8; + Byte ipcr; // Inport Port Change Register + Byte uA; + Byte isr; // Input Status Register + Byte uC; + Byte cur; // Current MSB of counter + Byte uE; + Byte clr; // Current LSB of counter + Byte u10; + Byte mrb; // Mode registers 1B and 2B + Byte u12; + Byte srb; // Status register B + Byte u14; + Byte doNotAccess2; // Do Not Access + Byte u16; + Byte rbb; // Receive Buffer B + Byte u18; + Byte ivr; // Interrupt vector register + Byte u1A; + Byte ipr; // Input Port register + Byte u1C; + Byte startCtr; // Start Counter command register + Byte u1E; + Byte stopCtr; // Stop Counter command register + } read; + + // Write Registers + struct { + Byte u0; + Byte mra; // Mode registers 1A and 2A + Byte u2; + Byte csra; // Clock Select Register A + Byte u4; + Byte cra; // Command Register A + Byte u6; + Byte tba; // Transmit Buffer A + Byte u8; + Byte acr; // Auxiliary Control Register + Byte uA; + Byte imr; // Interrupt Mask Register + Byte uC; + Byte ctur; // Counter/Timer Upper Preload Register + Byte uE; + Byte ctlr; // Couunter/Timer Lower Preload Register + Byte u10; + Byte mrb; // Mode registers 1B and 2B + Byte u12; + Byte csrb; // Clock Select Register B + Byte u14; + Byte crb; // Command Register B + Byte u16; + Byte tbb; // Transmitter Buffer B + Byte u18; + Byte ivr; // Interrupt Vector Register + Byte u1A; + Byte opcr; // Output Port Config Register + Byte u1C; + Byte opSet; // Output Port Bit Set + Byte u1E; + Byte opReset; // Output Port Bit Reset + } write; + } HwrDuartType; +#else // ! (HW_TARGET == HW_TARGET_302 || HW_TARGET == HW_TARGET_328EMU) + + +// For Pilot debug board zzz make conditional later +typedef union HwrDuartType { + + // Read Registers + struct { + Byte mra; // Mode registers 1A and 2A + Byte u0; + Byte sra; // Status register A + Byte u2; + Byte doNotAccess1; // Do Not Access + Byte u4; + Byte rba; // Receive Buffer A + Byte u6; + Byte ipcr; // Inport Port Change Register + Byte u8; + Byte isr; // Input Status Register + Byte uA; + Byte cur; // Current MSB of counter + Byte uC; + Byte clr; // Current LSB of counter + Byte uE; + Byte mrb; // Mode registers 1B and 2B + Byte u10; + Byte srb; // Status register B + Byte u12; + Byte doNotAccess2; // Do Not Access + Byte u14; + Byte rbb; // Receive Buffer B + Byte u16; + Byte ivr; // Interrupt vector register + Byte u18; + Byte ipr; // Input Port register + Byte u1A; + Byte startCtr; // Start Counter command register + Byte u1C; + Byte stopCtr; // Stop Counter command register + Byte u1E; + } read; + + // Write Registers + struct { + Byte mra; // Mode registers 1A and 2A + Byte u0; + Byte csra; // Clock Select Register A + Byte u2; + Byte cra; // Command Register A + Byte u4; + Byte tba; // Transmit Buffer A + Byte u6; + Byte acr; // Auxiliary Control Register + Byte u8; + Byte imr; // Interrupt Mask Register + Byte uA; + Byte ctur; // Counter/Timer Upper Preload Register + Byte uC; + Byte ctlr; // Couunter/Timer Lower Preload Register + Byte uE; + Byte mrb; // Mode registers 1B and 2B + Byte u10; + Byte csrb; // Clock Select Register B + Byte u12; + Byte crb; // Command Register B + Byte u14; + Byte tbb; // Transmitter Buffer B + Byte u16; + Byte ivr; // Interrupt Vector Register + Byte u18; + Byte opcr; // Output Port Config Register + Byte u1A; + Byte opSet; // Output Port Bit Set + Byte u1C; + Byte opReset; // Output Port Bit Reset + Byte u1E; + } write; + } HwrDuartType; + +#endif // #if (HW_TARGET == HW_TARGET_302 || HW_TARGET == HW_TARGET_328EMU) + + +typedef volatile HwrDuartType* HwrDuartPtr; + + + + + +/*********************************************************************** + * For Final code on the Touchdown Hardware, define all register bits here + * for now, we'll just define a few and use numbers in the code for the rest + ***********************************************************************/ + +// Status Register (SR) +#define hwrDuartSRRegRB 0x80 // Receive Break +#define hwrDuartSRRegFE 0x40 // Framing Err +#define hwrDuartSRRegPE 0x20 // Parity Err +#define hwrDuartSRRegOE 0x10 // Overrun Err +#define hwrDuartSRRegTxEMP 0x08 // Transmitter Empty +#define hwrDuartSRRegTxRDY 0x04 // Transmitter Ready +#define hwrDuartSRRegFFULL 0x02 // FIFO Full +#define hwrDuartSRRegRxRDY 0x01 // Receiver Ready diff --git a/sdk-2/include/Core/Hardware/M68KHwr.h b/sdk-2/include/Core/Hardware/M68KHwr.h new file mode 100644 index 0000000..6648f17 --- /dev/null +++ b/sdk-2/include/Core/Hardware/M68KHwr.h @@ -0,0 +1,116 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * M68KHwr.h + * + * Description: + * Pilot debugger remote hardware/system info + * + * History: + * 1/18/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __M68KHWR_H +#define __M68KHWR_H + +// Pilot common definitions +#include + + +/*********************************************************************** + * Breakpoint words we use + ***********************************************************************/ +#define m68kTrapInstr 0x4E40 +#define m68kTrapVectorMask 0x000F + +/*********************************************************************** + * 68000 Exception Vector table + ***********************************************************************/ +typedef struct M68KExcTableType { + DWord initStack; // initial stack pointer + DWord initPC; // initial PC + + DWord busErr; // 08 + DWord addressErr; // 0C + DWord illegalInstr; // 10 + DWord divideByZero; // 14 + DWord chk; // 18 + DWord trap; // 1C + DWord privilege; // 20 + DWord trace; // 24 + DWord aTrap; // 28 + DWord fTrap; // 2C + DWord reserved12; // 30 + DWord coproc; // 34 + DWord formatErr; // 38 + DWord unitializedInt; // 3C + + DWord reserved[8]; // 40-5C + + DWord spuriousInt; // 60 + DWord autoVec1; // 64 + DWord autoVec2; // 68 + DWord autoVec3; // 6C + DWord autoVec4; // 70 + DWord autoVec5; // 74 + DWord autoVec6; // 78 + DWord autoVec7; // 7C + + DWord trapN[16]; // 80 - BC + + DWord unassigned[16]; // C0 - FC + } M68KExcTableType; + + + +/************************************************************************************** + * 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. + * + **************************************************************************************/ +typedef struct M68KRegsType { + DWord d[8]; /* data registers */ + DWord a[7]; /* address registers */ + DWord usp; /* user stack pointer */ + DWord ssp; /* supervisor stack pointer */ + DWord pc; /* program counter */ + Word sr; /* status register */ +} M68KRegsType; + + + + +/************************************************************************************** + * bit masks for testing M68000 status register fields + **************************************************************************************/ + +/* trace mode */ +#define m68kSrTraceMask 0x08000 +#define m68kSrTraceBit 15 + +/* supervisor state */ +#define m68kSrSupervisorMask 0x02000 + +/* interrupt mask */ +#define m68kSrInterruptMask 0x00700 +#define m68kSrInterruptOffset 8 /* offset for right-shifting interrupt mask */ + +/* condition codes */ +#define m68kSrExtendMask 0x00010 +#define m68kSrNegativeMask 0x00008 +#define m68kSrZeroMask 0x00004 +#define m68kSrOverflowMask 0x00002 +#define m68kSrCarryMask 0x00001 + + + +#endif //__M68KHWR_H + diff --git a/sdk-2/include/Core/Pilot.h b/sdk-2/include/Core/Pilot.h new file mode 100644 index 0000000..c092033 --- /dev/null +++ b/sdk-2/include/Core/Pilot.h @@ -0,0 +1,83 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Pilot.h + * + * Description: + * Include file used by UI library source code modules + * + * History: + * 6/ 6/95 RM - Created by Ron Marianetti + * 2/24/97 RF - Changed to handle c++ versions. + * 4/24/97 SL - Changes for PalmOS 2.0 SDK + * 5/19/97 SL - Now includes only in MWERKS environments + * + *******************************************************************/ + + +// This tells "SysAll.h" not to use it's own pre-compiled header +#define __PILOT_H__ + +// Include the pre-compiled header, if not overriden. This pre-compiled header +// can be automatically re-generated by CodeWarrior by including the +// source file "Pilot.pch" in your project. +#ifndef PILOT_PRECOMPILED_HEADERS_OFF + + // Use Metrowerk's precompiled headers option + #if defined(__MWERKS__) + #if !__option(precompile) + #if __PALMOS_TRAPS__ + #ifdef __cplusplus + #include "Pilot.h++.mch" + #else + #include "Pilot.h.mch" + #endif + #else + #ifdef CMD_LINE_BUILD + #ifdef __cplusplus + #include "Pilot.h++.mpw.mch" + #else + #include "Pilot.h.mpw.mch" + #endif + #else + #ifdef __cplusplus + #include "Pilot.h++.sim.mch" + #else + #include "Pilot.h.sim.mch" + #endif + #endif + #endif + #define __INCLUDED_PILOT_H_OBJ__ + #endif + #endif + +#endif + + +// Fastest compilation speed is obtained by not including these +// headers when the pre-compiled header is used. +#ifndef __INCLUDED_PILOT_H_OBJ__ + +// The following Mac include file must be included before the Pilot +// headers for the emulator modules that have both Mac and Pilot +// code in them. This is only relevant for development environments +// that can compile both Mac and PalmOS code. +#if defined(__MWERKS__) + #if !defined(CMD_LINE_BUILD) && !defined(__PALMOS_TRAPS__) + #include // Include Mac types.h file + #endif +#endif + + +#include +#include + +#define NON_PORTABLE +#include +#include + +#endif diff --git a/sdk-2/include/Core/SysBuildRules.h b/sdk-2/include/Core/SysBuildRules.h new file mode 100644 index 0000000..6c4d70c --- /dev/null +++ b/sdk-2/include/Core/SysBuildRules.h @@ -0,0 +1,25 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysBuildRules.h + * + * Description: + * This header file can beused as a template for + * common build options across all applications. To use, simply break + * the pencil and edit. + * + * + * Typically, the options specified in this file are used to + * set the language and country for the emulator + * + * History: + * 6/6/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +//#define LANGUAGE LANGUAGE_FRENCH +//#define COUNTRY COUNTRY_FRANCE diff --git a/sdk-2/include/Core/System/AlarmMgr.h b/sdk-2/include/Core/System/AlarmMgr.h new file mode 100644 index 0000000..8a4bdee --- /dev/null +++ b/sdk-2/include/Core/System/AlarmMgr.h @@ -0,0 +1,211 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * AlarmMgr.h + * + * Description: + * Include file for Alarm Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __ALARM_MGR_H__ +#define __ALARM_MGR_H__ + + +// Include elementary types +#include +#include + + + + +/************************************************************ + * Alarm Manager result codes + * (almErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define almErrMemory (almErrorClass | 1) // ran out of memory +#define almErrFull (almErrorClass | 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. +typedef struct SysAlarmTriggeredParamType { + DWord ref; // --> alarm reference value passed by caller; + ULong alarmSeconds; // --> alarm date/time in seconds since 1/1/1904; + Boolean purgeAlarm; // <-- 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. + // If your application does not require the + // sysAppLaunchCmdDisplayAlarm action code, setting + // this field to true is a good optimization. + } SysAlarmTriggeredParamType; + +// 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. +typedef struct SysDisplayAlarmParamType { + DWord ref; // alarm reference value passed by caller; + ULong alarmSeconds; // alarm date/time in seconds since 1/1/1904; + Boolean soundAlarm; // true if alarm needs to be sounded (not used); + } SysDisplayAlarmParamType; + + + +/******************************************************************** + * Alarm Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// 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. +// +Err AlmInit(void) + SYS_TRAP(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. +// +Err AlmSetAlarm(UInt cardNo, LocalID dbID, DWord ref, + ULong alarmSeconds, Boolean quiet) + SYS_TRAP(sysTrapAlmSetAlarm); + + +// AlmGetAlarm() +// +// Gets the alarm seconds for a given app. +// Zero is returned if there is no alarm setting for the app. +ULong AlmGetAlarm(UInt cardNo, LocalID dbID, DWordPtr refP) + SYS_TRAP(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. +// +void AlmEnableNotification(Boolean enable) + SYS_TRAP(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. +// +void AlmDisplayAlarm(Boolean okToDisplay) + SYS_TRAP(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. +// +void AlmCancelAll(void) + SYS_TRAP(sysTrapAlmCancelAll); + + + +// AlmAlarmCallback() +// +// This function is called at interrupt time by the Time Manager when +// an alarm goes off. +// +void AlmAlarmCallback(void) + SYS_TRAP(sysTrapAlmAlarmCallback); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __ALARM_MGR_H__ + diff --git a/sdk-2/include/Core/System/AlarmPrv.h b/sdk-2/include/Core/System/AlarmPrv.h new file mode 100644 index 0000000..e586e05 --- /dev/null +++ b/sdk-2/include/Core/System/AlarmPrv.h @@ -0,0 +1,111 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * AlarmPrv.h + * + * Description: + * Private Include file for Alarm Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifdef NON_PORTABLE +#ifndef __ALARM_PRV_H__ +#define __ALARM_PRV_H__ + + + +/************************************************************ + * Alarm Manager Constants + * + *************************************************************/ +#define almMinTableLength 2 // minimum # of entries in alarm table; + // MUST NOT BE ZERO. + +#define almMaxTableLength 20 // maximum # of enries in alarm table + + +/******************************************************************* + * Alarm Manager alarm table structures + * + *******************************************************************/ + +// An entry in the alarm table +typedef struct AlmEntryType { + DWord ref; // alarm reference value passed by caller; + + ULong alarmSeconds; // alarm date/time in seconds since 1/1/1904; + // a value of 0 indicates unused entry; + + LocalID dbID; // creator app database ID; + Word cardNo : 1; // creator app card number; + + Word quiet : 1; // 1 indicates that the caller wants + // to be quietly notified when the alarm + // goes off without all the alarm bells + // and whistles; + + Word triggered : 1; // 1 indicates the alarm has been triggered; + + Word notified : 1; // 1 indicates we notified the caller that + // the alarm went off; + } AlmEntryType; + +typedef AlmEntryType* AlmEntryPtr; + + +// The alarm table +typedef struct AlmTableType { + Short numEntries; // Number of entries in alarm Table; + + // List of alarm entries; + // This is a variable size field which + // ***MUST BE LAST*** + AlmEntryType list[almMinTableLength]; + } AlmTableType; + +typedef AlmTableType* AlmTablePtr; +typedef AlmTablePtr* AlmTableHandle; + + +/******************************************************************* + * Alarm Manager Globals + * + *******************************************************************/ +typedef struct AlmGlobalsType { + // We're not making the alarm table a part of the + // Alarm Globals structure because it is allowed + // to resize, thus posing a problem for + // AlmAlarmCallback() which needs to access the + // Alarm Globals at interrupt time. + AlmTableHandle tableH; // alarm table handle; + + ULong lastSoundSeconds; + // alarm seconds of the last alarm for + // which an alarm was sounded; + + Word displaying : 1;// 1 indicates we're blocked waiting for + // some app to finish displaying an alarm + // dialog box; set and cleared by + // AlmDisplayNextAlarm(); + + Word triggered : 1; // 1 indicates an alarm was triggered; this + // field is set by the AlmAlarmCallback() and + // is checked and cleared by AlmDisplayAlarm(); + + Byte disableCount; // if this value is greater than zero, Alarm + // notifications are disabled (see AlmEnableNotification); + } AlmGlobalsType; + +typedef AlmGlobalsType* AlmGlobalsPtr; + + +#endif // __ALARM_MGR_H__ +#endif // NON_PORTABLE diff --git a/sdk-2/include/Core/System/AppLaunchCmd.h b/sdk-2/include/Core/System/AppLaunchCmd.h new file mode 100644 index 0000000..426a0f2 --- /dev/null +++ b/sdk-2/include/Core/System/AppLaunchCmd.h @@ -0,0 +1,244 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * AppLaunchCmd.h + * + * 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 + * + *******************************************************************/ + + #ifndef __APPLNCMD_H__ + #define __APPLNCMD_H__ + +// Include elementary types +#include + + +#define AppLaunchWithCommand(appCreator, appCommand, appCommandParams) \ +{ \ + UInt cardNo; \ + LocalID dbID; \ + DmSearchStateType searchState; \ + DmGetNextDatabaseByTypeCreator(true, &searchState, sysFileTApplication, \ + appCreator, true, &cardNo, &dbID); \ + ErrNonFatalDisplayIf(!dbID, "Could not find app"); \ + if (dbID) { \ + err = SysUIAppSwitch(cardNo, dbID, appCommand, appCommandParams); \ + ErrNonFatalDisplayIf(err, "Could not launch app"); \ + } \ + } + +#define AppCallWithCommand(appCreator, appCommand, appCommandParams) \ +{ \ + UInt cardNo; \ + LocalID dbID; \ + DmSearchStateType searchState; \ + DWord 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, (Ptr) 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. +typedef enum { + addrLookupName, + addrLookupFirstName, + addrLookupCompany, + addrLookupAddress, + addrLookupCity, + addrLookupState, + addrLookupZipCode, + addrLookupCountry, + addrLookupTitle, + addrLookupCustom1, + addrLookupCustom2, + addrLookupCustom3, + addrLookupCustom4, + addrLookupNote, // This field is assumed to be < 4K + addrLookupWork, + addrLookupHome, + addrLookupFax, + addrLookupOther, + addrLookupEmail, + addrLookupMain, + addrLookupPager, + addrLookupMobile, + addrLookupSortField, + addrLookupListPhone, + addrLookupNoField = 0xff +} AddressLookupFields; + + +#define addrLookupStringLength 12 + +typedef struct + { + CharPtr title; + // Title to appear in the title bar. If NULL the default is used. + + CharPtr pasteButtonText; + // Text to appear in paste button. If NULL "paste" is used. + + Char lookupString[addrLookupStringLength]; + // 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. + + AddressLookupFields field1; + // 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). + + AddressLookupFields field2; + // 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. + + Boolean field2Optional; + // 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. + + Boolean userShouldInteract; + // 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; + + CharPtr formatStringP; + // 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. + + Handle resultStringH; + // If there is a format string a result string is allocated on + // the dynamic heap and it's handle is returned here. + + DWord uniqueID; + // The unique ID of the found record or 0 if none was found. + + } AddrLookupParamsType; + +typedef AddrLookupParamsType * AddrLookupParamsPtr; + + + + +/************************************************************ + * Param Block passsed with the sysAppLaunchCmdSetActivePanel Command + *************************************************************/ + +#define prefAppLaunchCmdSetActivePanel (sysAppLaunchCmdCustomBase + 1) + // Record this panel so switching to the Prefs app + // causes this panel to execute. + +typedef struct + { + DWord activePanel; + // 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. + + } PrefActivePanelParamsType; + +typedef PrefActivePanelParamsType * PrefActivePanelParamsPtr; + + + +/************************************************************ + * Param Block passsed with the sysAppLaunchCmdAddRecord Command + *************************************************************/ + +//------------------------------------------------------------------- +// sysAppLaunchCmdAddRecord parameter block for the Mail application +//------------------------------------------------------------------- +// Param Block passsed with the sysAppLaunchCmdAddRecord Command + +typedef enum { mailPriorityHigh, mailPriorityNormal, mailPriorityLow } MailMsgPriorityType; + +typedef struct { + Boolean secret; + // True means that the message should be marked secret + + Boolean signature; + // True means that signature from the Mail application's preferences + // should be attached to the message. + + Boolean confirmRead; + // True means that a comfirmation should be sent when the message + // is read. + + Boolean confirmDelivery; + // True means that a comfirmation should be sent when the message + // is deliveried + + MailMsgPriorityType priority; + // high, normial, or low. + + CharPtr subject; + // Message's subject, a null-terminated string (optional). + + CharPtr from; + // Message's send, a null-terminated string (not currently used). + + CharPtr to; + // Address the the recipient, a null-terminated string (required). + + CharPtr cc; + // Copy Addresses, a null-terminated string (required). + + CharPtr bcc; + // Blind copy Addresses, a null-terminated string (required). + + CharPtr replyTo; + // Reply to address, a null-terminated string (required). + + CharPtr body; + // The text of the message, a null-terminated string (required). + +} MailAddRecordParamsType; + +typedef MailAddRecordParamsType * MailAddRecordParamsPtr; + + + + +#endif //__APPLNCMD_H__ diff --git a/sdk-2/include/Core/System/CMClient.h b/sdk-2/include/Core/System/CMClient.h new file mode 100644 index 0000000..f417dd0 --- /dev/null +++ b/sdk-2/include/Core/System/CMClient.h @@ -0,0 +1,118 @@ +/******************************************************************* + * Touchdown Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * CMClient.h + * + * Description: + * Connection Management Protocol client definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __CMCLIENT_H__ +#define __CMCLIENT_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Touchdown common definitions + #include "Common.h" + #include "SerLink.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Touchdown common definitions + #include + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + +/************************************************************ + * Connection Manager result codes + * (cmpErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define cmErrParam (cmpErrorClass | 1) // bad parameter +#define cmErrTimeOut (cmpErrorClass | 2) // connection listenning/initialization timed out +#define cmErrComm (cmpErrorClass | 3) // communication(send/receive) error +#define cmErrCommVersion (cmpErrorClass | 4) // incompatible comm version +#define cmErrMemory (cmpErrorClass | 5) // insufficient memory error +#define cmErrCommBusy (cmpErrorClass | 6) // PAD server is already in use +#define cmErrUserCan (cmpErrorClass | 7) // attempt cancelled by user + + + +/******************************************************************** + * Connection Manager Constants + ********************************************************************/ + +#define cmWakeupTransactionID 0xFF + +/******************************************************************** + * Connection Manager Structures + ********************************************************************/ +typedef Int (*CmAbortProc)(DWord userRef); + +typedef struct CmParamType { + UInt localSocket; // -> user's socket + UInt remoteSocket; // -> remote socket + ULong maxBaud; // -> maximum baud rate which can be used + Boolean viaModem; // -> set to true if connecting via modem + CmAbortProc abortProc; // -> ptr to abort procedure + DWord userRef; // -> reference value for abort procedure + } CmParamType; + +typedef CmParamType* CmParamPtr; + + +typedef struct CmSessionType { + // Parameters passed by user + CmParamType param; // user parameters + + UInt serRefNum; // serial library reference number + } CmSessionType; + +typedef CmSessionType* CmSessionPtr; + + + + +/******************************************************************** + * Connection Manager API Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Listens for a "wakeup" message from the broadcaster +// and completes the connection handshake by sending the "init" +// or "abort" message(called by client). +Err CmListen(CmParamPtr paramP); + + +#ifdef __cplusplus +} +#endif + + + +/******************************************************************** + * Connection Manager Macros + ********************************************************************/ + + + +#endif // __CMCLIENT_H__ diff --git a/sdk-2/include/Core/System/CMCommon.h b/sdk-2/include/Core/System/CMCommon.h new file mode 100644 index 0000000..96aec88 --- /dev/null +++ b/sdk-2/include/Core/System/CMCommon.h @@ -0,0 +1,360 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * CMCommon.h + * + * Description: + * Connection Management Protocol common definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * 11/19/96 vmk Added CM v1.1 receive timeout override extensions + * + *******************************************************************/ + + +#ifndef __CM_COMMON_H__ +#define __CM_COMMON_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Pilot common definitions + #include "Common.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Pilot common definitions + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + +/******************************************************************** + * CMP 1.0 Command Format + ********************************************************************/ + +// IT IS ANTICIPATED THAT the 1.0 PACKET FORMAT WILL BE USED TO INITIATE +// HOT SYNC "WAKE-UP" MESSAGE INDEFINITELY. BASED ON THE COMMUNICATIONS +// VERSION NUMBER PROVIDED IN THIS BASIC COMMAND STRUCTURE, FUTURE VERSIONS +// OF DESKTOP AND PILOT SOFTWARE MAY SUPPORT ADDITIONAL CONNECTION MANAGEMENT +// COMMANDS/FEATURES AS THE NEED ARISES. FOR EXAMPLE, TCP-ENABLED HOTSYNCS +// MAY PROVIDE ADDITIONAL INFORMATION, SUCH AS THE INTERNET ADDRESS OF THE +// PREFERRED HOTSYNC PC. THIS DESIGN PROVIDES FOR BACKWARD COMPATIBILITY +// WITH OLDER VERSIONS OF THE SOFTWARE. FUTURE COMMANDS WILL BE ADDED +// FOLLOWING THIS BASIC COMMAND SET. + +// The CMP packets are used for transmitting data for the Pilot CMP protocol layer. +// The structure of the CMP packet is built into the data part of the SLP packet and is, +// therefore, constrained by the SLP packet data size limitations. + + +// Packet type values used in the CMP packet body "type" field: +// +typedef enum CmpType { + cmpWakeup = 1, // CMP Wakeup packet sent from server to client + cmpInit, // CMP Init packet sent from client to server + cmpAbort, // CMP Abort packet sent from client to server + cmpExtended // For future command extensions + } CmpType; + + +// cmpInit and cmpWakeup packet body structure: +// +typedef struct CmpBodyType { + Byte type; // CMP packet type + + Byte flags; // in cmpInit packets: indicates which values were adjusted by + // the client(defined below); in cmpWakeup pakcets: null; + // in cmpAbort packets: reason for abort. + + Byte verMajor; // Major PAD version number + Byte verMinor; // Minor PAD version number + Word wReserved; // RESERVED -- set to NULL!!! + //DWord commVersion; // in cmpWakeup: server comm software version number; + // in cmpInit: client comm version + + DWord baudRate; // in cmpWakeup: max server baud rate; + // in cmpInit packets: the prescribed baud rate + } CmpBodyType; + +typedef CmpBodyType* CmpBodyPtr; + +// Flags used in the packet body "flags" field of cmpInit +// packets. These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpInitFlagChangeBaudRate 0x80 // signals that the baud rate was adjusted by the client + +// CM v1.1 extensions +#define cmpInitFlagRcvTOut1Min 0x40 // instructs the Pilot to set its receive timeout to 1 minute +#define cmpInitFlagRcvTOut2Min 0x20 // instructs the Pilot to set its receive timeout to 1 minute + + +// Flags used in the packet body "flags" field of cmpAbort packets. +// These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpAbortFlagVersionError 0x80 // signals incompatible comm versions + + + +/******************************************************************** + * CMP Protocol Parameters + ********************************************************************/ + +// This transaction id is used by cmpWakeup packets. cmpInit and cmpAbort +// packets MUST use a different transaction id. +// +#define cmpWakeupTransactionID 0xFF + +// This is the baud rate at which CMP connections are initiated +// +#define cmpInitialBaudRate 9600L + +// This is the time limit for trying to initiate a connection +// +#define cmpMaxInitiateSec 20 + + +/******************************************************************** + * CMP v2.0 Extensible Command Format + ********************************************************************/ + +// THE v2.0 COMMANDS USE A MORE FLEXIBLE STRUCTURE TO ANTICIPATE DYNAMIC +// ADDITION OF NEW ARGUMENTS. THE COMMAND HEADER AND ARGUMENT IDENTIFIERS +// AND THEIR STRUCTURES WILL BE SPECIFIED IN THIS INCLUDE FILE. THE PACKAGING +// OF THE ARGUMENTS WILL BE SPECIFIED IN THE TRANSPORT IMPLEMENTATION +// WHICH PROVIDES THE UTILITY ROUTINES TO PACKAGE DYNAMIC ARGUMENTS. + +typedef struct CmpCommandHeaderType { + Byte hdrType; // set to cmpExtended + Byte cmd; // extended command/response id + Word errorCode; // used in replies; set to null in commands! + Byte argCount; // number of arguments + Byte reserved1; // RESERVED - SET TO NULL! + DWord reserved2; // RESERVED - SET TO NULL! + } CmpCommandHeaderType; + + +// Generic command type for +typedef union CmpGenericCommandType { + Byte hdrType; // command header type(CmpType) + CmpBodyType body10; // v1.0 command/response body + CmpCommandHeaderType exHdr; // v2.0 extended command/response header + } CmpGenericCommandType; + +typedef CmpGenericCommandType* CmpGenericCommandPtr; + + +// cmpRespBit is used to form a response ID from a +// command ID by or'ing it with the function ID. +#define cmpRespBit 0x80 + +// cmpCmdIDMask is used to mask out the command/response ID value +#define cmpCmdIDMask 0x7f + +// Command/Response argument id's begin at this value +#define cmpFirstArgID 0x20 + + +//------------------------------------------------------------------------- +// Connection Management error codes returned in the response errorCode +// field. +//------------------------------------------------------------------------- +typedef enum CmpRespErrEnum { + cmpRespErrNone = 0, // reserve 0 for no error + cmpRespErrSystem, // general Pilot system error + cmpRespErrUnknownCmd, // unknown command ID + cmpRespErrMemory, // insufficient memory + cmpRespErrParam, // invalid parameter + + cmpRespErrLast // *KEEP THIS ENTRY LAST* + } CmpRespErrEnum; + + +//------------------------------------------------------------------------- +// Connection Management Extended Command ID's +//------------------------------------------------------------------------- +typedef enum CmpCmdEnum { + + cmpCmdReserved = 0x0F, // range reserved for internal use + + //---------------------------- + // v2.0 COMMANDS + //---------------------------- + cmpCmdXCommPrefs, // exchange communications protocol preferences + cmpCmdHShakeComplete, // hand-shake completion command + + cmpCmdLast // *KEEP THIS ENTRY LAST* + } CmpCmdEnum; + + + +//------------------------------------------------------------------------- +// v2.0 Connection Management Command/Response Structures +//------------------------------------------------------------------------- + +// CmpCommPrefsType: common data structure shared by cmpCmdXCommPrefs and +// cmpCmdHShakeComplete. In cmpCmdXCommPrefs, the data structure is used +// to exchange capabilities. In cmpCmdHShakeComplete, the structure is +// used to instruct the Pilot on which settings/features to use. Some +// fields apply to direct PAD-based connections only and should be ignored +// by other transports such as TCP. More on this later(DOLATER...) +// +typedef struct CmpCommPrefsType { + // OFFSET + DWord maxPktDataSize;// 0; maximum supported packet data size + DWord maxDataBlkSize;// 4; maximum supported data block size + DWord maxBaudRate; // 8; maximum supported baud rate/baud rate to use + DWord hwHShakeAbove; // 12; requires hardware handshake above this baud rate + DWord flags; // 16; flags + DWord version; // 20; transport version (comm version) + DWord reserved2; // 24; RESERVED - SET TO NULL! + DWord reserved3; // 28; RESERVED - SET TO NULL! + // TOTAL: 32 bytes; + } CmpCommPrefsType; + + +//-------------------------------------- +// Packet-level CRC preferences +//-------------------------------------- + +// cmpCommPrefsFlagSupportPktCRC16: if set, the transport layer is capable of +// CRC-16 protection of every data packet(v2.0 extension). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportPktCRC16 0x80000000L + +// cmpCommPrefsFlagUsePktCRC16: if set, instructs the transport layer to use +// the CRC-16 protection of every data packet(v2.0 extension). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUsePktCRC16 0x00008000L + +//-------------------------------------- +// Data offset size preferences +//-------------------------------------- + +// NOTE: +// If specifying short offsets, short argument wrappers will be used. +// If specifying long offsets, long argument wrappers will be used. + +// cmpCommPrefsFlagSupportShortOffsets: if set, indicates that the transport layer +// supports short(single-word) offsets/sizes in its data packets. The smaller +// field does not permit bigger blocks to be transmitted(v1.0-compatible). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportShortOffsets 0x40000000L + +// cmpCommPrefsFlagUseShortOffsets: if set, instructs the transport layer to use +// short(single-word) offsets/sizes in its data packets(v1.0-compatible). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUseShortOffsets 0x00004000L + +// cmpCommPrefsFlagSupportLongOffsets: if set, indicates that the transport layer +// supports long(double-word) offsets/sizes in its data packets. The larger +// field permits bigger blocks to be transmitted(v2.0 extension). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportLongOffsets 0x20000000L + +// cmpCommPrefsFlagUseLongOffsets: if set, instructs the transport layer to use +// long(double-word) offsets/sizes in its data packets(v2.0 extension). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUseLongOffsets 0x00002000L + + + +////////////////////////////////////////////////////////////////////////// +// cmpCmdXCommPrefs +////////////////////////////////////////////////////////////////////////// +// +// Description: +// Exchange communications preferences. +// +// Possible error codes +// cmpRespErrSystem, +// cmpRespErrMemory, +// cmpRespErrParam, + +//--------------------- +// Command arguments: +//--------------------- +enum { + cmpXCommPrefsReqArgID = cmpFirstArgID + }; + + +// cmpXCommPrefsReqArgID argument structure: +// +typedef struct CmpXCommPrefsReqType { + // OFFSET + CmpCommPrefsType prefs; // 0; CMP comm preferences + // TOTAL: 32 bytes; + } CmpXCommPrefsReqType; + + +//--------------------- +// Response arguments: +//--------------------- +enum { + cmpXCommPrefsPrefsRespArgID = cmpFirstArgID, // preferences argument + cmpXCommPrefsIPAddrRespArgID // preferred PC IP Address/host name + }; + + +// cmpXCommPrefsPrefsRespArgID argument structure: +// +typedef struct CmpXCommPrefsPrefsRespType { + // OFFSET + CmpCommPrefsType prefs; // 0; CMP comm preferences + // TOTAL: 32 bytes; + } CmpXCommPrefsPrefsRespType; + + +// cmpXCommPrefsIPAddrRespArgID argument structure: +// +typedef struct CmpXCommPrefsIPAddrRespType { + // OFFSET + Byte ipAddr[1]; // 0; IP address/host name string, zero-terminated + // TOTAL: variable size; + } CmpXCommPrefsIPAddrRespType; + + + +////////////////////////////////////////////////////////////////////////// +// cmpCmdHShakeComplete +////////////////////////////////////////////////////////////////////////// +// +// Description: +// Completes the Extended Connection Management hand-shake. Instructs +// the Pilot on which settings/features to use. +// +// Possible error codes +// cmpRespErrSystem, +// cmpRespErrMemory, +// cmpRespErrParam + +//--------------------- +// Command arguments: +//--------------------- +enum { + cmpHShakeCompleteReqArgID = cmpFirstArgID + }; + + +// cmpHShakeCompleteReqArgID argument structure: +// +typedef struct CmpHShakeCompleteReqType { + // OFFSET + CmpCommPrefsType final; // 0; final settings/features to use + // TOTAL: 32 bytes; + } CmpHShakeCompleteReqType; + + +//--------------------- +// Response arguments: +//--------------------- + +// No response arguments; the response consists of the command header only + + + +#endif // __CM_COMMON_H__ diff --git a/sdk-2/include/Core/System/CMServer.h b/sdk-2/include/Core/System/CMServer.h new file mode 100644 index 0000000..b47b35d --- /dev/null +++ b/sdk-2/include/Core/System/CMServer.h @@ -0,0 +1,104 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * CMServer.h + * + * Description: + * Connection Management Protocol server definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __CMSERVER_H__ +#define __CMSERVER_H__ + +// Pilot common definitions +#include + +//#include + + + +/************************************************************ + * Connection Manager result codes + * (cmpErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define cmErrParam (cmpErrorClass | 1) // bad parameter +#define cmErrTimedOut (cmpErrorClass | 2) // connection initiation/listenning timed out +#define cmErrComm (cmpErrorClass | 3) // communication(send/receive) error +#define cmErrCommVersion (cmpErrorClass | 4) // incompatible comm version +#define cmErrMemory (cmpErrorClass | 5) // insufficient memory error +#define cmErrCommBusy (cmpErrorClass | 6) // PAD server is already in use +#define cmErrUserCan (cmpErrorClass | 7) // attempt cancelled by user + + + +/******************************************************************** + * Connection Manager Constants + ********************************************************************/ + +/******************************************************************** + * Connection Manager Structures + ********************************************************************/ +typedef Int (*CmAbortProc)(DWord userRef); + +typedef struct CmParamType { + UInt localSocket; // -> user's socket + UInt remoteSocket; // -> remote socket + ULong maxBaud; // -> maximum baud rate which can be used + ULong hwShakeAbove; // -> enable HW hand-shake above this baud + Boolean viaModem; // -> set to true if connecting via modem + CmAbortProc abortProc; // -> ptr to abort procedure + DWord userRef; // -> reference value for abort procedure + } CmParamType; + +typedef CmParamType* CmParamPtr; + + +typedef struct CmSessionType { + // Parameters passed by user + CmParamType param; // user parameters + + UInt serRefNum; // serial library reference number + } CmSessionType; + +typedef CmSessionType* CmSessionPtr; + + + + +/******************************************************************** + * Connection Manager API Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Initiates connection establishment by sending "wakeup" packets +// and listens for connection handshake(called by server). +Err CmBroadcast(CmParamPtr paramP) + SYS_TRAP(sysTrapCmBroadcast); + + +#ifdef __cplusplus +} +#endif + + + +/******************************************************************** + * Connection Manager Macros + ********************************************************************/ + + + +#endif // __CMSERVER_H__ diff --git a/sdk-2/include/Core/System/ConsoleMgr.h b/sdk-2/include/Core/System/ConsoleMgr.h new file mode 100644 index 0000000..38e9d50 --- /dev/null +++ b/sdk-2/include/Core/System/ConsoleMgr.h @@ -0,0 +1,51 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * ConsoleMgr.h + * + * 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 + * + *******************************************************************/ + +#ifndef __CONSOLEMGR_H__ +#define __CONSOLEMGR_H__ + + + + +/******************************************************************** + * Console Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err ConPutS(CharPtr message) + SYS_TRAP(sysTrapConPutS); + +Err ConGetS(CharPtr message, Long timeout) + SYS_TRAP(sysTrapConGetS); + + +#ifdef __cplusplus +} +#endif + + + + +#endif // __CONSOLEMGR_H__ + + + + diff --git a/sdk-2/include/Core/System/Crc.h b/sdk-2/include/Core/System/Crc.h new file mode 100644 index 0000000..eca01a5 --- /dev/null +++ b/sdk-2/include/Core/System/Crc.h @@ -0,0 +1,63 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Crc.h + * + * Description: + * This is the header file for the CRC calculation routines for Pilot. + * + * History: + * 5/10/95 vmk Initial version. + * + *******************************************************************/ + + +#ifndef __CRC_H__ +#define __CRC_H__ + + +// Include elementary types +#include +#include + + + + +/******************************************************************** + * CRC Calculation Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + + +// Crc16CalcBlock() +// +// Calculate the 16-bit CRC of a data block using the table lookup method. +// +Word Crc16CalcBlock(VoidPtr bufP, UInt count, Word crc) + SYS_TRAP(sysTrapCrc16CalcBlock); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __CRC_H__ + diff --git a/sdk-2/include/Core/System/DLClient.h b/sdk-2/include/Core/System/DLClient.h new file mode 100644 index 0000000..905cd1d --- /dev/null +++ b/sdk-2/include/Core/System/DLClient.h @@ -0,0 +1,201 @@ +/******************************************************************* + * Touchdown Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DLClient.h + * + * Description: + * Desktop Link Protocol(DLP) client implementation definitions. + * + * History: + * 7/12/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + +#define INCLUDE_VIEWER_ID + +#ifndef __DL_CLIENT_H__ +#define __DL_CLIENT_H__ + + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + +// Touchdown common definitions +#include "Common.h" + +// Desktop Link common definitions +#include "DLCommon.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + +// Touchdown common definitions +#include + +// Desktop Link common definitions +#include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + + +/************************************************************ + * DLK result codes + * (dlkErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define dlkErrParam (dlkErrorClass | 1) // invalid parameter +#define dlkErrSessClosed (dlkErrorClass | 2) // session closed unexpectedly +#define dlkErrMemory (dlkErrorClass | 3) // memory allocation error +#define dlkErrLocalCan (dlkErrorClass | 4) // cancelled by local user +#define dlkErrNoSession (dlkErrorClass | 5) // could not establish a session +#define dlkErrSizeErr (dlkErrorClass | 6) // reply length is too big +#define dlkErrTooManyClients (dlkErrorClass | 7) // DLK WS end cannot handle any more clients +#define dlkErrBufTooSmall (dlkErrorClass | 8) // reply buffer is too small +#define dlkErrCreate (dlkErrorClass | 9) // error creating database +#define dlkErrNotEnoughSpace (dlkErrorClass | 10) // not enough space on remote +#define dlkErrAlreadyExists (dlkErrorClass | 11) // cannot create a duplicate +#define dlkErrNotFound (dlkErrorClass | 12) // database/record/resource/block not found +#define dlkErrDelete (dlkErrorClass | 13) // delete error +#define dlkErrClose (dlkErrorClass | 14) // close error +#define dlkErrWrite (dlkErrorClass | 15) // write record/resource error +#define dlkErrRead (dlkErrorClass | 16) // read record/resource/block error +#define dlkErrUserInfo (dlkErrorClass | 17) // error reading/writing user info +#define dlkErrReplyFormat (dlkErrorClass | 18) // reply format error +#define dlkErrDeleted (dlkErrorClass | 19) // record was deleted +#define dlkErrOpen (dlkErrorClass | 20) // open db error +#define dlkErrRPC (dlkErrorClass | 21) // generic RPC execution error +#define dklErrNoneOpen (dlkErrorClass | 22) // no database is open + + + +/******************************************************************** + * DLK Session Structures + ********************************************************************/ + +// +// DLP Client session information +// + +typedef Int (*DlkAbortProcPtr)(DWord userRef); + + +typedef struct DlkClientSessionType { + // Information supplied by user + Byte remoteSocket; // server socket + Byte localSocket; // workstation socket + DlkAbortProcPtr abortProcP; // ptr to abort proc + DWord userRef; // user reference value for abort proc + + // Session status information + Int numClients; // Number of clients + Byte dlpRefNum; // DLP session reference number + + // Reply buffer + WordPtr replyBufP; + ULong replyBufSize; + } DlkClientSessionType; + +typedef DlkClientSessionType* DlkClientSessionPtr; + + +// +// Parameter passed to DlkInitClient() +// +typedef struct DlkClientParamType { + Byte remoteSocket; // server socket for SP + Byte localSocket; // workstation socket + DlkAbortProcPtr abortProcP; + DWord userRef; + } DlkClientParamType; + +typedef DlkClientParamType* DlkClientParamPtr; + + +/******************************************************************** + * DLK Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// +// CLIENT API +// + +// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam, +// * dlkErrNoSession, dlkErrMemory, dlkErrTooManyClients +Err DlkInitClient(DlkClientParamPtr paramP, BytePtr refNumP); + +Err DlkClientDone(Byte refNum); + +Err DlkSendTickle(Byte refNum); + +Err DlkOpenDatabase(Byte refNum, Byte cardNo, CharPtr nameP, Byte mode, + BytePtr dlkDBIDP); + +Err DlkCreateDatabase(Byte refNum, Byte cardNo, CharPtr name, Word dbFlags, + DWord creator, DWord type, Word version, BytePtr dbIDP); + +Err DlkDeleteDatabase(Byte refNum, UInt cardNo, CharPtr nameP); + +Err DlkCloseDatabase(Byte refNum, Byte dbID); + +Err DlkReadOpenDBInfo(Byte refNum, Byte dbID, WordPtr numRecP); + +Err DlkReadAppBlock(Byte refNum, Byte dbID, UInt offset, UInt numBytes, + VoidPtr bufP, UInt bufSize, UIntPtr rcvdLenP, UIntPtr blkSizeP); + +Err DlkAddRecord(Byte refNum, Byte dbID, VoidPtr recP, + Word recSize, DWordPtr recIDP); + +Err DlkReadRecord(Byte refNum, Byte dbID, UInt index, UInt offset, + UInt numBytes, VoidPtr bufP, UInt bufSize, DWordPtr recIDP, + BytePtr attrP, BytePtr categoryP, UIntPtr rcvdLenP, UIntPtr recSizeP); + +Err DlkDeleteAllRecords(Byte RefNum, Byte dbID); + +Err DlkWriteResource(Byte refNum, Byte dbID, VoidPtr resP, Word resSize, + DWord resType, Word resID); + +Err DlkWriteUserInfo(Byte refNum, CharPtr userNameP, DWord userID, + DWord lastSyncPC); + +Err DlkReadUserInfo(Byte refNum, CharPtr userNameBufP, DWordPtr userIDP, + DWordPtr lastSyncPCP); + +Err DlkNotifyOpenConduit(Byte refNum, BooleanPtr cancelP); + +Err DlkNotifyEndOfSync(Byte refNum, DlpSyncTermCode termCode); + +Err DlkResetRemote(Byte refNum); + +Err DlkExecuteRPC(Byte refNum, VoidPtr cmdP, UInt cmdSize, + VoidPtr respBufP, UInt respBufSize, Boolean getReply); + +Err DlkSetDateTime(Byte refNum, int year, int month, int day, int hour, + int minute, int second); + +Err DlkGetDBNameViaCallAppTest(Byte refNum, Word cardNo, Word index, CharPtr bufP, Word bufSize); + + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * DLK Macros + ********************************************************************/ + + + +#endif // __DL_CLIENT_H__ diff --git a/sdk-2/include/Core/System/DLCommon.h b/sdk-2/include/Core/System/DLCommon.h new file mode 100644 index 0000000..d419d80 --- /dev/null +++ b/sdk-2/include/Core/System/DLCommon.h @@ -0,0 +1,2152 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DLCommon.h + * + * Description: + * Desktop Link Protocol(DLP) function id's, parameters, and frame + * structures. + * + * History: + * 6/7/95 vmk Created by Vitaly Marty Kruglikov + * 6/15/95 vmk Changed dlp/Read/Write/UserID to dlp/Read/Write/UserInfo and + * added the last sync PC id field to their arguments at Laura's request. + * 6/15/95 vmk Added option to dlpDeleteRecord to delete all records in DB. + * + *******************************************************************/ + + +#ifndef __DLCOMMON_H__ +#define __DLCOMMON_H__ + + +/************************************************************ + * DesktopLink function codes + *************************************************************/ + +// DlpFuncID -- function id's used in request blocks sent to +// the DesktopLink application on Pilot. The width of the function +// id base is 7 bits. The high order bit(the 8th bit) is used to +// distinguish requests from their responses -- it is cleared in request +// blocks and is set in response blocks (i.e., the response to a particular +// command will have the same function code base as the command and the +// high order bit set). See dlpFuncRespFlag defined below. +// +typedef enum DlpFuncID { + + dlpReservedFunc = 0x0F, // range reserved for internal use + + // DL 1.0 FUNCTIONS START HERE + dlpReadUserInfo, + + dlpWriteUserInfo, + + dlpReadSysInfo, + + dlpGetSysDateTime, + + dlpSetSysDateTime, + + dlpReadStorageInfo, + + dlpReadDBList, + + dlpOpenDB, + + dlpCreateDB, + + dlpCloseDB, + + dlpDeleteDB, + + dlpReadAppBlock, + + dlpWriteAppBlock, + + dlpReadSortBlock, + + dlpWriteSortBlock, + + dlpReadNextModifiedRec, + + dlpReadRecord, + + dlpWriteRecord, + + dlpDeleteRecord, + + dlpReadResource, + + dlpWriteResource, + + dlpDeleteResource, + + dlpCleanUpDatabase, + + dlpResetSyncFlags, + + dlpCallApplication, + + dlpResetSystem, + + dlpAddSyncLogEntry, + + dlpReadOpenDBInfo, + + dlpMoveCategory, + + dlpProcessRPC, // remote procedure calls interface + + dlpOpenConduit, // this command is sent before each conduit is opened + + dlpEndOfSync, // ends the sync session + + dlpResetRecordIndex, // resets "modified record" index + + dlpReadRecordIDList, // LAST 1.0 FUNCTION + + + // DL 1.1 FUNCTIONS ADDED HERE (Pilot 2.0 Personal, ROM-A) + dlpReadNextRecInCategory, + + dlpReadNextModifiedRecInCategory, + + dlpReadAppPreference, + + dlpWriteAppPreference, + + dlpReadNetSyncInfo, + + dlpWriteNetSyncInfo, + + dlpReadFeature, + + + + dlpLastFunc // ***ALWAYS KEEP LAST*** + + } DlpFuncID; + +#define dlpLastPilotV10FuncID dlpReadRecordIDList + + +// Desktop Link function error codes returned in the response errorCode +// field. +typedef enum DlpRespErrorCode { + dlpRespErrNone = 0, // reserve 0 for no error + dlpRespErrSystem, // general Pilot system error + dlpRespErrIllegalReq, // unknown function ID + dlpRespErrMemory, // insufficient dynamic heap memory + dlpRespErrParam, // invalid parameter + dlpRespErrNotFound, // database, record, or resource not found + dlpRespErrNoneOpen, // there are no open databases + dlpRespErrDatabaseOpen, // database is open by someone else + dlpRespErrTooManyOpenDatabases, // there are too many open databases + dlpRespErrAlreadyExists, // DB already exists + dlpRespErrCantOpen, // couldn't open DB + dlpRespErrRecordDeleted, // record is deleted + dlpRespErrRecordBusy, // record is in use by someone else + dlpRespErrNotSupported, // the requested operation is not supported + // on the given database type(record or resource) + dlpRespErrUnused1, // was dlpRespErrROMBased + dlpRespErrReadOnly, // caller does not have write access(or DB is in ROM) + dlpRespErrNotEnoughSpace, // not enough space in data store for record/resource/etc. + dlpRespErrLimitExceeded, // size limit exceeded + dlpRespErrCancelSync, // cancel the sync + + dlpRespErrBadWrapper, // bad arg wrapper(for debugging) + dlpRespErrArgMissing, // required arg not found(for debugging) + dlpRespErrArgSize, // invalid argument size + + dlpRespErrLastReserved = 127 // last error code reserved for Palm + // *KEEP THIS ENTRY LAST* + } DlpRespErrorCode; + + +// Database flags +// NOTE: THESE *MUST* MATCH THE TOUCHDOWN DB ATTRIBUTES(AT LEAST IN THE FIRST VERSION). +// ANY CHANGES MUST BE REFLECTED IN "READ DB LIST" AND +#define dlpDBFlagResDB 0x0001 // resource DB if set; record DB if cleared + +#define dlpDBFlagReadOnly 0x0002 // DB is read only if set; read/write if cleared + +#define dlpDBFlagAppInfoDirty 0x0004 // Set if Application Info block is dirty + // Optionally supported by an App's conduit + +#define dlpDBFlagBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. + +#define dlpDBFlagOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK + // for it to install a newer version of this database + // with a different name if the current database is + // open. This mechanism is used to update the + // Graffiti Shortcuts database, for example. + +#define dlpDBFlagResetAfterInstall 0x0020 // Device requires a reset after this database is + // installed. + +#define dlpDBFlagOpen 0x8000 // DB is open + + + + +// Database record attributes +#define dlpRecAttrDeleted 0x80 // delete this record next sync +#define dlpRecAttrDirty 0x40 // archive this record next sync +#define dlpRecAttrBusy 0x20 // record currently in use +#define dlpRecAttrSecret 0x10 // "secret" record - password protected +#define dlpRecAttrArchived 0x08 // archived record + + +// Date/time will be described in the following format +// yr(2 bytes), mo(1 byte, 1-12), dy(1 byte, 1-31), +// hr(1 byte, 0-23), min(1 byte, 0-59), sec(1 byte, 0-59), +// unused(1 byte). + +typedef struct DlpDateTimeType { // OFFSET + Word year; // 0; year (high, low) + Byte month; // 2; month: 1-12 + Byte day; // 3; day: 1-31 + Byte hour; // 4; hour: 0-23 + Byte minute; // 5; minute: 0-59 + Byte second; // 6; second: 0-59 + Byte unused; // 7; unused -- set to null! + } DlpDateTimeType; // TOTAL: 8 bytes + + + +/************************************************************ + * Request and Response headers. + * + * Each DLP request and response data block begins with the + * corresponding header structure which identifies the function + * id, argument count, and error code(responses only). + *************************************************************/ + +// Request header: +// +typedef struct DlpReqHeaderType { + // OFFSET + Byte id; // 0; request function ID + Byte argc; // 2; count of args that follow this header + // TOTAL: 2 bytes + } DlpReqHeaderType; + +typedef DlpReqHeaderType* DlpReqHeaderPtr; + +typedef struct DlpReqType { + // OFFSET + DlpReqHeaderType header; // 0; request header + // FIXED SIZE: 2 bytes + Byte args[1]; // 2; request arguments -- var size + } DlpReqType; + +typedef DlpReqType* DlpReqPtr; + +// Response header: +// +typedef struct DlpRespHeaderType { + // OFFSET + Byte id; // 0; response function ID + Byte argc; // 1; count of arguments that follow this header + Word errorCode; // 2; error code + // TOTAL: 4 bytes + } DlpRespHeaderType; + +typedef DlpRespHeaderType* DlpRespHeaderPtr; + +typedef struct DlpRespType { + // OFFSET + DlpRespHeaderType header; // 0; response header + // FIXED SIZE: 4 bytes + Byte args[1]; // 4; response arguments -- var size + } DlpRespType; + +typedef DlpRespType* DlpRespPtr; + + +// Generic request/response body type(for utility routines) +// +typedef union DlpGenericBodyType { + Byte id; // request/response id + DlpReqType req; // request body + DlpRespType resp; // response body + } DlpGenericBodyType; + +typedef DlpGenericBodyType* DlpGenericBodyPtr; + + +// dlpFuncRespFlag is used to form a function response ID from a +// function ID by or'ing it with the function ID. For example: if +// dlpFuncDeleteResource is the request ID, the correct response ID +// must be (dlpFuncDeleteResource | dlpFuncRespFlag). +// +#define dlpFuncRespFlag 0x80 + +// dlpFuncIDMask is used to mask out the function ID value +#define dlpFuncIDMask 0x7f + +// dlpFirstArgID is the value of the first argument ID to be defined for +// functions. Values below it are reserved. +// +#define dlpFirstArgID 0x20 + + +/************************************************************ + * + * Argument headers used to "wrap" request and response arguments + * + * IMPORTANT: ARGUMENT WRAPPERS IN REQUESTS AND RESPONSES MUST + * ALWAYS START ON AN EVEN-BYTE BOUNDARY. The server + * implementation expects this to be the case. + * + *************************************************************/ + +// dlpSmallArgFlag is used to identify "small" argument wrappers by +// or'ing it with the argument id in argument header. +// +#define dlpSmallArgFlag 0x080 + +// dlpShortArgIDMask is used to mask out the argument id value +// +#define dlpShortArgIDMask 0x7F + + +// dlpLongArgFlag is used to identify "long" argument wrappers by +// or'ing it with the argument id in argument header. +// +#define dlpLongArgFlag 0xC000 + +// dlpLongArgIDMask is used to mask out the argument id value +// +#define dlpLongArgIDMask 0x3FFF + + +//------------------------------------------------------------------------- +// Short argument wrappers (v1.0-compatible) +//------------------------------------------------------------------------- + +// Maximum short argument size which can be "wrapped" +#define dlpMaxTinyArgSize 0x000000FFL +#define dlpMaxSmallArgSize 0x0000FFFFL +#define dlpMaxShortArgSize dlpMaxSmallArgSize + + + +// Tiny argument header for data sizes up to 255 bytes(optimization) +// +typedef struct DlpTinyArgWrapperType { + // OFFSET + Byte bID; // 0; argument ID + Byte bSize; // 1; argument size (does NOT include this arg header) + // TOTAL: 2 bytes + } DlpTinyArgWrapperType; + +typedef struct DlpTinyArgType { + DlpTinyArgWrapperType wrapper; // 0; argument header + Byte data[1]; // 2; argument data -- var size + } DlpTinyArgType; + + +// Small argument header for data sizes above 255 bytes(*may also be used for +// smaller arguments when convenient*) +// +typedef struct DlpSmallArgWrapperType { + // OFFSET + Byte bID; // 0; argument ID + Byte unused; // 1; unused(for alignment) -- set to null! + Word wSize; // 2; argument size (does NOT include this arg header) + // TOTAL: 4 bytes + } DlpSmallArgWrapperType; + +typedef struct DlpSmallArgType { + DlpSmallArgWrapperType wrapper; // 0; argument header + Byte data[1]; // 4; argument data -- var size + } DlpSmallArgType; + +// Unions of short argument types +typedef union DlpShortArgWrapperType { + Byte bID; // arg id + DlpTinyArgWrapperType tiny; // "tiny" arg wrapper + DlpSmallArgWrapperType small;// "tiny" arg wrapper + } DlpShortArgWrapperType; +typedef DlpShortArgWrapperType* DlpShortArgWrapperPtr; + +typedef union DlpShortArgType { + Byte bID; // arg id + DlpTinyArgType tiny; // "tiny" arg + DlpSmallArgType small; // "small" arg + } DlpShortArgType; + +typedef DlpShortArgType* DlpShortArgPtr; + + + +//------------------------------------------------------------------------- +// Long argument wrapper (v2.0 extension) +//------------------------------------------------------------------------- +// NOTE: Pilot v2.0 will implement the capability to parse long arguments +// but will not originate them. This will assure backwards compatibility with +// the 1.0 desktop as well as compatibility with the future version of the +// desktop software which may originate the "long" argument wrappers. +// +// Long argument wrappers are identified by the dlpLongArgFlag bits set +// in the argument id field. + +// Maximum long argument size which can be "wrapped" +#define dlpMaxLongArgSize 0xFFFFFFFFL + +typedef struct DlpLongArgWrapperType { + // OFFSET + Word wID; // 0; argument ID + DWord dwSize; // 2; argument size (does NOT include this arg header) + // TOTAL: 6 bytes + } DlpLongArgWrapperType; +typedef DlpLongArgWrapperType* DlpLongArgWrapperPtr; + +typedef struct DlpLongArgType { + // OFFSET + DlpLongArgWrapperType wrapper; // 0; argument header + Byte data[1]; // 6; argument data -- var size + } DlpLongArgType; +typedef DlpLongArgType* DlpLongArgPtr; + + +//------------------------------------------------------------------------- +// Unions of all argument and wrapper types +//------------------------------------------------------------------------- + +// Union of all argument wrapper types +typedef union DlpGenericArgWrapperType { + DlpShortArgWrapperType shortWrap; // "short" arg wrapper(tiny and small) + DlpLongArgWrapperType longWrap; // "long" arg wrapper + } DlpGenericArgWrapperType; +typedef DlpGenericArgWrapperType* DlpGenericArgWrapperPtr; + + +// Union of all argument types +typedef union DlpGenericArgType { + DlpShortArgType shortArg; // "short" arg(tiny and small) + DlpLongArgType longArg; // "long" arg + } DlpGenericArgType; +typedef DlpGenericArgType* DlpGenericArgPtr; + + +/******************************************************************** + * Desktop Link Protocol Parameters + ********************************************************************/ + +// dlpCmdTimeoutSec -- this is the number of seconds to wait for a command +// to begin coming in before timing out +// +#define dlpCmdTimeoutSec 30 + + + +/************************************************************ + * DLP function argument structures + *************************************************************/ + + +////////////////////////////////////////////////////////////////////////// +// dlpReadUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: none +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadUserInfoRespArgID dlpFirstArgID + +typedef struct DlpReadUserInfoRespHdrType { + // OFFSET + DWord userID; // 0; user ID number (0 if none) + DWord viewerID; // 4; id assigned to viewer by the desktop + DWord lastSyncPC; // 8; last sync PC id (0 if none) + DlpDateTimeType succSyncDate; // 12; last successful sync (year = 0 if none) + DlpDateTimeType lastSyncDate; // 20; last sync date(year = 0 if none) + Byte userNameLen; // 28; length of user name field, + // including null (0 = no user name) + Byte passwordLen; // 29; length of encrypted password + // (0 = no password set) + // TOTAL: 30 bytes + } DlpReadUserInfoRespHdrType; + +typedef struct DlpReadUserInfoRespType { + // OFFSET + DlpReadUserInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 30 bytes + Byte nameAndPassword[1]; // 30; user name -- var size + // User name begins at the nameAndPassword field and is null-terminated. + // The encrypted password follows the user name and is NOT null-terminated. + // The encrypted password may contain any byte values(0-255). + } DlpReadUserInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// user id (4 bytes) +// last sync PC id(4 bytes) +// user name +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpWriteUserInfoReqArgID dlpFirstArgID + +#define dlpMaxUserNameSize 41 // max user name size, including null byte + +typedef struct DlpWriteUserInfoReqHdrType { + // OFFSET + DWord userID; // 0; user ID number + DWord viewerID; // 4; id assigned to viewer by the desktop + DWord lastSyncPC; // 8; last sync PC id + DlpDateTimeType lastSyncDate; // 12; last sync date(year = 0 if none) + Byte modFlags; // 20; flags indicating which values are being + // modified; see the dlpUserInfoMod... + // flags defined below + Byte userNameLen; // 21; user name length, including null + // TOTAL: 22 bytes + } DlpWriteUserInfoReqHdrType; + +// Flags indicating which values are being changed by the dlpWriteUserInfo +// request. These flags are used in the modFlags field of DlpWriteUserInfoReqHdrType. +// These flags are additive. +// +#define dlpUserInfoModUserID 0x80 // changing the user id +#define dlpUserInfoModSyncPC 0x40 // changing the last sync PC id +#define dlpUserInfoModSyncDate 0x20 // changing sync date +#define dlpUserInfoModName 0x10 // changing user name +#define dlpUserInfoModViewerID 0x08 // changing the viewer id + +typedef struct DlpWriteUserInfoReqType { + // OFFSET + DlpWriteUserInfoReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 22 bytes + Byte userName[1]; // 22; user name -- var size + // User name begins at the userName field and is null-terminated. + } DlpWriteUserInfoReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSysInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem +// + +// Request argument structure: +// +// none. + +// Response argument structure: +// +enum { + dlpReadSysInfoRespArgID = dlpFirstArgID + }; + +// dlpReadSysInfoRespArgID arg structure: +// +typedef struct DlpReadSysInfoRespType { + // OFFSET + DWord romSWVersion; // 0; ROM-based sys software version + DWord localizationID;// 4; localization ID + Byte unused; // 8; unused(for alignment) -- set to null! + Byte prodIDSize; // 9; size of productID/model field + DWord prodID; // 10; product id (was variable size) + // TOTAL: 14 bytes + } DlpReadSysInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpGetSysDateTime +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes: none + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpGetSysDateTimeRespArgID dlpFirstArgID + +typedef struct DlpGetSysDateTimeRespType { + // OFFSET + DlpDateTimeType dateTime; // 0; system date/time + // TOTAL: 8 bytes + } DlpGetSysDateTimeRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpSetSysDateTime +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// new system date/time +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrParam + +// Request argument structure: +// +#define dlpSetSysDateTimeReqArgID dlpFirstArgID + +typedef struct DlpSetSysDateTimeReqType { + // OFFSET + DlpDateTimeType dateTime; // 0; new system date/time + // TOTAL: 8 bytes + } DlpSetSysDateTimeReqType; + +typedef DlpSetSysDateTimeReqType* DlpSetSysDateTimeReqPtr; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadStorageInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +enum { + dlpReadStorageInfoReqArgID = dlpFirstArgID + }; + +typedef struct DlpReadStorInfoReqType { + // OFFSET + Byte startCardNo; // 0; card number to start at + // (0 = first) + Byte unused; // 1; unused -- set to null! + // TOTAL: 2 bytes + } DlpReadStorInfoReqType; + + +// Response argument structure: +// +enum { + dlpReadStorageInfoRespArgID = dlpFirstArgID, + dlpReadStorageInfoExRespArgID // v1.1 extension + }; + +// +// dlpReadStorageInfoRespArgID: +// + +// Card info structure of variable size +typedef struct DlpCardInfoHdrType { + // OFFSET + Byte totalSize; // 0; total size of this card info + // *ROUNDED UP TO EVEN SIZE* + Byte cardNo; // 1; card number + Word cardVersion; // 2; card version + DlpDateTimeType crDate; // 4; creation date/time + DWord romSize; // 12; ROM size + DWord ramSize; // 16; RAM size + DWord freeRam; // 20; free RAM size + Byte cardNameSize; // 24; size of card name string + Byte manufNameSize; // 25; size of manuf. name string + // TOTAL: 26 bytes; + } DlpCardInfoHdrType; + +typedef struct DlpCardInfoType { + // OFFSET + DlpCardInfoHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 26 bytes; + Byte cardNameAndManuf[1]; + // 26; card name and manuf. text -- var size + // Card name is the cardNameSize bytes of text at cardNameAndManuf, + // followed immediately by manufNameSize bytes of manufacturer name. + } DlpCardInfoType; + + +typedef struct DlpReadStorInfoRespHdrType { + // OFFSET + Byte lastCardNo; // 0; card number of last card retrieved + Byte more; // 1; non-zero if there are more cards + Byte unused; // 2; unused -- set to null! + Byte actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadStorInfoRespHdrType; + +typedef struct DlpReadStorInfoRespType { + // OFFSET + DlpReadStorInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpCardInfoType cardInfo[1]; // 4; actCount of card info structures -- var size + } DlpReadStorInfoRespType; + + +// +// EXTENDED ARGUMENTS(DL v1.1): dlpReadStorageInfoExRespArgID +// +typedef struct DlpReadStorInfoExRespType { + // OFFSET + Word romDBCount; // 0; ROM database count + Word ramDBCount; // 2; RAM database count + DWord dwReserved1; // 4; RESERVED -- SET TO NULL! + DWord dwReserved2; // 8; RESERVED -- SET TO NULL! + DWord dwReserved3; // 12; RESERVED -- SET TO NULL! + DWord dwReserved4; // 16; RESERVED -- SET TO NULL! + // TOTAL: 20 bytes + } DlpReadStorInfoExRespType; + + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadDBList +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +#define dlpReadDBListReqArgID dlpFirstArgID + +typedef struct DlpReadDBListReqType { + // OFFSET + Byte srchFlags; // 0; search flags + Byte cardNo; // 1; card number -- 0-based + Word startIndex; // 2; DB index to start at + // (0 = from beginning) + // TOTAL: 4 bytes + } DlpReadDBListReqType; + +#define dlpReadDBListFlagRAM 0x80 // Search for RAM-based +#define dlpReadDBListFlagROM 0x40 // Search for ROM-based + + +// Response argument structure: +// +#define dlpReadDBListRespArgID dlpFirstArgID + +// Database info structure of variable size +typedef struct DlpDBInfoHdrType { + // OFFSET + Byte totalSize; // 0; total size of the DB info + // *ROUNDED UP TO EVEN SIZE* + Byte miscFlags; // 1; flags(v1.1) -- set all unused bits to null! + Word dbFlags; // 2; DB flags: dlpDBFlagReadOnly, + // dlpDBFlagResDB, + // dlpDBFlagAppInfoDirty, dlpDBFlagOpen, + // dlpDBFlagBackup; + DWord type; // 4; database type + DWord creator; // 8; database creator + Word version; // 12; database version + DWord modNum; // 14; modification number + DlpDateTimeType crDate; // 18; creation date + DlpDateTimeType modDate; // 26; latest modification date + DlpDateTimeType backupDate; // 34; latest backup date + Word dbIndex; // 42; DB index + // TOTAL: 44 bytes; + } DlpDBInfoHdrType; +#define dlpDbInfoMiscFlagExcludeFromSync 0x80 + +typedef struct DlpDBInfoType { + // OFFSET + DlpDBInfoHdrType header; // 0; fixed-size header + // FIXED SIZE: 44 bytes; + Byte name[1]; // 44; databse name text -- var size and + // null-terminated + } DlpDBInfoType; + + +typedef struct DlpReadDBListRespHdrType { + // OFFSET + Word lastIndex; // 0; DB index of last entry retrieved + Byte flags; // 2; flags: dlpReadDBListRespFlagMore + Byte actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadDBListRespHdrType; + +// dlpReadDBListRespFlagMore flag: if set, indicates that there are more +// databases to list -- this enables the server to send the listing +// incrementally, reducing server memory requirements if necessary +#define dlpReadDBListRespFlagMore 0x80 + +typedef struct DlpReadDBListRespType { + // OFFSET + DlpReadDBListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpDBInfoType dbInfo[1]; // 4; actCount of DB info structures -- var size + } DlpReadDBListRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrTooManyOpenDatabases +// dlpRespErrCantOpen + +// Request argument structure: +// +#define dlpOpenDBReqArgID dlpFirstArgID + +typedef struct DlpOpenDBReqHdrType { + // OFFSET + Byte cardNo; // 0; memory module number + Byte mode; // 1; open mode + // TOTAL: 2 bytes; + } DlpOpenDBReqHdrType; + +#define dlpOpenDBModeRead 0x80 +#define dlpOpenDBModeWrite 0x40 +#define dlpOpenDBModeExclusive 0x20 +#define dlpOpenDBModeShowSecret 0x10 + + +typedef struct DlpOpenDBReqType { + // OFFSET + DlpOpenDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + Byte name[1]; // 2; databse name text -- var size + // zero-terminated + } DlpOpenDBReqType; + +typedef DlpOpenDBReqType* DlpOpenDBReqPtr; + + +// Response argument structure: +// +#define dlpOpenDBRespArgID dlpFirstArgID +// +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCreateDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrAlreadyExists, +// dlpRespErrCantOpen, +// dlpRespErrNotEnoughSpace, +// dlpRespErrTooManyOpenDatabases + +// Request argument structure: +// +#define dlpCreateDBReqArgID dlpFirstArgID + +typedef struct DlpCreateDBReqHdrType { + // OFFSET + DWord creator; // 0; DB creator + DWord type; // 4; DB type + Byte cardNo; // 8; memory module number + Byte unused; // 9; unused -- set to null + Word dbFlags; // 10; allowed flags: dlpDBFlagResDB, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall + Word version; // 12; DB version # + // TOTAL: 14 bytes; + } DlpCreateDBReqHdrType; + +typedef struct DlpCreateDBReqType { + // OFFSET + DlpCreateDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + Byte name[1]; // 14; DB name text -- var size + // zero-terminated + } DlpCreateDBReqType; + +typedef DlpCreateDBReqType* DlpCreateDBReqPtr; + + +// Response argument structure: +// +#define dlpCreateDBRespArgID dlpFirstArgID + +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCloseDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrParam, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNoneOpen + +// Request argument structure: +// +typedef enum { + dlpCloseDBReqDBIDArgID = dlpFirstArgID, // close a specific database + dlpCloseDBReqAllArgID // close all databases + } DlpCloseDBReqArgID; + +// Argument structure to close a specific database(dlpCloseDBReqDBIDArgID): +// +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Argument structure to close all databases(dlpCloseDBReqAllArgID): +// +// This request argument contains no data + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrCantOpen, +// dlpRespErrDatabaseOpen + +// Request argument structure: +// +#define dlpDeleteDBReqArgID dlpFirstArgID + +typedef struct DlpDeleteDBReqHdrType { + // OFFSET + Byte cardNo; // 0; memory module number + Byte unused; // 1; unused -- set to null! + // TOTAL: 2 bytes; + } DlpDeleteDBReqHdrType; + + +typedef struct DlpDeleteDBReqType { + // OFFSET + DlpDeleteDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + Byte name[1]; // 2; databse name text -- var size + // zero-terminated + } DlpDeleteDBReqType; + +typedef DlpDeleteDBReqType* DlpDeleteDBReqPtr; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadOpenDBInfo +////////////////////////////////////////////////////////////////////////// +// Get information on an open database +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadOpenDBInfoArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +#define dlpReadOpenDBInfoRespArgID dlpFirstArgID + + +typedef struct DlpReadOpenDBInfoRespType { + // OFFSET + Word numRec; // 0; number of records or resources + // TOTAL: 2 bytes + } DlpReadOpenDBInfoRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpMoveCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam +// dlpRespErrNotSupported +// dlpRespErrReadOnly + +// Request argument structure: +// +#define dlpMoveCategoryReqArgID dlpFirstArgID + +typedef struct DlpMoveCategoryReqType { + // OFFSET + Byte dbID; // 0; database id + Byte fromCategory; // 1; id of the "from" category + Byte toCategory; // 2; id of the "to" category + Byte unused; // 3; unused -- set to null! + // TOTAL: 4 bytes; + } DlpMoveCategoryReqType; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadBlockReqArgID dlpFirstArgID + +typedef struct DlpReadBlockReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word offset; // 2; offset into the block + Word numBytes; // 4; number of bytes to read starting + // at offset(-1 = to the end) + // TOTAL: 6 bytes; + } DlpReadBlockReqType; + + +// Response argument structure: +// +#define dlpReadBlockRespArgID dlpFirstArgID + +typedef struct DlpReadBlockRespHdrType { + // OFFSET + Word blockSize; // 0; actual block size -- may be greater + // than the amount of data returned + // TOTAL: 2 bytes + } DlpReadBlockRespHdrType; + +typedef struct DlpReadBlockRespType { + // OFFSET + DlpReadBlockRespHdrType // + header; // 0; fixed size header + // FIXED SIZE: 2 bytes + Byte data[1]; // 2; block data -- var size + } DlpReadBlockRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly +// dlpRespErrNotEnoughSpace +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteBlockReqArgID dlpFirstArgID + +typedef struct DlpWriteBlockReqHdrType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word blockSize; // 2; total block size(0 = free existing block) + // TOTAL: 4 bytes; + } DlpWriteBlockReqHdrType; + + +typedef struct DlpWriteBlockReqType { + // OFFSET + DlpWriteBlockReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes; + Byte data[1]; // 4; block data -- var size + } DlpWriteBlockReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpReadAppBlock + + +// Response argument structure: +// +// see dlpReadAppBlock + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpWriteAppBlock + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextModifiedRec +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadRecord +// + +// Request argument structure: +// +#define dlpReadNextModRecReqArgID dlpFirstArgID +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// Response argument id = dlpReadRecordRespArgID + +// Response argument structure = DlpReadRecordRespType + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetRecordIndex +////////////////////////////////////////////////////////////////////////// +// Resets the "next modified record" index to the beginning +// +// Possible error codes +// dlpRespErrParam +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetRecordIndexReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrRecordBusy, +// dlpRespErrNoneOpen + +typedef enum { + dlpReadRecordIdArgID = dlpFirstArgID, + dlpReadRecordIndexArgID + } DlpReadRecordReqArgID; + +// dlpReadRecordIdArgID request argument structure: +// +typedef struct DlpReadRecordByIDReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + DWord recordID; // 2; unique record id + Word offset; // 6; offset into the record + Word numBytes; // 8; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 10 bytes; + } DlpReadRecordByIDReqType; + +// dlpReadRecordIndexArgID request argument structure: +// +typedef struct DlpReadRecordByIndexReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word index; // 2; record index + Word offset; // 4; offset into the record + Word numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadRecordByIndexReqType; + + +// Response argument structure: +// +#define dlpReadRecordRespArgID dlpFirstArgID + +typedef struct DlpReadRecordRespHdrType { + // OFFSET + DWord recordID; // 0; unique record id + Word index; // 4; record index + Word recSize; // 6; total record size in bytes + Byte attributes; // 8; record attributes + Byte category; // 9; record category index + // TOTAL: 10 bytes; + } DlpReadRecordRespHdrType; + +typedef struct DlpReadRecordRespType { + // OFFSET + DlpReadRecordRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + Byte data[1]; // 8; record data -- var size + } DlpReadRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecordIDList +////////////////////////////////////////////////////////////////////////// +// Returns a list of unique record id's. May need to call more than once +// to get the entire list. dlpRespErrNotFound is returned when "start" +// is out of bounds +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrNoneOpen + +#define dlpReadRecordIDListReqArgID dlpFirstArgID + +// dlpReadRecordIDListReqArgID request argument structure: +// +typedef struct DlpReadRecordIDListReqType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; request flags + Word start; // 2; starting record index (0-based) + Word maxEntries; // 4; maximum number of entries, or + // 0xFFFF to return as many as possible + // TOTAL: 6 bytes; + } DlpReadRecordIDListReqType; + +// dlpReadRecordIDListFlagSortDB: if set, DL Server will call the creator +// application to resort the database before returning the list. +#define dlpReadRecordIDListFlagSortDB 0x80 + + +// Response argument structure: +// +#define dlpReadRecordIDListRespArgID dlpFirstArgID + +typedef struct DlpReadRecordIDListRespHdrType { + // OFFSET + Word numEntries; // 0; number of entries returned + // TOTAL: 2 bytes; + } DlpReadRecordIDListRespHdrType; + +typedef struct DlpReadRecordIDListRespType { + // OFFSET + DlpReadRecordIDListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + DWord recID[1]; // 8; list of record id's -- var size + } DlpReadRecordIDListRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotEnoughSpace +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteRecordReqArgID dlpFirstArgID + +// dlpWriteRecordReqArgID -- required +typedef struct DlpWriteRecordReqHdrType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; set unused bits to null! + DWord recordID; // 2; unique record id or null + Byte attributes; // 6; record attributes -- only + // dlpRecAttrSecret is allowed here + // v1.1 extension: + // dlpRecAttrDeleted, dlpRecAttrArchived and + // dlpRecAttrDirty are also allowed. + Byte category; // 7; record category + // TOTAL: 8 bytes; + } DlpWriteRecordReqHdrType; + +#define dlpWriteRecordReqFlagDataIncluded 0x80 // original implementer of destop software always + // set this bit. Define it here for compatibility + +typedef struct DlpWriteRecordReqType { + // OFFSET + DlpWriteRecordReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + Byte data[1]; // 8; record data -- var size + } DlpWriteRecordReqType; + + +// Response argument structure: +// +#define dlpWriteRecordRespArgID dlpFirstArgID + +typedef struct DlpWriteRecordRespType { + // OFFSET + DWord recordID; // 0; record ID + // TOTAL: 4 bytes + } DlpWriteRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen +// + +// Request argument structure: +// +#define dlpDeleteRecordReqArgID dlpFirstArgID + +// Argument structure to delete by record ID(dlpDeleteRecordReqIDArgID): +typedef struct DlpDeleteRecordReqType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; flags (dlpDeleteRecFlagDeleteAll) + DWord recordID; // 2; unique record id (see flags) + // TOTAL: 6 bytes; + } DlpDeleteRecordReqType; + +// dlpDeleteRecFlagDeleteAll: if this flag is set, the reocordID field +// is ignored and all database records will be deleted +#define dlpDeleteRecFlagDeleteAll 0x80 + +// dlpDeleteRecFlagByCategory: if this flag is set, the least significant byte +// of the reocordID field contains the category id of records to be deleted +#define dlpDeleteRecFlagByCategory 0x40 + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +typedef enum { + dlpReadResourceIndexArgID = dlpFirstArgID, + dlpReadResourceTypeArgID + } DlpReadResourceReqArgID; + +// dlpReadResourceIndexArgID request argument structure: +// +typedef struct DlpReadResourceByIndexReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word index; // 2; resource index + Word offset; // 4; offset into the resource + Word numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadResourceByIndexReqType; + +// dlpReadResourceTypeArgID request argument structure: +// +typedef struct DlpReadResourceByTypeReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + DWord type; // 2; resource type + Word id; // 6; resource id + Word offset; // 8; offset into the resource + Word numBytes; // 10; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 12 bytes; + } DlpReadResourceByTypeReqType; + + +// Response argument structure: +// +#define dlpReadResourceRespArgID dlpFirstArgID + +typedef struct DlpReadResourceRespHdrType { + // OFFSET + DWord type; // 0; resource type + Word id; // 4; resource id + Word index; // 6; resource index + Word resSize; // 8; total resource size in bytes + // TOTAL: 10 bytes; + } DlpReadResourceRespHdrType; + +typedef struct DlpReadResourceRespType { + // OFFSET + DlpReadResourceRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes; + Byte resData[1]; // 6; resource data -- var size + } DlpReadResourceRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteResourceReqArgID dlpFirstArgID + +typedef struct DlpWriteResourceReqHdrType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; inused -- set to null! + DWord type; // 2; resource type + Word id; // 6; resource id + Word resSize; // 8; total resource size + // TOTAL: 10 bytes; + } DlpWriteResourceReqHdrType; + +typedef struct DlpWriteResourceReqType { + // OFFSET + DlpWriteResourceReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 10 bytes; + Byte data[1]; // 10; resource data -- var size + } DlpWriteResourceReqType; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpDeleteResourceReqArgID dlpFirstArgID + +typedef struct DlpDeleteResourceReqType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; flags (dlpDeleteResFlagDeleteAll) + DWord type; // 2; resource type + Word id; // 6; resource id + // TOTAL: 8 bytes; + } DlpDeleteResourceReqType; + +// dlpDeleteResFlagDeleteAll: if set, all resources in the db will be deleted +#define dlpDeleteResFlagDeleteAll 0x80 + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCleanUpDatabase +////////////////////////////////////////////////////////////////////////// +// Deletes all records which are marked as archived or deleted in the +// record database +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly, +// dlpRespErrNotSupported +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpCleanUpDatabaseReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSyncFlags +////////////////////////////////////////////////////////////////////////// +// For record databases, reset all dirty flags. +// For both record and resource databases, set the last sync time to NOW +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam +// dlpRespErrReadOnly, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetSyncFlagsReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCallApplication +////////////////////////////////////////////////////////////////////////// +// Call an application entry point via an action code +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound + +// Request argument structure: +// +enum { + dlpCallApplicationReqArgIDV10 = dlpFirstArgID, // req id for Pilot v1.0 + dlpCallAppReqArgID // req id for Pilot v2.0 and later + }; + +// dlpCallApplicationReqArgIDV10: +typedef struct DlpCallApplicationReqHdrTypeV10 { + // OFFSET + DWord creator; // 0; app DB creator id + Word action; // 4; action code + Word paramSize; // 6; custom param size + // TOTAL: 8 bytes + } DlpCallApplicationReqHdrTypeV10; + +typedef struct DlpCallApplicationReqTypeV10 { + // OFFSET + DlpCallApplicationReqHdrTypeV10 // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes + Byte paramData[1]; // 8; custom param data -- var size + } DlpCallApplicationReqTypeV10; + + +// dlpCallAppReqArgID (Pilot v2.0): +typedef struct DlpCallAppReqHdrType { + // OFFSET + DWord creator; // 0; DB creator id of target executable + DWord type; // 4; DB type id of target executable + Word action; // 8; action code + DWord dwParamSize; // 10; custom param size in number of bytes + DWord dwReserved1; // 14; RESERVED -- set to NULL!!! + DWord dwReserved2; // 18; RESERVED -- set to NULL!!! + // TOTAL: 22 bytes + } DlpCallAppReqHdrType; + +typedef struct DlpCallAppReqType { + // OFFSET + DlpCallAppReqHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 22 bytes + Byte paramData[1]; // 22; custom param data -- var size + } DlpCallAppReqType; + + + +// Response argument structure: +// +enum { + dlpCallApplicationRespArgIDV10 = dlpFirstArgID, // resp id for Pilot v1.0 + dlpCallAppRespArgID // resp id for Pilot v2.0 and later + }; + +// dlpCallApplicationRespArgIDV10: +typedef struct DlpCallApplicationRespHdrTypeV10 { + // OFFSET + Word action; // 0; action code which was called + Word resultCode; // 2; result error code returned by action + Word resultSize; // 4; custom result data size + // TOTAL: 6 bytes + } DlpCallApplicationRespHdrTypeV10; + +typedef struct DlpCallApplicationRespTypeV10 { + // OFFSET + DlpCallApplicationRespHdrTypeV10 // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes + Byte resultData[1]; // 6; custom result data -- var size + } DlpCallApplicationRespTypeV10; + +// dlpCallAppRespArgID: +typedef struct DlpCallAppRespHdrType { + // OFFSET + DWord dwResultCode; // 0; result error code returned by handler + DWord dwResultSize; // 4; custom result data size + DWord dwReserved1; // 8; RESERVED -- SET TO NULL!!! + DWord dwReserved2; // 12; RESERVED -- SET TO NULL!!! + // TOTAL: 16 bytes + } DlpCallAppRespHdrType; + +typedef struct DlpCallAppRespType { + // OFFSET + DlpCallAppRespHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 16 bytes + Byte resultData[1]; // 16; custom result data -- var size + } DlpCallAppRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSystem +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpAddSyncLogEntry +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrLimitExceeded, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpAddSyncLogEntryReqArgID dlpFirstArgID + +typedef struct DlpAddSyncLogEntryReqType { + // OFFSET + Byte text[1]; // 0; entry text -- var size and + // null-terminated + } DlpAddSyncLogEntryReqType; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpProcessRPC +////////////////////////////////////////////////////////////////////////// +// Remote Procedure Call interface +// +// Request arguments: +// RPC command block +// +// Response arguments: +// RPC reply block +// +// Possible error codes +// 0 on success; otherwise error code from the TouchDown +// RPC executor +// +// NOTE: this is a low-level system command which does not use arg wrappers. + +// Request argument structure: +// +// Block of RPC command data (no arg wrapper) + +// Response argument structure: +// +// Block of RPC reply data of same length as command block(no arg wrapper) + + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenConduit +////////////////////////////////////////////////////////////////////////// +// This command is sent before each conduit is opened by the desktop. +// If the viewer has a cancel pending, it will return dlpRespErrCancelSync +// in the response header's errorCode field. +// +// Request arguments: none. +// +// Response arguments: none. +// +// Possible error codes +// dlpRespErrCancelSync + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpEndOfSync +////////////////////////////////////////////////////////////////////////// +// This command is sent by the desktop to end the sync. +// +// Request arguments: termination code: 0 = normal termination; +// otherwise the client is aborting the sync +// +// Possible error codes +// 0 + +// Request argument structure: +// +#define dlpEndOfSyncReqArgID dlpFirstArgID + +typedef enum DlpSyncTermCode { + dlpTermCodeNormal = 0, // normal termination + dlpTermCodeOutOfMemory, // termination due to low memory on TD + dlpTermCodeUserCan, // user cancelled from desktop + dlpTermCodeOther // catch-all abnormal termination code + } DlpSyncTermCode; + + +typedef struct DlpEndOfSyncReqType { + // OFFSET + Word termCode; // 0; termination code + // TOTAL: 2 bytes + } DlpEndOfSyncReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextRecInCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadRecord + +#define dlpReadNextRecInCategoryReqArgID dlpFirstArgID + +// dlpReadNextRecInCategoryReqArgID request argument structure: +// +typedef struct DlpReadNextRecInCategoryReqType { + // OFFSET + Byte dbID; // 0; database id + Byte category; // 1; category id + // TOTAL: 2 bytes; + } DlpReadNextRecInCategoryReqType; + + +// Response argument structure: +// +// Response argument id = dlpReadRecordRespArgID + +// Response argument structure = DlpReadRecordRespType + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextModifiedRecInCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadNextRecInCategory + +// Request argument structure: +// +// same as dlpReadNextRecInCategory + +// Response argument structure: +// +// same as dlpReadNextRecInCategory + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadAppPreference +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound, + +#define dlpReadAppPreferenceReqArgID dlpFirstArgID + +// dlpReadAppPreferenceReqArgID request argument structure: +// +typedef struct DlpReadAppPreferenceReqType { + // OFFSET + DWord creator; // 0; application creator type + Word id; // 4; preference id + Word reqBytes; // 6; max. number of preference bytes requested; + // pass 0xFFFF for actual size + Byte flags; // 8; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db + Byte unused; // 9; reserved/padding -- set to NUL! + // TOTAL: 10 bytes; + } DlpReadAppPreferenceReqType; + +#define dlpReadAppPrefActualSize 0xFFFF +#define dlpAppPrefReqFlagBackedUp 0x80 + +// Response argument structure: +// +#define dlpReadAppPreferenceRespArgID dlpFirstArgID + +typedef struct DlpReadAppPreferenceRespHdrType { + // OFFSET + Word version; // 0; version number of the application + Word actualSize; // 2; actual preference data size + Word retBytes; // 4; number of preference bytes returned + // TOTAL: 6 bytes + } DlpReadAppPreferenceRespHdrType; + +typedef struct DlpReadAppPreferenceRespType { + // OFFSET + DlpReadAppPreferenceRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes + Byte data[1]; // 6; custom result data -- var size + } DlpReadAppPreferenceRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteAppPreference +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotEnoughSpace + +// Request argument structure: +// +#define dlpWriteAppPreferenceReqArgID dlpFirstArgID + +typedef struct DlpWriteAppPreferenceReqHdrType { + // OFFSET + DWord creator; // 0; application creator type + Word id; // 4; preference id + Word version; // 6; version number of the application + Word prefSize; // 8; preference size(in number of bytes) + Byte flags; // 10; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db + Byte unused; // 11; reserved/padding -- set to NUL! + // TOTAL: 12 bytes; + } DlpWriteAppPreferenceReqHdrType; + +typedef struct DlpWriteAppPreferenceReqType { + // OFFSET + DlpWriteAppPreferenceReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + Byte data[1]; // 12; record data -- var size + } DlpWriteAppPreferenceReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNetSyncInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: none +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadNetSyncInfoRespArgID dlpFirstArgID + +typedef struct DlpReadNetSyncInfoRespHdrType { + // OFFSET + Byte lanSyncOn; // 0; non-zero if Lan Sync is enabled + Byte bReserved1; // 1; reserved -- SET TO NULL! + DWord dwReserved1; // 2; reserved -- SET TO NULL! + DWord dwReserved2; // 6; reserved -- SET TO NULL! + DWord dwReserved3; // 10; reserved -- SET TO NULL! + DWord dwReserved4; // 14; reserved -- SET TO NULL! + Word syncPCNameSize;// 18; length of sync PC host name, + // including null (0 = no host name) + Word syncPCAddrSize;// 20; length of sync PC address, + // including null (0 = no address) + Word syncPCMaskSize;// 22; length of sync PC subnet mask, + // including null (0 = no mask) + // TOTAL: 24 bytes + } DlpReadNetSyncInfoRespHdrType; + +typedef struct DlpReadNetSyncInfoRespType { + // OFFSET + DlpReadNetSyncInfoRespHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 24 bytes + Byte syncAddr[1]; // 24; sync IP address/host name -- var size, + // null-terminated + } DlpReadNetSyncInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteNetSyncInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpWriteNetSyncInfoReqArgID dlpFirstArgID + +#define dlpMaxHostAddrLength 255 // maximum PC host name length, not including NULL + +typedef struct DlpWriteNetSyncInfoReqHdrType { + // OFFSET + Byte modFlags; // 0; flags indicating which values are being + // modified; see the dlpNetSyncInfoMod... + // flags defined below + Byte lanSyncOn; // 1; non-zero if Lan Sync is enabled + DWord dwReserved1; // 2; reserved -- SET TO NULL! + DWord dwReserved2; // 6; reserved -- SET TO NULL! + DWord dwReserved3; // 10; reserved -- SET TO NULL! + DWord dwReserved4; // 14; reserved -- SET TO NULL! + Word syncPCNameSize;// 18; length of sync PC host name, + // including null (0 = no address/host name) + Word syncPCAddrSize;// 20; length of sync PC address, + // including null (0 = no address) + Word syncPCMaskSize;// 22; length of sync PC subnet mask, + // including null (0 = no mask) + // TOTAL: 24 bytes + } DlpWriteNetSyncInfoReqHdrType; + +// Flags indicating which values are being changed by the dlpWriteNetSyncInfo +// request. These flags are used in the modFlags field of DlpWriteNetSyncInfoReqHdrType. +// These flags are additive. +// +#define dlpNetSyncInfoModLanSyncOn 0x80 // changing the "lan sync on" setting +#define dlpNetSyncInfoModSyncPCName 0x40 // changing the sync PC host name +#define dlpNetSyncInfoModSyncPCAddr 0x20 // changing the sync PC address +#define dlpNetSyncInfoModSyncPCMask 0x10 // changing the sync PC subnet mask + +typedef struct DlpWriteNetSyncInfoReqType { + // OFFSET + DlpWriteNetSyncInfoReqHdrType + hdr; // 0; fixed-size header + // FIXED SIZE: 24 bytes + Byte syncAddr[1]; // 24; sync IP address/host name -- var size, + // null-terminated + } DlpWriteNetSyncInfoReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadFeature +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotFound, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadFeatureReqArgID dlpFirstArgID + +typedef struct DlpReadFeatureReqType { + // OFFSET + DWord dwFtrCreator; // 0; feature creator + Word wFtrNum; // 4; feature number + // TOTAL: 6 bytes + } DlpReadFeatureReqType; + + +// Response argument structure: +// +#define dlpReadFeatureRespArgID dlpFirstArgID + +typedef struct DlpReadFeatureRespType { + // OFFSET + DWord dwFeature; // 0; feature value + // TOTAL: 4 bytes + } DlpReadFeatureRespType; + + +/************************************************************ + * Macros + *************************************************************/ + + +#endif // __DLCOMMON_H__ + + diff --git a/sdk-2/include/Core/System/DLServer.h b/sdk-2/include/Core/System/DLServer.h new file mode 100644 index 0000000..0e4b57c --- /dev/null +++ b/sdk-2/include/Core/System/DLServer.h @@ -0,0 +1,390 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DLServer.h + * + * Description: + * Desktop Link Protocol(DLP) Server implementation definitions. + * + * History: + * vmk 7/12/95 Created by Vitaly Marty Kruglikov + * vmk 7/12/96 Converted to HTAL architecture + * + *******************************************************************/ + + +#ifndef __DL_SERVER_H__ +#define __DL_SERVER_H__ + +// Pilot common definitions +#include +#include // for DmOpenRef + + + +/************************************************************ + * DLK result codes + * (dlkErrorClass is defined in SystemMgr.h) + *************************************************************/ +#pragma mark *Error Codes* + +#define dlkErrParam (dlkErrorClass | 1) // invalid parameter +#define dlkErrMemory (dlkErrorClass | 2) // memory allocation error +#define dlkErrNoSession (dlkErrorClass | 3) // could not establish a session + +#define dlkErrSizeErr (dlkErrorClass | 4) // reply length was too big + +#define dlkErrLostConnection (dlkErrorClass | 5) // lost connection +#define dlkErrInterrupted (dlkErrorClass | 6) // sync was interrupted (see sync state) +#define dlkErrUserCan (dlkErrorClass | 7) // cancelled by user + + + +/******************************************************************** + * Desktop Link system preferences resource for user info + * id = sysResIDDlkUserInfo, defined in SystemMgr.rh + ********************************************************************/ +#pragma mark *User Info Preference* + +#define dlkMaxUserNameLength 40 +#define dlkUserNameBufSize (dlkMaxUserNameLength + 1) + +#define dlkMaxLogSize (2 * 1024) + +typedef enum DlkSyncStateType { + dlkSyncStateNeverSynced = 0, // never synced + dlkSyncStateInProgress, // sync is in progress + dlkSyncStateLostConnection, // connection lost during sync + dlkSyncStateLocalCan, // cancelled by local user on TD + dlkSyncStateRemoteCan, // cancelled by user from desktop + dlkSyncStateLowMemoryOnTD, // sync ended due to low memory on TD + dlkSyncStateAborted, // sync was aborted for some other reason + dlkSyncStateCompleted // sync completed normally + } DlkSyncStateType; + +#define dlkUserInfoPrefVersion 0x0102 // current user info pref version: 1.2 + +typedef struct DlkUserInfoHdrType { + Word version; // pref version number + DWord userID; // user id + DWord viewerID; // id assigned to viewer by the desktop + DWord lastSyncPC; // last sync PC id + ULong succSyncDate; // last successful sync date + ULong lastSyncDate; // last sync date + DlkSyncStateType lastSyncState; // last sync status + UInt lanSyncEnabled;// if non-zero, LAN Sync is enabled + DWord hsTcpPortNum; // TCP/IP port number of Desktop HotSync + DWord dwReserved1; // RESERVED -- set to NULL! + DWord dwReserved2; // RESERVED -- set to NULL! + Byte userNameLen; // length of name field(including null) + UInt syncLogLen; // length of sync log(including null) + } DlkUserInfoHdrType; + +typedef struct DlkUserInfoType { + DlkUserInfoHdrType header; // fixed size header + Char nameAndLog[2]; // user name, followed by sync log; + // both null-terminated(for debugging) + } DlkUserInfoType; + +typedef DlkUserInfoType* DlkUserInfoPtr; // user info pointer + + +/******************************************************************** + * Desktop Link system preferences resource for the Conduit Filter Table + * id = sysResIDDlkCondFilterTab, defined in SystemMgr.rh + ********************************************************************/ +#pragma mark *Conduit Filter Preference* + +// +// Table for specifying conduits to "filter out" during HotSync +// + +// This table consists of DlkCondFilterTableHdrType header followed by a +// variable number of DlkCondFilterEntryType entries + +typedef struct DlkCondFilterTableHdrType { + Word entryCount; + } DlkCondFilterTableHdrType; +typedef DlkCondFilterTableHdrType* DlkCondFilterTableHdrPtr; + +typedef struct DlkCondFilterEntryType { + DWord creator; + DWord type; + } DlkCondFilterEntryType; +typedef DlkCondFilterEntryType* DlkCondFilterEntryPtr; + +typedef struct DlkCondFilterTableType { + DlkCondFilterTableHdrType + hdr; // table header + DlkCondFilterEntryType + entry[1]; // variable number of entries + } DlkCondFilterTableType; +typedef DlkCondFilterTableType* DlkCondFilterTablePtr; + + + +/******************************************************************** + * DLK Session Structures + ********************************************************************/ +#pragma mark *Session Structures* + + +// DesktopLink event notification callback. If non-zero is returned, +// sync will be cancelled as soon as a safe point is reached. +typedef enum { + dlkEventOpeningConduit = 1, // conduit is being opened -- paramP + // is null; + + dlkEventDatabaseOpened, // client has opened a database -- paramP + // points to DlkEventDatabaseOpenedType; + + dlkEventCleaningUp, // last stage of sync -- cleaning up (notifying apps, etc) -- + // paramP is null + + dlkEventSystemResetRequested // system reset was requested by the desktop client + // (the normal action is to delay the reset until + // end of sync) -- paramP is null + } DlkEventType; + +// Prototype for the event notification callback +typedef Int (*DlkEventProcPtr)(DWord eventRef, DlkEventType dlkEvent, + VoidPtr paramP); + +// Parameter structure for dlkEventDatabaseOpened +// Added new fields for Pilot v2.0 vmk 12/24/96 +typedef struct DlkEventDatabaseOpenedType { + DmOpenRef dbR; // open database ref (v2.0) + CharPtr dbNameP; // database name + ULong dbType; // databse type (v2.0) + ULong dbCreator; // database creator + } DlkEventDatabaseOpenedType; + + +// Prototype for the "user cancel" check callback function +typedef Int (*DlkUserCanProcPtr)(DWord canRef); + + +// +// List of modified database creators maintained by DLP Server +// +typedef struct DlkDBCreatorList { + UInt count; // number of entries in the list + Handle listH; // chunk handle of the creators list + } DlkDBCreatorList; + + +// +// DLP Server session information +// +typedef struct DlkServerSessionType { + UInt htalLibRefNum; // HTAL library reference number - the library has a live connection + ULong maxHtalXferSize; // Maximum transfer block size + + // Information supplied by user + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + DWord eventRef; // user reference value for event proc + DlkUserCanProcPtr canProcP; // ptr to user-cancel function + DWord canRef; // parameter for canProcP() + Handle condFilterH; // handle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none + + // Current database information + Byte dlkDBID; // Desktop Link database id + DmOpenRef dbR; // TouchDown database access pointer -- if null, no current db + UInt cardNo; // memory module number + ULong dbCreator; // creator id + Char dbName[dmDBNameLength]; // DB name + UInt dbOpenMode; // database open mode + Boolean created; // true if the current db was created + Boolean isResDB; // set to true if resource database + Boolean ramBased; // true if the db is in RAM storage + Boolean readOnly; // true if the db is read-only + LocalID dbLocalID; // TouchDown LocalID of the database + ULong initialModNum; // initial DB modification number + ULong curRecIndex; // current record index for enumeration functions + // (0=beginning) + + // List of modified database creators maintained by DLP Server + DlkDBCreatorList creatorList; + + // Session status information + DlkSyncStateType syncState; // current sync state; + + Boolean complete; // set to true when completion request + // has been received + + Boolean conduitOpened; // set to true after the first coduit + // is opened by remote + + Boolean logCleared; // set to true after sync log has been + // cleared during the current session; + // The log will be cleared before any new entries are added or at + // the end of sync in case no new entries were added. + // (we do not clear the log at the beginning of sync in case the + // user cancels during the "identifying user" phase; in this + // event, the spec calls for preserving the original log) + + Boolean resetPending; // set to true if system reset is pending; + // the reset will be carried out at end + // of sync + + // Current request information + Boolean gotCommand; // set to true when got a request + Byte cmdTID; // current transaction ID + Word cmdLen; // size of data in request buffer + VoidPtr cmdP; // pointer to command + VoidHand cmdH; // handle of command buffer + } DlkServerSessionType; + +typedef DlkServerSessionType* DlkServerSessionPtr; + + +/******************************************************************** + * DLK Function Parameter Structures + ********************************************************************/ +#pragma mark *Function Parameter Structures* + +// +// Parameter passed to DlkControl() +// +typedef enum DlkCtlEnum { + dlkCtlFirst = 0, // reserve 0 + + // + // Pilot v2.0 control codes: + // + dlkCtlGetPCHostName, // param1P = ptr to text buffer; (can be null if *(UIntPtr)param2P is 0) + // param2P = ptr to buffer size(UInt); + // returns actual length, including null, in *(UIntPtr)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostName, // param1P = ptr to host name(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt), including NULL (if length is 0, the current name is deleted) + + dlkCtlGetCondFilterTable, // param1P = ptr to destination buffer for filter table, or NULL if *param2 is 0 + // param2P = on entry, ptr to size of buffer(UInt) (the size may be 0) + // on return, size, in bytes, of the actual filter table + + dlkCtlSetCondFilterTable, // param1P = ptr to to conduit filter table, or NULL if *param2 is 0 + // param2P = ptr to size of filter table(UInt) (if size is 0, the current table will be deleted) + + dlkCtlGetLANSync, // param1P = ptr to store for the LANSync setting(UInt): 0 = off, otherwise on + // param2P = not used, set to NULL + + dlkCtlSetLANSync, // param1P = ptr to the LANSync setting(UInt): 0 = off, otherwise on + // param2P = not used, set to NULL + + dlkCtlGetHSTCPPort, // param1P = ptr to store for the Desktop HotSync TCP/IP port number(DWord) -- zero if not set + // param2P = not used, set to NULL + + dlkCtlSetHSTCPPort, // param1P = ptr to the Desktop HotSync TCP/IP port number(DWord) + // param2P = not used, set to NULL + + dlkCtlSendCallAppReply, // param1P = ptr to DlkCallAppReplyParamType structure + // param2P = not used, set to NULL + // + // RETURNS: send error code; use this error code + // as return value from the action code handler + + + dlkCtlGetPCHostAddr, // param1P = ptr to text buffer; (can be null if *(UIntPtr)param2P is 0) + // param2P = ptr to buffer size(UInt); + // returns actual length, including null, in *(UIntPtr)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostAddr, // param1P = ptr to host address string(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt), including NULL (if length is 0, the current name is deleted) + + + dlkCtlGetPCHostMask, // param1P = ptr to text buffer; (can be null if *(UIntPtr)param2P is 0) + // param2P = ptr to buffer size(UInt); + // returns actual length, including null, in *(UIntPtr)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostMask, // param1P = ptr to subnet mask string(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt), including NULL (if length is 0, the current name is deleted) + + + dlkCtlLAST // *KEEP THIS ENTRY LAST* + +} DlkCtlEnum; + + +// +// Parameter passed to DlkStartServer() +// +typedef struct DlkServerParamType { + UInt htalLibRefNum; // HTAL library reference number - the library has a live connection + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + DWord eventRef; // user reference value for event proc + DWord reserved1; // reserved - set to NULL + DWord reserved2; // reserved - set to NULL + Handle condFilterH; // handle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none + } DlkServerParamType; + +typedef DlkServerParamType* DlkServerParamPtr; + + + +// +// Parameter passed with DlkControl()'s dlkCtlSendCallAppReply code +// +typedef struct DlkCallAppReplyParamType { + Word pbSize; // size of this parameter block (set to sizeof(DlkCallAppReplyParamType)) + DWord dwResultCode; // result code to be returned to remote caller + VoidPtr resultP; // ptr to result data + DWord dwResultSize; // size of reply data in number of bytes + VoidPtr dlRefP; // DesktopLink reference pointer from + // SysAppLaunchCmdHandleSyncCallAppType + DWord dwReserved1; // RESERVED -- set to null!!! + } DlkCallAppReplyParamType; + + +/******************************************************************** + * DesktopLink Server Routines + ********************************************************************/ +#pragma mark *Function Prototypes* + +#ifdef __cplusplus +extern "C" { +#endif + +// +// SERVER API +// + +// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam, +// * dlkErrNoSession, dlkErrLostConnection, dlkErrMemory, +// * dlkErrUserCan +extern Err DlkStartServer(DlkServerParamPtr paramP) + SYS_TRAP(sysTrapDlkStartServer); + +extern Err DlkGetSyncInfo(ULongPtr succSyncDateP, ULongPtr lastSyncDateP, + DlkSyncStateType* syncStateP, CharPtr nameBufP, + CharPtr logBufP, ULongPtr logLenP) + SYS_TRAP(sysTrapDlkGetSyncInfo); + +// DOLATER... this is a temporary function for debugging modem manager. +// remove it when done. +extern void DlkSetLogEntry(CharPtr textP, Int textLen, Boolean append) + SYS_TRAP(sysTrapDlkSetLogEntry); + +// Dispatch a DesktopLink request (exposed for patching) +extern Err DlkDispatchRequest(DlkServerSessionPtr sessP) + SYS_TRAP(sysTrapDlkDispatchRequest); + +extern Err DlkControl(DlkCtlEnum op, VoidPtr param1P, VoidPtr param2P) + SYS_TRAP(sysTrapDlkControl); + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * DLK Macros + ********************************************************************/ + + + +#endif // __DL_SERVER_H__ diff --git a/sdk-2/include/Core/System/DLUtil.h b/sdk-2/include/Core/System/DLUtil.h new file mode 100644 index 0000000..d115578 --- /dev/null +++ b/sdk-2/include/Core/System/DLUtil.h @@ -0,0 +1,56 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DLUtil.h + * + * Description: + * Desktop Link Protocol(DLP) utility definitions. + * + * History: + * 8/12/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __DL_UTIL_H__ +#define __DL_UTIL_H__ + +// Pilot common definitions +#include + +// Desktop Link common definitions +#include + + +/******************************************************************** + * Utility Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +extern Int DlkUtilFillArgWrapper(DlpGenericArgWrapperPtr wrapperP, + Word wID, ULong argSize); + +extern Boolean DlkUtilFindArg(VoidPtr bufP, ULong bufSize, + Word wID, VoidPtr* argDataPP, ULongPtr argDataSizeP); + + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * Utility Macros + ********************************************************************/ + + + +#endif // __DL_UTIL_H__ diff --git a/sdk-2/include/Core/System/DataMgr.h b/sdk-2/include/Core/System/DataMgr.h new file mode 100644 index 0000000..8eb414e --- /dev/null +++ b/sdk-2/include/Core/System/DataMgr.h @@ -0,0 +1,480 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DataMgr.h + * + * Description: + * Header for the Data Manager + * + * History: + * 11/14/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __DATAMGR_H__ +#define __DATAMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + +// Other headers we depend on +#include + + +/************************************************************ + * Category equates + *************************************************************/ +#define dmRecAttrCategoryMask 0x0F // mask for category # +#define dmRecNumCategories 16 // number of categories +#define dmCategoryLength 16 // 15 chars + 1 null terminator + +#define dmAllCategories 0xff +#define dmUnfiledCategory 0 + +#define dmMaxRecordIndex 0xffff + + + +// Record Attributes +#define dmRecAttrDelete 0x80 // delete this record next sync +#define dmRecAttrDirty 0x40 // archive this record next sync +#define dmRecAttrBusy 0x20 // record currently in use +#define dmRecAttrSecret 0x10 // "secret" record - password protected + + + + +/************************************************************ + * Database Header equates + *************************************************************/ +#define dmDBNameLength 32 // 31 chars + 1 null terminator + +// Attributes of a Database +#define dmHdrAttrResDB 0x0001 // Resource database +#define dmHdrAttrReadOnly 0x0002 // Read Only database +#define dmHdrAttrAppInfoDirty 0x0004 // Set if Application Info block is dirty + // Optionally supported by an App's conduit +#define dmHdrAttrBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. +#define dmHdrAttrOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK + // for it to install a newer version of this database + // with a different name if the current database is + // open. This mechanism is used to update the + // Graffiti Shortcuts database, for example. +#define dmHdrAttrResetAfterInstall 0x0020 // Device requires a reset after this database is + // installed. +#define dmHdrAttrOpen 0x8000 // Database not closed properly + + +/************************************************************ + * Unique ID equates + *************************************************************/ +#define dmRecordIDReservedRange 1 // The range of upper bits in the database's + // uniqueIDSeed from 0 to this number are + // reserved and not randomly picked when a + // database is created. +#define dmDefaultRecordsID 0 // Records in a default database are copied + // with their uniqueIDSeeds set in this range. + + +/************************************************************ + * Mode flags passed to DmOpenDatabase + *************************************************************/ +#define dmModeReadOnly 0x0001 // read access +#define dmModeWrite 0x0002 // write access +#define dmModeReadWrite 0x0003 // read & write access +#define dmModeLeaveOpen 0x0004 // leave open when app quits +#define dmModeExclusive 0x0008 // don't let anyone else open it +#define dmModeShowSecret 0x0010 // force show of secret records + +// Generic type used to represent an open Database +typedef VoidPtr DmOpenRef; + + +/************************************************************ + * Structure passed to DmGetNextDatabaseByTypeCreator and used + * to cache search information between multiple searches. + *************************************************************/ +typedef struct { + DWord info[8]; + } DmSearchStateType; +typedef DmSearchStateType* DmSearchStatePtr; + + + +/************************************************************ + * Structures used by the sorting routines + *************************************************************/ +typedef struct { + Byte attributes; // record attributes; + Byte uniqueID[3]; // unique ID of record + } SortRecordInfoType; + +typedef SortRecordInfoType * SortRecordInfoPtr; + +typedef Int DmComparF (void *, void *, Int other, SortRecordInfoPtr, + SortRecordInfoPtr, VoidHand appInfoH); + + + +/************************************************************ + * Database manager error codes + * the constant dmErrorClass is defined in SystemMgr.h + *************************************************************/ +#define dmErrMemError (dmErrorClass | 1) +#define dmErrIndexOutOfRange (dmErrorClass | 2) +#define dmErrInvalidParam (dmErrorClass | 3) +#define dmErrReadOnly (dmErrorClass | 4) +#define dmErrDatabaseOpen (dmErrorClass | 5) +#define dmErrCantOpen (dmErrorClass | 6) +#define dmErrCantFind (dmErrorClass | 7) +#define dmErrRecordInWrongCard (dmErrorClass | 8) +#define dmErrCorruptDatabase (dmErrorClass | 9) +#define dmErrRecordDeleted (dmErrorClass | 10) +#define dmErrRecordArchived (dmErrorClass | 11) +#define dmErrNotRecordDB (dmErrorClass | 12) +#define dmErrNotResourceDB (dmErrorClass | 13) +#define dmErrROMBased (dmErrorClass | 14) +#define dmErrRecordBusy (dmErrorClass | 15) +#define dmErrResourceNotFound (dmErrorClass | 16) +#define dmErrNoOpenDatabase (dmErrorClass | 17) +#define dmErrInvalidCategory (dmErrorClass | 18) +#define dmErrNotValidRecord (dmErrorClass | 19) +#define dmErrWriteOutOfBounds (dmErrorClass | 20) +#define dmErrSeekFailed (dmErrorClass | 21) +#define dmErrAlreadyOpenForWrites (dmErrorClass | 22) +#define dmErrOpenedByAnotherTask (dmErrorClass | 23) +#define dmErrUniqueIDNotFound (dmErrorClass | 24) +#define dmErrAlreadyExists (dmErrorClass | 25) +#define dmErrInvalidDatabaseName (dmErrorClass | 26) +#define dmErrDatabaseProtected (dmErrorClass | 27) + + +/************************************************************ + * Values for the direction parameter of DmSeekRecordInCategory + *************************************************************/ +#define dmSeekForward 1 +#define dmSeekBackward -1 + + +/************************************************************ + * Data Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initialization +Err DmInit(void) + SYS_TRAP(sysTrapDmInit); + + +// Directory Lists +Err DmCreateDatabase(UInt cardNo, const CharPtr nameP, + ULong creator, ULong type, Boolean resDB) + SYS_TRAP(sysTrapDmCreateDatabase); + +Err DmCreateDatabaseFromImage(Ptr bufferP) + SYS_TRAP(sysTrapDmCreateDatabaseFromImage); + + +Err DmDeleteDatabase(UInt cardNo, LocalID dbID) + SYS_TRAP(sysTrapDmDeleteDatabase); + +UInt DmNumDatabases(UInt cardNo) + SYS_TRAP(sysTrapDmNumDatabases); + +LocalID DmGetDatabase(UInt cardNo, UInt index) + SYS_TRAP(sysTrapDmGetDatabase); + +LocalID DmFindDatabase(UInt cardNo, const CharPtr nameP) + SYS_TRAP(sysTrapDmFindDatabase); + +Err DmGetNextDatabaseByTypeCreator(Boolean newSearch, DmSearchStatePtr stateInfoP, + ULong type, ULong creator, Boolean onlyLatestVers, + UIntPtr cardNoP, LocalID* dbIDP) + SYS_TRAP(sysTrapDmGetNextDatabaseByTypeCreator); + + +// Database info +Err DmDatabaseInfo(UInt cardNo, LocalID dbID, const CharPtr nameP, + UIntPtr attributesP, UIntPtr versionP, ULongPtr crDateP, + ULongPtr modDateP, ULongPtr bckUpDateP, + ULongPtr modNumP, LocalID* appInfoIDP, + LocalID* sortInfoIDP, ULongPtr typeP, + ULongPtr creatorP) + SYS_TRAP(sysTrapDmDatabaseInfo); + +Err DmSetDatabaseInfo(UInt cardNo, LocalID dbID, const CharPtr nameP, + UIntPtr attributesP, UIntPtr versionP, ULongPtr crDateP, + ULongPtr modDateP, ULongPtr bckUpDateP, + ULongPtr modNumP, LocalID* appInfoIDP, + LocalID* sortInfoIDP, ULongPtr typeP, + ULongPtr creatorP) + SYS_TRAP(sysTrapDmSetDatabaseInfo); + +Err DmDatabaseSize(UInt cardNo, LocalID dbID, ULongPtr numRecordsP, + ULongPtr totalBytesP, ULongPtr dataBytesP) + SYS_TRAP(sysTrapDmDatabaseSize); + + +// This routine can be used to prevent a database from being deleted (by passing +// true for 'protect'). It will increment the protect count if 'protect' is true +// and decrement it if 'protect' is false. This is used by code that wants to +// keep a particular record or resource in a database locked down but doesn't +// want to keep the database open. This information is keep in the dynamic heap so +// all databases are "unprotected" at system reset. +Err DmDatabaseProtect(UInt cardNo, LocalID dbID, Boolean protect) + SYS_TRAP(sysTrapDmDatabaseProtect); + + +// Open Databases info +DmOpenRef DmOpenDatabase(UInt cardNo, LocalID dbID, UInt mode) + SYS_TRAP(sysTrapDmOpenDatabase); + +DmOpenRef DmOpenDatabaseByTypeCreator(ULong type, ULong creator, UInt mode) + SYS_TRAP(sysTrapDmOpenDatabaseByTypeCreator); + +Err DmCloseDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmCloseDatabase); + + +DmOpenRef DmNextOpenDatabase(DmOpenRef currentP) + SYS_TRAP(sysTrapDmNextOpenDatabase); + +Err DmOpenDatabaseInfo(DmOpenRef dbP, LocalID* dbIDP, + UIntPtr openCountP, UIntPtr modeP, UIntPtr cardNoP, + BooleanPtr resDBP) + SYS_TRAP(sysTrapDmOpenDatabaseInfo); + +LocalID DmGetAppInfoID (DmOpenRef dbP) + SYS_TRAP(sysTrapDmGetAppInfoID); + + +// Utility to unlock all records and clear busy bits +Err DmResetRecordStates(DmOpenRef dbP) + SYS_TRAP(sysTrapDmResetRecordStates); + + +// Error Query +Err DmGetLastErr(void) + SYS_TRAP(sysTrapDmGetLastErr); + + +//------------------------------------------------------------ +// Record based access routines +//------------------------------------------------------------ + +// Record Info +UInt DmNumRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumRecords); + +UInt DmNumRecordsInCategory(DmOpenRef dbP, UInt category) + SYS_TRAP(sysTrapDmNumRecordsInCategory); + +Err DmRecordInfo(DmOpenRef dbP, UInt index, + UIntPtr attrP, ULongPtr uniqueIDP, LocalID* chunkIDP) + SYS_TRAP(sysTrapDmRecordInfo); + +Err DmSetRecordInfo(DmOpenRef dbP, UInt index, + UIntPtr attrP, ULongPtr uniqueIDP) + SYS_TRAP(sysTrapDmSetRecordInfo); + + + +// Record attaching and detaching +Err DmAttachRecord(DmOpenRef dbP, UIntPtr atP, + Handle newH, Handle* oldHP) + SYS_TRAP(sysTrapDmAttachRecord); + +Err DmDetachRecord(DmOpenRef dbP, UInt index, + Handle* oldHP) + SYS_TRAP(sysTrapDmDetachRecord); + +Err DmMoveRecord(DmOpenRef dbP, UInt from, UInt to) + SYS_TRAP(sysTrapDmMoveRecord); + + + +// Record creation and deletion +VoidHand DmNewRecord(DmOpenRef dbP, UIntPtr atP, + ULong size) + SYS_TRAP(sysTrapDmNewRecord); + +Err DmRemoveRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmRemoveRecord); + +Err DmDeleteRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmDeleteRecord); + +Err DmArchiveRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmArchiveRecord); + +VoidHand DmNewHandle(DmOpenRef dbP, ULong size) + SYS_TRAP(sysTrapDmNewHandle); + +Err DmRemoveSecretRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmRemoveSecretRecords); + + +// Record viewing manipulation +Err DmFindRecordByID(DmOpenRef dbP, ULong uniqueID, UIntPtr indexP) + SYS_TRAP(sysTrapDmFindRecordByID); + +VoidHand DmQueryRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmQueryRecord); + +VoidHand DmGetRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmGetRecord); + +VoidHand DmQueryNextInCategory(DmOpenRef dbP, UIntPtr indexP, UInt category) + SYS_TRAP(sysTrapDmQueryNextInCategory); + +UInt DmPositionInCategory (DmOpenRef dbP, UInt index, UInt category) + SYS_TRAP(sysTrapDmPositionInCategory); + +Err DmSeekRecordInCategory (DmOpenRef dbP, UIntPtr indexP, Int offset, + Int direction, UInt category) + SYS_TRAP(sysTrapDmSeekRecordInCategory); + + +VoidHand DmResizeRecord(DmOpenRef dbP, UInt index, ULong newSize) + SYS_TRAP(sysTrapDmResizeRecord); + +Err DmReleaseRecord(DmOpenRef dbP, UInt index, Boolean dirty) + SYS_TRAP(sysTrapDmReleaseRecord); + +Int DmSearchRecord(VoidHand recH, DmOpenRef* dbPP) + SYS_TRAP(sysTrapDmSearchRecord); + + +// Category manipulation +Err DmMoveCategory (DmOpenRef dbP, UInt toCategory, UInt fromCategory, Boolean dirty) + SYS_TRAP(sysTrapDmMoveCategory); + +Err DmDeleteCategory (DmOpenRef dbR, UInt categoryNum) + SYS_TRAP(sysTrapDmDeleteCategory); + + +// Validation for writing +Err DmWriteCheck(VoidPtr recordP, ULong offset, ULong bytes) + SYS_TRAP(sysTrapDmWriteCheck); + +// Writing +Err DmWrite(VoidPtr recordP, ULong offset, VoidPtr srcP, ULong bytes) + SYS_TRAP(sysTrapDmWrite); + +Err DmStrCopy(VoidPtr recordP, ULong offset, CharPtr srcP) + SYS_TRAP(sysTrapDmStrCopy); + +Err DmSet(VoidPtr recordP, ULong offset, ULong bytes, Byte value) + SYS_TRAP(sysTrapDmSet); + + + + +//------------------------------------------------------------ +// Resource based access routines +//------------------------------------------------------------ + +// High level access routines +VoidHand DmGetResource(ULong type, Int id) + SYS_TRAP(sysTrapDmGetResource); + +VoidHand DmGet1Resource(ULong type, Int id) + SYS_TRAP(sysTrapDmGet1Resource); + +Err DmReleaseResource(VoidHand resourceH) + SYS_TRAP(sysTrapDmReleaseResource); + +VoidHand DmResizeResource(VoidHand resourceH, ULong newSize) + SYS_TRAP(sysTrapDmResizeResource); + + +// Searching resource databases +DmOpenRef DmNextOpenResDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNextOpenResDatabase); + +Int DmFindResourceType(DmOpenRef dbP, ULong resType, Int typeIndex) + SYS_TRAP(sysTrapDmFindResourceType); + +Int DmFindResource(DmOpenRef dbP, ULong resType, Int resID, + VoidHand resH) + SYS_TRAP(sysTrapDmFindResource); + +Int DmSearchResource(ULong resType, Int resID, + VoidHand resH, DmOpenRef* dbPP) + SYS_TRAP(sysTrapDmSearchResource); + + +// Resource Info +UInt DmNumResources(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumResources); + +Err DmResourceInfo(DmOpenRef dbP, Int index, + ULongPtr resTypeP, IntPtr resIDP, + LocalID* chunkLocalIDP) + SYS_TRAP(sysTrapDmResourceInfo); + +Err DmSetResourceInfo(DmOpenRef dbP, Int index, + ULongPtr resTypeP, IntPtr resIDP) + SYS_TRAP(sysTrapDmSetResourceInfo); + + + +// Resource attaching and detaching +Err DmAttachResource(DmOpenRef dbP, VoidHand newH, + ULong resType, Int resID) + SYS_TRAP(sysTrapDmAttachResource); + +Err DmDetachResource(DmOpenRef dbP, Int index, + VoidHand* oldHP) + SYS_TRAP(sysTrapDmDetachResource); + + + +// Resource creation and deletion +VoidHand DmNewResource(DmOpenRef dbP, ULong resType, Int resID, + ULong size) + SYS_TRAP(sysTrapDmNewResource); + +Err DmRemoveResource(DmOpenRef dbP, Int index) + SYS_TRAP(sysTrapDmRemoveResource); + + + +// Resource manipulation +VoidHand DmGetResourceIndex(DmOpenRef dbP, Int index) + SYS_TRAP(sysTrapDmGetResourceIndex); + + + +// Record sorting +Err DmQuickSort(const DmOpenRef dbP, DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmQuickSort); + +Err DmInsertionSort (const DmOpenRef dbR, DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmInsertionSort); + +UInt DmFindSortPosition(DmOpenRef dbP, VoidPtr newRecord, + SortRecordInfoPtr newRecordInfo, DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmFindSortPosition); + +UInt DmFindSortPositionV10(DmOpenRef dbP, VoidPtr newRecord, + DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmFindSortPositionV10); + +#ifdef __cplusplus +} +#endif + +#endif // __DATAMGR_H__ + diff --git a/sdk-2/include/Core/System/DataPrv.h b/sdk-2/include/Core/System/DataPrv.h new file mode 100644 index 0000000..0947a3c --- /dev/null +++ b/sdk-2/include/Core/System/DataPrv.h @@ -0,0 +1,227 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DataPrv.h + * + * Description: + * Private Header for the Data Manager + * + * History: + * 8/10/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __DATAPRV_H__ +#define __DATAPRV_H__ + + + +/************************************************************ + * Structure of a Record entry + *************************************************************/ +typedef struct { + LocalID localChunkID; // local chunkID of a record + Byte attributes; // record attributes; + Byte uniqueID[3]; // unique ID of record; should + // not be 0 for a legal record. + } RecordEntryType; +typedef RecordEntryType* RecordEntryPtr; + + + +/************************************************************ + * Structure of a Resource entry + *************************************************************/ +typedef struct { + DWord type; // resource type + Word id; // resource id + LocalID localChunkID; // resource data chunk ID + } RsrcEntryType; +typedef RsrcEntryType* RsrcEntryPtr; + +// Attributes field +#define dmRsrcAttrUnused 0x0000 // to be defined... + + + +/************************************************************ + * Structure of a record list extension. This is used if all + * the database record/resource entries of a database can't fit into + * the database header. + *************************************************************/ +typedef struct { + LocalID nextRecordListID; // local chunkID of next list + Word numRecords; // number of records in this list + Word firstEntry; // array of Record/Rsrc entries + // starts here + } RecordListType; +typedef RecordListType* RecordListPtr; + + + + +/************************************************************ + * Structure of a Database Header + *************************************************************/ +typedef struct { + Byte name[dmDBNameLength]; // name of database + Word attributes; // database attributes + Word version; // version of database + + DWord creationDate; // creation date of database + DWord modificationDate; // latest modification date + DWord lastBackupDate; // latest backup date + DWord modificationNumber; // modification number of database + + LocalID appInfoID; // application specific info + LocalID sortInfoID; // app specific sorting info + + DWord type; // database type + DWord creator; // database creator + + DWord uniqueIDSeed; // used to generate unique IDs. + // Note that only the low order + // 3 bytes of this is used (in + // RecordEntryType.uniqueID). + // We are keeping 4 bytes for + // alignment purposes. + + RecordListType recordList; // first record list + } DatabaseHdrType; + +typedef DatabaseHdrType* DatabaseHdrPtr; +typedef DatabaseHdrPtr* DatabaseHdrHand; + + + + + +/************************************************************ + * Directory of all available databases - maintained by the + * Database Manager. This directory also includes resource + * databases. There is one of these directories for each store + * (either RAM or ROM store) in a memory card. + *************************************************************/ +typedef struct { + LocalID nextDatabaseListID; // continuation list, if any + Word numDatabases; // # of database ID's in this list + LocalID databaseID[1]; // ChunkID of each Database + } DatabaseDirType; + +typedef DatabaseDirType* DatabaseDirPtr; + + + + +/************************************************************ + * This structure is used to hold information on an open database + * It gets allocated as a non-movable chunk in the dynamic heap + * when a database is opened and caches database information that + * helps speed up performance. + *************************************************************/ +typedef struct { + VoidPtr next; // ptr to next access structure + UInt openCount; // incremented every time it's opened + ULong ownerTaskID; // taskID of owner + UInt exclusive : 1; // true if opened with exclusive access + UInt writeAccess : 1; // true if opened with write access + UInt resDB : 1; // true if resource database + LocalID hdrID; // local ID of database header + DatabaseHdrHand hdrH; // Database header handle + DatabaseHdrPtr hdrP; // Database header ptr for faster access + UInt cardNo; // card number of database + UInt numRecords; // cached here for better performance + Ptr hdrMasterP; // master ptr to header if ROM based + Ptr* handleTableP; // pointer to block of ROM handles + } DmOpenInfoType; + +typedef DmOpenInfoType* DmOpenInfoPtr; + + + +/************************************************************ + * This structure is used to hold client specific information for + * an open database. There is one of these allocated every time + * a database is opened, even if it's already open. This structure + * holds the open mode of the client and a pointer to the DmOpenInfoType + * of the database which contains the common database info for all + * clients. The SysAppInfoPtr, referenced off of the current A5, + * has a pointer to the first DmAccessType in the linked list. + *************************************************************/ +typedef struct DmAccessType { + struct DmAccessType* next; // ptr to next access structure + UInt mode; // mode it was opened in + DmOpenInfoPtr openP; // ptr to DmOpenInfoType for database + } DmAccessType; + +typedef DmAccessType* DmAccessPtr; + + + +/************************************************************ + * This structure is used to hold the results of a search + * in DmGetNextDatabaseByTypeCreator. It is the "real" structure + * of the generic type DmSearchStateType used by applications. + *************************************************************/ +typedef struct { + Int index; + UInt relIndex; + SByte cardNo; + SByte storeNo; + UInt storeEntries; + UInt storeStartIndex; + LocalID dirID; + } DmPrvSearchStateType; +typedef DmPrvSearchStateType* DmPrvSearchStatePtr; + + +/************************************************************ + * This structure is used to keep track of protected databases. These + * are databases which have been protected through the DmDatabaseProtect() + * call. A handle to an array of these structures is stored in the + * low memory global GDmProtectListH. The number of entries in the array + * must be calculated by taking the size of the handle and dividing + * by sizeof (DmProtectEntryType) + *************************************************************/ +typedef struct { + Byte protectCount; + Byte cardNo; + LocalID dbID; + } DmProtectEntryType, *DmProtectEntryPtr; + + + +/************************************************************ + * The owner ID of chunks allocated by the Database Manager + *************************************************************/ +#define dmDynOwnerID 0x00 // Dynamic heap chunks +#define dmMgrOwnerID 0x01 // Management chunks +#define dmRecOwnerID 0x02 // Record chunks +#define dmOrphanOwnerID 0x03 // Orphaned record chunks + + +/************************************************************ + * Private Data Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err DmMoveOpenDBContext(DmAccessPtr* listHeadP, DmAccessPtr dbP) + SYS_TRAP(sysTrapDmMoveOpenDBContext); + + + +#ifdef __cplusplus +} +#endif + + +#endif // __DATAPRV_H__ +#endif //NON_PORTABLE + diff --git a/sdk-2/include/Core/System/DateTime.h b/sdk-2/include/Core/System/DateTime.h new file mode 100644 index 0000000..fb83e2b --- /dev/null +++ b/sdk-2/include/Core/System/DateTime.h @@ -0,0 +1,209 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DateTime.h + * + * Description: + * Date and Time calculations + * + * History: + * 1/19/95 rsf - Created by Roger Flores + * + * + *******************************************************************/ + +#ifndef __DATETIME_H__ +#define __DATETIME_H__ + + +typedef DWord time_t; + +typedef struct { + SWord second; + SWord minute; + SWord hour; + SWord day; + SWord month; + SWord year; + SWord weekDay; // Days since Sunday (0 to 6) + } DateTimeType; + +typedef DateTimeType * DateTimePtr; + + +// This is the time format. Times are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + Byte hours; + Byte minutes; +} TimeType; + +typedef TimeType * TimePtr; + +#define noTime -1 // The entire TimeType is -1 if there isn't a time. + + +// This is the date format. Dates are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + Word year :7; // years since 1904 (MAC format) + Word month :4; + Word day :5; +} DateType; + +typedef DateType * DatePtr; + + +/************************************************************ + * Date Time Constants + *************************************************************/ + +// Maximum lengths of strings return by the date and time formating +// routine DateToAscii and TimeToAscii. +#define timeStringLength 9 +#define dateStringLength 9 +#define longDateStrLength 15 + + +#define firstYear 1904 +#define numberOfYears 128 +#define lastYear (firstYear + numberOfYears - 1) + + + +// Constants for time calculations +// Could change these from xIny to yPerX +#define minutesInSeconds 60 +#define hoursInMinutes 60 +#define hoursInSeconds (hoursInMinutes * minutesInSeconds) +#define hoursPerDay 24 +//#define daysInSeconds ((long)(hoursPerDay) * ((long)hoursInSeconds)) +#define daysInSeconds (0x15180) // cc bug + +#define daysInWeek 7 +#define daysInYear 365 +#define daysInLeapYear 366 +#define daysInFourYears (daysInLeapYear + 3 * daysInYear) + +#define monthsInYear 12 + +#define maxDays ((ULong) numberOfYears / 4 * daysInFourYears - 1) +#define maxSeconds ((ULong) maxDays * daysInSeconds) +#define maxTime 0x + +// Values returned by DayOfWeek routine. +#define sunday 0 +#define monday 1 +#define tuesday 2 +#define wednesday 3 +#define thursday 4 +#define friday 5 +#define saturday 6 + +// Months of the year +#define january 1 +#define february 2 +#define march 3 +#define april 4 +#define may 5 +#define june 6 +#define july 7 +#define august 8 +#define september 9 +#define october 10 +#define november 11 +#define december 12 + + +// Values returned by DoyOfMonth routine. +typedef enum { + dom1stSun, dom1stMon, dom1stTue, dom1stWen, dom1stThu, dom1stFri, dom1stSat, + dom2ndSun, dom2ndMon, dom2ndTue, dom2ndWen, dom2ndThu, dom2ndFri, dom2ndSat, + dom3rdSun, dom3rdMon, dom3rdTue, dom3rdWen, dom3rdThu, dom3rdFri, dom3rdSat, + dom4thSun, dom4thMon, dom4thTue, dom4thWen, dom4thThu, dom4thFri, dom4thSat, + domLastSun, domLastMon, domLastTue, domLastWen, domLastThu, domLastFri, + domLastSat + } DayOfWeekType; + + +//************************************************************ +//* Date and Time macros +//*********************************************************** + +// Convert a date in a DateType structure to an unsigned int. + #define DateToInt(date) (*(UInt *) &date) + + +// Convert a date in a DateType structure to an unsigned int. + #define TimeToInt(time) (*(Int *) &time) + + + +//************************************************************ +//* Date Time procedures +//************************************************************ +#ifdef __cplusplus +extern "C" { +#endif + + +void TimSecondsToDateTime(ULong seconds, DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimSecondsToDateTime); + +ULong TimDateTimeToSeconds(DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimDateTimeToSeconds); + +void TimAdjust(DateTimePtr dateTimeP, Long adjustment) + SYS_TRAP(sysTrapTimAdjust); + +void TimeToAscii(Byte hours, Byte minutes, TimeFormatType timeFormat, + CharPtr pString) + SYS_TRAP(sysTrapTimeToAscii); + + + +UInt DaysInMonth(UInt month, UInt year) + SYS_TRAP(sysTrapDaysInMonth); + +UInt DayOfWeek (UInt month, UInt day, UInt year) + SYS_TRAP(sysTrapDayOfWeek); + +UInt DayOfMonth (UInt month, UInt day, UInt year) + SYS_TRAP(sysTrapDayOfMonth); + + + +// Date routines. +void DateSecondsToDate (ULong seconds, DatePtr date) + SYS_TRAP(sysTrapDateSecondsToDate); + +void DateDaysToDate (ULong days, DatePtr date) + SYS_TRAP(sysTrapDateDaysToDate); + +ULong DateToDays (DateType date) + SYS_TRAP(sysTrapDateToDays); + +void DateAdjust (DatePtr dateP, Long adjustment) + SYS_TRAP(sysTrapDateAdjust); + +void DateToAscii(Byte months, Byte days, Word years, + DateFormatType dateFormat, CharPtr pString) + SYS_TRAP(sysTrapDateToAscii); + +void DateToDOWDMFormat(Byte months, Byte days, Word years, + DateFormatType dateFormat, CharPtr pString) + SYS_TRAP(sysTrapDateToDOWDMFormat); + + +#ifdef __cplusplus +} +#endif + + +#endif //__DATETIME_H__ diff --git a/sdk-2/include/Core/System/DebugMgr.h b/sdk-2/include/Core/System/DebugMgr.h new file mode 100644 index 0000000..942615f --- /dev/null +++ b/sdk-2/include/Core/System/DebugMgr.h @@ -0,0 +1,98 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DebugMgr.h + * + * Description: + * Debugging functions + * + * History: + * 11/03/94 RM - Created by Ron Marianetti + * 5/19/97 SL - Fixed DbgBreak for other environments + * + * + *******************************************************************/ + + +#ifndef __DEBUGMGR_H__ +#define __DEBUGMGR_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +/************************************************************ + * Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Long DbgInit(Ptr spaceP, Ptr dispatchTableP[], Boolean openComm); + + +// NOTE!!! DbgBreak can NOT be written using the ONEWORD_INLINE macro +// because it must always resolve to a trap instruction even when +// USE_TRAPS is set to 0. In particular the SmallROM compiles with +// USE_TRAPS set to 0 and needs the DbgBreak to resolve as a trap +// instruction. Thus we explicitly check USE_TRAPS before using +// default ONEWORD_INLINE definition. + +#ifndef __GNUC__ +#if EMULATION_LEVEL == EMULATION_NONE + #if USE_TRAPS == 0 && defined(__MWERKS__) // for Palm SmallROM builds + void DbgBreak(void) = {m68kTrapInstr+sysDbgTrapNum}; + #elif USE_TRAPS == 0 // for others who set USE_TRAPS to 0 + void DbgBreak(void); + #else // default: fall through to ONEWORD_INLINE + void DbgBreak(void) + ONEWORD_INLINE(m68kTrapInstr+sysDbgTrapNum); + #endif +#else /* EMULATION_LEVEL */ + void DbgBreak(void); +#endif /* EMULATION_LEVEL */ + + +void DbgSrcBreak(void) + ONEWORD_INLINE(m68kTrapInstr+sysDbgTrapNum); +#else /* __GNUC__ */ + +#define DbgBreak() ONEWORD_INLINE(m68kTrapInstr+sysDbgTrapNum) +#define DbgSrcBreak() ONEWORD_INLINE(m68kTrapInstr+sysDbgTrapNum) + +#endif /* __GNUC__ */ + +void DbgSrcMessage(char* debugStr) + SYS_TRAP(sysTrapDbgSrcMessage); + +void DbgMessage(char* aStr) + SYS_TRAP(sysTrapDbgMessage); + +CharPtr DbgGetMessage(BytePtr bufferP, Long timeout) + SYS_TRAP(sysTrapDbgGetMessage); + +Err DbgCommSettings(ULongPtr baudP, ULongPtr flagsP) + SYS_TRAP(sysTrapDbgCommSettings); + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _DbgBreak \ + DC.W m68kTrapInstr+sysDbgTrapNum + + + +#endif // __DEBUGMGR_H__ + + diff --git a/sdk-2/include/Core/System/DebugPrv.h b/sdk-2/include/Core/System/DebugPrv.h new file mode 100644 index 0000000..648a0b7 --- /dev/null +++ b/sdk-2/include/Core/System/DebugPrv.h @@ -0,0 +1,351 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * DebugPrv.h + * + * Description: + * PrivatŤDebugging functions + * + * History: + * 8/10/95 RM - Created by Ron Marianetti + * + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __DEBUGPRV_H__ +#define __DEBUGPRV_H__ + + +/*********************************************************************** + * Debugger Constants + ***********************************************************************/ +#define dbgLoopsPerTick 0x0800 +#define dbgStackSize 0x0300 // DOLATER -- resize??? + +#define dbgNormalBreakpoints 5 +#define dbgTempBPIndex dbgNormalBreakpoints +#define dbgTotalBreakpoints (dbgTempBPIndex+1) + +#define dbgFlashCodeSpace sysInitStack // where we copy flash code +#define dbgFlashCodeSize 0x200 // size of flash code + +#define dbgTotalTrapBreaks 5 // up to this many trap breaks at a time + + + + +/*********************************************************************** + * Structure of Debugger Breakpoints + ***********************************************************************/ +typedef struct BreakpointType { + Ptr addr; // address of breakpoint + Boolean enabled; // true if enabled + Boolean installed; // for alignment + } BreakpointType; + + + + + +/*********************************************************************** + * Structure of Debugger Specific System Packet Type Bodies. + ***********************************************************************/ + +#define sysPktMaxNameLen 32 // Max length of a routine name + +//-------------------------------------------------------------- +// sysPktStateCmd +// - get processor state +//------------------------------------------------------------------ +// number of remote code words to send in the 'state response' packet +#define sysPktStateRspInstWords 15 + + +typedef struct SysPktStateCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktStateCmdCmdType; +typedef SysPktStateCmdCmdType* SysPktStateCmdCmdPtr; + + +// Packet Body structure for the state command response packet +typedef struct SysPktStateRspType { + _sysPktBodyCommon; // Common Body header + Boolean resetted; // true if target has just reset + Word exceptionId; // exception which caused the + // debugger to be entered. + M68KRegsType reg; // current remote registers. + Word inst[sysPktStateRspInstWords]; + // instruction buffer for + // code beginning at PC. + BreakpointType bp[dbgTotalBreakpoints]; // current breakpoints + + void* startAddr; // start address of routine + void* endAddr; // end address of routine + char name[sysPktMaxNameLen]; + // routine name (0 or more chars, + // no null), immediately + // follows the address range. + Byte trapTableRev; // rev of trap table. Used to determine + // when host's trap table cache is invalid + } SysPktStateRspType; +typedef SysPktStateRspType* SysPktStateRspPtr; + +//-------------------------------------------------------------------- +// sysPktGetRtnNameCmd +// - get routine name +//-------------------------------------------------------------------- +// The response packet body will contain start address(4 bytes), +// end address(4 bytes), followed by 0 or more bytes of the routine +// name (no null byte). +typedef struct SysPktRtnNameCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // -> address to query on + } SysPktRtnNameCmdType; +typedef SysPktRtnNameCmdType* SysPktRtnNameCmdPtr; + +typedef struct SysPktRtnNameRspType { + _sysPktBodyCommon; // Common Body header + void* address; // -> address to query on + void* startAddr; // <- start address of routine + void* endAddr; // <- end address of routine + char name[sysPktMaxNameLen]; // <- routine name, if any immediately + // follows the address range. + // The balance need not be sent. + } SysPktRtnNameRspType; +typedef SysPktRtnNameRspType* SysPktRtnNameRspPtr; + + +//-------------------------------------------------------------------- +// sysPktReadRegsCmd +// - read registers +//-------------------------------------------------------------------- +// Packet Body structure for the read regs command response packet +typedef struct SysPktReadRegsCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktReadRegsCmdType; +typedef SysPktReadRegsCmdType* SysPktReadRegsCmdPtr; + +typedef struct SysPktReadRegsRspType { + _sysPktBodyCommon; // Common Body header + //M68KRegsType reg; // <- return registers + } SysPktReadRegsRspType; +typedef SysPktReadRegsRspType* SysPktReadRegsRspPtr; + + + +//-------------------------------------------------------------------- +// sysPktWriteRegsCmd +// - write registers +//-------------------------------------------------------------------- +// Packet Body structure for the write regs command packet +typedef struct SysPktWriteRegsCmdType { + _sysPktBodyCommon; // Common Body header + M68KRegsType reg; // -> registers to write + } SysPktWriteRegsCmdType; +typedef SysPktWriteRegsCmdType* SysPktWriteRegsCmdPtr; + + +// Packet Body structure for the write regs command packet +typedef struct SysPktWriteRegsRspType { + _sysPktBodyCommon; // Common Body header + } SysPktWriteRegsRspType; +typedef SysPktWriteRegsRspType* SysPktWriteRegsRspPtr; + + +//-------------------------------------------------------------------- +// sysPktContinueCmd +// - continue +//-------------------------------------------------------------------- +// Packet Body structure for the continue command packet +typedef struct SysPktContinueCmdType { + _sysPktBodyCommon; // Common Body header + M68KRegsType regs; // registers + Boolean stepSpy; // set true to do step spy + DWord ssAddr; // step spy address + DWord ssCount; // # of bytes + DWord ssCheckSum; // checksum + } SysPktContinueCmdType; + +typedef SysPktContinueCmdType* SysPktContinueCmdPtr; + + +//-------------------------------------------------------------------- +// sysPktGetBreakPointsCmd +// +// - Get breakpoints +//-------------------------------------------------------------------- +typedef struct SysPktGetBreakpointsCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktGetBreakpointsCmdType; +typedef SysPktGetBreakpointsCmdType* SysPktGetBreakpointsCmdPtr; + +typedef struct SysPktGetBreakpointsRspType { + _sysPktBodyCommon; // Common Body header + //BreakpointType bp[dbgTotalBreakpoints]; + } SysPktGetBreakpointsRspType; +typedef SysPktGetBreakpointsRspType* SysPktGetBreakpointsRspPtr; + + +//-------------------------------------------------------------------- +// sysPktSetBreakPointsCmd +// +// - Set breakpoints +//-------------------------------------------------------------------- +typedef struct SysPktSetBreakpointsCmdType { + _sysPktBodyCommon; // Common Body header + //BreakpointType bp[dbgTotalBreakpoints]; + } SysPktSetBreakpointsCmdType; +typedef SysPktSetBreakpointsCmdType* SysPktSetBreakpointsCmdPtr; + +typedef struct SysPktSetBreakpointsRspType { + _sysPktBodyCommon; // Common Body header + } SysPktSetBreakpointsRspType; +typedef SysPktSetBreakpointsRspType* SysPktSetBreakpointsRspPtr; + + + + +//-------------------------------------------------------------------- +// sysPktDbgBreakToggleCmd +// - Enable/Disable DbgBreak's command +//-------------------------------------------------------------------- +typedef struct SysPktDbgBreakToggleCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktDbgBreakToggleCmdType; +typedef SysPktDbgBreakToggleCmdType* SysPktDbgBreakToggleCmdPtr; + +typedef struct SysPktDbgBreakToggleRspType { + _sysPktBodyCommon; // Common Body header + Boolean newState; + } SysPktDbgBreakToggleRspType; +typedef SysPktDbgBreakToggleRspType* SysPktDbgBreakToggleRspPtr; + + +//-------------------------------------------------------------------- +// sysPktFlashCmd +// Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns info on the flash in: +// manuf - manufacturer code +// device - device code +// width - width of FLASH +// ramSpaceP - buffer in RAM for flash sector +//-------------------------------------------------------------------- +typedef struct SysPktFlashWriteType { + _sysPktBodyCommon; // Common Body header + Word numBytes; // -> # of bytes in sector + DWord flashBase; // -> base address of FLASH, or 0 for default + DWord srcAddr; // -> source address of new data + DWord dstAddr; // -> dest address in flash memory + Byte manuf; // <- manufacturer + Byte device; // <- device + Byte width; // <- Flash memory width + Byte filler; + DWord ramSpaceP; // <- available space in RAM for sector + } SysPktFlashWriteType; +typedef SysPktFlashWriteType* SysPktFlashWritePtr; + + +//-------------------------------------------------------------------- +// sysPktGetTrapBreaksCmd +// +// - Get Trap Breaks +//-------------------------------------------------------------------- +typedef struct SysPktGetTrapBreaksCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktGetTrapBreaksCmdType; +typedef SysPktGetTrapBreaksCmdType* SysPktGetTrapBreaksCmdPtr; + +typedef struct SysPktGetTrapBreaksRspType { + _sysPktBodyCommon; // Common Body header + //Word trapBP[dbgTotalTrapBreaks]; + } SysPktGetTrapBreaksRspType; +typedef SysPktGetTrapBreaksRspType* SysPktGetTrapBreaksRspPtr; + + +//-------------------------------------------------------------------- +// sysPktSetTrapBreaksCmd +// +// - Set Trap Breaks +//-------------------------------------------------------------------- +typedef struct SysPktSetTrapBreaksCmdType { + _sysPktBodyCommon; // Common Body header + //Word trapBP[dbgTotalTrapBreaks]; + } SysPktSetTrapBreaksCmdType; +typedef SysPktSetTrapBreaksCmdType* SysPktSetTrapBreaksCmdPtr; + +typedef struct SysPktSetTrapBreaksRspType { + _sysPktBodyCommon; // Common Body header + } SysPktSetTrapBreaksRspType; +typedef SysPktSetTrapBreaksRspType* SysPktSetTrapBreaksRspPtr; + + + + + +// The following indicates how much space in debugger globals we've reserved for +// the SerialLibrary globals for the Debugger. Reserve 8 extra bytes for +// patching. +#define dbgSerRsvGlobalsSize 32 + + + + +/*********************************************************************** + * Stucture of Debugger Globals + ***********************************************************************/ +struct DbgGlobalsType { + // Saved registers + M68KRegsType reg; + + // Breakpoints and saved opcodes behind each one + Boolean romBP; + Boolean stepOverBP; // true if single-stepping over a BP + BreakpointType bp[dbgTotalBreakpoints]; + Word bpOpcode[dbgTotalBreakpoints]; + + // Current trap breaks + Word trapBreak[dbgTotalTrapBreaks]; + DWord oldDispatcher; // saved trap dispatcher + Boolean breakingOnATrap; // set by debugger trap dispatcher + + // Mode settings + Boolean ignoreDbgBreaks; // if true, ignore DbgBreak's + Boolean commOpened; // if true, comm library and socket have been + // opened. + + // Step spy support + Boolean stepSpy; // true if step spying. + DWord ssAddr; // address to step spy on + DWord ssValue; // saved value + + // Exception type + Word excType; // why we entered debugger + Byte reEntered; // true if we re-entered + Byte firstEntrance; // true first time we enter debugger + + // Debugger Serial Library globals + Byte serGlobals[dbgSerRsvGlobalsSize]; // Debugger Serial globals + + // Saved bus error exception info + DWord busErrStack[2]; // first 2 long words of bus error stack frame + + // Debugger Stack + Byte stack[dbgStackSize]; // Debugger stack + Word stackEnd; // End of stack + + }; + +typedef struct DbgGlobalsType DbgGlobalsType; + +typedef DbgGlobalsType* DbgGlobalsPtr; + + + +#endif // __DEBUGMGR_H__ +#endif // NON_PORTABLE + diff --git a/sdk-2/include/Core/System/EmuStubs.h b/sdk-2/include/Core/System/EmuStubs.h new file mode 100644 index 0000000..296af09 --- /dev/null +++ b/sdk-2/include/Core/System/EmuStubs.h @@ -0,0 +1,134 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * EmuStubs.h + * + * Description: + * Stub routines used only when emulating. + * + * Note: All of these routines must be declared using generic + * C types so that this header file can be included in both + * Pilot source code and Mac or PC source code. + * + * The module that contains these routines "MacStubs.c" or + * "PCStubs.c" is the glue between the Pilot routines and the OS and + * does not include any Pilot headers. + * + * History: + * 11/03/94 RM - Created by Ron Marianetti + * + * + *******************************************************************/ + + +#ifndef __EMUSTUBS_H__ +#define __EMUSTUBS_H__ + +typedef enum + { + emuSendNoEvent, + emuSendNilEvent, + emuSendPenOrKeyEvent + } StubNilEventIsPendingResults; + +/************************************************************ + * Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Screen Driver Stubs +void StubDrawNotify(void* srcWinP, short scrRowBytes, short scrDepth, + short fromX, short fromY, short width, short height); + +// Console stubs +int StubConPutS(char* cstring); +int StubConGetS(char* cstring); + +// Debugger Stubs +void StubDbgSrcBreak(void); +void StubDbgSrcMessage(char* debugStr); +void StubDbgBreak(void); +void StubDbgMessage(char* aStr); + +// Time Manager Stubs +unsigned long StubTimGetTicks(void); +unsigned long StubTimGetSeconds(void); +void StubTimSetSeconds(unsigned long seconds); + + +// Event Manager Stubs +void StubProcessMacEvents(long timeout); +void StubEnqueuePenPosition(void); +void StubFlushEvents (void); + + +// Emulator Stubs +StubNilEventIsPendingResults StubNilEventIsPending(); + + +// Error Manager stubs +void StubErrDisplayFileLineMsg(char* filename, unsigned int lineNo, char* msg); + + +// Sound Manager stubs +#define stubSndErrBadParam -1 +#define stubSndErrBadChannel -2 + +#define stubSndCmdFreqDurationAmp 1 + +short StubSndCommand(void* channelP, unsigned short defAmp, + unsigned short cmd, unsigned long param1, + unsigned short param2, unsigned short param3, + char noWait); + + +// Alarm Manager stubs +short StubAlmSetAlarm(unsigned long alarmType, + long (*callback)(), unsigned long alarmTime); +unsigned long StubAlmGetAlarm(unsigned long alarmType); +void StubAlmDisplayAlarm(void); + + +// Emulator Utility Functions +void StubEventTrace(void *eventP); // Pilot Emulator Event Trace call + + +// Resource Utility Functions +void** StubGet1Resource(unsigned long resType, int resID); + +// Graphics Utility functions. +void StubInitCTable(void* cTableP, unsigned int depth); + +// Utility functions +unsigned int StubRandom(void); +short StubShowStopAlert(short alertID); +void StubTerminateApp(void); + + +// Key Manager stubs +unsigned long StubKeyCurrentState(void); + +#define stubKeyBitPower 0x0001 +#define stubKeyBitPageUp 0x0002 +#define stubKeyBitPageDown 0x0004 +#define stubKeyBitHard1 0x0008 +#define stubKeyBitHard2 0x0010 +#define stubKeyBitHard3 0x0020 +#define stubKeyBitHard4 0x0040 + +char StubCancelKey(void); + +#ifdef __cplusplus +} +#endif + + +#endif // __EMUSTUBS_H__ + + diff --git a/sdk-2/include/Core/System/Encrypt.h b/sdk-2/include/Core/System/Encrypt.h new file mode 100644 index 0000000..457b33c --- /dev/null +++ b/sdk-2/include/Core/System/Encrypt.h @@ -0,0 +1,58 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Encrypt.h + * + * Description: + * Equates for encryption/digestion routines in pilot + * + * History: + * 7/31/96 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __ENCRYPT_H__ +#define __ENCRYPT_H__ + + + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Perform reversible encryption or decryption of 8 byte string in +// srcP using 8 byte key keyP. Place 8 byte result in dstP. +Err EncDES(BytePtr srcP, BytePtr keyP, BytePtr dstP, Boolean encrypt) + SYS_TRAP(sysTrapEncDES); + + +// Digest a string of bytes and produce a 128 bit result using +// the MD4 algorithm. +Err EncDigestMD4(BytePtr strP, Word strLen, Byte digestP[16]) + SYS_TRAP(sysTrapEncDigestMD4); + + +// Digest a string of bytes and produce a 128 bit result using +// the MD5 algorithm. +Err EncDigestMD5(BytePtr strP, Word strLen, Byte digestP[16]) + SYS_TRAP(sysTrapEncDigestMD5); + + + +#ifdef __cplusplus +} +#endif + + + +#endif //__ENCRYPT_H__ + diff --git a/sdk-2/include/Core/System/ErrorMgr.h b/sdk-2/include/Core/System/ErrorMgr.h new file mode 100644 index 0000000..2b64322 --- /dev/null +++ b/sdk-2/include/Core/System/ErrorMgr.h @@ -0,0 +1,261 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * ErrorMgr.h + * + * Description: + * Include file for Error Management + * + * History: + * 10/25/94 RM - Created by Ron Marianetti + * + *----------------------------------------------------------------------- + * Exception Handling + * + * This unit implements an exception handling mechanism that is similar + * to "real" C++ Exceptions. Our Exceptions are untyped, and there + * must be one and only one Catch block for each Try block. + * + * Try/Catch Syntax: + * + * ErrTry { + * // Do something which may fail. + * // Call ErrThrow() to signal failure and force jump + * // to the following Catch block. + * } + * + * ErrCatch(inErr) { + * // Recover or cleanup after a failure in the above Try block. + * // "inErr" is an ExceptionCode identifying the reason + * // for the failure. + * + * // You may call Throw() if you want to jump out to + * // the next Catch block. + * + * // The code in this Catch block does not execute if + * // the above Try block completes without a Throw. + * + * } ErrEndCatch + * + * You must structure your code exactly as above. You can't have a + * ErrTry { } without a ErrCatch { } ErrEndCatch, or vice versa. + * + * + * ErrThrow + * + * To signal failure, call ErrThrow() from within a Try block. The + * Throw can occur anywhere in the Try block, even within functions + * called from the Try block. A ErrThrow() will jump execution to the + * start of the nearest Catch block, even across function calls. + * Destructors for stack-based objects which go out of scope as + * a result of the ErrThrow() are called. + * + * You can call ErrThrow() from within a Catch block to "rethrow" + * the exception to the next nearest Catch block. + * + * + * Exception Codes + * + * An ExceptionCode is a 32-bit number. You will normally use + * Pilot error codes, which are 16-bit numbers. This allows + * plently of room for defining codes for your own kinds of errors. + * + * + * Limitations + * + * Try/Catch and Throw are based on setjmp/longjmp. At the + * beginning of a Try block, setjmp saves the machine registers. + * Throw calls longjmp, which restores the registers and jumps + * to the beginning of the Catch block. Therefore, any changes + * in the Try block to variables stored in registers will not + * be retained when entering the Catch block. + * + * The solution is to declare variables that you want to use + * in both the Try and Catch blocks as "volatile". For example: + * + * volatile long x = 1; // Declare volatile local variable + * ErrTry { + * x = 100; // Set local variable in Try + * ErrThrow(-1); + * } + * + * ErrCatch(inErr) { + * if (x > 1) { // Use local variable in Catch + * SysBeep(1); + * } + * } ErrEndCatch + * + * + *******************************************************************/ + +#ifndef __ERRORMGR_H__ +#define __ERRORMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +#if EMULATION_LEVEL != EMULATION_NONE +#include +#endif + +/************************************************************ + * Macros for Showing Errors + * + ********************************************************************/ + + +//------------------------------------------------------------ +// Full Error Checking +//------------------------------------------------------------ +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + +#define ErrFatalDisplayIf(condition, msg) \ + if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + +#define ErrNonFatalDisplayIf(condition, msg) \ + if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + + + + +//------------------------------------------------------------ +// Fatal Error Checking Only +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_PARTIAL + +#define ErrFatalDisplayIf(condition, msg) \ + if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + + + +//------------------------------------------------------------ +// No Error Checking +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_NONE + +#define ErrFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrDisplay(msg) + + +//------------------------------------------------------------ +// Not Defined... +//------------------------------------------------------------ +#else +#error ERROR: the compiler define 'ERROR_CHECK_LEVEL' must be defined! + +#endif // ERROR_CHECK_LEVEL + + + + +/******************************************************************** + * 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 + ********************************************************************/ +typedef long* ErrJumpBuf[12]; // D3-D7,PC,A2-A7 + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrJumpBuf jmp_buf +#endif + +// Structure used to store Try state. +typedef struct ErrExceptionType { + struct ErrExceptionType* nextP; // next exception type + ErrJumpBuf state; // setjmp/longjmp storage + Long err; // Error code + } ErrExceptionType; +typedef ErrExceptionType* ErrExceptionPtr; + + +// Try & Catch macros +#define ErrTry \ + { \ + ErrExceptionType _TryObject; \ + _TryObject.err = 0; \ + _TryObject.nextP = (ErrExceptionPtr)*ErrExceptionList(); \ + *ErrExceptionList() = (Ptr)&_TryObject; \ + if (ErrSetJump(_TryObject.state) == 0) { + + +#define ErrCatch(theErr) \ + *ErrExceptionList() = (Ptr)_TryObject.nextP; \ + } \ + else { \ + Long theErr = _TryObject.err; \ + *ErrExceptionList() = (Ptr)_TryObject.nextP; + + +#define ErrEndCatch \ + } \ + } + + + +/******************************************************************** + * Error Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrSetJump(buf) setjmp(buf) + #define ErrLongJump(buf,res) longjmp(buf,res) + +#else + Int ErrSetJump(ErrJumpBuf buf) + SYS_TRAP(sysTrapErrSetJump); + + void ErrLongJump(ErrJumpBuf buf, Int result) + SYS_TRAP(sysTrapErrLongJump); +#endif + +Ptr* ErrExceptionList(void) + SYS_TRAP(sysTrapErrExceptionList); + +void ErrThrow(Long err) + SYS_TRAP(sysTrapErrThrow); + +void ErrDisplayFileLineMsg(CharPtr filename, UInt lineno, CharPtr msg) + SYS_TRAP(sysTrapErrDisplayFileLineMsg); + +#ifdef __cplusplus +} +#endif + + + + +#endif // __ERRORMGR_H__ + + + + diff --git a/sdk-2/include/Core/System/FatalAlert.h b/sdk-2/include/Core/System/FatalAlert.h new file mode 100644 index 0000000..13e5c24 --- /dev/null +++ b/sdk-2/include/Core/System/FatalAlert.h @@ -0,0 +1,29 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * FatalAlert.h + * + * Description: + * This file defines the fatal alert routine. + * + * History: + * 9/12/94 art - Created by Art Lamb + * + *******************************************************************/ + +#ifndef __FATAL_ALERT_H__ +#define __FATAL_ALERT_H__ + +// Value retunred by FatalAlert +#define fatalContinue 0 +#define fatalReset 1 + +UInt SysFatalAlert (CharPtr msg) + SYS_TRAP(sysTrapSysFatalAlert); + +#endif + diff --git a/sdk-2/include/Core/System/FeatureMgr.h b/sdk-2/include/Core/System/FeatureMgr.h new file mode 100644 index 0000000..48694e4 --- /dev/null +++ b/sdk-2/include/Core/System/FeatureMgr.h @@ -0,0 +1,74 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * FeatureMgr.h + * + * Description: + * Header for the Feature Manager + * + * History: + * 11/14/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __FEATUREMGR_H__ +#define __FEATUREMGR_H__ + + +#include + + + +/************************************************************ + * Feature manager error codes + * the constant ftrErrorClass is defined in SystemMgr.h + *************************************************************/ +#define ftrErrInvalidParam (ftrErrorClass | 1) +#define ftrErrNoSuchFeature (ftrErrorClass | 2) +#define ftrErrAlreadyExists (ftrErrorClass | 3) +#define ftrErrROMBased (ftrErrorClass | 4) +#define ftrErrInternalErr (ftrErrorClass | 5) + + +/************************************************************ + * Feature Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Init the feature Manager +Err FtrInit(void) + SYS_TRAP(sysTrapFtrInit); + + +// Get a feature +Err FtrGet(DWord creator, UInt featureNum, DWordPtr valueP) + SYS_TRAP(sysTrapFtrGet); + +// Set/Create a feature. +Err FtrSet(DWord creator, UInt featureNum, DWord newValue) + SYS_TRAP(sysTrapFtrSet); + +// Unregister a feature +Err FtrUnregister(DWord creator, UInt featureNum) + SYS_TRAP(sysTrapFtrUnregister); + +// Get a feature by index +Err FtrGetByIndex(UInt index, Boolean romTable, + DWordPtr creatorP, UIntPtr numP, DWordPtr valueP) + SYS_TRAP(sysTrapFtrGetByIndex); + + + +#ifdef __cplusplus +} +#endif + +#endif // __FEATUREMGR_H__ + diff --git a/sdk-2/include/Core/System/FeaturePrv.h b/sdk-2/include/Core/System/FeaturePrv.h new file mode 100644 index 0000000..c7dd049 --- /dev/null +++ b/sdk-2/include/Core/System/FeaturePrv.h @@ -0,0 +1,77 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * FeaturePrv.h + * + * Description: + * Private Header for the Feature Manager + * + * History: + * 8/9/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __FEATUREPRV_H__ +#define __FEATUREPRV_H__ + + + + +/************************************************************ + * Structure of a Feature Table + *************************************************************/ +typedef struct FtrFeatureType { + UInt num; // feature number + DWord value; // feature value + } FtrFeatureType; +typedef FtrFeatureType* FtrFeaturePtr; + +typedef struct FtrCreatorType { + DWord creator; // feature creator + UInt numEntries; // # of entries + FtrFeatureType feature[1]; // variable size array of Features + } FtrCreatorType; +typedef FtrCreatorType* FtrCreatorPtr; + +typedef struct FtrTableType { + UInt numEntries; // # of entries + FtrCreatorType creator[1]; // var. size array of Creators + } FtrTableType; +typedef FtrTableType* FtrTablePtr; +typedef FtrTablePtr* FtrTableHand; + + +/************************************************************ + * Structure of a Feature Manager Globals + *************************************************************/ +typedef struct FtrGlobalsType { + FtrTableHand romTableH; // ROM table of features + FtrTableHand ramTableH; // RAM table of features + } FtrGlobalsType; +typedef FtrGlobalsType* FtrGlobalsPtr; + + + +/************************************************************ + * Private structures + *************************************************************/ +// This structure created for temporary use within calls +typedef struct FtrCacheType { + FtrTableHand romTableH; // ROM table of features + FtrTableHand ramTableH; // RAM table of features + FtrTablePtr romTableP; + FtrTablePtr ramTableP; + } FtrCacheType; +typedef FtrCacheType* FtrCachePtr; + + + + + +#endif // __FEATUREPRV_H__ +#endif // NON_PORTABLE diff --git a/sdk-2/include/Core/System/FloatMgr.h b/sdk-2/include/Core/System/FloatMgr.h new file mode 100644 index 0000000..7365b64 --- /dev/null +++ b/sdk-2/include/Core/System/FloatMgr.h @@ -0,0 +1,104 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * FloatMgr.h + * + * Description: + * Floating point routines + * + * History: + * 3/9/95 - Created by Ron Marianetti + * + *******************************************************************/ + + +#ifndef __FLOATMGR_H__ +#define __FLOATMGR_H__ + +#include + +/************************************************************************ + * Constants + ***********************************************************************/ +#define fMaxLong ((Long)0x7FFFFFFF) +#define fMinLong ((Long)0x80000000) + + +/************************************************************************ + * Floating point type + * An exponent of kExpInf represents infinity + ***********************************************************************/ +typedef struct { + DWord man; // unsigned 32 bit + SWord exp; // signed 16 bit + SByte sign; // +/- 1 + } FloatType; +#define kExpInf 16000 + + + +/******************************************************************* + * Floating pointer Library Errors + * The constant fplErrorClass is defined in SystemMgr.h + *******************************************************************/ +#define fplErrOutOfRange (fplErrorClass | 1) + + +/************************************************************ + * Floating point manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err FplInit(void) + SYS_TRAP(sysTrapFplInit); + +void FplFree(void) + SYS_TRAP(sysTrapFplFree); + +Err FplFToA(FloatType a, char* s) + SYS_TRAP(sysTrapFplFToA); + +FloatType FplAToF(char* s) + SYS_TRAP(sysTrapFplAToF); + +Err FplBase10Info(FloatType a, ULong* mantissaP, Int* exponentP, + Int* signP) + SYS_TRAP(sysTrapFplBase10Info); + +FloatType FplLongToFloat(Long x) + SYS_TRAP(sysTrapFplLongToFloat); + +Long FplFloatToLong(FloatType f) + SYS_TRAP(sysTrapFplFloatToLong); + +ULong FplFloatToULong(FloatType f) + SYS_TRAP(sysTrapFplFloatToULong); + + +FloatType FplMul(FloatType a, FloatType b) + SYS_TRAP(sysTrapFplMul); + +FloatType FplAdd(FloatType a, FloatType b) + SYS_TRAP(sysTrapFplAdd); + +FloatType FplSub(FloatType a, FloatType b) + SYS_TRAP(sysTrapFplSub); + +FloatType FplDiv(FloatType dividend, FloatType divisor) + SYS_TRAP(sysTrapFplDiv); + + +#ifdef __cplusplus +} +#endif + + +#endif //__FLOATMGR_H__ + + diff --git a/sdk-2/include/Core/System/FloatPrv.h b/sdk-2/include/Core/System/FloatPrv.h new file mode 100644 index 0000000..e9b2b24 --- /dev/null +++ b/sdk-2/include/Core/System/FloatPrv.h @@ -0,0 +1,36 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * FloatPrv.h + * + * Description: + * Private Floating point header + * + * History: + * 3/9/95 - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __FLOATPRV_H__ +#define __FLOATPRV_H__ + + +/************************************************************************ + * Structure of Floating point Library globals + ***********************************************************************/ +typedef struct { + FloatType tenPowers[200]; // 10^-99 to 10^99 + } FplGlobalsType; +typedef FplGlobalsType* FplGlobalsPtr; + + + + +#endif //__FLOATPRV_H__ +#endif // NON_PORTABLE + diff --git a/sdk-2/include/Core/System/Globals.h b/sdk-2/include/Core/System/Globals.h new file mode 100644 index 0000000..1d9f317 --- /dev/null +++ b/sdk-2/include/Core/System/Globals.h @@ -0,0 +1,342 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * globals.h + * + * Description: + * Structure definition of Pilot globals + * + * History: + * 10/26/94 RM - Created by Ron Marianetti + * 4/13/95 VMK Added Sound Manager globals + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __GLOBALS_H__ +#define __GLOBALS_H__ + +#include + +// The following indicates how much space in low memory we've reserved for +// the UI globals. The UI initialization code makes sure that we don't +// overrun this space by comparing the size of the structure UIGlobalsType +// with this constant. +#define sysUIRsvGlobalsSize 0xB0 + + + +/************************************************************ + * Structure of Fixed System Globals + *************************************************************/ +typedef struct FixedGlobalsType { + + // Memory Manager Globals + Byte memCardSlots; // number of memory card slots + Byte dbgWasEntered; // set true the first time debugger is entered + Ptr memCardInfoP; // pointer to array of CardInfoTypes stored + DWord memSemaphoreID; // Memory Manager semaphore + Word memDebugMode; // Current debug mode of Memory Manager + + // Data Manager Globals + Ptr dmOpenList; // Linked list of open databases (DmOpenInfoPtr) + + // Debugger/System Shared globals + Byte dbgInDebugger; // true if in debugger + Byte dbgTracing; // tracing in debugger + Ptr dbgGlobalsP; // pointer to dbgGlobals + Ptr dbgSerGlobalsP; // pointer to Debugger Serial globals + + + // System Manager Globals + Ptr sysAppInfoP; // pointer to SysAppInfoType for system + Ptr sysKernelDataP; // pointer to Kernel data + Ptr* sysDispatchTableP; // pointer to dispatch table + DWord sysOwnerIDsInUse; // 1 bit for each owner ID in use + Ptr sysAMXAppInfoP; // SysAppInfoType for AMX app. + DWord sysClockFreq; // processor clock frequency + DWordPtr sysHardKeyCreators; // ptr to array of App Creator types + + SWord sysBatteryCheckTimer; // # of ticks left before we check battery again + Byte sysBatteryMinThreshold; // System will shut down if battery falls below this + Byte hwrBatteryLevel; // current battery level + SWord sysNextBatteryAlertTimer; // # of ticks till next battery warning + Byte sysBatteryWarnThreshold; // If battery below this level, post low battery keyboard event + + Byte sysDispatchTableRev; // incremented every time a trap is patched. Used + // by host debugger to invalidate it's cache. + Word sysDispatchTableSize; // # of entries in dispatch table + Ptr sysLibTableP; // (SysLibTblEntryPtr) pointer to Library entries + Word sysLibTableEntries; // size of library table + Ptr sysConsoleStackChunkP; // pointer to console task stack chunk + Ptr sysUIShellAppInfoP; // AppInfoPtr for UIAppShell + + DWord sysTimerID; // TimerID of timer used for periodic system stuff + ULong sysAutoOffEvtTicks; // Ticks of last event - used to support auto-off + Word sysAutoOffSeconds; // Auto-sleep timeout in seconds. + + Long sysRandomSeed; // Random # seed + + + + // Other Manager's globals + Ptr slkGlobalsP; // pointer to serial link globals + Ptr serGlobalsP; // pointer to serial manager globals + Ptr scrGlobalsP; // pointer to screen driver globals + Ptr fplGlobalsP; // pointer to Floating Point Library globals + Ptr penGlobalsP; // Pen manager globals ptr + Ptr sysEvtMgrGlobalsP; // System Event Manager Globals + Ptr sndGlobalsP; // Sound Manager globals + Ptr timGlobalsP; // Time Manager globals + Ptr almGlobalsP; // Alarm Manager globals + Ptr ftrGlobalsP; // pointer to feature manager globals + Ptr grfGlobalsP; // pointer to Graffiti globals + Ptr keyGlobalsP; // Key manager globals + + // UI Globals + Byte uiGlobals[sysUIRsvGlobalsSize]; // Basic UI Globals + Ptr uiExtensionsP; // for future use... + + + // Globals used by UIAppShell in order to manage the launching of UI Apps. + Ptr curUIAppInfoP; // SysAppInfoPtr of current UI App + DWord nextUIAppDBID; // Database LocalID of next UI App to launch + Word nextUIAppCmd; // Cmd for next UI App + Ptr nextUIAppCmdPBP; // Cmd ParamBlock Ptr for next UI App + Byte nextUIAppCardNo; // Card number of next UI App to launch + + + // Hardware Manager Globals + SByte hwrDataWELevel; // if > 0, Data area is write enabled + Word hwrWakeUp; // Bit mask of which peripherals need to be + // enabled when system wakes + Byte hwrCPUDutyCycle; // Desired Duty cycle of CPU in 31ths. + Byte hwrPenDown; // last state of pen-down + DWord hwrCurTicks; // Current hardware tickCount - + // maintained separately from AMX ticks for performance reasons. + DWord hwrTotalRAMSize; // total RAM Size, used by HwrMemWritable + DWord hwrDozeSubTicks; // # of subTicks we've dozed for since reset + // a sub-tick is 1/4096 seconds. + + // Pad server + Ptr padGlobalsP; // PAD Server globals + + // New System globals + Byte sysResetFlags; // Reset flags sysResetFlagXXXX + Byte sysBatteryKind; // SysBatteryKind enumerated type + + // New Memory Manager global for recording minimum heap free - used for debugging only + DWord memMinDynHeapFree; // Minimum free space in dynamic heap + + + // System Preferences flags + Word sysPrefFlags; // System Pref flags: sysPrefFlagXXXX + + + // This is a pointer to the System Manager variable size globals + Ptr sysGlobalsP; // pointer to System Globals + + // Miscellaneous System flags + Word sysMiscFlags; // System Misc flags: sysMiscFlagXXX + + + //----------------------------------------------------------------------- + // New Globals added after 1.0 release... + //----------------------------------------------------------------------- + Word sysLibNet; // refnum of TCP/IP library + VoidPtr netPktFreeQ; // global needed by Net Library + + + // EventGroupID used by the System Event Manager for blocking on user input + // and by the Net Library for implementing NetLibSelect() + DWord sysEvGroupID; // AMX EventGroup ID. + + + Ptr irq3GlobalsP; // IRQ3 handler globals + + // Tick count last time we displayed a low battery warning. This is used by + // the system timer procedure in AMXHardwareTD1.c to insure that it doesn't + // display low battery warnings more than once/minute. + DWord sysLastBatteryWarning; // tickcount of last warning. + + // Checksum of exception vector area of low memory. Used when ROM built for full + // error checking to make sure no apps overwrite low memory by using null pointers. + DWord sysLowMemChecksum; // checksum of low memory. + + // Hardware rev. This is determined during bootup time. The first shipping rev + // is 1. + Word hwrHardwareRev; // hardware rev. + + + // Handle to list of protected databases + Handle dmProtectListH; // handle to array of protected + // databases (DmProtectEntryType) + // Miscellaneous hardware flags + Word hwrMiscFlags; // Hardware Misc Flags: hwrMiscFlagXXX + + // Support for profiling + DWord sysProfileRefcon; // Refcon value for profiler function + Ptr sysProfileProcP; // Profiler procedure, called if non-zero + // during tick interrupt (100/sec). + + // NewFloatMgr's MWSFPE (MetroWerks Software Floating Point Emulator) + // needs a global to keep track of its status and control. + // This global (__SoftFPSCR__) is referenced by the 68K code located at + // Pilot:Libraries:NewFloatMgr:mc68ksfpe.s + DWord flpSoftFPSCR; + + //----------------------------------------------------------------------- + // Put New globals here... + //----------------------------------------------------------------------- + // type newGlobal; + + } FixedGlobalsType; + + +/************************************************************ + * This structure defines the start of the Low Memory Area. + * The complete structure of LowMemory is defined in SystemPrv.h + * and includes this low memory header followed by some variable + * size globals that may change from rev to rev of the System Software. + * + * When emulating under Windows, this structure ends up at some random + * place in memory and the global variable GlobalsP points to it. + * + * When running in the native environment, this structure starts at + * address sysGlobalsOffset. + * + * In order to simplify the source code, macros are defined for + * accessing commonly used globals in the optimim manner for + * each environment. + *************************************************************/ +typedef struct LowMemHdrType { + //--------------------------------------------------------------------------- + // Processor exception table + //--------------------------------------------------------------------------- + M68KExcTableType vectors; // Exception vectors, + // or Card header for RAM only cards + + //--------------------------------------------------------------------------- + // System Globals + //--------------------------------------------------------------------------- + FixedGlobalsType globals; // System Globals + + } LowMemHdrType; + + + +#if EMULATION_LEVEL == EMULATION_NONE + #define PilotGlobalsP 0 +#else + extern Ptr PilotGlobalsP; // pointer to start of Memory card 0 +#endif + + + + + +/************************************************************ + * Macros for accessing globals. + * When emulating, the globals are allocated in a memory chunk and our + * global variable Card0P points to this chunk. + * In native mode, Card0P is defined to be 0 at all times. + *************************************************************/ +#define GMemCardSlots (((LowMemHdrType*)PilotGlobalsP)->globals.memCardSlots) +#define GMemCardInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP) +#define GMemSemaphoreID (((LowMemHdrType*)PilotGlobalsP)->globals.memSemaphoreID) +#define GMemDebugMode (((LowMemHdrType*)PilotGlobalsP)->globals.memDebugMode) +#define GMemMinDynHeapFree (((LowMemHdrType*)PilotGlobalsP)->globals.memMinDynHeapFree) + +#define GDmOpenList (((LowMemHdrType*)PilotGlobalsP)->globals.dmOpenList) +#define GDmProtectListH (((LowMemHdrType*)PilotGlobalsP)->globals.dmProtectListH) + +#define GDbgWasEntered (((LowMemHdrType*)PilotGlobalsP)->globals.dbgWasEntered) +#define GDbgInDebugger (((LowMemHdrType*)PilotGlobalsP)->globals.dbgInDebugger) +#define GDbgTracing (((LowMemHdrType*)PilotGlobalsP)->globals.dbgTracing) +#define GDbgGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.dbgGlobalsP) + +#define GSysAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysAppInfoP) +#define GSysKernelDataP (((LowMemHdrType*)PilotGlobalsP)->globals.sysKernelDataP) +#define GSysDispatchTableP (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableP) +#define GSysDispatchTableSize (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableSize) +#define GSysDispatchTableRev (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableRev) +#define GSysOwnerIDsInUse (((LowMemHdrType*)PilotGlobalsP)->globals.sysOwnerIDsInUse) +#define GSysAMXAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysAMXAppInfoP) +#define GSysClockFreq (((LowMemHdrType*)PilotGlobalsP)->globals.sysClockFreq) +#define GSysHardKeyCreators (((LowMemHdrType*)PilotGlobalsP)->globals.sysHardKeyCreators) +#define GSysNextBatteryAlertTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysNextBatteryAlertTimer) +#define GSysBatteryCheckTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryCheckTimer) +#define GSysBatteryWarnThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryWarnThreshold) +#define GHwrBatteryLevel (((LowMemHdrType*)PilotGlobalsP)->globals.hwrBatteryLevel) +#define GSysBatteryMinThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryMinThreshold) +#define GSysBatteryKind (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryKind) +#define GSysConsoleStackChunkP (((LowMemHdrType*)PilotGlobalsP)->globals.sysConsoleStackChunkP) +#define GSysUIShellAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysUIShellAppInfoP) +#define GSysTimerID (((LowMemHdrType*)PilotGlobalsP)->globals.sysTimerID) +#define GSysAutoOffEvtTicks (((LowMemHdrType*)PilotGlobalsP)->globals.sysAutoOffEvtTicks) +#define GSysAutoOffSeconds (((LowMemHdrType*)PilotGlobalsP)->globals.sysAutoOffSeconds) +#define GSysRandomSeed (((LowMemHdrType*)PilotGlobalsP)->globals.sysRandomSeed) +#define GSysResetFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysResetFlags) +#define GSysPrefFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysPrefFlags) +#define GSysMiscFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysMiscFlags) +#define GSysGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysGlobalsP) +#define GSysLibNet (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibNet) +#define GSysEvGroupID (((LowMemHdrType*)PilotGlobalsP)->globals.sysEvGroupID) +#define GSysLastBatteryWarning (((LowMemHdrType*)PilotGlobalsP)->globals.sysLastBatteryWarning) +#define GSysLowMemChecksum (((LowMemHdrType*)PilotGlobalsP)->globals.sysLowMemChecksum) +#define GSysProfileRefcon (((LowMemHdrType*)PilotGlobalsP)->globals.sysProfileRefcon) +#define GSysProfileProcP (((LowMemHdrType*)PilotGlobalsP)->globals.sysProfileProcP) + +#define GNetPktFreeQ (((LowMemHdrType*)PilotGlobalsP)->globals.netPktFreeQ) + + +#define GSlkGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.slkGlobalsP) +#define GSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.serGlobalsP) +#define GSer681GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq3GlobalsP) +#define GScrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.scrGlobalsP) +#define GFplGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.fplGlobalsP) +#define GPenGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.penGlobalsP) +#define GSysEvtMgrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysEvtMgrGlobalsP) +#define GSndGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sndGlobalsP) +#define GTimGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.timGlobalsP) +#define GAlmGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.almGlobalsP) +#define GFtrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.ftrGlobalsP) +#define GGrfGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.grfGlobalsP) +#define GKeyGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.keyGlobalsP) +#define GPADGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.padGlobalsP) + +#define GUIGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.uiGlobals) + +#define GNextUIAppDBID (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppDBID) +#define GNextUIAppCardNo (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCardNo) +#define GNextUIAppCmd (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCmd) +#define GNextUIAppCmdPBP (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCmdPBP) +#define GCurUIAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.curUIAppInfoP) + +#define GHwrDataWELevel (((LowMemHdrType*)PilotGlobalsP)->globals.hwrDataWELevel) +#define GHwrWakeUp (((LowMemHdrType*)PilotGlobalsP)->globals.hwrWakeUp) +#define GHwrCPUDutyCycle (((LowMemHdrType*)PilotGlobalsP)->globals.hwrCPUDutyCycle) +#define GHwrPenDown (((LowMemHdrType*)PilotGlobalsP)->globals.hwrPenDown) +#define GHwrCurTicks (((LowMemHdrType*)PilotGlobalsP)->globals.hwrCurTicks) +#define GHwrTotalRAMSize (((LowMemHdrType*)PilotGlobalsP)->globals.hwrTotalRAMSize) +#define GHwrDozeSubTicks (((LowMemHdrType*)PilotGlobalsP)->globals.hwrDozeSubTicks) +#define GHwrHardwareRev (((LowMemHdrType*)PilotGlobalsP)->globals.hwrHardwareRev) +#define GHwrMiscFlags (((LowMemHdrType*)PilotGlobalsP)->globals.hwrMiscFlags) + +#define GSysLibTableP (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableP) +#define GSysLibTableEntries (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableEntries) +#define GDbgSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.dbgSerGlobalsP) + + +#endif //__GLOBALS_H__ + +#endif // NON_PORTABLE + + + + diff --git a/sdk-2/include/Core/System/Graffiti.h b/sdk-2/include/Core/System/Graffiti.h new file mode 100644 index 0000000..9562f5f --- /dev/null +++ b/sdk-2/include/Core/System/Graffiti.h @@ -0,0 +1,213 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Graffiti.h + * + * Description: + * Header for the Graffiti interface + * + * History: + * 6/30 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __GRAFFITI_H__ +#define __GRAFFITI_H__ + +#include + +#define grfNoShortCut 0xffff // Index which isn't a shortcut + +/*------------------------------------------------------------------------------ + * Match info structure. Returned by GrfMatch and GrfMatchGlyph + *-----------------------------------------------------------------------------*/ +typedef struct { + Byte glyphID; /* glyph ID of this match */ + Byte unCertainty; /* unCertainty of this match (0 most certain) */ + } GrfMatchType; + + +#define grfMaxMatches 4 +typedef struct { + Word numMatches; /* number of matches returned in this structure */ + GrfMatchType match[grfMaxMatches]; + } GrfMatchInfoType; +typedef GrfMatchInfoType* GrfMatchInfoPtr; + +#define grfNameLength 8 // eight letters possible (don't forget CR) +//#define grfTextLength 56 // Use + + +//---------------------------------------------------------------------------- +// Escape codes preceding special sequences in the dictionary or macros +//---------------------------------------------------------------------------- +// In dictionary or macros preceding virtual key event sequences. These are always +// 11 byte sequences that have ASCII encoded values for the ascii code, keyCode, +// and modifiers: +// grfVirtualSequence, ascii, keyCode, modifiers. +// 1 byte 4 bytes 4 bytes 2 byte +#define grfVirtualSequence 0x01 + +// In dictionary to tell us about temp shift state changes. +#define grfShiftSequence 0x02 + +// In dictionary/macros to hide special features +#define grfSpecialSequence 0x03 + +// Char indicating a seqeunce of characters to expand. +#define grfExpansionSequence '@' + +// Chars indicating what to expand into +#define expandDateChar 'D' +#define expandTimeChar 'T' +#define expandStampChar 'S' // This follows 'D' or 'T' for the sake + // of the mnemonic name. + +#define shortcutBinaryDataFlag 0x01 + + +// Determine if a string has a sequence +#define HasVirtualSequence(s) (s[0] == grfVirtualSequence) +#define HasSpecialSequence(s) (s[0] == grfSpecialSequence) +#define HasExpansionSequence(s) (s[0] == grfExpansionSequence) + + + +/*------------------------------------------------------------------------------ + * Temp shift states, returned by GrfGetState + *-----------------------------------------------------------------------------*/ +#define grfTempShiftPunctuation 1 +#define grfTempShiftExtended 2 +#define grfTempShiftUpper 3 +#define grfTempShiftLower 4 + + + +/************************************************************ + * Graffiti result codes + *************************************************************/ +#define grfErrBadParam (grfErrorClass | 1) +#define grfErrPointBufferFull (grfErrorClass | 2) +#define grfErrNoGlyphTable (grfErrorClass | 3) +#define grfErrNoDictionary (grfErrorClass | 4) +#define grfErrNoMapping (grfErrorClass | 5) +#define grfErrMacroNotFound (grfErrorClass | 6) +#define grfErrDepthTooDeep (grfErrorClass | 7) +#define grfErrMacroPtrTooSmall (grfErrorClass | 8) +#define grfErrNoMacros (grfErrorClass | 9) + +#define grfErrMacroIncomplete (grfErrorClass | 129) // (grfWarningOffset+1) +#define grfErrBranchNotFound (grfErrorClass | 130) // (grfWarningOffset+2) + + +/************************************************************ + * Graffiti interface procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err GrfInit (void) + SYS_TRAP(sysTrapGrfInit); + +Err GrfFree (void) + SYS_TRAP(sysTrapGrfFree); + +Err GrfProcessStroke(PointType* startPtP, PointType* endPtP, + Boolean upShift) + SYS_TRAP(sysTrapGrfProcessStroke); + +Err GrfFieldChange(Boolean resetState, UIntPtr characterToDelete) + SYS_TRAP(sysTrapGrfFieldChange); + +Err GrfGetState(Boolean* capsLockP, Boolean* numLockP, + WordPtr tempShiftP, Boolean* autoShiftedP) + SYS_TRAP(sysTrapGrfGetState); + +Err GrfSetState(Boolean capsLock, Boolean numLock, + Boolean upperShift) + SYS_TRAP(sysTrapGrfSetState); + + +//----------------------------------------------------------------- +// Mid Level Calls +//------------------------------------------------------------------ + +Err GrfFlushPoints (void) + SYS_TRAP(sysTrapGrfFlushPoints); + +Err GrfAddPoint (PointType* pt) + SYS_TRAP(sysTrapGrfAddPoint); + +Err GrfInitState(void) + SYS_TRAP(sysTrapGrfInitState); + +Err GrfCleanState(void) + SYS_TRAP(sysTrapGrfCleanState); + +Err GrfMatch (WordPtr flagsP, void* dataPtrP, WordPtr dataLenP, + WordPtr uncertainLenP, GrfMatchInfoPtr matchInfoP) + SYS_TRAP(sysTrapGrfMatch); + +Err GrfGetMacro(CharPtr nameP, BytePtr macroDataP, + WordPtr dataLenP) + SYS_TRAP(sysTrapGrfGetMacro); + +Err GrfGetAndExpandMacro(CharPtr nameP, BytePtr macroDataP, + WordPtr dataLenP) + SYS_TRAP(sysTrapGrfGetAndExpandMacro); + + +//----------------------------------------------------------------- +// Low Level Calls +//------------------------------------------------------------------ +Err GrfFilterPoints (void) + SYS_TRAP(sysTrapGrfFilterPoints); + +Err GrfGetNumPoints(WordPtr numPtsP) + SYS_TRAP(sysTrapGrfGetNumPoints); + +Err GrfGetPoint(Word index, PointType* pointP) + SYS_TRAP(sysTrapGrfGetPoint); + +Err GrfFindBranch(Word flags) + SYS_TRAP(sysTrapGrfFindBranch); + +Err GrfMatchGlyph (GrfMatchInfoPtr matchInfoP, + Word maxUnCertainty, Word maxMatches) + SYS_TRAP(sysTrapGrfMatchGlyph); + +Err GrfGetGlyphMapping (Word glyphID, WordPtr flagsP, + void* dataPtrP, WordPtr dataLenP, WordPtr uncertainLenP) + SYS_TRAP(sysTrapGrfGetGlyphMapping); + +Err GrfGetMacroName(Word index, CharPtr nameP) + SYS_TRAP(sysTrapGrfGetMacroName); + +Err GrfDeleteMacro(Word index) + SYS_TRAP(sysTrapGrfDeleteMacro); + +Err GrfAddMacro(CharPtr nameP, BytePtr macroDataP, + Word dataLen) + SYS_TRAP(sysTrapGrfAddMacro); + + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SYSEVTMGR_H__ + + + diff --git a/sdk-2/include/Core/System/GraffitiPrv.h b/sdk-2/include/Core/System/GraffitiPrv.h new file mode 100644 index 0000000..399a9b3 --- /dev/null +++ b/sdk-2/include/Core/System/GraffitiPrv.h @@ -0,0 +1,106 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * GraffitiPRV.h + * + * Description: + * Private Header for the Graffiti interface + * + * History: + * 6/30 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __GRAFFITIPRV_H__ +#define __GRAFFITIPRV_H__ + + + +#define DP3MachineMacintosh +#include + + +/************************************************************ + * Graffiti Constants + *************************************************************/ +// Bytes that follow the grfSpecialSequence byte in Graffiti dictionary +// or macros. These are used for special test code and debugging +#define grfSpecialToggleSplitMode 0x01 // Toggle split mode +#define grfSpecialNoAutoOff 0x02 // Disable auto-off +#define grfSpecialShowUserInfo 0x03 // Display user information +#define grfSpecialDeleteUserInfo 0x04 // Delete user name & id +#define grfSpecialSystemBuildDate 0x05 // Show System Build date +#define grfSpecialBatteryKind 0x06 // Change battery kind + +// Max # of keys returned from dictionary or macros +#define grfMaxKeys 100 + +// Resource type and ID of macros resource +#define grfMacrosResT 'macr' +#define grfMacrosResID 10000 +#define grfMacrosMinSize 10 // min size of macros resource + +// Version of Graffiti Macros database +#define grfMacrosDBVersion 0 // version word + + +// Constant used to translate internal Graffiti Warnings into Pilot error codes +#define grfWarningOffset 128 + + +/************************************************************ + * Graffiti Globals + *************************************************************/ +#define grfMaxMacroName 32 +typedef struct GrfGlobalsType { + TP3Data p3Data; + TP3DictState state; + Int uncertain; + Word glyphFlags; + Word shiftState; // temp shift state + + SWord macroNameLen; + Byte macroName[grfMaxMacroName]; + Byte lastChar; + + ULong globalsSize; + + + // Various flags + Word splitMode : 1; + Word restoreCaps : 1; + Word inMacro : 1; + Word wasAutoShifted : 1; + + // Glyph ID assigned to the up-stroke + Byte upShiftGlyphID; + + // Handle to P3 private globals + Handle globalsH; + + // Handle to template file + Handle templateH; + + // Handle to dictionary + Handle dictH; + + // Handle to macros resource + Handle macrosH; + // Database acccess pointer to macros database + DmOpenRef macrosDbP; + + } GrfGlobalsType; + +typedef GrfGlobalsType* GrfGlobalsPtr; + + +#endif //__GRAFFITIPRV_H__ +#endif // NON_PORTABLE + + + diff --git a/sdk-2/include/Core/System/GraffitiReference.h b/sdk-2/include/Core/System/GraffitiReference.h new file mode 100644 index 0000000..b7743a7 --- /dev/null +++ b/sdk-2/include/Core/System/GraffitiReference.h @@ -0,0 +1,57 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * GraffitiReference.h + * + * Description: + * This file defines the Graffiti Reference routines + * + * History: + * 6/25/96 roger - Created + * + *******************************************************************/ + + +#ifndef __GRR_H__ +#define __GRR_H__ + + + + +typedef enum + { + referenceAlpha, + referencePunc1, + referencePunc2, + referencePunc3, + referenceExtended, + referenceAccent, + referenceDefault = 0xff // based on graffiti mode (referenceAlpha) + } ReferenceType; + + +#define referenceFirst referenceAlpha +#define referenceLast referenceAccent + + +/************************************************************ + * Graffiti Reference procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +extern void SysGraffitiReferenceDialog (ReferenceType referenceType) + SYS_TRAP(sysTrapSysGraffitiReferenceDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __GRR_H__ diff --git a/sdk-2/include/Core/System/HSUtil.h b/sdk-2/include/Core/System/HSUtil.h new file mode 100644 index 0000000..7a9089d --- /dev/null +++ b/sdk-2/include/Core/System/HSUtil.h @@ -0,0 +1,86 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * HSUtil.h + * + * Description: + * HotSync utility definitions. + * + * Platform-independence data conversion macros. + * + * History: + * 7/19/96 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + +#ifndef __HS_UTIL_H__ +#define __HS_UTIL_H__ + +// Cross-map Pilot types used in common headers to Microsoft VC++ types +#ifdef _MSC_VER + typedef BYTE Byte; + typedef WORD Word; + typedef DWORD DWord; + typedef DWord ULong; + typedef void* VoidPtr; + typedef ULong* ULongPtr; + typedef Word UInt; +#endif + + +//----------------------------------------------------------- +// Platform-independence macros +//----------------------------------------------------------- + +#define HSUtilReverseWord(__theWord__) \ + ( (Word) \ + ( \ + (((Word)(__theWord__) << 8) & 0xFF00) | \ + (((Word)(__theWord__) >> 8) & 0x00FF) \ + ) \ + ) + +#define HSUtilReverseDWord(__theDWord__) \ + ( (DWord) \ + ( \ + (((DWord)(__theDWord__) << 24) & 0xFF000000L) | \ + (((DWord)(__theDWord__) << 8) & 0x00FF0000L) | \ + (((DWord)(__theDWord__) >> 8) & 0x0000FF00L) | \ + (((DWord)(__theDWord__) >> 24) & 0x000000FFL) \ + ) \ + ) + +#if ((defined(CPU_TYPE) && CPU_TYPE == CPU_68K) || defined(_MAC) || defined(_68K_) ) + #define HSUtilPilotToHostWord(__theWord__) \ + (__theWord__) + + #define HSUtilPilotToHostDWord(__theDWord__) \ + (__theDWord__) + + #define HSUtilHostToPilotWord(__theWord__) \ + (__theWord__) + + #define HSUtilHostToPilotDWord(__theDWord__) \ + (__theDWord__) + +#else // CPU_TYPE != CPU_68K + #define HSUtilPilotToHostWord(__theWord__) \ + HSUtilReverseWord(__theWord__) + + #define HSUtilPilotToHostDWord(__theDWord__) \ + HSUtilReverseDWord(__theDWord__) + + #define HSUtilHostToPilotWord(__theWord__) \ + HSUtilReverseWord(__theWord__) + + #define HSUtilHostToPilotDWord(__theDWord__) \ + HSUtilReverseDWord(__theDWord__) +#endif //CPU_TYPE == CPU_68K + + + +#endif // __HS_UTIL_H__ diff --git a/sdk-2/include/Core/System/HTALAPI.h b/sdk-2/include/Core/System/HTALAPI.h new file mode 100644 index 0000000..22e7ab2 --- /dev/null +++ b/sdk-2/include/Core/System/HTALAPI.h @@ -0,0 +1,463 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * HTALAPI.h + * + * Description: + * HotSync Transport Adaptation Layer(HTAL) library API. + * + * History: + * 7/3/96 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __HTAL_API_H__ +#define __HTAL_API_H__ + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Type and creator of HTAL Library databases + ********************************************************************/ +#pragma mark -Creator and Type- + +// Creator. Used for both the database that contains the HTAL Library and +// it's preferences database. +#define htalCreatorPAD sysFileCPADHtal // Our PAD HTAL Library creator +#define htalCreatorTCP sysFileCTCPHtal // Our TCP HTAL Library creator + +// Types. Used to identify the HTAL Library from it's prefs. +#define htalLibType sysFileTHtalLib // Our HTAL Code Resources Database type +#define htalPrefsType 'rsrc' // Our HTAL Preferences Database type + + +/************************************************************ + * HTAL result codes + * (htalErrorClass is defined in SystemMgr.h) + *************************************************************/ +#pragma mark -Result Codes- + +#define htalErrTimeOut (htalErrorClass | 1) // call timed out(INTERNAL ERROR CODE) +#define htalErrParam (htalErrorClass | 2) // invalid parameter +#define htalErrInUse (htalErrorClass | 3) // HTAL library is already in use +#define htalErrMemory (htalErrorClass | 4) // not enough memory +#define htalErrUserCan (htalErrorClass | 5) // cancelled by user +#define htalErrSizeErr (htalErrorClass | 6) // reply block is too big +#define htalErrNotConnected (htalErrorClass | 7) // lost/could not establish connection +#define htalErrNotOpen (htalErrorClass | 8) // library is not open +#define htalErrInterfaceBusy (htalErrorClass | 9) // comm interface(serial port, TCP/IP, etc.) is busy +#define htalErrCommSetup (htalErrorClass | 10) // comm setup error + +#define htalErrRemoteConnect (htalErrorClass | 11) // could not establish remote connection and error + // was already reported to the user(ie., modem dial + // failed, etc.) + +#define htalErrCommVersion (htalErrorClass | 12) // comm version is incompatible with the desktop + +#define htalErrRmtMemory (htalErrorClass | 13) // not enough memory on remote device + +#define htalErrDestHostName (htalErrorClass | 14) // invalid destination host name, or host name not + // found on the network + +#define htalErrGotTickle (htalErrorClass | 15) // INTERNAL error code indicating that a keep-alive + // tickle packet was received -- this error code + // should never be returned to the client + + +#define htalErrExtLoopback (htalErrorClass | 16) // External loopback was detected -- this error code + // is returned when an HTAL library detects that a + // loopback test is being performed. + + +//----------------------------------------------------------------------------- +// HTAL library call ID's. Each library call gets the trap number: +// htalLibTrapXXXX 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 xxxHTALDispatch.c (where xxx is PAD, TCP, etc.)!!! +//----------------------------------------------------------------------------- +#pragma mark -Traps- + +typedef enum { + htalLibTrapSetOption = sysLibTrapCustom, + htalLibTrapGetOption, + htalLibTrapControl, + htalLibTrapConnectPhase1, + htalLibTrapDisconnect, + htalLibTrapGetCommand, + htalLibTrapSendReply, + htalLibTrapCancel, + + // New Traps, re-order these later.. + htalLibTrapMaxBlockSize, + htalLibTrapVersion, + htalLibTrapAddSegmentSizes, + htalLibTrapConnectPhase2, + + htalLibTrapLast + } HtalLibTrapNumberEnum; + + + +/******************************************************************** + * HTAL Session Structures + ********************************************************************/ +#pragma mark -Session Structures- + + +//----------------------------------------------------------------------------- +// Option id's used by HtalLib/Set/Get/Option +//----------------------------------------------------------------------------- +#pragma mark ---Option Enums- + +typedef enum HtalOptEnum { + htalOptFirst = 0, + + htalOptBlockingHook, // param1P = ptr to callback func ptr; param2P = ptr to user ref value(DWord) + + htalOptEventHook, // param1P = ptr to callback func ptr; param2P = ptr to user ref value(DWord) + + htalOptMemAllocHook, // param1P = ptr to callback func ptr; param2P = ptr to user ref value(DWord) + + htalOptCmdWaitTimeOut, // param1P = ptr to command timeout seconds(Int) -1 = forever; param2P = nil + + htalOptConnMgmtEnabled, // param1P = ptr to Boolean(true = enabled,false=disabled); param2P = nil + + htalOptKeepAliveEnabled,// param1P = ptr to Boolean(true = enabled,false=disabled); param2P = nil + // keep-alive is ON by default + + // Add option id's here + htalOptMakeAsyncReqCallback,// param1P = ptr to callback func ptr; param2P = ptr to user ref value(DWord) + + + + htalOptLast + +} HtalOptEnum; + +#define htalOptFirstCustom 0xA800 + + +//----------------------------------------------------------------------------- +// Control id's used by HtalLibControl +//----------------------------------------------------------------------------- +#pragma mark ---Control Enums- + +typedef enum HtalCtlEnum { + htalCtlFirst = 0, + + htalCtlGetServiceList, // Get a list of supported services + // paramP -- ptr to array of HtalServiceEntryType (can be + // null if *(UIntPtr)paramLenP is 0) + // *paramLenP -- number of elements in array (if *paramLenP == 0, + // number of supported services is returned here) + + htalCtlPrintDebugInfo, // Print debug info to the Pilot's display + // paramP -- on entry, ptr to Word variable containing the vertical + // display offset in # of pixels where printing is to begin; + // on return, the variable is filled in with the vertical pixel + // offset where printing may continue. + // *paramLenP -- set to sizeof(Word); + + + htalCtlLAST // *KEEP THIS ENTRY LAST* + +} HtalCtlEnum; + +#define htalCtlFirstCustom 0xA800 + + +//----------------------------------------------------------------------------- +// Temporary data structures which will need to be defined elsewhere +//----------------------------------------------------------------------------- +#pragma mark ---Temporary Data Structures- + +// parameter for sysDialLaunchCmdDial +typedef struct DialLaunchCmdDialType { + DWord svcID; // service id + Boolean dontDisplayUI; // if true, the dialer must avoid UI of any kind + Byte bReserved; // reserved -- SET TO NULL! + UInt serRefNum; // serial library reference number + Err modemError; // error code returned from Modem Manager + DWord dwReserved; // reserved -- SET TO NULL! + } DialLaunchCmdDialType; +typedef DialLaunchCmdDialType* DialLaunchCmdDialPtr; + +#define dialErrPhoneSetup (appErrorClass | 1) // phone setup is not complete +#define dialErrParam (appErrorClass | 2) // invalid parameter +#define dialErrNotSupported (appErrorClass | 3) // the requested dial option is not supported +#define dialErrMemory (appErrorClass | 4) // insufficient memory +#define dialErrModem (appErrorClass | 5) // when this error is returned, look in the mdmError field + // for the cause of error +#define dialErrUserCan (appErrorClass | 6) // user cancelled + + + +//----------------------------------------------------------------------------- +// The HtalDataSegmentType structure enables the caller to +// specify the block's data in multiple non-contiguous segments. For example, when +// sending a record, DesktopLink will specify the function header, the argument wrapper, +// the fixed record info, and the record data as two or more segments(one or more segments +// for the fixed structures and one segment for the record data). In such an instance, +// it is not practical(and sometimes not possible) to allocate a single data buffer to +// contain all that information contiguously. +//----------------------------------------------------------------------------- +#pragma mark ---Data Segment Descriptor- + +typedef struct HtalDataSegmentType { + VoidPtr dataP; // ptr to segment data + DWord dwDataSize; // segment data size in bytes + Boolean wordAlign; // if true, this segments data will be sent + // at an even offset from the start of the + // block, padding the previous segment's + // data with a null byte, if necessary + } HtalDataSegmentType; + +typedef HtalDataSegmentType* HtalDataSegmentPtr; + + + +//----------------------------------------------------------------------------- +// HTAL callback function prototypes +//----------------------------------------------------------------------------- +#pragma mark ---Callback Prototypes- + + +// Prototype for the "blocking hook" callback function +typedef void HtalBlockingCallbackType(DWord userRef); +typedef HtalBlockingCallbackType* HtalBlockingCallbackPtr; + + +// Prototype for the "event notification" callback function +typedef enum HtalEventType { + htalEventDialing = 1, // dataP = ptr to dial string + htalEventWaitingForCallback, + htalEventEstablishingConnection, + htalEventDisconnecting, + htalEventAborting + } HtalEventType; +typedef ULong HtalEventCallbackType(DWord userRef, HtalEventType eventType, VoidPtr dataP); +typedef HtalEventCallbackType* HtalEventCallbackPtr; + + +// Prototype for the "memory allocation" callback function +typedef enum HtalMemAllocType { + htalMemTypeNone = 0, // command buffer could not be allocated + htalMemTypeInternalPointer, // pointer to an internal buffer(client must not attempt to free this buffer) + htalMemTypeDynamicHeapHandle, // client-allocated dynamic heap handle(client responsible for freeing) + htalMemTypeDataHeapHandle, // client-allocated data heap handle(client responsible for freeing) + htalMemTypeLast + } HtalMemAllocType; +typedef DWord HtalMemAllocCallbackType(DWord userRef, ULong size, HtalMemAllocType* memTypeP); +typedef HtalMemAllocCallbackType* HtalMemAllocCallbackPtr; + + +// Prototypes for the "request asynchronous callback" function +// THIS FUNCTION IS CALLED FROM A TIMER PROC OR FROM ANOTHER THREAD. +// IT MUST NOT ALLOCATE MEMORY OR CONSUME AN EXCESSIVE AMOUNT OF TIME. +// WHEN CALLED FROM A TIMER PROC, IT MUST NOT BLOCK!!! +// +// NULL reqDataP cancels the request. +// Returns: 0 on success +typedef Err HtalAsyncReqHandlerType(UInt refNum, VoidPtr reqDataP); +typedef HtalAsyncReqHandlerType* HtalAsyncReqHandlerPtr; + +typedef struct HtalAsyncReqParamType { + Boolean fromTimer; // true if called from timer proc + DWord userRef; // user reference value + UInt htalRefNum; // HTAL lib reference number + VoidPtr reqDataP; // request data pointer (NULL to cancel request) + HtalAsyncReqHandlerPtr + handlerP; // ptr to request handler function + } HtalAsyncReqParamType; + +typedef HtalAsyncReqParamType* HtalAsyncReqParamPtr; + +// Returns true if handled +typedef Boolean HtalMakeAsyncReqCallbackType(HtalAsyncReqParamPtr paramP); +typedef HtalMakeAsyncReqCallbackType* HtalMakeAsyncReqCallbackPtr; + + + +#pragma mark ---Function Parameter Structures- + +//----------------------------------------------------------------------------- +// HtalLibConnectPhase1 function parameter +//----------------------------------------------------------------------------- + +//#define htalTempDirectCableConnection 1 +//#define htalTempDirectModemConnection 2 + +typedef struct HtalConnectParamType { + DWord svcOwnCreator; // creator of the module which owns the connection id + DWord svcOwnType; // type of the module which owns the connection id + DWord svcID; // connection id + //CharPtr tempPhoneNumP; // phone num string(temporary - will be part of connection template) + DWord miscFlags; // miscellaneous flags(to be defined) -- SET UNUSED BITS TO ZERO! + DWord dwReserved1; // reserved -- SET TO NULL! + } HtalConnectParamType; +typedef HtalConnectParamType* HtalConnectParamPtr; + + + +//----------------------------------------------------------------------------- +// HtalLibGetCommand function parameter +//----------------------------------------------------------------------------- + +typedef struct HtalGetCommandParamType { + Word tid; // transaction id of command returned here + ULong cmdLen; // length of received command returned here + DWord cmdBufRef; // reference to command buffer returned here(actual + // data type depends on cmdBufType) + HtalMemAllocType cmdBufType; // command buffer type returned here + } HtalGetCommandParamType; + +typedef HtalGetCommandParamType* HtalGetCommandParamPtr; + + + +//----------------------------------------------------------------------------- +// HtalLibSendReply function parameter +//----------------------------------------------------------------------------- +typedef struct HtalSendReplyParamType { + Word tid; // -> transaction id of reply + HtalDataSegmentPtr segP; // -> ptr to HTAL data segment array + Int segCount; // -> segment count + } HtalSendReplyParamType; + +typedef HtalSendReplyParamType* HtalSendReplyParamPtr; + + + +//----------------------------------------------------------------------------- +// HtalLibControl function parameters +//----------------------------------------------------------------------------- +typedef struct HtalServiceEntryType { + ULong type; // service type + ULong creator; // service creator + DWord dwReserved; // RESERVED -- SET TO NULL! + } HtalServiceEntryType; +typedef HtalServiceEntryType* HtalServiceEntryPtr; + + + +#pragma mark -API Prototypes- + +#ifdef __cplusplus +extern "C" { +#endif + + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- + +typedef Err HtalLibOpenFunc(UInt refNum); +extern HtalLibOpenFunc HtalLibOpen + SYS_TRAP(sysLibTrapOpen); + +typedef Err HtalLibCloseFunc(UInt refNum); +extern HtalLibCloseFunc HtalLibClose + SYS_TRAP(sysLibTrapClose); + +typedef Err HtalLibSleepFunc(UInt refNum); +extern HtalLibSleepFunc HtalLibSleep + SYS_TRAP(sysLibTrapSleep); + +typedef Err HtalLibWakeFunc(UInt refNum); +extern HtalLibWakeFunc HtalLibWake + SYS_TRAP(sysLibTrapWake); + +//-------------------------------------------------- +// Custom routines +//-------------------------------------------------- + +// Set an option +typedef Err HtalLibSetOptionFunc(UInt refNum, HtalOptEnum optionID, VoidPtr param1P, VoidPtr param2P); +extern HtalLibSetOptionFunc HtalLibSetOption + SYS_TRAP(htalLibTrapSetOption); + +// Get an option value +typedef Err HtalLibGetOptionFunc(UInt refNum, HtalOptEnum optionID, VoidPtr param1P, VoidPtr param2P); +extern HtalLibGetOptionFunc HtalLibGetOption + SYS_TRAP(htalLibTrapGetOption); + +// Control +typedef Err HtalLibControlFunc(UInt refNum, HtalCtlEnum ctl, VoidPtr paramP, WordPtr paramLenP); +extern HtalLibControlFunc HtalLibControl + SYS_TRAP(htalLibTrapControl); + +// Phase 1 of connection establishment potentially involving UI +typedef Err HtalLibConnectPhase1Func(UInt refNum, HtalConnectParamPtr paramP); +extern HtalLibConnectPhase1Func HtalLibConnectPhase1 + SYS_TRAP(htalLibTrapConnectPhase1); + +// Phase 2 of connection establishment not involving UI +typedef Err HtalLibConnectPhase2Func(UInt refNum); +extern HtalLibConnectPhase2Func HtalLibConnectPhase2 + SYS_TRAP(htalLibTrapConnectPhase2); + +// Shut down the connection +typedef Err HtalLibDisconnectFunc(UInt refNum, Boolean abort); +extern HtalLibDisconnectFunc HtalLibDisconnect + SYS_TRAP(htalLibTrapDisconnect); + +// Receive the next command block +typedef Err HtalLibGetCommandFunc(UInt refNum, HtalGetCommandParamPtr paramP); +extern HtalLibGetCommandFunc HtalLibGetCommand + SYS_TRAP(htalLibTrapGetCommand); + +// Send a reply block +typedef Err HtalLibSendReplyFunc(UInt refNum, HtalSendReplyParamPtr paramP); +extern HtalLibSendReplyFunc HtalLibSendReply + SYS_TRAP(htalLibTrapSendReply); + +// Cancel the current blocking operation (can be called from blocking hook) +typedef Err HtalLibCancelFunc(UInt refNum); +extern HtalLibCancelFunc HtalLibCancel + SYS_TRAP(htalLibTrapCancel); + +// +// HTAL LIB UTILITY ROUTINES +// + +// Get the maximum block size which can be sent in one transaction +typedef ULong HtalLibMaxBlockSizeFunc(UInt refNum); +extern HtalLibMaxBlockSizeFunc HtalLibMaxBlockSize + SYS_TRAP(htalLibTrapMaxBlockSize); + +// Get HTAL library version +typedef DWord HtalLibVersionFunc(UInt refNum); +extern HtalLibVersionFunc HtalLibVersion + SYS_TRAP(htalLibTrapVersion); + +// Total the sizes of HTAL data segments +typedef ULong HtalLibAddSegmentSizesFunc(UInt refNum, Int segCount, HtalDataSegmentType seg[]); +extern HtalLibAddSegmentSizesFunc HtalLibAddSegmentSizes + SYS_TRAP(htalLibTrapAddSegmentSizes); + + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * HTAL Macros + ********************************************************************/ +#pragma mark -Macros- + + + + +#endif // __HTAL_API_H__ diff --git a/sdk-2/include/Core/System/KeyMgr.h b/sdk-2/include/Core/System/KeyMgr.h new file mode 100644 index 0000000..f1ed9c4 --- /dev/null +++ b/sdk-2/include/Core/System/KeyMgr.h @@ -0,0 +1,71 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * KeyMgr.h + * + * Description: + * Include file for Key manager + * + * History: + * 9/13/95 Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __KEYMGR_H__ +#define __KEYMGR_H__ + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Definition of bit field returned from KeyCurrentState + ********************************************************************/ +#define keyBitPower 0x01 // Power key +#define keyBitPageUp 0x02 // Page-up +#define keyBitPageDown 0x04 // Page-down +#define keyBitHard1 0x08 // App #1 +#define keyBitHard2 0x10 // App #2 +#define keyBitHard3 0x20 // App #3 +#define keyBitHard4 0x40 // App #4 +#define keyBitCradle 0x80 // Button on cradle + +#define keyBitsAll 0xFFFFFFFF // all keys + + +#define slowestKeyDelayRate 0xff +#define slowestKeyPeriodRate 0xff + + +/******************************************************************** + * Key manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Set/Get the auto-key repeat rate +Err KeyRates(Boolean set, WordPtr initDelayP, WordPtr periodP, + WordPtr doubleTapDelayP, BooleanPtr queueAheadP) + SYS_TRAP(sysTrapKeyRates); + +// Get the current state of the hardware keys +DWord KeyCurrentState(void) + SYS_TRAP(sysTrapKeyCurrentState); + +// Set the state of the hardware key mask which controls if the key +// generates a keyDownEvent +DWord KeySetMask(DWord keyMask) + SYS_TRAP(sysTrapKeySetMask); + +#ifdef __cplusplus +} +#endif + + +#endif //__KEYMGR_H__ diff --git a/sdk-2/include/Core/System/KeyPrv.h b/sdk-2/include/Core/System/KeyPrv.h new file mode 100644 index 0000000..ef9c3e5 --- /dev/null +++ b/sdk-2/include/Core/System/KeyPrv.h @@ -0,0 +1,119 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * KeyPrv.h + * + * Description: + * Private Include file for Key manager + * + * History: + * 9/13/95 Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __KEYPRV_H +#define __KEYPRV_H + + +/******************************************************************** + * Key Manager Constants + ********************************************************************/ +#define keyMinUpTicks (sysTicksPerSecond/20) // Min# of ticks key must be up to recognize it + +#define keyMinBacklightTicks (sysTicksPerSecond) // Min# of ticks key must be held down to + // turn on backlight + +#define keyBitMask 0x007F // Which bits in port D we use for keys + +/******************************************************************** + * Key Manager Globals + ********************************************************************/ +typedef struct KeyGlobalsType { + ULong lastKeyTicks; // GHwrCurTicks last time we enqueued + // a key event - cleared as soon as + // key is released. + + + Byte keyState; // current state of hardware keys - returned + // by KeyCurrentState + Byte keyStateMask; // which keys generate an event + Byte keyUpCount; // # of consecutive times we've detected + // no keys down - used for debouncing + Byte initDelay; // key repeat init delay in ticks + Byte period; // key repeat period in ticks + + DWord turnOnTicks; // Tickcount for key that turned + // device on. Used for + // detecting when we should turn on backlight + + // These variables used for sensing double-taps + ULong doubleTapTicks; // GHwrCurTicks last tiem we enqueued + // a key event - never cleared. + Word doubleTapDelay; // double-tap timeout in ticks + Byte doubleTapState; // state of hardware keys last time + + // Belongs next to 'period' but put here for alignment + Boolean queueAhead; // if true, enqueue auto-repeat keys even if + // queue is not empty. + } KeyGlobalsType; + +typedef KeyGlobalsType* KeyGlobalsPtr; + + + + + +/******************************************************************** + * Key manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Called early on during boot-up to get status of hard reset +// and debugger key options. Returns DWord with bits set for each +// key down. +DWord KeyBootKeys(void); + + +// Initializes the Key Manager and allocates it's globals +Err KeyInit(void) + SYS_TRAP(sysTrapKeyInit); + + +// Called as a result of a key-down interrupt or periodically by +// by timer task while key is down. Returns # of ticks before +// it should be called again by timer task. +ULong KeyHandleInterrupt(Boolean periodic, DWord status) + SYS_TRAP(sysTrapKeyHandleInterrupt); + + +// Called by SysEvtMgr when it gets a pen event in order to +// reset the key manager's double-tap detection. +Err KeyResetDoubleTap(void) + SYS_TRAP(sysTrapKeyResetDoubleTap); + + +// Called before system goes to sleep +Err KeySleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapKeySleep); + + +// Called when the system wakes up +Err KeyWake(void) + SYS_TRAP(sysTrapKeyWake); + + + +#ifdef __cplusplus +} +#endif + + +#endif //__KEYPRV_H +#endif // NON_PORTABLE diff --git a/sdk-2/include/Core/System/Keyboard.h b/sdk-2/include/Core/System/Keyboard.h new file mode 100644 index 0000000..46a8a7d --- /dev/null +++ b/sdk-2/include/Core/System/Keyboard.h @@ -0,0 +1,63 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Keyboard.h + * + * Description: + * This file defines the keyboard's structures and routines. + * + * History: + * 3/29/95 rsf - Created by Roger Flores + * + *******************************************************************/ + + +#ifndef __KBD_H__ +#define __KBD_H__ + + + +#define kbdReturnKey linefeedChr +#define kbdTabKey tabChr +#define kbdBackspaceKey backspaceChr +#define kbdShiftKey 2 +#define kbdCapsKey 1 +#define kbdNoKey -1 + + +typedef enum + { + kbdAlpha = 0, + kbdNumbersAndPunc = 1, + kbdAccent = 2, + kbdDefault = 0xff // based on graffiti mode (usually alphaKeyboard) + } KeyboardType; + + +/************************************************************ + * Keyboard procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// 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. + +extern void SysKeyboardDialogV10 () + SYS_TRAP(sysTrapSysKeyboardDialogV10); + +extern void SysKeyboardDialog (KeyboardType kbd) + SYS_TRAP(sysTrapSysKeyboardDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __KBD_H__ diff --git a/sdk-2/include/Core/System/Launcher.h b/sdk-2/include/Core/System/Launcher.h new file mode 100644 index 0000000..cc16e89 --- /dev/null +++ b/sdk-2/include/Core/System/Launcher.h @@ -0,0 +1,60 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Launcher.h + * + * Description: + * These are the routines for the launcher. + * + * History: + * 4/27/95 roger - Created + * + *******************************************************************/ + +#ifndef __LAUNCHER_H__ +#define __LAUNCHER_H__ + +#include +#include +#include +#include +#include + +typedef struct { + FormPtr form; + Int numItems; // numItems of applications available via the launcher + Int columns; + Int rows; + Int topItem; + SByte selection; + VoidHand appInfoH; // an array is to be allocated + TimeFormatType timeFormat; // Format to display time in + char timeString[timeStringLength]; + FormPtr savedForm; // the currently active dialog. +} LauncherType; + +typedef LauncherType * LauncherPtr; + + + +/************************************************************ + * Launcher procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +void SysAppLauncherDialog() + SYS_TRAP(sysTrapSysAppLauncherDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __LAUNCHER_H__ + diff --git a/sdk-2/include/Core/System/Localize.h b/sdk-2/include/Core/System/Localize.h new file mode 100644 index 0000000..fcb3771 --- /dev/null +++ b/sdk-2/include/Core/System/Localize.h @@ -0,0 +1,45 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Localize.c + * + * Description: + * Functions to localize data. + * + * History: + * 8/28/96 Roger - Initial version + * + *******************************************************************/ + +#ifndef __LOCALIZE_H__ +#define __LOCALIZE_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +#ifdef __cplusplus +extern "C" { +#endif + + +void LocGetNumberSeparators(NumberFormatType numberFormat, + Char *thousandSeparator, Char *decimalSeparator) + SYS_TRAP(sysTrapLocGetNumberSeparators); + + + +#ifdef __cplusplus +} +#endif + + +#endif // __LOCALIZE_H__ + + diff --git a/sdk-2/include/Core/System/MemoryMgr.h b/sdk-2/include/Core/System/MemoryMgr.h new file mode 100644 index 0000000..5ce10ec --- /dev/null +++ b/sdk-2/include/Core/System/MemoryMgr.h @@ -0,0 +1,344 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * MemoryMgr.h + * + * Description: + * Include file for Memory Manager + * + * History: + * 10/25/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + + +#ifndef __MEMORYMGR_H__ +#define __MEMORYMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +/************************************************************ + * Memory Manager Types + *************************************************************/ +typedef enum { memIDPtr, memIDHandle } LocalIDKind; + + + +/************************************************************ + * Flags accepted as parameter for MemNewChunk. + *************************************************************/ +#define memNewChunkFlagPreLock 0x0100 +#define memNewChunkFlagNonMovable 0x0200 +#define memNewChunkFlagAtStart 0x0400 // force allocation at front of heap +#define memNewChunkFlagAtEnd 0x0800 // force allocation at end of heap + + + +/************************************************************ + * Memory Manager Debug settings for the MemSetDebugMode function + *************************************************************/ +#define memDebugModeCheckOnChange 0x0001 +#define memDebugModeCheckOnAll 0x0002 +#define memDebugModeScrambleOnChange 0x0004 +#define memDebugModeScrambleOnAll 0x0008 +#define memDebugModeFillFree 0x0010 +#define memDebugModeAllHeaps 0x0020 +#define memDebugModeRecordMinDynHeapFree 0x0040 + + + + +/************************************************************ + * Memory Manager result codes + *************************************************************/ +#define memErrChunkLocked (memErrorClass | 1) +#define memErrNotEnoughSpace (memErrorClass | 2) +#define memErrInvalidParam (memErrorClass | 3) +#define memErrChunkNotLocked (memErrorClass | 4) +#define memErrCardNotPresent (memErrorClass | 5) +#define memErrNoCardHeader (memErrorClass | 6) +#define memErrInvalidStoreHeader (memErrorClass | 7) +#define memErrRAMOnlyCard (memErrorClass | 8) +#define memErrWriteProtect (memErrorClass | 9) +#define memErrNoRAMOnCard (memErrorClass | 10) +#define memErrNoStore (memErrorClass | 10) + + + +/******************************************************************** + * Memory Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err MemInit(void) + SYS_TRAP(sysTrapMemInit); + +Err MemKernelInit(void) + SYS_TRAP(sysTrapMemKernelInit); + +Err MemInitHeapTable(UInt cardNo) + SYS_TRAP(sysTrapMemInitHeapTable); + +//------------------------------------------------------------------- +// Card formatting and Info +//------------------------------------------------------------------- +UInt MemNumCards(void) + SYS_TRAP(sysTrapMemNumCards); + +Err MemCardFormat(UInt cardNo, CharPtr cardNameP, + CharPtr manufNameP, CharPtr ramStoreNameP) + SYS_TRAP(sysTrapMemCardFormat); + +Err MemCardInfo(UInt cardNo, + CharPtr cardNameP, CharPtr manufNameP, + UIntPtr versionP, ULongPtr crDateP, + ULongPtr romSizeP, ULongPtr ramSizeP, + ULongPtr freeBytesP) + SYS_TRAP(sysTrapMemCardInfo); + + +//------------------------------------------------------------------- +// Store Info +//------------------------------------------------------------------- +Err MemStoreInfo(UInt cardNo, UInt storeNumber, + UIntPtr versionP, UIntPtr flagsP, CharPtr nameP, + ULongPtr crDateP, ULongPtr bckUpDateP, + ULongPtr heapListOffsetP, ULongPtr initCodeOffset1P, + ULongPtr initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreInfo); + +Err MemStoreSetInfo(UInt cardNo, UInt storeNumber, + UIntPtr versionP, UIntPtr flagsP, CharPtr nameP, + ULongPtr crDateP, ULongPtr bckUpDateP, + ULongPtr heapListOffsetP, ULongPtr initCodeOffset1P, + ULongPtr initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreSetInfo); + + +//------------------------------------------------------------------- +// Heap Info & Utilities +//------------------------------------------------------------------- +UInt MemNumHeaps(UInt cardNo) + SYS_TRAP(sysTrapMemNumHeaps); + +UInt MemNumRAMHeaps(UInt cardNo) + SYS_TRAP(sysTrapMemNumRAMHeaps); + +UInt MemHeapID(UInt cardNo, UInt heapIndex) + SYS_TRAP(sysTrapMemHeapID); + +Boolean MemHeapDynamic(UInt heapID) + SYS_TRAP(sysTrapMemHeapDynamic); + +Err MemHeapFreeBytes(UInt heapID, ULongPtr freeP, ULongPtr maxP) + SYS_TRAP(sysTrapMemHeapFreeBytes); + +ULong MemHeapSize(UInt heapID) + SYS_TRAP(sysTrapMemHeapSize); + +UInt MemHeapFlags(UInt heapID) + SYS_TRAP(sysTrapMemHeapFlags); + + +// Heap utilities +Err MemHeapCompact(UInt heapID) + SYS_TRAP(sysTrapMemHeapCompact); + +Err MemHeapInit(UInt heapID, Int numHandles, Boolean initContents) + SYS_TRAP(sysTrapMemHeapInit); + +Err MemHeapFreeByOwnerID(UInt heapID, UInt ownerID) + SYS_TRAP(sysTrapMemHeapFreeByOwnerID); + + +//------------------------------------------------------------------- +// Low Level Allocation +//------------------------------------------------------------------- +VoidPtr MemChunkNew(UInt heapID, ULong size, UInt attr) + SYS_TRAP(sysTrapMemChunkNew); + +Err MemChunkFree(VoidPtr chunkDataP) + SYS_TRAP(sysTrapMemChunkFree); + + + +//------------------------------------------------------------------- +// Pointer (Non-Movable) based Chunk Routines +//------------------------------------------------------------------- +VoidPtr MemPtrNew(ULong size) + SYS_TRAP(sysTrapMemPtrNew); + +#define MemPtrFree( p) \ + MemChunkFree(p) + +// Getting Attributes +VoidHand MemPtrRecoverHandle(VoidPtr p) + SYS_TRAP(sysTrapMemPtrRecoverHandle); + +UInt MemPtrFlags(VoidPtr p) + SYS_TRAP(sysTrapMemPtrFlags); + +ULong MemPtrSize(VoidPtr p) + SYS_TRAP(sysTrapMemPtrSize); + +UInt MemPtrOwner(VoidPtr p) + SYS_TRAP(sysTrapMemPtrOwner); + +UInt MemPtrHeapID(VoidPtr p) + SYS_TRAP(sysTrapMemPtrHeapID); + +Boolean MemPtrDataStorage(VoidPtr p) + SYS_TRAP(sysTrapMemPtrDataStorage); + +UInt MemPtrCardNo(VoidPtr p) + SYS_TRAP(sysTrapMemPtrCardNo); + +LocalID MemPtrToLocalID(VoidPtr p) + SYS_TRAP(sysTrapMemPtrToLocalID); + +// Setting Attributes +Err MemPtrSetOwner(VoidPtr p, UInt owner) + SYS_TRAP(sysTrapMemPtrSetOwner); + +Err MemPtrResize(VoidPtr p, ULong newSize) + SYS_TRAP(sysTrapMemPtrResize); + +Err MemPtrResetLock(VoidPtr p) + SYS_TRAP(sysTrapMemPtrResetLock); + +Err MemPtrUnlock(VoidPtr p) + SYS_TRAP(sysTrapMemPtrUnlock); + + +//------------------------------------------------------------------- +// Handle (Movable) based Chunk Routines +//------------------------------------------------------------------- +VoidHand MemHandleNew(ULong size) + SYS_TRAP(sysTrapMemHandleNew); + +Err MemHandleFree(VoidHand h) + SYS_TRAP(sysTrapMemHandleFree); + +// Getting Attributes +UInt MemHandleFlags(VoidHand h) + SYS_TRAP(sysTrapMemHandleFlags); + +ULong MemHandleSize(VoidHand h) + SYS_TRAP(sysTrapMemHandleSize); + +UInt MemHandleOwner(VoidHand h) + SYS_TRAP(sysTrapMemHandleOwner); + +UInt MemHandleLockCount(VoidHand h) + SYS_TRAP(sysTrapMemHandleLockCount); + +UInt MemHandleHeapID(VoidHand h) + SYS_TRAP(sysTrapMemHandleHeapID); + +Boolean MemHandleDataStorage(VoidHand h) + SYS_TRAP(sysTrapMemHandleDataStorage); + +UInt MemHandleCardNo(VoidHand h) + SYS_TRAP(sysTrapMemHandleCardNo); + +LocalID MemHandleToLocalID(VoidHand h) + SYS_TRAP(sysTrapMemHandleToLocalID); + + +// Setting Attributes +Err MemHandleSetOwner( VoidHand h, UInt owner) + SYS_TRAP(sysTrapMemHandleSetOwner); + +Err MemHandleResize(VoidHand h, ULong newSize) + SYS_TRAP(sysTrapMemHandleResize); + +VoidPtr MemHandleLock(VoidHand h) + SYS_TRAP(sysTrapMemHandleLock); + +Err MemHandleUnlock(VoidHand h) + SYS_TRAP(sysTrapMemHandleUnlock); + +Err MemHandleResetLock(VoidHand h) + SYS_TRAP(sysTrapMemHandleResetLock); + + + + +//------------------------------------------------------------------- +// Local ID based routines +//------------------------------------------------------------------- +VoidPtr MemLocalIDToGlobal(LocalID local, UInt cardNo) + SYS_TRAP(sysTrapMemLocalIDToGlobal); + +LocalIDKind MemLocalIDKind(LocalID local) + SYS_TRAP(sysTrapMemLocalIDKind); + +VoidPtr MemLocalIDToPtr(LocalID local, UInt cardNo) + SYS_TRAP(sysTrapMemLocalIDToPtr); + +VoidPtr MemLocalIDToLockedPtr(LocalID local, UInt cardNo) + SYS_TRAP(sysTrapMemLocalIDToLockedPtr); + + +//------------------------------------------------------------------- +// Utilities +//------------------------------------------------------------------- +Err MemMove(VoidPtr dstP, VoidPtr srcP, ULong numBytes) + SYS_TRAP(sysTrapMemMove); + +Err MemSet(VoidPtr dstP, ULong numBytes, Byte value) + SYS_TRAP(sysTrapMemSet); + +Int MemCmp (VoidPtr s1, VoidPtr s2, ULong numBytes) + SYS_TRAP(sysTrapMemCmp); + +Err MemSemaphoreReserve(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreReserve); + +Err MemSemaphoreRelease(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreRelease); + +//------------------------------------------------------------------- +// Debugging Support +//------------------------------------------------------------------- +Word MemDebugMode(void) + SYS_TRAP(sysTrapMemDebugMode); + +Err MemSetDebugMode(Word flags) + SYS_TRAP(sysTrapMemSetDebugMode); + +Err MemHeapScramble(UInt heapID) + SYS_TRAP(sysTrapMemHeapScramble); + +Err MemHeapCheck(UInt heapID) + SYS_TRAP(sysTrapMemHeapCheck); + + +#ifdef __cplusplus +} +#endif + + + + + +#endif // __MEMORYMGR_H__ + diff --git a/sdk-2/include/Core/System/MemoryPrv.h b/sdk-2/include/Core/System/MemoryPrv.h new file mode 100644 index 0000000..e694cc9 --- /dev/null +++ b/sdk-2/include/Core/System/MemoryPrv.h @@ -0,0 +1,416 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * MemoryMgrPrv.h + * + * Description: + * Private includes for Memory Manager + * + * History: + * 7/20/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +// SystemPrv.h must be included before this header file. SystemPrv.h will +// then in turn include this header. +#ifndef __SYSTEMPRV_H__ +#include +#endif + +#ifndef __MEMORYMGRPRV_H__ +#define __MEMORYMGRPRV_H__ + + + +/******************************************************************** + * Structure of a Master Pointer chunk + * The first master pointer chunk is always immediately following the + * heap header. As more movable chunks are created, new master + * pointer chunks are allocated dynamically and linked together through + * the nextTblOffset field and prevTblOffset field. + ********************************************************************/ +typedef struct { + Word numEntries; // number of master pointer entries + Word nextTblOffset; // offset from start of heap to next table + //Ptr mstrP[numEntries]; // array of pointers to movable chunks + } MstrPtrTableType; +typedef MstrPtrTableType* MstrPtrTablePtr; + + +/******************************************************************** + * Structure of a Heap + * + * A heap starts with a HeapHeader + * Followed by the offset table (numHandles) + * Followed by movable chunks + * Followed by non-movable chunks + ********************************************************************/ +typedef struct { + Word flags; // heap flags; + Word size; // size of heap - 0 means 64K; + MstrPtrTableType mstrPtrTbl; // Master pointer table + } HeapHeaderType; +typedef HeapHeaderType* HeapHeaderPtr; + +// Flags Field +#define memHeapFlagReadOnly 0x0001 // heap is read-only (ROM based) +#define memHeapFlagVers2 0x8000 // version 2 heap (> 64K) + +#define memMstrPtrTableGrowBy 50 // # of entries to grow master pointer tables by +#define memMstrPtrTableInitSizeD 40 // # of entries to allocate initially for dynamic heap(s) +#define memMstrPtrTableInitSizeS 200 // # of entries to allocate initially for storage heap(s) + + + +/******************************************************************** + * Structure of a Chunk + * + ********************************************************************/ +typedef struct { + Word size; // size of block in bytes, including header + Byte lockOwner; // lock count in high nibble, owner in low + Byte flags; // flags, size adj in low nibble + SWord hOffset; // offset/2 to handle for movables + } ChunkHeaderType; +typedef ChunkHeaderType* ChunkHeaderPtr; + +// Definition of ChunkHeaderType.flags -------------------------------- +#define memChunkFlagFree 0x80 // free bit +#define memChunkFlagUnused1 0x40 // unused +#define memChunkFlagUnused2 0x20 // unused +#define memChunkFlagUnused3 0x10 // unused +#define memChunkFlagSizeAdj 0x0F // mask for size adjustment + + +// This macro is used to grab all the flags at once and place them into +// a byte +#define memChunkFlags(p) (((ChunkHeaderPtr)p)->flags & 0xF0) + + +// A non-movable chunk has 0xF as the lock count +#define memChunkLockMask 0xF0 +#define memChunkOwnerMask 0x0F + +// A lockcount of memPtrLockCount means a permanently unmovable chunk +#define memPtrLockCount 15 + +// A ownerID of 15 is used for master pointer chunks +#define memOwnerMasterPtrTbl 15 + + +// This equate returns the name of the ChunkHeaderType. This was created +// so that we can change the name of the CHunkHeaderType (as we did for V2 of +// the Memory Manager) and souce code won't know the difference +#define memChunkHeaderTypeName ChunkHeaderType + + +/******************************************************************** + * + * They are a general way to get info out of a Chunk header + * whether it be a version 1 or version 2 header. They are used almost + * exclusively by the Pilot Debugger and Simulator Heap Dump utility + * since it must be able to do heap dumps of both versions of the Pilot + * Memory Manager. + * + * The 'ver' parameter to these macros is either 1 for version 1 or + * 2 for version 2 and the 'p' parameter is the chunk header pointer. + ********************************************************************/ +// This structure is big enough to read in a version 1 or version 2 +// Master Pointer Table into +typedef struct { + MstrPtrTableType ver1; + } MemMstrPtrTableUnionType; + +#define memUSizeOfMstrPtrTable(ver) \ + (ver>1 ? DbgSrcBreak(),0 : sizeof(MstrPtrTableType)) + +#define memUMstrPtrTableNextTblOffset(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((MstrPtrTablePtr)p)->nextTblOffset) + +#define memUMstrPtrTableNumEntries(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((MstrPtrTablePtr)p)->numEntries) + + +typedef struct { + HeapHeaderType ver1; + } MemHeapHeaderUnionType; + +#define memUSizeOfHeapHeader(ver) \ + (ver>1 ? DbgSrcBreak(),0 : sizeof(HeapHeaderType)) + +#define memUHeapSize(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((HeapHeaderPtr)p)->size) + +#define memUHeapFlags(p) \ + (((HeapHeaderPtr)p)->flags) + +#define memUHeapMstrPtrEntries(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((HeapHeaderPtr)p)->mstrPtrTbl.numEntries) + +#define memUHeapMstrPtrAddr(p,ver) \ + (ver>1 ? 0 : &((HeapHeaderPtr)p)->mstrPtrTbl) + + + +typedef struct { + ChunkHeaderType ver1; + } MemChunkHeaderUnionType; + +#define memUSizeOfHeapTerminator(ver) \ + (ver>1 ? DbgSrcBreak(),0 : sizeof(Word)) + +#define memUSizeOfChunkHeader(ver) \ + (ver>1 ? DbgSrcBreak(),0 : sizeof(ChunkHeaderType)) + +#define memUChunkSize(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->size) + +#define memUChunkFlags(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->flags & 0xF0) + +#define memUChunkSizeAdj(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->flags & memChunkFlagSizeAdj) + +#define memUChunkLockCount(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->lockOwner >> 4) + +#define memUChunkOwner(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->lockOwner & memChunkOwnerMask) + +#define memUChunkHOffset(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->hOffset) + + + + +/************************************************************ + * Structure of a Card Header. + * There is 1 card header for in every card that has ROM. The + * card header is stored at sysCardHeaderOffset into the card. + * + * RAM only cards will not have a card header + *************************************************************/ +#define memMaxNameLen 32 // size of name and manuf fields including null +typedef struct { + DWord initStack; // initial stack pointer + DWord resetVector; // reset vector + DWord signature; // must be sysCardSignature + Word hdrVersion; // header version + Word flags; // card flags; + Byte name[memMaxNameLen]; // card name + Byte manuf[memMaxNameLen]; // card manufacturer's name + Word version; // card version + DWord creationDate; // card creation date + Word numRAMBlocks; // number of RAM blocks on card + DWord blockListOffset; // offset to RAM block list + Byte reserved[164]; // to bring us to 0x100 alignment + } CardHeaderType; +typedef CardHeaderType* CardHeaderPtr; + +#define memCardHeaderFlagRAMOnly 0x0001 // RAM only card + + + +/************************************************************ + * Structure of a Storage Header. + * There is 1 of these for every "store" on a memory card. A + * "store" can be all the RAM on a card or all the ROM on a card. + * + * The RAM storage header is stored at sysRAMHeader offset into the + * card. and the ROM storage header is stored at sysROMHeader offset + * into the card. + *************************************************************/ +typedef struct { + DWord signature; // must be sysStoreSignature + Word version; // version of header + Word flags; // flags + Byte name[memMaxNameLen]; // name of store + DWord creationDate; // creation date + DWord backupDate; // last backup date + DWord heapListOffset; // offset to heap list for store + DWord initCodeOffset1; // init code for store, if any + DWord initCodeOffset2; // second init code for store, if any + LocalID databaseDirID; // local ID of database dir. + DWord rsvSpace; // where first heap starts. + DWord dynHeapSpace; // how big the dynamic heap area is + // (always 0 for ROM stores) + DWord firstRAMBlockSize; // Copy of firstRAMBlock size from cardinfo + // Used to determine if we're rebooting + // with a different amount of RAM. + + // The following fields are used to store non-volatile information that + // must be accessed by the system but that is not convenient to store + // in a database due to access time or frequency. It is only valid + // in the RAM STORE ON CARD #0!. + SysNVParamsType nvParams; + + // Filler bytes - reserved for future use. Size adjusted to + // keep total size of storage header at 0x100 bytes. + Byte reserved[176-sizeof(SysNVParamsType)]; + + // CRC value + DWord crc; // crc to check validity + } StorageHeaderType; +typedef StorageHeaderType* StorageHeaderPtr; + +#define memStoreHeaderFlagRAMOnly 0x0001 // RAM store + + +// A Heap list for each store on a card (either RAM or ROM) gives a list of +// heaps' starting offsets for that store +typedef struct { + Word numHeaps; // Number of heaps in store + DWord heapOffset[1]; // offset to heap + } HeapListType; + + + +/******************************************************************** + * CardInfo structure + * The Pilot globals has a pointer to an array of CardInfo structures. + * + * This array is initialized by the Boot code before the Memory Manager + * starts up. Among other things, it tells the Memory Manager where + * every card is and the size of each card. + ********************************************************************/ +typedef struct { + + // These fields are filled in by the boot code BEFORE + // MemInit() is called. + BytePtr baseP; // base address of card + DWord size; // address range of card + DWord firstRAMBlockSize; // size of RAM block at offset 0 + DWord targetROMShift; // used only under Emulation mode, must be + // added to emulated ROM pointers when calculating + // a LocalID for use in the device ROM. + + + DWord cardHeaderOffset; // offset to card header (usually in ROM) + // = 0 if RAM only card + + DWord rsvSpace; // reserve space in RAM before first heap + DWord dynHeapSpace; // how much space to reserve for dynamic heap(s) + StorageHeaderPtr ramStoreP; // pointer to RAM store header + // This location depends on how much space + // was reserved on the card for the dynamic + // heap. + + // These fields are copies of information in the card and storage headers + // they are cached here for quicker access by the Memory Manager. They + // are filled in by the Memory Manager during MemInit. + Word numRAMHeaps; // Number of RAM heaps - for quick access + DWordPtr ramHeapOffsetsP; // Table of RAM heap offsets - for quick access + Word numROMHeaps; // Number of RAM heaps - for quick access + DWordPtr romHeapOffsetsP; // Table of RAM heap offsets - for quick access + + } CardInfoType; +typedef CardInfoType* CardInfoPtr; + +// The constant hwrNumCardSlots, defined in Hardware.h defines the maximum number +// of cards supported by the hardware. + + + + +/************************************************************ + * Private Memory Manager Constants + *************************************************************/ +// Private constant - # of dynamic heaps +#define memDynamicHeaps 1 + + + + +/************************************************************ + * Private Memory Manager Macros. These macros are not + * guaranteed to be compatible in the future and should + * only be used in system code, not applications. + * + * To use these, define NON_PORTABLE at the top of your + * source code module. + * + * WARNING: This macro must only be used on Locked chunks!!! + * When running with error checking, it will verify + * that the chunk is locked before it dereferences it. + *************************************************************/ + +#if MEMORY_FORCE_LOCK == MEMORY_FORCE_LOCK_ON + #define memHandleProtect(h) \ + ((VoidHand)((DWord)h | 0x80000000)) + #define memHandleUnProtect(h) \ + ((VoidHand)((DWord)h & 0x7FFFFFFF)) +#else + #define memHandleProtect(h) (h) + #define memHandleUnProtect(h) (h) +#endif + + +#if MEMORY_TYPE == MEMORY_LOCAL + #if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + #define MemDeref(h) \ + (MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : (*memHandleUnProtect(h))) + #else + #define MemDeref(h) \ + (*(memHandleUnProtect(h))) + #endif + +#else + #if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + #define MemDeref(h) \ + (MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : ((Ptr)ShlDWord(h))) + #else + #define MemDeref(h) \ + ((Ptr)ShlDWord(memHandleUnProtect(h))) + #endif +#endif + +#endif // NON_PORTABLE + + + +// Typecast access to the MemCardInfo Ptr +#define memCardInfoP(cardNo) \ + ( ((CardInfoPtr) ((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP) + cardNo) + + + +/******************************************************************** + * Memory Manager Private Routines + * These are used only by internal System code + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +HeapHeaderPtr MemHeapPtr(UInt heapID) + SYS_TRAP(sysTrapMemHeapPtr); + +Err MemStoreSearch(VoidPtr startP, DWord range, StorageHeaderPtr* storePP) + SYS_TRAP(sysTrapMemStoreSearch); + +Err MemStoreInit(DWord firstHeapSize, UInt firstHeapMstrPtrs, + UInt cardNo, Word numBlocks, DWordPtr blockInfoP, + StorageHeaderPtr storeP, Word numMstrPtrs) + SYS_TRAP(sysTrapMemStoreInit); + +Err MemNVParams(Boolean set, SysNVParamsPtr paramsP) + SYS_TRAP(sysTrapMemNVParams); + +#ifdef __cplusplus +} +#endif + + + + + + +#endif // __MEMORYMGRPRV_H__ + diff --git a/sdk-2/include/Core/System/ModemMgr.h b/sdk-2/include/Core/System/ModemMgr.h new file mode 100644 index 0000000..0e2313a --- /dev/null +++ b/sdk-2/include/Core/System/ModemMgr.h @@ -0,0 +1,145 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * ModemMgr.h + * + * Description: + * Include file for Modem Manager + * + * History: + * 9/20/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __MODEM_MGR_H__ +#define __MODEM_MGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Modem Manager constants + *************************************************************/ + +#define mdmMaxStringSize 40 + +#define mdmCmdBufSize 81 // command buffer capacity (including null) +#define mdmRespBufSize 81 // reply buffer capacity (including null) +#define mdmCmdSize 8 // max storage needed for smartmodem command + +#define mdmDefCmdTimeOut 500000L // in micro-seconds + +#define mdmDefDTWaitSec 4 +#define mdmDefDCDWaitSec 70 +#define mdmDefSpeakerVolume 1 + + +// Speaker volume settings +enum { + mdmVolumeOff = 0, + mdmVolumeLow = 1, + mdmVolumeMed = 2, + mdmVolumeHigh = 3 + }; + + +// Modem connection stages (NEW for Pilot 2.0) +typedef enum { + mdmStageInvalid = 0, // invalid state + mdmStageReserved = 1, // reserved for 1.0 compatibility + mdmStageFindingModem, // checking if modem is present + mdmStageInitializing, // initializing the modem + mdmStageDialing, // dialing the modem + mdmStageWaitingForCarrier, // waiting for carrier detect + mdmStageHangingUp // hanging up the modem + } MdmStageEnum; + +/************************************************************ + * Modem Manager data structures + *************************************************************/ +// Prototype for the "user cancel" check callback function +typedef Int (*MdmUserCanProcPtr)(DWord userRef); + +typedef struct MdmInfoType { + UInt serRefNum; // serial library reference number + ULong initialBaud; // initial baud rate to use + ULong cmdTimeOut; // number of micro-sec to wait after a cmd + Int dtWaitSec; // dialtone wait (sec) (-1 for modem's default) + Int dcdWaitSec; // dcd timeout wait (sec) (-1 for modem's default) + Int volume; // speaker volume(see mdmVolume... constants) + Boolean pulse; // pulse or tone dialing + Boolean hwHShake; // enable cts/rts handshaking + Boolean autoBaud; // enable/disable auto-baud to connected baud rate + MdmUserCanProcPtr canProcP; // ptr to user-cancel function + DWord userRef; // parameter for canProcP() + Char cmdBuf[mdmCmdBufSize]; // build all commands here + Char respBuf[mdmRespBufSize];// response buffer + ULong connectBaud; // baud at which connection was established + // (0 = unknown) + Byte curStage; // set by ModemMgr to report current MdmStageEnum + } MdmInfoType; + +typedef MdmInfoType* MdmInfoPtr; + +/************************************************************ + * Modem Manager result codes + * (mdmErrorClass is defined in SystemMgr.h) + *************************************************************/ +#pragma mark -Error Codes- + +#define mdmErrNoTone (mdmErrorClass | 1) // no dial tone +#define mdmErrNoDCD (mdmErrorClass | 2) // no carrier / timeout +#define mdmErrBusy (mdmErrorClass | 3) // busy signal heard +#define mdmErrUserCan (mdmErrorClass | 4) // cancelled by user +#define mdmErrCmdError (mdmErrorClass | 5) // command error +#define mdmErrNoModem (mdmErrorClass | 6) // no modem detected +#define mdmErrMemory (mdmErrorClass | 7) // not enough memory +#define mdmErrPrefs (mdmErrorClass | 8) // modem preferences have not been + // setup - (app should take user to modem prefs panel) + + + +/******************************************************************** + * Modem Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#pragma mark -API Routines- + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +Err MdmDial(MdmInfoPtr modemP, CharPtr okDialP, CharPtr userInitP, CharPtr phoneNumP) + SYS_TRAP(sysTrapMdmDial); + +Err MdmHangUp(MdmInfoPtr modemP) + SYS_TRAP(sysTrapMdmHangUp); + + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Modem Manager Macros + *************************************************************/ + +#endif // __MODEM_MGR_H__ + diff --git a/sdk-2/include/Core/System/ModemPrv.h b/sdk-2/include/Core/System/ModemPrv.h new file mode 100644 index 0000000..36c1101 --- /dev/null +++ b/sdk-2/include/Core/System/ModemPrv.h @@ -0,0 +1,124 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * ModemPrv.h + * + * Description: + * Private Include file for Modem Manager + * + * History: + * 9/25/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __MODEM_PRV_H__ +#define __MODEM_PRV_H__ + +// Include elementary types +#include + + + +/************************************************************ + * Modem Manager constants + *************************************************************/ +#define mdmDefaultResponseWait 300000L // in microseconds + +/************************************************************ + * Modem Manager data structures + *************************************************************/ +typedef enum { + mdmCmdCSI, + mdmCmdEOC, + mdmCmdQuiet, + mdmCmdDialTone, + mdmCmdDialPulse, + mdmCmdEchoOff, + mdmCmdVerbose, + mdmCmdDTWait, + mdmCmdDCDWait, + mdmCmdBasicXCmd, + mdmCmdAdvXCmd, + mdmCmdSpkrOnTillConnect, + mdmCmdSpkrOff, + mdmCmdVolume, + mdmCmdHUP, + mdmCmdFirmDTRDCD, + mdmCmdEscape, + mdmCmdReset, + mdmCmdFactory + } MdmCmdEnum; + +typedef enum MdmRespIDType { + mdmRespUnknown = 0, + mdmRespOK, + mdmRespConnect, + mdmRespNoCarrier, + mdmRespError, + mdmRespNoDialTone, + mdmRespBusy, + mdmRespRing, + + mdmRespReserved = -1 // reserve -1 for internal use + } MdmRespIDType; + + +// Configuration constants: + +// Hardware handshake settings +enum { + mdmHandshakeStd = 0, // standard AT handshaking (on at > 2400 baud) + mdmHandshakeOff = 1, // force handshaking off + mdmHandshakeOn = 2 // force handshaking on + }; + + +// +// Modem Manager preference structure (system pref rsc id = sysResIDModemMgrPref): +// +#define mdmPrefVersionNum 2 // modem preference version + +typedef struct MdmPrefType { + Word version; + ULong baud; // baud rate + Byte volume; // speaker volume level + Boolean pulse; // set to true for pulse dial mode + Byte hShk; // handshake option + Boolean autoBaud; // set to true for auto-baud + Char resetString[(mdmCmdSize*2)+1]; // string to be embedded in the reset command (vmk added 12/17/96) + Char initString[mdmCmdBufSize]; // modem init string + } MdmPrefType; +typedef MdmPrefType* MdmPrefPtr; + +#define mdmDefaultDialMode false + + +/************************************************************ + * Modem Manager default settings. Used by PrvGetModemPrefs() + * in ModemMgr.c when invalid or no prefs found. + * + * WARNING: In order to avoid confusion for the user, these + * defaults should match what the Modem Panel uses as it's defaults. + * The modem panels defaults are set by editing it's resources so + * they must be manually updated when these equates are changed. + *************************************************************/ +#define mdmDefaultBaud 19200 +#define mdmDefaultVolume mdmVolumeLow +#define mdmDefaultPulse false +#define mdmDefaultHShk mdmHandshakeStd +#define mdmDefaultAutoBaud false +#define mdmDefaultResetString "" +#define mdmDefaultInitString "&F&B1X4" + + +/************************************************************ + * Modem Manager Macros + *************************************************************/ + +#endif // __MODEM_PRV_H__ + diff --git a/sdk-2/include/Core/System/NetMgr.h b/sdk-2/include/Core/System/NetMgr.h new file mode 100644 index 0000000..a6993c6 --- /dev/null +++ b/sdk-2/include/Core/System/NetMgr.h @@ -0,0 +1,1193 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * NetMgr.h + * + * Description: + * This module contains the interface definition for the TCP/IP + * library on Pilot. + * + * History: + * 2/14/96 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __NETMGR_H__ +#define __NETMGR_H__ + +#include +#include + + +/******************************************************************** + * Type and creator of Net Library database + ********************************************************************/ + +// Creator. Used for both the database that contains the Net Library and +// it's preferences database. +#define netCreator 'netl' // Our Net Library creator + +// Feature Creators and numbers, for use with the FtrGet() call. This +// feature can be obtained to get the current version of the Net Library +#define netFtrCreator netCreator +#define netFtrNumVersion 0 // get version of Net Library + // 0xMMmfsbbb, where MM is major version, m is minor version + // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development, + // bbb is build number for non-releases + // V1.12b3 would be: 0x01122003 + // V2.00a2 would be: 0x02001002 + // V1.01 would be: 0x01013000 + + +// Types. Used to identify the Net Library from it's prefs. +#define netLibType 'libr' // Our Net Code Resources Database type +#define netPrefsType 'rsrc' // Our Net Preferences Database type + + +// All Network interface's have the following type: +#define netIFFileType 'neti' // The filetype of all Network Interfaces + +// Each Network interface has a unique creator: +#define netIFCreatorLoop 'loop' // Loopback network interface creator. +#define netIFCreatorSLIP 'slip' // SLIP network interface creator. +#define netIFCreatorPPP 'ppp_' // PPP network interface creator. + + + +//----------------------------------------------------------------------------- +// Misc. constants +//----------------------------------------------------------------------------- +#define netDrvrTypeNameLen 8 // Maximum driver type length +#define netDrvrHWNameLen 16 // Maximum driver hardware name length +#define netIFNameLen 10 // Maximum interface name (driver type + instance num) +#define netIFMaxHWAddrLen 14 // Maximum size of a hardware address + + + +//----------------------------------------------------------------------------- +// Option constants that can be passed to NetSocketOptionSet and NetSocketOptionGet +// When an option is set or retrieved, both the level of the option and the +// option number must be specified. The level refers to which layer the option +// refers to, like the uppermost socket layer, for example. +//----------------------------------------------------------------------------- + +// Socket level options +typedef enum { + // IP Level options + netSocketOptIPOptions = 1, // options in IP header (IP_OPTIONS) + + // TCP Level options + netSocketOptTCPNoDelay = 1, // don't delay send to coalesce packets + netSocketOptTCPMaxSeg = 2, // TCP maximum segment size (TCP_MAXSEG) + + // Socket level options + netSocketOptSockDebug = 0x0001, // turn on debugging info recording + netSocketOptSockAcceptConn = 0x0002, // socket has had listen + netSocketOptSockReuseAddr = 0x0004, // allow local address reuse + netSocketOptSockKeepAlive = 0x0008, // keep connections alive + netSocketOptSockDontRoute = 0x0010, // just use interface addresses + netSocketOptSockBroadcast = 0x0020, // permit sending of broadcast msgs + netSocketOptSockUseLoopback = 0x0040, // bypass hardware when possible + netSocketOptSockLinger = 0x0080, // linger on close if data present + netSocketOptSockOOBInLine = 0x0100, // leave received OutOfBand data in line + + netSocketOptSockSndBufSize = 0x1001, // send buffer size + netSocketOptSockRcvBufSize = 0x1002, // receive buffer size + netSocketOptSockSndLowWater = 0x1003, // send low-water mark + netSocketOptSockRcvLowWater = 0x1004, // receive low-water mark + netSocketOptSockSndTimeout = 0x1005, // send timeout + netSocketOptSockRcvTimeout = 0x1006, // receive timeout + netSocketOptSockErrorStatus= 0x1007, // get error status and clear + netSocketOptSockSocketType = 0x1008, // get socket type + + // The following are Pilot specific options + netSocketOptSockNonBlocking = 0x2000 // set non-blocking mode on or off + } NetSocketOptEnum; + + + + +// Option levels for SocketOptionSet and SocketOptionGet +typedef enum { + netSocketOptLevelIP = 0, // IP level options (IPPROTO_IP) + netSocketOptLevelTCP = 6, // TCP level options (IPPROTO_TCP) + netSocketOptLevelSocket = 0xFFFF // Socket level options (SOL_SOCKET) + } NetSocketOptLevelEnum; + + +// Structure used for manipulating the linger option +typedef struct { + SWord onOff; // option on/off + SWord time; // linger time in seconds + } NetSocketLingerType; + +//----------------------------------------------------------------------------- +// Enumeration of Socket domains and types passed to NetSocketOpen +//----------------------------------------------------------------------------- +typedef enum { + netSocketAddrINET=2 // (AF_INET) + } NetSocketAddrEnum; + +typedef enum { + netSocketTypeStream=1, // (SOCK_STREAM) + netSocketTypeDatagram=2, // (SOCK_DGRAM) + netSocketTypeRaw=3 // (SOCK_RAW) + } NetSocketTypeEnum; + + +//----------------------------------------------------------------------------- +// Enumeration of Socket direction, passed to NetSocketShutdown +//----------------------------------------------------------------------------- +typedef enum { + netSocketDirInput=0, + netSocketDirOutput=1, + netSocketDirBoth=2 + } NetSocketDirEnum; + + +//----------------------------------------------------------------------------- +// Basic Types +//----------------------------------------------------------------------------- +// Socket refnum +typedef SWord NetSocketRef; + +// Type used to hold internet addresses +typedef DWord NetIPAddr; // a 32-bit IP address. + + + +//----------------------------------------------------------------------------- +// Structure used to hold an internet socket address. This includes the internet +// address and the port number. This structure directly maps to the BSD unix +// struct sockaddr_in. +//----------------------------------------------------------------------------- +typedef struct NetSocketAddrINType { + SWord family; // Address family in HBO (Host Byte Order) + Word port; // the UDP port in NBO (Network Byte Order) + NetIPAddr addr; // IP address in NBO (Network Byte Order) + } NetSocketAddrINType; + +// Constant that means "use the local machine's IP address" +#define netIPAddrLocal 0 // Can be used in NetSockAddrINType.addr + + +// Structure used to hold a generic socket address. This is a generic struct +// designed to hold any type of address including internet addresses. This +// structure directly maps to the BSD unix struct sockaddr. +typedef struct NetSocketAddrType { + SWord family; // Address family + Byte data[14]; // 14 bytes of address + } NetSocketAddrType; + + + +//----------------------------------------------------------------------------- +// Structure used to hold information about data to be sent. This structure +// is passed to NetLibSendMsg and contains the optional address to send to, +// a scatter-write array of data to be sent, and optional access rights +//----------------------------------------------------------------------------- + +// Scatter/Gather array type. A pointer to an array of these structs is +// passed to the NetLibSendPB and NetLibRecvPB calls. It specifies where +// data should go to or come from as a list of buffer addresses and sizes. +typedef struct NetIOVecType { + BytePtr bufP; // buffer address + Word bufLen; // buffer length + } NetIOVecType, *NetIOVecPtr; + +#define netIOVecMaxLen 16 // max# of NetIOVecTypes in an array + +// Read/Write ParamBlock type. Passed directly to the SendPB and RecvPB calls. +typedef struct { + BytePtr addrP; // address - or 0 for default + Word addrLen; // length of address + NetIOVecPtr iov; // scatter/gather array + Word iovLen; // length of above array + BytePtr accessRights; // access rights + Word accessRightsLen; // length of accessrights + } NetIOParamType, *NetIOParamPtr; + +// Flags values for the NetLibSend, NetLibReceive calls +#define netIOFlagOutOfBand 0x01 // process out-of-band data +#define netIOFlagPeek 0x02 // peek at incoming message +#define netIOFlagDontRoute 0x04 // send without using routing + + + +//----------------------------------------------------------------------------- +// Structures used for looking up a host by name or address (NetLibGetHostByName) +//----------------------------------------------------------------------------- + +// Equates for DNS names, from RFC-1035 +#define netDNSMaxDomainName 255 +#define netDNSMaxDomainLabel 63 + +#define netDNSMaxAliases 1 // max # of aliases for a host +#define netDNSMaxAddresses 4 // max # of addresses for a host + + +// The actual results of NetLibGetHostByName() are returned in this structure. +// This structure is designed to match the "struct hostent" structure in Unix. +typedef struct { + CharPtr nameP; // official name of host + CharPtr* nameAliasesP; // array of alias's for the name + Word addrType; // address type of return addresses + Word addrLen; // the length, in bytes, of the addresses + BytePtr* addrListP; // array of ptrs to addresses in HBO + } NetHostInfoType, *NetHostInfoPtr; + + +// "Buffer" passed to call as a place to store the results +typedef struct { + NetHostInfoType hostInfo; // high level results of call are here + + // The following fields contain the variable length data that + // hostInfo points to + Char name[netDNSMaxDomainName+1]; // hostInfo->name + + CharPtr aliasList[netDNSMaxAliases+1]; // +1 for 0 termination. + Char aliases[netDNSMaxAliases][netDNSMaxDomainName+1]; + + NetIPAddr* addressList[netDNSMaxAddresses]; + NetIPAddr address[netDNSMaxAddresses]; + + } NetHostInfoBufType, *NetHostInfoBufPtr; + + +//----------------------------------------------------------------------------- +// Structures used for looking up a service (NetLibGetServByName) +//----------------------------------------------------------------------------- + +// Equates for service names +#define netServMaxName 15 // max # characters in service name +#define netProtoMaxName 15 // max # characters in protocol name +#define netServMaxAliases 1 // max # of aliases for a service + + +// The actual results of NetLibGetServByName() are returned in this structure. +// This structure is designed to match the "struct servent" structure in Unix. +typedef struct { + CharPtr nameP; // official name of service + CharPtr* nameAliasesP; // array of alias's for the name + Word port; // port number for this service + CharPtr protoP; // name of protocol to use + } NetServInfoType, *NetServInfoPtr; + +// "Buffer" passed to call as a place to store the results +typedef struct { + NetServInfoType servInfo; // high level results of call are here + + // The following fields contain the variable length data that + // servInfo points to + Char name[netServMaxName+1]; // hostInfo->name + + CharPtr aliasList[netServMaxAliases+1]; // +1 for 0 termination. + Char aliases[netServMaxAliases][netServMaxName]; + Char protoName[netProtoMaxName+1]; + + } NetServInfoBufType, *NetServInfoBufPtr; + + + + +/******************************************************************** + * Tracing Flags. These flags are ORed together and passed as a DWord + * in the netSettingTraceFlags setting and netIFSettingTraceFlags to + * enable/disable various trace options. + ********************************************************************/ +#define netTracingErrors 0x00000001 // record errors +#define netTracingMsgs 0x00000002 // record messages +#define netTracingPkts 0x00000004 // record packets I/O +#define netTracingFuncs 0x00000008 // record function flow +#define netTracingAppMsgs 0x00000010 // record application messages + // (NetLibTracePrintF, NetLibTracePutS) + + + +/******************************************************************** + * Command numbers and parameter blocks for the NetLibMaster() call. + * This call is used to put the Net library into certain debugging modes + * or for obtaining statistics from the Net Library. + * + ********************************************************************/ +#pragma mark Master +typedef enum { + // These calls return info + netMasterInterfaceInfo, + netMasterInterfaceStats, + netMasterIPStats, + netMasterICMPStats, + netMasterUDPStats, + netMasterTCPStats, + + // This call used to read the trace buffer. + netMasterTraceEventGet // get trace event by index + + } NetMasterEnum; + + +typedef struct NetMasterPBType { + + // These fields are specific to each command + union { + + //............................................................. + // InterfaceInfo command + //............................................................. + struct { + Word index; // -> index of interface + DWord creator; // <- creator + Word instance; // <- instance + VoidPtr netIFP; // <- net_if pointer + + // driver level info + Char drvrName[netDrvrTypeNameLen]; // <- type of driver (SLIP,PPP, etc) + Char hwName[netDrvrHWNameLen]; // <- hardware name (Serial Library, etc) + Byte localNetHdrLen; // <- local net header length + Byte localNetTrailerLen; // <- local net trailer length + Word localNetMaxFrame; // <- local net maximum frame size + + // media layer info + Char ifName[netIFNameLen];// <- interface name w/instance + Boolean driverUp; // <- true if interface driver up + Boolean ifUp; // <- true if interface is up + Word hwAddrLen; // <- length of hardware address + Byte hwAddr[netIFMaxHWAddrLen]; // <- hardware address + Word mtu; // <- maximum transfer unit of interface + DWord speed; // <- speed in bits/sec. + DWord lastStateChange; // <- time in milliseconds of last state change + + // Address info + NetIPAddr ipAddr; // Address of this interface + NetIPAddr subnetMask; // subnet mask of local network + NetIPAddr broadcast; // broadcast address of local network + } interfaceInfo; + + //............................................................. + // InterfaceStats command + //............................................................. + struct { + Word index; // -> index of interface + DWord inOctets; // <- .... + DWord inUcastPkts; + DWord inNUcastPkts; + DWord inDiscards; + DWord inErrors; + DWord inUnknownProtos; + DWord outOctets; + DWord outUcastPkts; + DWord outNUcastPkts; + DWord outDiscards; + DWord outErrors; + } interfaceStats; + + //............................................................. + // IPStats command + //............................................................. + struct { + DWord ipInReceives; + DWord ipInHdrErrors; + DWord ipInAddrErrors; + DWord ipForwDatagrams; + DWord ipInUnknownProtos; + DWord ipInDiscards; + DWord ipInDelivers; + DWord ipOutRequests; + DWord ipOutDiscards; + DWord ipOutNoRoutes; + DWord ipReasmReqds; + DWord ipReasmOKs; + DWord ipReasmFails; + DWord ipFragOKs; + DWord ipFragFails; + DWord ipFragCreates; + DWord ipRoutingDiscards; + DWord ipDefaultTTL; + DWord ipReasmTimeout; + } ipStats; + + //............................................................. + // ICMPStats command + //............................................................. + struct { + DWord icmpInMsgs; + DWord icmpInErrors; + DWord icmpInDestUnreachs; + DWord icmpInTimeExcds; + DWord icmpInParmProbs; + DWord icmpInSrcQuenchs; + DWord icmpInRedirects; + DWord icmpInEchos; + DWord icmpInEchoReps; + DWord icmpInTimestamps; + DWord icmpInTimestampReps; + DWord icmpInAddrMasks; + DWord icmpInAddrMaskReps; + DWord icmpOutMsgs; + DWord icmpOutErrors; + DWord icmpOutDestUnreachs; + DWord icmpOutTimeExcds; + DWord icmpOutParmProbs; + DWord icmpOutSrcQuenchs; + DWord icmpOutRedirects; + DWord icmpOutEchos; + DWord icmpOutEchoReps; + DWord icmpOutTimestamps; + DWord icmpOutTimestampReps; + DWord icmpOutAddrMasks; + DWord icmpOutAddrMaskReps; + } icmpStats; + + //............................................................. + // UDPStats command + //............................................................. + struct { + DWord udpInDatagrams; + DWord udpNoPorts; + DWord udpInErrors; + DWord udpOutDatagrams; + } udpStats; + + //............................................................. + // TCPStats command + //............................................................. + struct { + DWord tcpRtoAlgorithm; + DWord tcpRtoMin; + DWord tcpRtoMax; + DWord tcpMaxConn; + DWord tcpActiveOpens; + DWord tcpPassiveOpens; + DWord tcpAttemptFails; + DWord tcpEstabResets; + DWord tcpCurrEstab; + DWord tcpInSegs; + DWord tcpOutSegs; + DWord tcpRetransSegs; + DWord tcpInErrs; + DWord tcpOutRsts; + } tcpStats; + + //............................................................. + // TraceEventGet command + //............................................................. + struct { + Word index; // which event + CharPtr textP; // ptr to text string to return it in + } traceEventGet; + + } param; + + } NetMasterPBType, *NetMasterPBPtr; + + + + + +//----------------------------------------------------------------------------- +// Enumeration of Net settings as passed to NetLibSettingGet/Set. +//----------------------------------------------------------------------------- +#pragma mark Settings +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Global environment settings common to all attached network interfaces, +// passed to NetLibSettingGet/Set +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +typedef enum { + netSettingResetAll, // void, NetLibSettingSet only, resets all settings + // to their defaults. + + netSettingPrimaryDNS, // DWord, IP address of Primary DN Server + netSettingSecondaryDNS, // DWord, IP address of Secondary DN Server + netSettingDefaultRouter, // DWord, IP address of Default router + netSettingDefaultIFCreator, // DWord, Creator type of default interface + netSettingDefaultIFInstance, // Word, Instance# of default interface + netSettingHostName, // Char[64], name of host (not including domain) + netSettingDomainName, // Char[256], domain name of hosts's domain + netSettingHostTbl, // Char[], host table + netSettingCloseWaitTime, // DWord, time in milliseconds to stay in close-wait state + + + // The following settings are not used for configuration, but rather put the + // stack into various modes for debugging, etc. + netSettingTraceBits = 0x1000, // DWord, enable/disable various trace flags (netTraceBitXXXX) + netSettingTraceSize, // DWord, max trace buffer size in bytes. Default 0x800. + // Setting this will also clear the trace buffer. + netSettingTraceStart, // DWord, for internal use ONLY!! + netSettingTraceRoll, // Byte, if true, trace buffer will rollover after it fills. + // Default is true. + + netSettingRTPrimaryDNS, // used internally by Network interfaces + // that dynamically obtain the DNS address + netSettingRTSecondaryDNS // used internally by Network interfaces + // that dynamically obtain the DNS address + + } NetSettingEnum; + + +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Settings for each Network Interface, passed to NetLibIFSettingGet/Set +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +typedef enum { + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Reset all settings to defaults + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingResetAll, // void, NetLibIFSettingSet only, resets all settings + // to their defaults. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Status - read only + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingUp, // Byte, true if interface is UP. + netIFSettingName, // Char[32], name of interface + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Addressing + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingReqIPAddr, // DWord, requested IP address of this interface + netIFSettingSubnetMask, // DWord, subnet mask of this interface + netIFSettingBroadcast, // DWord, broadcast address for this interface + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // User Info + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingUsername, // Char[], login script user name + // If 0 length, then user will be prompted for it + netIFSettingPassword, // Char[], login script user password + // If 0 length, then user will be prompted for it + netIFSettingDialbackUsername, // Char[], login script dialback user name. + // If 0 length, then netIFSettingUsername is used + netIFSettingDialbackPassword, // Char[], login script dialback user password. + // If 0 length, then user will be prompted for it + netIFSettingAuthUsername, // Char[], PAP/CHAP name. + // If 0 length, then netIFSettingUsername is used + netIFSettingAuthPassword, // Char[], PAP/CHAP password. + // If "$", then user will be prompted for it + // else If 0 length, then netIFSettingPassword or result + // of it's prompt (if it was empty) will be used + // else it is used as-is. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Connect Settings + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingServiceName, // Char[], name of service + netIFSettingLoginScript, // Char[], login script + netIFSettingConnectLog, // Char[], connect log + netIFSettingInactivityTimeout, // Word, # of seconds of inactivity allowed before + // interface is brought down. If 0 then + // no inactivity timeout enforced. + netIFSettingEstablishmentTimeout, // Word, max delay in seconds between connection + // establishment stages + + // Serial based protocol options + netIFSettingDynamicIP, // Byte, if true, get IP address from server + // N/A for SLIP + netIFSettingVJCompEnable, // Byte, if true enable VJ Header compression + // Default is on for PPP, off for SLIP + netIFSettingVJCompSlots, // Byte, # of slots to use for VJ compression. + // Default is 4 for PPP, 16 for SLIP + // (each slot uses 256 bytes of RAM). + netIFSettingMTU, // Word, maximum transmission unit in bytes + // ignored in current PPP and SLIP interfaces + netIFSettingAsyncCtlMap, // DWord, bitmask of characters to escape + // ignored in current PPP interfaces + + // Serial settings, used by serial based network interfaces + netIFSettingPortNum, // Word, port number to use + netIFSettingBaudRate, // DWord, baud rate in bits/sec. + netIFSettingFlowControl, // Byte, flow control setting bits. Set to 0x01 for + // hardware flow control, else set to 0x00. + netIFSettingStopBits, // Byte, # of stop bits + netIFSettingParityOn, // Byte, true if parity on + netIFSettingParityEven, // Byte, true if parity even + + // Modem settings, optionally used by serial based network interfaces + netIFSettingUseModem, // Byte, if true dial-up through modem + netIFSettingPulseDial, // Byte, if true use pulse dial, else tone + netIFSettingModemInit, // Char[], modem initialization string + netIFSettingModemPhone, // Char[], modem phone number string + netIFSettingRedialCount, // Word, # of times to redial + + + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // The following settings are not used for configuration, but rather put the + // stack into various modes for debugging, etc. + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingTraceBits = 0x1000, // DWord, enable/disable various trace flags (netTraceBitXXXX) + netIFSettingGlobalsPtr, // DWord, (Read-Only) sinterface's globals ptr + netIFSettingActualIPAddr, // DWord, (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, // DWord, (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, // Byte, if true interface will be brought down when + // Pilot is turned off. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // 3rd party settings start here... + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingCustom = 0x8000 + + } NetIFSettingEnum; + + + + + +/************************************************************ + * Net Library Macros + *************************************************************/ +// Return current time in milliseconds. +#define NetNow() (TimGetTicks() * 1000L/sysTicksPerSecond) + + +// File Descriptor macros used for the NetLibSelect() call +typedef DWord NetFDSetType; +#define netFDSetSize 32 + +#define netFDSet(n,p) ((*p) |= (1L << n)) +#define netFDClr(n,p) ((*p) &= ~(1L << n)) +#define netFDIsSet(n,p) ((*p) & (1L << n)) +#define netFDZero(p) ((*p) = 0) + + + +//----------------------------------------------------------------------------- +// Net error codes +//----------------------------------------------------------------------------- +#pragma mark ErrorCodes +#define netErrAlreadyOpen (netErrorClass | 1) +#define netErrNotOpen (netErrorClass | 2) +#define netErrStillOpen (netErrorClass | 3) +#define netErrParamErr (netErrorClass | 4) +#define netErrNoMoreSockets (netErrorClass | 5) +#define netErrOutOfResources (netErrorClass | 6) +#define netErrOutOfMemory (netErrorClass | 7) +#define netErrSocketNotOpen (netErrorClass | 8) +#define netErrSocketBusy (netErrorClass | 9) //EINPROGRESS +#define netErrMessageTooBig (netErrorClass | 10) +#define netErrSocketNotConnected (netErrorClass | 11) +#define netErrNoInterfaces (netErrorClass | 12) //ENETUNREACH +#define netErrBufTooSmall (netErrorClass | 13) +#define netErrUnimplemented (netErrorClass | 14) +#define netErrPortInUse (netErrorClass | 15) //EADDRINUSE +#define netErrQuietTimeNotElapsed (netErrorClass | 16) //EADDRINUSE +#define netErrInternal (netErrorClass | 17) +#define netErrTimeout (netErrorClass | 18) //ETIMEDOUT +#define netErrSocketAlreadyConnected (netErrorClass | 19) //EISCONN +#define netErrSocketClosedByRemote (netErrorClass | 20) +#define netErrOutOfCmdBlocks (netErrorClass | 21) +#define netErrWrongSocketType (netErrorClass | 22) +#define netErrSocketNotListening (netErrorClass | 23) +#define netErrUnknownSetting (netErrorClass | 24) +#define netErrInvalidSettingSize (netErrorClass | 25) +#define netErrPrefNotFound (netErrorClass | 26) +#define netErrInvalidInterface (netErrorClass | 27) +#define netErrInterfaceNotFound (netErrorClass | 28) +#define netErrTooManyInterfaces (netErrorClass | 29) +#define netErrBufWrongSize (netErrorClass | 30) +#define netErrUserCancel (netErrorClass | 31) +#define netErrBadScript (netErrorClass | 32) +#define netErrNoSocket (netErrorClass | 33) +#define netErrSocketRcvBufFull (netErrorClass | 34) +#define netErrNoPendingConnect (netErrorClass | 35) +#define netErrUnexpectedCmd (netErrorClass | 36) +#define netErrNoTCB (netErrorClass | 37) +#define netErrNilRemoteWindowSize (netErrorClass | 38) +#define netErrNoTimerProc (netErrorClass | 39) +#define netErrSocketInputShutdown (netErrorClass | 40) // EOF to sockets API +#define netErrCmdBlockNotCheckedOut (netErrorClass | 41) +#define netErrCmdNotDone (netErrorClass | 42) +#define netErrUnknownProtocol (netErrorClass | 43) +#define netErrUnknownService (netErrorClass | 44) +#define netErrUnreachableDest (netErrorClass | 45) +#define netErrReadOnlySetting (netErrorClass | 46) +#define netErrWouldBlock (netErrorClass | 47) //EWOULDBLOCK +#define netErrAlreadyInProgress (netErrorClass | 48) //EALREADY +#define netErrPPPTimeout (netErrorClass | 49) +#define netErrPPPBroughtDown (netErrorClass | 50) +#define netErrAuthFailure (netErrorClass | 51) +#define netErrPPPAddressRefused (netErrorClass | 52) +// The following map into the Epilogue DNS errors declared in DNS.ep.h: +// and MUST be kept in this order!! +#define netErrDNSNameTooLong (netErrorClass | 53) +#define netErrDNSBadName (netErrorClass | 54) +#define netErrDNSBadArgs (netErrorClass | 55) +#define netErrDNSLabelTooLong (netErrorClass | 56) +#define netErrDNSAllocationFailure (netErrorClass | 57) +#define netErrDNSTimeout (netErrorClass | 58) +#define netErrDNSUnreachable (netErrorClass | 59) +#define netErrDNSFormat (netErrorClass | 60) +#define netErrDNSServerFailure (netErrorClass | 61) +#define netErrDNSNonexistantName (netErrorClass | 62) +#define netErrDNSNIY (netErrorClass | 63) +#define netErrDNSRefused (netErrorClass | 64) +#define netErrDNSImpossible (netErrorClass | 65) +#define netErrDNSNoRRS (netErrorClass | 66) +#define netErrDNSAborted (netErrorClass | 67) +#define netErrDNSBadProtocol (netErrorClass | 68) +#define netErrDNSTruncated (netErrorClass | 69) +#define netErrDNSNoRecursion (netErrorClass | 70) +#define netErrDNSIrrelevant (netErrorClass | 71) +#define netErrDNSNotInLocalCache (netErrorClass | 72) +#define netErrDNSNoPort (netErrorClass | 73) +// The following map into the Epilogue IP errors declared in IP.ep.h: +// and MUST be kept in this order!! +#define netErrIPCantFragment (netErrorClass | 74) +#define netErrIPNoRoute (netErrorClass | 75) +#define netErrIPNoSrc (netErrorClass | 76) +#define netErrIPNoDst (netErrorClass | 77) +#define netErrIPktOverflow (netErrorClass | 78) +// End of Epilogue IP errors +#define netErrTooManyTCPConnections (netErrorClass | 79) +#define netErrNoDNSServers (netErrorClass | 80) + + +//----------------------------------------------------------------------------- +// Net library call ID's. Each library call gets the trap number: +// netTrapXXXX which serves as an index into the library's dispatch table. +// The constant sysLibTrapCustom is the first available trap number after +// the system predefined library traps Open,Close,Sleep & Wake. +// +// WARNING!!! This order of these traps MUST match the order of the dispatch +// table in NetDispatch.c!!! +//----------------------------------------------------------------------------- +#pragma mark Traps +typedef enum { + netLibTrapAddrINToA = sysLibTrapCustom, + netLibTrapAddrAToIN, + + netLibTrapSocketOpen, + netLibTrapSocketClose, + netLibTrapSocketOptionSet, + netLibTrapSocketOptionGet, + netLibTrapSocketBind, + netLibTrapSocketConnect, + netLibTrapSocketListen, + netLibTrapSocketAccept, + netLibTrapSocketShutdown, + + netLibTrapSendPB, + netLibTrapSend, + netLibTrapReceivePB, + netLibTrapReceive, + netLibTrapDmReceive, + netLibTrapSelect, + + netLibTrapPrefsGet, + netLibTrapPrefsSet, + + // The following traps are for internal and Network interface + // use only. + netLibTrapDrvrWake, + netLibTrapInterfacePtr, + netLibTrapMaster, + + // New Traps, re-order these later.. + netLibTrapGetHostByName, + netLibTrapSettingGet, + netLibTrapSettingSet, + netLibTrapIFAttach, + netLibTrapIFDetach, + netLibTrapIFGet, + netLibTrapIFSettingGet, + netLibTrapIFSettingSet, + netLibTrapIFUp, + netLibTrapIFDown, + netLibTrapIFMediaUp, + netLibTrapScriptExecute, + netLibTrapGetHostByAddr, + netLibTrapGetServByName, + netLibTrapSocketAddr, + netLibTrapFinishCloseWait, + netLibTrapGetMailExchangeByName, + netLibTrapPrefsAppend, + netLibTrapIFMediaDown, + netLibTrapOpenCount, + + netLibTrapTracePrintF, + netLibTrapTracePutS, + + netLibTrapOpenIfCloseWait, + netLibTrapHandlePowerOff, + + netLibTrapConnectionRefresh, + + netLibTrapLast + } NetLibTrapNumberEnum; + + + +/************************************************************ + * Net Library procedures. + *************************************************************/ +#pragma mark Functions +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +Err NetLibOpen (Word libRefnum, WordPtr netIFErrsP) + SYS_TRAP(sysLibTrapOpen); + +Err NetLibClose (Word libRefnum, Word immediate) + SYS_TRAP(sysLibTrapClose); + +Err NetLibSleep (Word libRefnum) + SYS_TRAP(sysLibTrapSleep); + +Err NetLibWake (Word libRefnum) + SYS_TRAP(sysLibTrapWake); + + +// This call forces the library to complete a close if it's +// currently in the close-wait state. Returns 0 if library is closed, +// Returns netErrFullyOpen if library is still open by some other task. +Err NetLibFinishCloseWait(Word libRefnum) + SYS_TRAP(netLibTrapFinishCloseWait); + +// This call is for use by the Network preference panel only. It +// causes the NetLib to fully open if it's currently in the close-wait +// state. If it's not in the close wait state, it returns an error code +Err NetLibOpenIfCloseWait(Word libRefnum) + SYS_TRAP(netLibTrapOpenIfCloseWait); + +// Get the open Count of the NetLib +Err NetLibOpenCount (Word refNum, WordPtr countP) + SYS_TRAP(netLibTrapOpenCount); + +// Give NetLib a chance to close the connection down in response +// to a power off event. Returns non-zero if power should not be +// turned off. EventP points to the event that initiated the power off +// which is either a keyDownEvent of the hardPowerChr or the autoOffChr. +Err NetLibHandlePowerOff (Word refNum, EventPtr eventP) + SYS_TRAP(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. +Err NetLibConnectionRefresh(Word refNum, Boolean refresh, + BytePtr allInterfacesUpP, WordPtr netIFErrP) + SYS_TRAP(netLibTrapConnectionRefresh); + + +//-------------------------------------------------- +// Net address translation and conversion routines. +//-------------------------------------------------- + +// convert host short to network short +#define NetHToNS(x) (x) + +// convert host long to network long +#define NetHToNL(x) (x) + +// convert network short to host short +#define NetNToHS(x) (x) + +// convert network long to host long +#define NetNToHL(x) (x) + +// Convert 32-bit IP address to ascii dotted decimal form. The Sockets glue +// macro inet_ntoa will pass the address of an application global string in +// spaceP. +CharPtr NetLibAddrINToA(Word libRefnum, NetIPAddr inet, CharPtr spaceP) + SYS_TRAP(netLibTrapAddrINToA); + +// Convert a dotted decimal ascii string format of an IP address into +// a 32-bit value. +NetIPAddr NetLibAddrAToIN(Word libRefnum, CharPtr a) + SYS_TRAP(netLibTrapAddrAToIN); + + + +//-------------------------------------------------- +// Socket creation and option setting +//-------------------------------------------------- + +// Create a socket and return a refnum to it. Protocol is normally 0. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +NetSocketRef NetLibSocketOpen(Word libRefnum, NetSocketAddrEnum domain, + NetSocketTypeEnum type, SWord protocol, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketOpen); + +// Close a socket. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketClose(Word libRefnum, NetSocketRef socket, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketClose); + +// Set a socket option. Level is usually netSocketOptLevelSocket. Option is one of +// netSocketOptXXXXX. OptValueP is a pointer to the new value and optValueLen is +// the length of the option value. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketOptionSet(Word libRefnum, NetSocketRef socket, + Word /*NetSocketOptLevelEnum*/ level, Word /*NetSocketOptEnum*/ option, + VoidPtr optValueP, Word optValueLen, + SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketOptionSet); + +// Get a socket option. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketOptionGet(Word libRefnum, NetSocketRef socket, + Word /*NetSocketOptLevelEnum*/ level, Word /*NetSocketOptEnum*/ option, + VoidPtr optValueP, WordPtr optValueLenP, + SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketOptionGet); + + +//-------------------------------------------------- +// Socket Control +//-------------------------------------------------- + +// Bind a source address and port number to a socket. This makes the +// socket accept incoming packets destined for the given socket address. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketBind(Word libRefnum, NetSocketRef socket, + NetSocketAddrType* sockAddrP, SWord addrLen, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketBind); + + +// Connect to a remote socket. For a stream based socket (i.e. TCP), this initiates +// a 3-way handshake with the remote machine to establish a connection. For +// non-stream based socket, this merely specifies a destination address and port +// number for future outgoing packets from this socket. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketConnect(Word libRefnum, NetSocketRef socket, + NetSocketAddrType* sockAddrP, SWord addrLen, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketConnect); + + +// Makes a socket ready to accept incoming connection requests. The queueLen +// specifies the max number of pending connection requests that will be enqueued +// while the server is busy handling other requests. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketListen(Word libRefnum, NetSocketRef socket, + Word queueLen, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketListen); + + +// Blocks the current process waiting for an incoming connection request. The socket +// must have previously be put into listen mode through the NetLibSocketListen call. +// On return, *sockAddrP will have the remote machines address and port number. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketAccept(Word libRefnum, NetSocketRef socket, + NetSocketAddrType* sockAddrP, SWord* addrLenP, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketAccept); + + +// Shutdown a connection in one or both directions. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketShutdown(Word libRefnum, NetSocketRef socket, + SWord /*NetSocketDirEnum*/ direction, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketShutdown); + + + +// Gets the local and remote addresses of a socket. Useful for TCP sockets that +// get dynamically bound at connect time. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketAddr(Word libRefnum, NetSocketRef socketRef, + NetSocketAddrType* locAddrP, SWord* locAddrLenP, + NetSocketAddrType* remAddrP, SWord* remAddrLenP, + SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketAddr); + + + +//-------------------------------------------------- +// Sending and Receiving +//-------------------------------------------------- +// Send data through a socket. The data is specified through the NetIOParamType +// structure. +// Flags is one or more of netMsgFlagXXX. +// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled +// in with error code. +SWord NetLibSendPB(Word libRefNum, NetSocketRef socket, + NetIOParamType* pbP, Word flags, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSendPB); + +// Send data through a socket. The data to send is passed in a single buffer, +// unlike NetLibSendPB. If toAddrP is not nil, the data will be sent to +// address *toAddrP. +// Flags is one or more of netMsgFlagXXX. +// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled +// in with error code. +SWord NetLibSend(Word libRefNum, NetSocketRef socket, + const VoidPtr bufP, Word bufLen, Word flags, + VoidPtr toAddrP, Word toLen, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSend); + +// Receive data from a socket. The data is gatthered into buffers specified in the +// NetIOParamType structure. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +SWord NetLibReceivePB(Word libRefNum, NetSocketRef socket, + NetIOParamType* pbP, Word flags, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapReceivePB); + +// Receive data from a socket. The data is read into a single buffer, unlike +// NetLibReceivePB. If fromAddrP is not nil, *fromLenP must be initialized to +// the size of the buffer that fromAddrP points to and on exit *fromAddrP will +// have the address of the sender in it. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +SWord NetLibReceive(Word libRefNum, NetSocketRef socket, + VoidPtr bufP, Word bufLen, Word flags, + VoidPtr fromAddrP, WordPtr fromLenP, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapReceive); + + +// Receive data from a socket directly into a (write-protected) Data Manager +// record. +// If fromAddrP is not nil, *fromLenP must be initialized to +// the size of the buffer that fromAddrP points to and on exit *fromAddrP will +// have the address of the sender in it. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +SWord NetLibDmReceive(Word libRefNum, NetSocketRef socket, + VoidPtr recordP, DWord recordOffset, Word rcvLen, Word flags, + VoidPtr fromAddrP, WordPtr fromLenP, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapDmReceive); + + +//-------------------------------------------------- +// Name Lookups +//-------------------------------------------------- +NetHostInfoPtr NetLibGetHostByName(Word libRefNum, CharPtr nameP, + NetHostInfoBufPtr bufP, Long timeout, Err* errP) + SYS_TRAP(netLibTrapGetHostByName); + + +NetHostInfoPtr NetLibGetHostByAddr(Word libRefNum, BytePtr addrP, Word len, Word type, + NetHostInfoBufPtr bufP, Long timeout, Err* errP) + SYS_TRAP(netLibTrapGetHostByAddr); + + +NetServInfoPtr NetLibGetServByName(Word libRefNum, CharPtr servNameP, + CharPtr protoNameP, NetServInfoBufPtr bufP, + Long timeout, Err* errP) + SYS_TRAP(netLibTrapGetServByName); + +// Looks up a mail exchange name and returns a list of hostnames for it. Caller +// must pass space for list of return names (hostNames), space for +// list of priorities for those hosts (priorities) and max # of names to +// return (maxEntries). +// Returns # of entries found, or -1 on error. If error, *errP gets filled in +// with error code. +SWord NetLibGetMailExchangeByName(Word libRefNum, CharPtr mailNameP, + Word maxEntries, + Char hostNames[][netDNSMaxDomainName+1], Word priorities[], + Long timeout, Err* errP) + SYS_TRAP(netLibTrapGetMailExchangeByName); + + +//-------------------------------------------------- +// Interface setup +//-------------------------------------------------- +Err NetLibIFGet(Word libRefNum, Word index, DWordPtr ifCreatorP, + WordPtr ifInstanceP) + SYS_TRAP(netLibTrapIFGet); + +Err NetLibIFAttach(Word libRefNum, DWord ifCreator, Word ifInstance, + SDWord timeout) + SYS_TRAP(netLibTrapIFAttach); + +Err NetLibIFDetach(Word libRefNum, DWord ifCreator, Word ifInstance, + SDWord timeout) + SYS_TRAP(netLibTrapIFDetach); + +Err NetLibIFUp(Word libRefNum, DWord ifCreator, Word ifInstance) + SYS_TRAP(netLibTrapIFUp); + +Err NetLibIFDown(Word libRefNum, DWord ifCreator, Word ifInstance, + SDWord timeout) + SYS_TRAP(netLibTrapIFDown); + + + + +//-------------------------------------------------- +// Settings +//-------------------------------------------------- +// General settings +Err NetLibSettingGet(Word libRefNum, + Word /*NetSettingEnum*/ setting, VoidPtr valueP, WordPtr valueLenP) + SYS_TRAP(netLibTrapSettingGet); + +Err NetLibSettingSet(Word libRefNum, + Word /*NetSettingEnum*/ setting, VoidPtr valueP, Word valueLen) + SYS_TRAP(netLibTrapSettingSet); + +// Network interface specific settings. +Err NetLibIFSettingGet(Word libRefNum, DWord ifCreator, Word ifInstance, + Word /*NetIFSettingEnum*/ setting, VoidPtr valueP, WordPtr valueLenP) + SYS_TRAP(netLibTrapIFSettingGet); + +Err NetLibIFSettingSet(Word libRefNum, DWord ifCreator, Word ifInstance, + Word /*NetIFSettingEnum*/ setting, VoidPtr valueP, Word valueLen) + SYS_TRAP(netLibTrapIFSettingSet); + + + +//-------------------------------------------------- +// System level +//-------------------------------------------------- +SWord NetLibSelect(Word libRefNum, Word width, NetFDSetType* readFDs, + NetFDSetType* writeFDs, NetFDSetType* exceptFDs, + Long timeout, Err* errP) + SYS_TRAP(netLibTrapSelect); + + + +//-------------------------------------------------- +// Debugging support +//-------------------------------------------------- +Err NetLibMaster(Word libRefNum, Word cmd, NetMasterPBPtr pbP, + Long timeout) + SYS_TRAP(netLibTrapMaster); + +Err NetLibTracePrintF(Word libRefNum, CharPtr formatStr, ...) + SYS_TRAP(netLibTrapTracePrintF); + +Err NetLibTracePutS(Word libRefNum, CharPtr strP) + SYS_TRAP(netLibTrapTracePutS); + + +#ifdef __cplusplus +} +#endif + + +#endif // __NETMGR_H__ + + + + + + diff --git a/sdk-2/include/Core/System/NewFloatMgr.h b/sdk-2/include/Core/System/NewFloatMgr.h new file mode 100644 index 0000000..8323d5d --- /dev/null +++ b/sdk-2/include/Core/System/NewFloatMgr.h @@ -0,0 +1,502 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * NewFloatMgr.h + * + * 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 SDWords + * so total size of FlpCompDouble is 64 bits, not 96. + * 2/ 5/97 - Added note about FlpBase10Info reporting "negative" zero. + * 2/27/97 - Added support for new compiler flag (fp_pilot_traps). + * + *******************************************************************/ + +#ifndef __NEWFLOATMGR_H__ +#define __NEWFLOATMGR_H__ + +#if defined(__MWERKS__) // Metrowerks compiler (CodeWarrior or MPW) + + #if __option(IEEEdoubles) == off + #error "IEEEdoubles ('8-Byte Doubles' option in the 68K Processor preference panel) MUST be on!!" + #endif + + #ifndef _DONT_USE_FP_TRAPS_ + #if EMULATION_LEVEL != EMULATION_NONE + #define _DONT_USE_FP_TRAPS_ 1 // For emulator builds - direct link to FP library + #elif defined(CMD_LINE_BUILD) + #define _DONT_USE_FP_TRAPS_ 0 // For PalmOS 2.0 (MPW) - Use new FP traps + #elif __option (fp_pilot_traps) + #define _DONT_USE_FP_TRAPS_ 0 // For PalmOS 2.0 (IDE) - Use new FP traps + #else + #define _DONT_USE_FP_TRAPS_ 1 // For PalmOS 1.0 compatibility - direct link to FP library + #endif + #endif + +#else + + #ifndef _DONT_USE_FP_TRAPS_ + #define _DONT_USE_FP_TRAPS_ 0 // For PalmOS 2.0 (IDE) - Use new FP traps + #endif + +#endif + + +#include + + +/************************************************************************ + * Differences between FloatMgr (PalmOS v1.0) and (this) NewFloatMgr + ***********************************************************************/ +// +// FloatMgr (PalmOS v1.0) NewFloatMgr (PalmOS v2.0 and NewFloatMgr.lib) +// ---------------------- --------------------------------------------- +// 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 + ***********************************************************************/ + +#define flpVersion 0x02008000 // first version of NewFloatMgr (PalmOS 2.0) + +/* + * These constants are passed to and received from the _fp_round routine. + */ + +#define flpToNearest 0 +#define flpTowardZero 1 +#define flpUpward 3 +#define flpDownward 2 +#define flpModeMask 0x00000030 +#define 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. + */ + +#define flpInvalid 0x00008000 +#define flpOverflow 0x00004000 +#define flpUnderflow 0x00002000 +#define flpDivByZero 0x00001000 +#define flpInexact 0x00000800 + +/* + * These constants are returned by _d_cmp, _d_cmpe, _f_cmp, and _f_cmpe: + */ + +#define flpEqual 0 +#define flpLess 1 +#define flpGreater 2 +#define flpUnordered 3 + + +/************************************************************************ + * New Floating point manager types (private) + ***********************************************************************/ +typedef struct { + SDWord high; + SDWord low; +} _sfpe_64_bits; // for internal use only + +typedef _sfpe_64_bits sfpe_long_long; // for internal use only +typedef _sfpe_64_bits sfpe_unsigned_long_long; // for internal use only + + +/************************************************************************ + * New Floating point manager types (public) + ***********************************************************************/ +typedef SDWord FlpFloat; +typedef _sfpe_64_bits FlpDouble; +typedef _sfpe_64_bits FlpLongDouble; + +/* +* 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. +*/ + +typedef struct { + SDWord sign : 1; + SDWord exp : 11; + DWord manH : 20; + DWord manL; +} FlpDoubleBits; // for accessing specific fields + +typedef union { + double d; // for easy assignment of values + FlpDouble fd; // for calling New Floating point manager routines + DWord 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 + DWord ul; // for accessing bits of the float +} FlpCompFloat; + + +/************************************************************************ + * Useful macros... + ***********************************************************************/ +#define BIG_ENDIAN 1 +#define __FIRST32(x) *((DWord *) &x) +#define __SECOND32(x) *((DWord *) &x + 1) +#define __ALL32(x) *((DWord *) &x) + +#ifdef LITTLE_ENDIAN +#define __LO32(x) *((DWord *) &x) +#define __HI32(x) *((DWord *) &x + 1) +#define __HIX 1 +#define __LOX 0 +#else +#define __HI32(x) *((DWord *) &x) +#define __LO32(x) *((DWord *) &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) + + +// DOLATER - Should we remove FlpNegate? There is an fp (_d_neg) call for this... +#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 + *******************************************************************/ +#define flpErrOutOfRange (flpErrorClass | 1) + + +/************************************************************ + * New Floating point manager trap macros + *************************************************************/ +#define m68kMoveQd2Instr 0x7400 + +#if _DONT_USE_FP_TRAPS_ + +#define FLOAT_TRAP(floatSelectorNum) +#define FLOAT_EM_TRAP(floatSelectorNum) + +#else + +#define FLOAT_TRAP(floatSelectorNum) \ + THREEWORD_INLINE(m68kMoveQd2Instr + floatSelectorNum, \ + m68kTrapInstr+sysDispatchTrapNum, sysTrapFlpDispatch) +#define FLOAT_EM_TRAP(floatEmSelectorNum) \ + THREEWORD_INLINE(m68kMoveQd2Instr + floatEmSelectorNum, \ + m68kTrapInstr+sysDispatchTrapNum, sysTrapFlpEmDispatch) +#endif + +/************************************************************ + * New Floating point manager selectors + *************************************************************/ +typedef enum { // The order of this enum *MUST* match the + // sysFloatSelector table in NewFloatDispatch.c + sysFloatBase10Info = 0, // 0 + sysFloatFToA, // 1 + sysFloatAToF, // 2 + sysFloatCorrectedAdd, // 3 + sysFloatCorrectedSub, // 4 + sysFloatVersion, // 5 + + flpMaxFloatSelector = sysFloatVersion // used by NewFloatDispatch.c +} sysFloatSelector; + + +typedef enum { // The order of this enum *MUST* match the + // sysFloatSelector table in NewFloatDispatch.c + sysFloatEm_fp_round = 0,// 0 + sysFloatEm_fp_get_fpscr,// 1 + sysFloatEm_fp_set_fpscr,// 2 + + sysFloatEm_f_utof, // 3 + sysFloatEm_f_itof, // 4 + sysFloatEm_f_ulltof, // 5 + sysFloatEm_f_lltof, // 6 + + sysFloatEm_d_utod, // 7 + sysFloatEm_d_itod, // 8 + sysFloatEm_d_ulltod, // 9 + sysFloatEm_d_lltod, // 10 + + sysFloatEm_f_ftod, // 11 + sysFloatEm_d_dtof, // 12 + sysFloatEm_f_ftoq, // 13 + sysFloatEm_f_qtof, // 14 + sysFloatEm_d_dtoq, // 15 + sysFloatEm_d_qtod, // 16 + + sysFloatEm_f_ftou, // 17 + sysFloatEm_f_ftoi, // 18 + sysFloatEm_f_ftoull, // 19 + sysFloatEm_f_ftoll, // 20 + + sysFloatEm_d_dtou, // 21 + sysFloatEm_d_dtoi, // 22 + sysFloatEm_d_dtoull, // 23 + sysFloatEm_d_dtoll, // 24 + + sysFloatEm_f_cmp, // 25 + sysFloatEm_f_cmpe, // 26 + sysFloatEm_f_feq, // 27 + sysFloatEm_f_fne, // 28 + sysFloatEm_f_flt, // 29 + sysFloatEm_f_fle, // 30 + sysFloatEm_f_fgt, // 31 + sysFloatEm_f_fge, // 32 + sysFloatEm_f_fun, // 33 + sysFloatEm_f_for, // 34 + + sysFloatEm_d_cmp, // 35 + sysFloatEm_d_cmpe, // 36 + sysFloatEm_d_feq, // 37 + sysFloatEm_d_fne, // 38 + sysFloatEm_d_flt, // 39 + sysFloatEm_d_fle, // 40 + sysFloatEm_d_fgt, // 41 + sysFloatEm_d_fge, // 42 + sysFloatEm_d_fun, // 43 + sysFloatEm_d_for, // 44 + + sysFloatEm_f_neg, // 45 + sysFloatEm_f_add, // 46 + sysFloatEm_f_mul, // 47 + sysFloatEm_f_sub, // 48 + sysFloatEm_f_div, // 49 + + sysFloatEm_d_neg, // 50 + sysFloatEm_d_add, // 51 + sysFloatEm_d_mul, // 52 + sysFloatEm_d_sub, // 53 + sysFloatEm_d_div // 54 +} sysFloatEmSelector; + + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************ + * 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. +Err FlpBase10Info(FlpDouble a, DWord* mantissaP, SWord* exponentP, SWord* signP) + FLOAT_TRAP(sysFloatBase10Info); + +Err FlpFToA(FlpDouble a, Char* s) + FLOAT_TRAP(sysFloatFToA); + +FlpDouble FlpAToF(Char* s) + FLOAT_TRAP(sysFloatAToF); + +FlpDouble FlpCorrectedAdd(FlpDouble firstOperand, FlpDouble secondOperand, SWord howAccurate) + FLOAT_TRAP(sysFloatCorrectedAdd); + +FlpDouble FlpCorrectedSub(FlpDouble firstOperand, FlpDouble secondOperand, SWord howAccurate) + FLOAT_TRAP(sysFloatCorrectedSub); + +DWord FlpVersion(void) + FLOAT_TRAP(sysFloatVersion); + +void FlpSelectorErrPrv (Word flpSelector) + ; // 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 + */ + +SDWord _fp_round(SDWord) FLOAT_EM_TRAP(sysFloatEm_fp_round); + +/* + * Constants passed to _fp_set_fpscr and received from _fp_get_fpscr are: + * flpInvalid, flpOverflow, flpUnderflow, flpDivByZero, or flpInexact + */ + +SDWord _fp_get_fpscr(void) FLOAT_EM_TRAP(sysFloatEm_fp_get_fpscr); +void _fp_set_fpscr(SDWord) FLOAT_EM_TRAP(sysFloatEm_fp_set_fpscr); + + +/* + * The shorthand here can be determined from the context: + * i --> long (SDWord) + * u --> unsigned long (DWord) + * ll --> long long int + * ull --> unsigned long 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 + */ + +FlpFloat _f_utof(DWord) FLOAT_EM_TRAP(sysFloatEm_f_utof); +FlpFloat _f_itof(SDWord) FLOAT_EM_TRAP(sysFloatEm_f_itof); +FlpFloat _f_ulltof(sfpe_unsigned_long_long) FLOAT_EM_TRAP(sysFloatEm_f_ulltof); +FlpFloat _f_lltof(sfpe_long_long) FLOAT_EM_TRAP(sysFloatEm_f_lltof); + +FlpDouble _d_utod(DWord) FLOAT_EM_TRAP(sysFloatEm_d_utod); +FlpDouble _d_itod(SDWord) FLOAT_EM_TRAP(sysFloatEm_d_itod); +FlpDouble _d_ulltod(sfpe_unsigned_long_long) FLOAT_EM_TRAP(sysFloatEm_d_ulltod); +FlpDouble _d_lltod(sfpe_long_long) FLOAT_EM_TRAP(sysFloatEm_d_lltod); + + +FlpDouble _f_ftod(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftod); +FlpFloat _d_dtof(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtof); + +FlpLongDouble _f_ftoq(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoq); +FlpFloat _f_qtof(const FlpLongDouble *) FLOAT_EM_TRAP(sysFloatEm_f_qtof); + +FlpLongDouble _d_dtoq(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoq); +FlpDouble _d_qtod(const FlpLongDouble *) FLOAT_EM_TRAP(sysFloatEm_d_qtod); + + +DWord _f_ftou(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftou); +SDWord _f_ftoi(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoi); + +sfpe_unsigned_long_long _f_ftoull(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoull); +sfpe_long_long _f_ftoll(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoll); + +DWord _d_dtou(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtou); +SDWord _d_dtoi(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoi); + +sfpe_unsigned_long_long _d_dtoull(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoull); +sfpe_long_long _d_dtoll(FlpDouble) FLOAT_EM_TRAP(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) + */ + +SDWord _f_cmp(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_cmp); +SDWord _f_cmpe(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_cmpe); +SDWord _f_feq(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_feq); +SDWord _f_fne(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fne); +SDWord _f_flt(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_flt); +SDWord _f_fle(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fle); +SDWord _f_fgt(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fgt); +SDWord _f_fge(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fge); +SDWord _f_fun(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fun); +SDWord _f_for(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_for); + +SDWord _d_cmp(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_cmp); +SDWord _d_cmpe(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_cmpe); +SDWord _d_feq(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_feq); +SDWord _d_fne(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fne); +SDWord _d_flt(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_flt); +SDWord _d_fle(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fle); +SDWord _d_fgt(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fgt); +SDWord _d_fge(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fge); +SDWord _d_fun(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fun); +SDWord _d_for(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_for); + + +FlpFloat _f_neg(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_neg); +FlpFloat _f_add(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_add); +FlpFloat _f_mul(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_mul); +FlpFloat _f_sub(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_sub); +FlpFloat _f_div(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_div); + +FlpDouble _d_neg(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_neg); +FlpDouble _d_add(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_add); +FlpDouble _d_mul(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_mul); +FlpDouble _d_sub(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_sub); +FlpDouble _d_div(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_div); + + +#ifdef __cplusplus +} +#endif + + +#endif //__NEWFLOATMGR_H__ + + diff --git a/sdk-2/include/Core/System/PadCommn.h b/sdk-2/include/Core/System/PadCommn.h new file mode 100644 index 0000000..23ef33e --- /dev/null +++ b/sdk-2/include/Core/System/PadCommn.h @@ -0,0 +1,167 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PadCommn.h + * + * Description: + * Common Packet Assembly / Disassembly Protocol(PADP) definitions. + * + * History: + * 8/8/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __PAD_COMMON_H__ +#define __PAD_COMMON_H__ + +#include + + +/******************************************************************** + * PADP Packet Format + ********************************************************************/ + +// The PADP packets are used for transmitting data for the Pilot PADP protocol layer. +// The structure of the PADP packet is built into the data part of the SLP packet and is, +// therefore, constrained by the SLP packet data size limitations. + + +// Packet type values used in the PADP packet header's "type" field: +// +typedef enum PadType { + // 1.0 types + padData = 0x01, // PADP data packet + padAck = 0x02, // PADP ACK packet + padUnused = 0x03, // used to be PADP NACK packet + padTickle = 0x04, // PADP TICKLE packet(keep-alive) + // 1.1 stuff added here: + padAbort = 0x08 // PAD abort connection packet + } PadType; + + +// PADP "short" packet header (Pilot v1.0-compatible): +// +typedef struct PadShortHeaderType { + Byte type; // PADP packet type + Byte flags; // flags to signal special conditions + Word wSizeOrOffset; // (high, low) -- + // in the 1st padData packet of the block, this field holds the + // total block data size; in the subsequent padData packets, + // this field holds the offset of data being sent; in padAck + // packets, this field is set to the value of the padData packet + // being ack'ed. + } PadShortHeaderType; // TOTAL: 4 bytes + +typedef PadShortHeaderType* PadShortHeaderPtr; + + +#if 0 // FUTURE + // PADP "long" packet header (Future extension): + // + typedef struct PadLongHeaderType { + Byte type; // PADP packet type + Byte flags; // flags to signal special conditions + DWord dwSizeOrOffset; // (high, low) -- + // in the 1st padData packet of the block, this field holds the + // total block data size; in the subsequent padData packets, + // this field holds the offset of data being sent; in padAck + // packets, this field is set to the value of the padData packet + // being ack'ed. + } PadLongHeaderType; // TOTAL: 6 bytes + + typedef PadLongHeaderType* PadLongHeaderPtr; + + + // Union of all header types + typedef union PadGenericHeaderType { + struct { + Byte type; + Byte flags; + } typeAndFlags; + PadShortHeaderType shortHdr; + PadLongHeaderType longHdr; + } PadGenericHeaderType; + + // This is the maximum amount of data which may be sent in one PADP block using + // long packet headers (Future extension) + // + #define padMaxLongBlockSize 0xFFFFFFFFL + + #define padHdrFlagLongHeader 0x10 // signals long header (Future extension) + +#endif // FUTURE + + +// This is the maximum amount of data which may be sent in one PADP block using +// short packet headers +// +#define padMaxShortBlockSize 0x0000FFFFL // 64K - 1 + + + + +// Flag values used in the PADP packet header's "flags" field. padHdrFlagFirst and +// padHdrFlagLast must both be set when the entire data block is being transmitted +// in a single PADP packet. +// +#define padHdrFlagFirst 0x80 // identifies the 1st padData packet + // of the block + +#define padHdrFlagLast 0x40 // identifies the last padData packet + // of the block + +#define padHdrFlagErrMemory 0x20 // signals remote memory error in + // padAck packets + + + + +/******************************************************************** + * PADP Protocol Parameters + ********************************************************************/ + + +// This is the maximum amount of data(in bytes) which may be sent in a single +// PADP packet(not including the PADP packet header) +// +#define padMaxPktDataSize (1*1024) + + +// This is the maximum number of retries for resending a given data packet +// +#define padMaxRetries 10 + + +// This is the maximum number of seconds to wait for an acknowledgement after sending +// a data packet +// +#define padAckWaitSec 2 + + +// This is the maximum number of seconds to wait for the next data packet to begin arriving +// +#define padInterPktTimeOutSec 30 // large value for debugging + + +// default max sec. to wait for command/reply +// +#define padCmdWaitSec 30 +#define padReplyWaitSec 30 + + +// Pilot-to-host tickle(keep alive) interval in seconds +// +#define padPilotToHostTickleIntervalSec 3 + +/******************************************************************** + * Macros + ********************************************************************/ + + + +#endif // __PAD_COMMON_H__ diff --git a/sdk-2/include/Core/System/PadServer.h b/sdk-2/include/Core/System/PadServer.h new file mode 100644 index 0000000..baaceac --- /dev/null +++ b/sdk-2/include/Core/System/PadServer.h @@ -0,0 +1,206 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PadServer.h + * + * Description: + * Packet Assembly/Disassembly server-side definitions + * + * History: + * 7/17/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __PAD_SERVER_H__ +#define __PAD_SERVER_H__ + +// Pilot common definitions +#include +#include + +// Data Manager definitions +#include // for DmOpenRef + +// Common Session Protocol definitions +#include + +#include + + +/******************************************************************** + * PAD Server Parameters + ********************************************************************/ +#define psrMaxPktBufSize ( sizeof(PadHeaderType) + \ + padMaxPktDataSize ) + +// psrMinSerRcvBufSize: minimum serial receive buffer size needed +// for PAD Server. The extra 32 bytes are for beginning/end of queue +// and other serial manager overhead +#define psrMinSerRcvBufSize ( sizeof(SlkPktHeaderType) + \ + psrMaxPktBufSize + \ + sizeof(SlkPktFooterType) + \ + 32 ) + +// psrCmdWaitIntervalSec: when waiting for the beginning of a command, +// the PAD receiver will wait up to this many seconds before before timing +// out on the first packet. The higher-level routine will perform +// its regular maintenance tasks (such as checking for user cancel) around +// calls to the PAD receiver. +#define psrCmdWaitIntervalSec 2 + + +/************************************************************ + * Session Protocol result codes + * (padErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define psrErrParam (padErrorClass | 1) // invalid parameter +#define psrErrTooManyRetries (padErrorClass | 2) // too many retries +#define psrErrTimeOut (padErrorClass | 4) // call timed out +#define psrErrInUse (padErrorClass | 5) // PAD Server/WS manager is in use +#define psrErrMemory (padErrorClass | 6) // not enough memory +#define psrErrUserCan (padErrorClass | 7) // cancelled by user +#define psrErrSizeErr (padErrorClass | 8) // reply block is too big +#define psrErrBlockFormat (padErrorClass | 9) // block format error + + + + +/******************************************************************** + * Session Manager Structures + ********************************************************************/ + + +// +// Packet Assembly/Disassembly structures +// + + +// PAD sender-specific parameters +typedef struct PsrSendParamType { + Byte remoteSocket; // remote socket id + Byte transID; // transaction ID to use on block packets + + // Send segments specification: + Int segCount; // number of segments to send + PmSegmentPtr segP; // ptr to array of segments + + // Statistical information for fine-tuning and debugging: + ULong numAttempted; // number of data packets we attempted to send + ULong numAcked; // number of packets which were acked + ULong retries; // number of retries + } PsrSendParamType; + + +// PAD receiver-specific parameters +typedef struct PsrRcvParamType { + Byte filterTransID; // tranasaction id to filter out + DmOpenRef dbP; // database reference for allocating memory + + // Set by PrvReceiveCmdBlock: + VoidPtr cmdP; // ptr to command in dynamic heap chunk + VoidHand cmdBufH; // handle of command buffer chunk in data heap; + ULong blockSize; // size of block + ULong rcvdLen; // amount of data received so far + Byte transID; // received transaction id + Byte remoteSocket; // source socket + Boolean gotTickle; // Set to true if Tickle had been received + } PsrRcvParamType; + + +// PAD parameter for PrvSendReplyBlock and PrvReceiveCmdBlock: +typedef struct PsrPadParamType { + Byte localSocket; // local socket + SlkPktHeaderPtr slkHdrBufP; // ptr to buffer for serial link header + PadHeaderPtr pktBufP; // ptr to packet buffer of psrMaxPktBufSize bytes + Int initTimeoutSec;// initial receiver timeout seconds + + PsrSendParamType send; // PAD sender-specific params + PsrRcvParamType rcv; // PAD receiver-specific params + } PsrPadParamType; + +typedef PsrPadParamType* PsrPadParamPtr; + + +// +// PAD Server globals +// + +// Prototype for the "user cancel" check callback function +typedef Int (*PsrUserCanProcPtr)(DWord userRef); + +// Server globals +typedef struct PsrGlobalsType { + //Boolean inUse; // true when session is in use + //Boolean open; // true when session is open + Byte serverSocket; // session listenning socket + Int cmdWaitSec; // max seconds to wait for commands + // (-1 = forever) + PsrUserCanProcPtr canProcP; // ptr to user-cancel function + DWord userRef; // parameter for cancelProcP() + SlkPktHeaderType slkHdrBuf; // Serial Link header buffer + // packet data buffer + Word pktBuf[(psrMaxPktBufSize+1)/2]; + Byte lastRcvdCmdTID; // transaction id of last command received + // (for duplicate filtration) + + PsrPadParamType pad; // PAD routines parameter + } PsrGlobalsType; + +typedef PsrGlobalsType* PsrGlobalsPtr; + + +/******************************************************************** + * Session Manager Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +// +// Server API +// + +// RETURNED: 0 on success; otherwise: psrErrParam, psrErrInUse, +// psrErrMemory +Err PsrInit(Byte serverSocket, PsrUserCanProcPtr canProcP, DWord userRef, + Int cmdWaitSec) + SYS_TRAP(sysTrapPsrInit); + +// MUST be called when done with the session to clean up server info +// if PsrInit() was successful +// +// * RETURNED: 0 on success; otherwise: psrErrParam +Err PsrClose(void) SYS_TRAP(sysTrapPsrClose); + +// * RETURNED: 0 on success; otherwise: psrErrParam, psrErrTimeOut, +// * psrErrBlockFormat, psrErrUserCan +Err PsrGetCommand(DmOpenRef refDBP, VoidPtr* cmdPP, VoidHand* cmdBufHP, + WordPtr rcvdCmdLenP, BytePtr tidP, BytePtr remoteSocketP) + SYS_TRAP(sysTrapPsrGetCommand); + +// * RETURNED: 0 on success; otherwise: psrErrParam, psrErrTooManyRetries, +// * psrErrSizeErr, psrErrUserCan +Err PsrSendReply(Byte remoteSocket, Byte refTID, PmSegmentPtr segP, Int segCount) + SYS_TRAP(sysTrapPsrSendReply); + + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * Session Protocol Macros + ********************************************************************/ + + + +#endif // __PAD_SERVER_H__ diff --git a/sdk-2/include/Core/System/PadUtil.h b/sdk-2/include/Core/System/PadUtil.h new file mode 100644 index 0000000..d81e86c --- /dev/null +++ b/sdk-2/include/Core/System/PadUtil.h @@ -0,0 +1,74 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PadUtil.h + * + * Description: + * Packet Assembly/Disassembly utility definitions + * + * History: + * 8/11/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __PAD_UTIL_H__ +#define __PAD_UTIL_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Pilot common definitions + #include "Common.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Pilot common definitions + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + +// The PmSegmentType structure enables the caller to +// specify the block's data in multiple non-contiguous segments. For example, when +// sending a record, DesktopLink will specify the function header, the argument wrapper, +// the fixed record info, and the record data as two or more segments(one or more segments +// for the fixed structures and one segment for the record data). In such an instance, +// it is not practical(and sometimes not possible) to allocate a single data buffer to +// contain all that information contiguously. +// +typedef struct PmSegmentType { + VoidPtr dataP; // ptr to segment data + Word dataSize; // segment data size in bytes + Boolean wordAlign; // if true, this segments data will be sent + // at an even offset from the start of the + // block, padding the previous segment's + // data with a null byte, if necessary + } PmSegmentType; + +typedef PmSegmentType* PmSegmentPtr; + + +#ifdef __cplusplus +extern "C" { +#endif + +ULong PmAddSegmentSizes(Int segCount, PmSegmentType seg[]); + +ULong PmCopyFromSegments(VoidPtr bufP, Int segCount, PmSegmentType seg[], + ULong blockOffset, ULong maxSize); + + +#ifdef __cplusplus +} +#endif + + +#endif // __PAD_UTIL_H__ diff --git a/sdk-2/include/Core/System/PadWS.h b/sdk-2/include/Core/System/PadWS.h new file mode 100644 index 0000000..6063b39 --- /dev/null +++ b/sdk-2/include/Core/System/PadWS.h @@ -0,0 +1,213 @@ +/******************************************************************* + * Touchdown Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PadWS.h + * + * Description: + * Packet Assembly/Disassembly workstation-side definitions + * + * History: + * 8/11/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __PAD_WS_H__ +#define __PAD_WS_H__ + + + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Touchdown common definitions + #include "Common.h" + #include "SerLink.h" + + // PAD Protocol definitions + #include "PadCommn.h" + #include "PadUtil.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Touchdown common definitions + #include + #include + + // PAD Protocol definitions + #include + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + +/******************************************************************** + * Session Manager Parameters + ********************************************************************/ +#define pmMaxPktBufSize ( sizeof(PadHeaderType) + \ + padMaxPktDataSize ) + +// pmReplyWaitIntervalSec: when waiting for the beginning of a reply, +// the PAD receiver will wait up to this many seconds before before timing +// out on the first packet. The higher-level routine will perform +// its regular maintenance tasks (such as checking for user cancel) around +// calls to the PAD receiver. +#define pmReplyWaitIntervalSec 2 + + +/************************************************************ + * Session Protocol result codes + * (padErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define pmErrParam (padErrorClass | 1) // invalid parameter +#define pmErrTooManyRetries (padErrorClass | 2) // too many retries +#define pmErrTimeOut (padErrorClass | 4) // call timed out +#define pmErrInUse (padErrorClass | 5) // PAD Server/WS manager is in use +#define pmErrMemory (padErrorClass | 6) // not enough memory +#define pmErrUserCan (padErrorClass | 7) // cancelled by user +#define pmErrSizeErr (padErrorClass | 8) // reply block is too big +#define pmErrBlockFormat (padErrorClass | 9) // block format error +#define pmErrBufTooSmall (padErrorClass | 10) // buffer is too small +#define pmErrRemoteMemory (padErrorClass | 11) // remote memory error + + + + +/******************************************************************** + * Session Manager Structures + ********************************************************************/ + + +// +// Packet Assembly/Disassembly structures +// + +// PAD sender-specific parameters +typedef struct PmSendParamType { + // Send segments specification: + Int segCount; // number of segments to send + PmSegmentPtr segP; // ptr to array of segments + + // Statistical information for fine-tuning and debugging: + ULong numAttempted; // number of data packets we attempted to send + ULong numSucceeded; // number of packets successfully sent + ULong retries; // number of retries + } PmSendParamType; + + +// PAD receiver-specific parameters +typedef struct PmRcvParamType { + VoidPtr rcvBufP; // ptr to receive buffer + ULong rcvBufSize; // receive buffer size + + // Set by PrvReceiveReplyBlock: + ULong blockSize; // size of block + ULong rcvdLen; // amount of data received so far + } PmRcvParamType; + + +// PAD parameter for PrvSendCommandBlock and PrvReceiveReplyBlock: +typedef struct PmPadParamType { + Byte localSocket; // local socket + Byte remoteSocket; // remote socket + SlkPktHeaderPtr slkHdrBufP; // ptr to buffer for serial link header + PadHeaderPtr pktBufP; // ptr to packet buffer of pmMaxPktBufSize bytes + Int initTimeoutSec;// initial receiver timeout seconds + Int maxRetries; // max # of retries + Byte transID; // current command/reply transaction ID + + PmSendParamType send; // PAD sender-specific params + PmRcvParamType rcv; // PAD receiver-specific params + } PmPadParamType; + +typedef PmPadParamType* PmPadParamPtr; + + + +// +// PAD Manager Workstation-end globals +// + +// Prototype for the "user cancel" check callback function +typedef Int (*PmUserCanProcPtr)(DWord userRef); + +typedef struct PmWSGlobalsType { + Int replyWaitSec; // maximum number of seconds to + // wait for a command reply + Int maxRetries; + + PmUserCanProcPtr canProcP; // ptr to user-cancel function + DWord userRef; // parameter for cancelProcP() + + SlkPktHeaderType slkHdrBuf; // serial link header buffer + // packet data buffer + Word pktBuf[(pmMaxPktBufSize+1)/2]; + + // Transaction id of last request which we originated + Byte lastTID; // last sent transaction id + + PmPadParamType pad; // PAD routines parameter + } PmWSGlobalsType; + +typedef PmWSGlobalsType* PmWSGlobalsPtr; + + + +/******************************************************************** + * Session Manager Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +// +// Workstation API +// + +// RETURNED: 0 on success; otherwise: pmErrParam, pmErrInUse, +// pmErrMemory +Err PmInitWS(Byte wsSocket, Byte serverSocket, PmUserCanProcPtr canProcP, + DWord userRef, Int replyWaitSec, Int maxRetries); + +// MUST be called when done with the session to clean up workstation info +// if PmInitWS() was successful +// +// * RETURNED: 0 on success +Err PmCloseWS(void); + +// * RETURNED: 0 on success; +Err PmSendTickle(void); + +// * RETURNED: 0 on success; otherwise: pmErrParam, pmErrTimeOut, +// * pmErrBlockFormat, pmErrUserCan, pmErrSizeErr, pmErrBufTooSmall +Err PmSendCommand(PmSegmentPtr cmdSegP, Int cmdSegCount, Int replyWaitSec, + VoidPtr replyBufP, ULong replyBufSize, WordPtr replyLenP, + WordPtr actRcvdLenP); + +// * RETURNED: 0 on success; otherwise: pmErrParam, pmErrTimeOut, +// * pmErrBlockFormat, pmErrUserCan, pmErrSizeErr, pmErrBufTooSmall +Err PmReceiveReply( Int replyWaitSec, Byte refTID, VoidPtr replyBufP, + ULong replyBufSize, WordPtr replyLenP, WordPtr actRcvdLenP); + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * Session Protocol Macros + ********************************************************************/ + + + +#endif // __PAD_WS_H__ diff --git a/sdk-2/include/Core/System/Password.h b/sdk-2/include/Core/System/Password.h new file mode 100644 index 0000000..f416c85 --- /dev/null +++ b/sdk-2/include/Core/System/Password.h @@ -0,0 +1,44 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Password.h + * + * Description: + * Password include file + * + * History: + * 4/1/95 - created by Roger Flores + * + *******************************************************************/ + + #ifndef __PASSWORD_H__ + #define __PASSWORD_H__ + + + +#define pwdLength 32 +#define pwdEncryptionKeyLength 64 + +Boolean PwdExists() + SYS_TRAP(sysTrapPwdExists); + +Boolean PwdVerify(CharPtr string) + SYS_TRAP(sysTrapPwdVerify); + +void PwdSet(CharPtr oldPassword, CharPtr newPassword) + SYS_TRAP(sysTrapPwdSet); + +void PwdRemove(void) + SYS_TRAP(sysTrapPwdRemove); + + +#endif // __PASSWORD_H__ + + + + + diff --git a/sdk-2/include/Core/System/PenMgr.h b/sdk-2/include/Core/System/PenMgr.h new file mode 100644 index 0000000..03a3356 --- /dev/null +++ b/sdk-2/include/Core/System/PenMgr.h @@ -0,0 +1,95 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PenMgr.h + * + * Description: + * Include file for Pen manager + * + * History: + * 6/5/96 Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __PEN_MGR_H +#define __PEN_MGR_H + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Pen Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ +#define penErrBadParam (penErrorClass | 1) + + + +/******************************************************************** + * Pen manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initializes the Pen Manager +Err PenOpen(void) + SYS_TRAP(sysTrapPenOpen); + +// Closes the Pen Manager and frees whatever memory it allocated +Err PenClose(void) + SYS_TRAP(sysTrapPenClose); + + +// Put pen to sleep +Err PenSleep(void) + SYS_TRAP(sysTrapPenSleep); + +// Wake pen +Err PenWake(void) + SYS_TRAP(sysTrapPenWake); + + +// Get the raw pen coordinates from the hardware. +Err PenGetRawPen(PointType* penP) + SYS_TRAP(sysTrapPenGetRawPen); + +// Reset calibration in preparation for setting it again +Err PenResetCalibration (void) + SYS_TRAP(sysTrapPenResetCalibration); + +// Set calibration settings for the pen +Err PenCalibrate (PointType* digTopLeftP, PointType* digBotRightP, + PointType* scrTopLeftP, PointType* scrBotRightP) + SYS_TRAP(sysTrapPenCalibrate); + +// Scale a raw pen coordinate into screen coordinates +Err PenRawToScreen(PointType* penP) + SYS_TRAP(sysTrapPenRawToScreen); + +// Scale a screen pen coordinate back into a raw coordinate +Err PenScreenToRaw(PointType* penP) + SYS_TRAP(sysTrapPenScreenToRaw); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _PenGetRawPen \ + ASM_SYS_TRAP(sysTrapPenGetRawPen) + + + +#endif //__PEN_MGR_H diff --git a/sdk-2/include/Core/System/PenPrv.h b/sdk-2/include/Core/System/PenPrv.h new file mode 100644 index 0000000..d692b3f --- /dev/null +++ b/sdk-2/include/Core/System/PenPrv.h @@ -0,0 +1,93 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * PenPrv.h + * + * Description: + * Private Include file for Pen manager + * + * History: + * 6/5/96 Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __PEN_PRV_H +#define __PEN_PRV_H + + +/******************************************************************** + * Pen Manager Constants + ********************************************************************/ +#define penCalibrateTop 10 +#define penCalibrateLeft 10 +#define penCalibrateBottom (hwrDisplayHeight-10) +#define penCalibrateRight (hwrDisplayWidth-10) + +#define penInitDelay 30 +#define penInitMaxDDZ 12 // max change allowed in dx or dy between + // 2 samples. + +// We sample the pen 2 times in a row every 20ms and make sure the 2 points are +// within this many pixels. +#define penInitMaxSlop 2 + +// The max blip we allow on the last point of a stroke as compared to the +// previous point +#define penInitMaxEndBlip 5 + +// Number of samples we keep around for filtering functions. +// Must allow room for at least 2 samples previous to the hot sample +// (i.e. must be >= penHotSample+3 +#define penNumSamples 5 + +// Index of the sample we return from PenGetRawPen. Must be less than +// penNumSamples!! +#define penHotSample 2 + +// Number of pen-up samples in a row we must see in order to recognize a pen-up. +// Must be <= penHotSample+1 since we must have space in the sample array +// before and including the hot sample to store all these up samples. +#define penMinUpSamples 3 + + +// This constant is stored in the x field of a point within our sample +// array to indicate a pen down but with no valid position. +#define penDownButInvalid 0x7FFF + + + +/******************************************************************** + * Pen Manager Globals + ********************************************************************/ +typedef struct PenGlobalsType { + // Calibration info + Boolean calibrated; + Boolean filler; + UInt xOffset, yOffset; + UInt xScale, yScale; + + // Array of pen samples we've taken. The most recent sample is at index #0. + // We keep this history of samples in order to filter out bad points. + // The sample that we return to the caller of PenGetRawPen is stored + // at index pen + PointType sample[penNumSamples]; + + // Parameters for filter + UInt delay; // delay before reading A/D + UInt maxDDZ; // max 2nd derivative. + UInt maxSlop; // max delta between 2 samples taken immediately + // after each other + UInt maxEndBlip; // max blip we allow at the end of a stroke + } PenGlobalsType; + +typedef PenGlobalsType* PenGlobalsPtr; + + + +#endif //__PEN_MGR_H +#endif // NON_PORTABLE diff --git a/sdk-2/include/Core/System/Preferences.h b/sdk-2/include/Core/System/Preferences.h new file mode 100644 index 0000000..25b409c --- /dev/null +++ b/sdk-2/include/Core/System/Preferences.h @@ -0,0 +1,344 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * Preferences.h + * + * Description: + * Header for the system preferences + * + * History: + * 2/31/95 rsf - Created by Roger Flores + * + *******************************************************************/ + +#ifndef __PREFERENCES_H__ +#define __PREFERENCES_H__ + + +/*********************************************************************** + * Constants + ***********************************************************************/ + +#define noPreferenceFound -1 + +#define preferenceDataVersion 2 + +#define defaultAutoOffDuration 2 // minutes + + +#if EMULATION_LEVEL == EMULATION_NONE + #define defaultSysSoundLevel slOn + #define defaultGameSoundLevel slOn + #define defaultAlarmSoundLevel slOn +#else // EMULATION_LEVEL != EMULATION_NONE + #define defaultSysSoundLevel slOff + #define defaultGameSoundLevel slOff + #define defaultAlarmSoundLevel slOn +#endif + + +typedef enum + { + cAustralia, + cAustria, + cBelgium, + cBrazil, + cCanada, + cDenmark, + cFinland, + cFrance, + cGermany, + cHongKong, + cIceland, + cIreland, + cItaly, + cJapan, + cLuxembourg, + cMexico, + cNetherlands, + cNewZealand, + cNorway, + cSpain, + cSweden, + cSwitzerland, + cUnitedKingdom, + cUnitedStates + } CountryType; + +#define countryFirst cAustralia +#define countryLast cUnitedStates +#define countryCount (countryLast - countryFirst + 1) + + +typedef enum + { + tfColon, + tfColonAMPM, // 1:00 pm + tfColon24h, // 13:00 + tfDot, + tfDotAMPM, // 1.00 pm + tfDot24h, // 13.00 + tfHoursAMPM, // 1 pm + tfHours24h, // 13 + tfComma24h // 13,00 + } TimeFormatType; + + +typedef enum { + dsNone, // Daylight Savings Time not observed + dsUSA, // United States Daylight Savings Time + dsAustralia, // Australian Daylight Savings Time + dsWesternEuropean, // Western European Daylight Savings Time + dsMiddleEuropean, // Middle European Daylight Savings Time + dsEasternEuropean, // Eastern European Daylight Savings Time + dsGreatBritain, // Great Britain and Eire Daylight Savings Time + dsRumania, // Rumanian Daylight Savings Time + dsTurkey, // Turkish Daylight Savings Time + dsAustraliaShifted // Australian Daylight Savings Time with shift in 1986 + } DaylightSavingsTypes; + + +// pass a TimeFormatType +#define Use24HourFormat(t) ((t) == tfColon24h || (t) == tfDot24h || (t) == tfHours24h || (t) == tfComma24h) +#define TimeSeparator(t) ( t <= tfColon24h ? ':' : (t <= tfDot24h ? '.' : ',')) + + +typedef enum { + dfMDYWithSlashes, // 12/31/95 + dfDMYWithSlashes, // 31/12/95 + dfDMYWithDots, // 31.12.95 + dfDMYWithDashes, // 31-12-95 + dfYMDWithSlashes, // 95/12/31 + dfYMDWithDots, // 95.12.31 + dfYMDWithDashes, // 95-12-31 + + dfMDYLongWithComma, // Dec 31, 1995 + dfDMYLong, // 31 Dec 1995 + dfDMYLongWithDot, // 31. Dec 1995 + dfDMYLongNoDay, // Dec 1995 + dfDMYLongWithComma, // 31 Dec, 1995 + dfYMDLongWithDot, // 1995.12.31 + dfYMDLongWithSpace, // 1995 Dec 31 + + dfMYMed // Dec '95 + } DateFormatType; + + +// The number format (thousands separator and decimal point). This defines +// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland). +typedef enum { + nfCommaPeriod, + nfPeriodComma, + nfSpaceComma, + nfApostrophePeriod, + nfApostropheComma + } NumberFormatType; + + +// These sound levels must corrospond to positions in the popup lists +// used by the preferences app. +typedef enum { + slOn = 0, + slOff = 1 + } SoundLevelType; + + +#define countryNameLength 20 +#define currencyNameLength 20 +#define currencySymbolLength 6 + +// An array of these structures (one per country) is kept in the system +// resource. +typedef struct + { + CountryType country; // Country the structure represents + Char countryName[countryNameLength]; + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Byte weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + Char currencyName[currencyNameLength]; // Dollars + Char currencySymbol[currencySymbolLength]; // $ + Char uniqueCurrencySymbol[currencySymbolLength]; // US$ + Byte currencyDecimalPlaces; // 2 for 1.00 + DaylightSavingsTypes daylightSavings; // Type of daylight savings correction + DWord minutesWestOfGMT; // minutes west of Greenwich + } CountryPreferencesType; + +// The number format (thousands separator and decimal point). This defines +// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland). +typedef enum { + alOff, // Never show an animation + alEventsOnly, // Show an animation for an event + alEventsAndRandom, // Also show random animation + alEventsAndMoreRandom // Show random animations more frequently + } AnimationLevelType; + + +typedef enum + { + prefVersion, + prefCountry, + prefDateFormat, + prefLongDateFormat, + prefWeekStartDay, + prefTimeFormat, + prefNumberFormat, + prefAutoOffDuration, + prefSysSoundLevel, + prefGameSoundLevel, + prefAlarmSoundLevel, + prefHidePrivateRecords, + prefDeviceLocked, + prefLocalSyncRequiresPassword, + prefRemoteSyncRequiresPassword, + prefSysBatteryKind, + prefAllowEasterEggs, + prefMinutesWestOfGMT, + prefDaylightSavings, + prefRonamaticChar, + prefHard1CharAppCreator, // App creator for hard key #1 + prefHard2CharAppCreator, // App creator for hard key #2 + prefHard3CharAppCreator, // App creator for hard key #3 + prefHard4CharAppCreator, // App creator for hard key #4 + prefCalcCharAppCreator, // App creator for calculator soft key + prefHardCradleCharAppCreator, // App creator for hard cradle key + prefLauncherAppCreator, // App creator for launcher soft key + prefSysPrefFlags, + prefHardCradle2CharAppCreator, // App creator for 2nd hard cradle key + prefAnimationLevel + + } SystemPreferencesChoice; + + +typedef struct { + Word version; // Version of preference info + + // International preferences + CountryType country; // Country the device is in + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Byte weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + + // system preferences + Byte autoOffDuration; // Time period before shutting off + SoundLevelType sysSoundLevel; // High, Med, Low, Off - error beeps + SoundLevelType alarmSoundLevel; // High, Med, Low, Off - alarm only + Boolean hideSecretRecords; // True to not display records with + // their secret bit attribute set + Boolean deviceLocked; // Device locked until the system + // password is entered + Word sysPrefFlags; // Miscellaneous system pref flags + // copied into the global GSysPrefFlags + // at boot time. + SysBatteryKind sysBatteryKind; // The type of batteries installed. This + // is copied into the globals GSysbatteryKind + // at boot time. + + } SystemPreferencesTypeV10; + + + +// Any entries added to this structure must be initialized in +// Prefereces.c:GetPreferenceResource + +typedef struct + { + Word version; // Version of preference info + + // International preferences + CountryType country; // Country the device is in + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Byte weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + + // system preferences + Byte autoOffDuration; // Time period in minutes before shutting off + SoundLevelType sysSoundLevel; // High, Med, Low, Off - error beeps + SoundLevelType gameSoundLevel; // game sound effects + SoundLevelType alarmSoundLevel; // High, Med, Low, Off - alarm only + Boolean hideSecretRecords; // True to not display records with + // their secret bit attribute set + Boolean deviceLocked; // Device locked until the system + // password is entered + Boolean localSyncRequiresPassword; // User must enter password on Pilot + Boolean remoteSyncRequiresPassword; // User must enter password on Pilot + Word sysPrefFlags; // Miscellaneous system pref flags + // copied into the global GSysPrefFlags + // at boot time. Constants are + // sysPrefFlagXXX defined in SystemPrv.h + SysBatteryKind sysBatteryKind; // The type of batteries installed. This + // is copied into the globals GSysbatteryKind + // at boot time. + DWord minutesWestOfGMT; // minutes west of Greenwich + DaylightSavingsTypes daylightSavings; // Type of daylight savings correction + UInt ronamaticChar; // character to generate from ronamatic stroke. + // Typically it popups the onscreen keyboard. + DWord hard1CharAppCreator; // creator of application to launch in response + // to the hard button #1. Used by SysHandleEvent. + DWord hard2CharAppCreator; // creator of application to launch in response + // to the hard button #2. Used by SysHandleEvent. + DWord hard3CharAppCreator; // creator of application to launch in response + // to the hard button #3. Used by SysHandleEvent. + DWord hard4CharAppCreator; // creator of application to launch in response + // to the hard button #4. Used by SysHandleEvent. + DWord calcCharAppCreator; // creator of application to launch in response + // to the Calculator icon. Used by SysHandleEvent. + DWord hardCradleCharAppCreator; // creator of application to launch in response + // to the Cradle button. Used by SysHandleEvent. + DWord launcherCharAppCreator; // creator of application to launch in response + // to the launcher button. Used by SysHandleEvent. + DWord hardCradle2CharAppCreator; // creator of application to launch in response + // to the 2nd Cradle button. Used by SysHandleEvent. + AnimationLevelType animationLevel; // amount of animation to display + } SystemPreferencesType; + + + +typedef SystemPreferencesType * SystemPreferencesPtr; + + +extern DmOpenRef PrefOpenPreferenceDBV10 (void) + SYS_TRAP(sysTrapPrefOpenPreferenceDBV10); + +extern DmOpenRef PrefOpenPreferenceDB (Boolean saved) + SYS_TRAP(sysTrapPrefOpenPreferenceDB); + +extern void PrefGetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefGetPreferences); + +extern void PrefSetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefSetPreferences); + +extern DWord PrefGetPreference(SystemPreferencesChoice choice) + SYS_TRAP(sysTrapPrefGetPreference); + +extern void PrefSetPreference(SystemPreferencesChoice choice, DWord value) + SYS_TRAP(sysTrapPrefSetPreference); + +extern SWord PrefGetAppPreferences (DWord creator, Word id, VoidPtr prefs, + Word *prefsSize, Boolean saved) + SYS_TRAP(sysTrapPrefGetAppPreferences); + +extern Boolean PrefGetAppPreferencesV10 (DWord type, SWord version, VoidPtr prefs, + Word prefsSize) + SYS_TRAP(sysTrapPrefGetAppPreferencesV10); + +extern void PrefSetAppPreferences (DWord creator, Word id, SWord version, + VoidPtr prefs, Word prefsSize, Boolean saved) + SYS_TRAP(sysTrapPrefSetAppPreferences); + +extern void PrefSetAppPreferencesV10 (DWord creator, SWord version, VoidPtr prefs, + Word prefsSize) + SYS_TRAP(sysTrapPrefSetAppPreferencesV10); + +#endif // __PREFERENCES_H__ diff --git a/sdk-2/include/Core/System/SerialLib68328.h b/sdk-2/include/Core/System/SerialLib68328.h new file mode 100644 index 0000000..4a0a189 --- /dev/null +++ b/sdk-2/include/Core/System/SerialLib68328.h @@ -0,0 +1,63 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLib68328.h + * + * Description: + * Include file for 68328 Serial Library + * + * History: + * 2/7/95 Created by Ron Marianetti + * vmk 8/21/95 Added defQData field to serial globals + * + *******************************************************************/ + +#ifndef __SERIAL_LIB_68328_H +#define __SERIAL_LIB_68328_H + + +// Pilot common definitions +#include + + +/******************************************************************** + * Serial Globals + ********************************************************************/ +typedef struct SerGlobalsType { + UInt openCount; // # of times we've been opened + Int port; // DOLATER... NOT NEEDED ??? + SerSettingsType settings; + Word lineErrors; // line errors bitfield + + #ifndef BUILDING_FOR_DEBUGGER + // Receive Queue. When the queue is empty, qStart == qEnd. When the queue + // is full, qStart = qEnd-1 (taking wrap-around into account if necessary). + Word qStart; // start offset of queue + Word qEnd; // end offset of queue + Word qSize; // size of queue + Ptr qData; // pointer to queue data + Ptr defQData; // pointer to default queue data + + // Receive Queue semaphore info + ProcPtr wakeupHandler; // Wakeup handler, if installed + DWord wakeupRefcon; // refcon for wakeup handler + Word smSignalSize; // How much the semaphore is waiting for + DWord smID; // semaphore ID + + DWord lastRcvTicks; // tick count of last received char + + // For debugging + Word numReceived; // # of chars received since serial manager opened + Word lastErrorStatus; // receiver status of last line error + Word numRcvErrors; // # of receive line errors since serial manager opened + #endif + } SerGlobalsType; +typedef SerGlobalsType* SerGlobalsPtr; + +#define serDefaultRcvBufferSize 0x200 + +#endif //__SERIAL_LIB_68328_H diff --git a/sdk-2/include/Core/System/SerialLib68681.h b/sdk-2/include/Core/System/SerialLib68681.h new file mode 100644 index 0000000..737223d --- /dev/null +++ b/sdk-2/include/Core/System/SerialLib68681.h @@ -0,0 +1,96 @@ +/******************************************************************* + * Touchdown Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLib68328.h + * + * Description: + * Include file for 68328 Serial Library + * + * History: + * 2/7/95 Created by Ron Marianetti + * vmk 8/21/95 Added defQData field to serial globals + * + *******************************************************************/ + +#ifndef __SERIAL_LIB_68681_H +#define __SERIAL_LIB_68681_H + + +// Touchdown common definitions +#include + +/******************************************************************** + * Debug Info stored in serial globals + ********************************************************************/ +typedef struct Ser681DebugInfoType { + Word lineErrorCount; // number of line errors since opening + + #ifdef INCLUDE_BASIC_681_DEBUG_INFO + Word numReceived; // number of bytes received since opening + Word numSent; // number of bytes sent + Byte lastReceived; // last byte received + Byte lastErrorStatus; // receiver status of last line error + + // Include extensive debug info only if basic info is included + #ifdef INCLUDE_EXTENSIVE_681_DEBUG_INFO + Word hwOverrunCount; // number of hardware overrun errors since opening + Word parityErrorCount; // number of parity errors since opening + Word framingErrorCount;// number of framing errors since opening + #endif //#ifdef INCLUDE_EXTENSIVE_681_DEBUG_INFO + #endif //#ifdef INCLUDE_BASIC_681_DEBUG_INFO + + } Ser681DebugInfoType; + +typedef Ser681DebugInfoType* Ser681DebugInfoPtr; + + + +/******************************************************************** + * Serial Globals + ********************************************************************/ +typedef struct Ser681GlobalsType { + DWord openSignature; // hack to detect if we have been opened when + // booting from the 68328-based debugger + UInt openCount; // # of times we've been opened + Int port; + SerSettingsType settings; + Word lineErrors; // line errors bitfield + + + VoidPtr chanP; // pointer to this channel base in UART + +#ifndef BUILDING_FOR_DEBUGGER + // Receive Queue. When the queue is empty, qStart == qEnd. When the queue + // is full, qStart = qEnd-1 (taking wrap-around into account if necessary). + Word qStart; // start offset of queue + Word qEnd; // end offset of queue + Word qSize; // size of queue + Ptr qData; // pointer to queue data + Ptr defQData; // pointer to default queue data + + // Receive Queue semaphore info + Word smSignalSize; // How much the semaphore is waiting for + DWord smID; // semaphore ID + + DWord lastRcvTicks; // tick count of last received char + + Byte currentIMR; // current value of interrupt mask register + Ptr oldIRQ3P; // saved pointer to previously-installed IRQ3 handler + + Boolean breakIsOn; // set to true when break signal is started, false when it is stopped +#endif //#ifndef BUILDING_FOR_DEBUGGER + + // Serial Library debugging information + Ser681DebugInfoType debugInfo; + + } Ser681GlobalsType; + +typedef Ser681GlobalsType* Ser681GlobalsPtr; + +#define serLibDefaultRcvBufferSize 0x200 + +#endif //__SERIAL_LIB_68681_H diff --git a/sdk-2/include/Core/System/SerialLibMac.h b/sdk-2/include/Core/System/SerialLibMac.h new file mode 100644 index 0000000..3c057f6 --- /dev/null +++ b/sdk-2/include/Core/System/SerialLibMac.h @@ -0,0 +1,70 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLibMac.h + * + * Description: + * Include file for Mac Serial Library + * + * History: + * 6/30/95 Created by Vitaly Kruglikov + * + *******************************************************************/ + +#ifndef __SERIAL_LIB_MAC_H +#define __SERIAL_LIB_MAC_H + + +// Pilot common definitions +#include "Common.h" +#include "SerialMgr.h" + +// Maximum size of our receive window. We have to emulate this +// functionality on the Mac by reading out of the Mac's serial +// driver into a temporary buffer maintained by the Serial Library +// in the emulator. +#define serFakeIntQueueSize 0x10 + + +/******************************************************************** + * Serial Globals + ********************************************************************/ +typedef struct SerMacGlobalsType { + UInt refNum; // port reference number + UInt openCount; // number of times we have been opened + UInt port; + SerSettingsType settings; + Word lineErrors; // line errors bitfield + DWord maxBaud; // maximum supported baud rate + Boolean breakIsOn; // set to true when break signal is started, false when it is stopped + + short inRefNum; // input driver reference number + short outRefNum; // output driver reference number + Ptr inBufP; // custom input buffer ptr + + // THe following fields are used to emulate the SerReceiveWindowOpen + // and SerReceiveWindowClose() routines in the Emulator. + Boolean windowOpen; // non-zero if window currently open + // used for error checking. + Word windowOffset; // next available byte in intQueue; + Word windowSize; // # of bytes read into "int queue" + Byte intQueue[serFakeIntQueueSize]; // fake Int. queue" + SerCallbackEntryType + blockingHook; // blocking hook callback + + // Receive Queue semaphore info + SerWakeupHandler wakeupHandler; // Wakeup handler, if installed + DWord wakeupRefcon; // refcon for wakeup handler + Word smSignalSize; // How much the semaphore is waiting for + ULong emTaskID; // Task ID of interrupt simulator + } SerMacGlobalsType; +typedef SerMacGlobalsType* SerMacGlobalsPtr; + +#define serDefaultRcvBufferSize (30*1024) + +Err SerPrvInstallDispatcher(UInt refNum, SysLibTblEntryPtr entryP); +#endif //__SERIAL_LIB_MAC_H diff --git a/sdk-2/include/Core/System/SerialLinkMgr.h b/sdk-2/include/Core/System/SerialLinkMgr.h new file mode 100644 index 0000000..4d2529f --- /dev/null +++ b/sdk-2/include/Core/System/SerialLinkMgr.h @@ -0,0 +1,432 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLinkMgr.c + * + * Description: + * Source for Serial Link Routines on Pilot + * + * History: + * 2/6/95 replaces DSerial.h from Debugger + * + *******************************************************************/ + +#ifndef __SERIAL_LINK_H +#define __SERIAL_LINK_H + + + +// Pilot common definitions +#include +#include + + + +//************************************************************************* +// Pre-defined, fixxed Socket ID's +//************************************************************************* +#define slkSocketDebugger 0 // Debugger Socket +#define slkSocketConsole 1 // Console Socket +#define slkSocketRemoteUI 2 // Remote UI Socket +#define slkSocketDLP 3 // Desktop Link Socket +#define slkSocketFirstDynamic 4 // first dynamic socket ID + + +//************************************************************************* +// Packet Types +//************************************************************************* +#define slkPktTypeSystem 0 // System packets +#define slkPktTypeUnused1 1 // used to be: Connection Manager packets +#define slkPktTypePAD 2 // PAD Protocol packets +#define slkPktTypeLoopBackTest 3 // Loop-back test packets + + + +//************************************************************************* +// +// Packet structure: +// header +// body (0-dbgMaxPacketBodyLength bytes of data) +// footer +// +//************************************************************************* + +//---------------------------------------------------------------------- +// packet header +// Fields marked with -> must be filled in by caller +// Fields marked with X will be filled in by SlkSendPacket. +//---------------------------------------------------------------------- + +typedef Byte SlkPktHeaderChecksum; + +typedef struct SlkPktHeaderType { + Word signature1; // X first 2 bytes of signature + Byte signature2; // X 3 and final byte of signature + Byte dest; // -> destination socket Id + Byte src; // -> src socket Id + Byte type; // -> packet type + Word bodySize; // X size of body + Byte transId; // -> transaction Id + // if 0 specified, it will be replaced + SlkPktHeaderChecksum checksum; // X check sum of header + } SlkPktHeaderType; + +typedef SlkPktHeaderType* SlkPktHeaderPtr; + +#define slkPktHeaderSignature1 0xBEEF +#define slkPktHeaderSignature2 0xED + +#define slkPktHeaderSigFirst 0xBE // First byte +#define slkPktHeaderSigSecond 0xEF // second byte +#define slkPktHeaderSigThird 0xED // third byte + +//---------------------------------------------------------------------- +// packet footer +//---------------------------------------------------------------------- +typedef struct SlkPktFooterType { + Word crc16; // header and body crc + } SlkPktFooterType; + +typedef SlkPktFooterType* SlkPktFooterPtr; + + +//************************************************************************* +// +// Write Data Structure passed to SlkSendPacket. This structure +// Tells SlkSendPacket where each of the chunks that comprise the body are +// and the size of each. SlkSendPacket accepts a pointer to an array +// of SlkWriteDataTypes, the last one has a size field of 0. +// +//************************************************************************* +typedef struct SlkWriteDataType { + Word size; // last one has size of 0 + void* dataP; // pointer to data + } SlkWriteDataType; +typedef SlkWriteDataType* SlkWriteDataPtr; + + + + +//************************************************************************* +// +// CPU-dependent macros for getting/setting values from/to packets +// +//************************************************************************* + +//-------------------------------------------------------------------- +// macros to get packet values +//-------------------------------------------------------------------- + +#define slkGetPacketByteVal(srcP) (*(BytePtr)(srcP)) + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketWordVal(srcP) \ + ( (Word) \ + ( \ + ((Word)((BytePtr)(srcP))[0] << 8) | \ + ((Word)((BytePtr)(srcP))[1]) \ + ) \ + ) +#else +#define slkGetPacketWordVal(srcP) \ + ( *((WordPtr)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketDWordVal(srcP) \ + ( (DWord) \ + ( \ + ((DWord)((BytePtr)(srcP))[0] << 24) | \ + ((DWord)((BytePtr)(srcP))[1] << 16) | \ + ((DWord)((BytePtr)(srcP))[2] << 8) | \ + ((DWord)((BytePtr)(srcP))[3]) \ + ) \ + ) +#else +#define slkGetPacketDWordVal(srcP) \ + ( *((DWordPtr)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#define slkGetPacketSignature1(sigP) \ + slkGetPacketWordVal(sigP) + +#define slkGetPacketSignature2(sigP) \ + slkGetPacketByteVal(sigP) + + +#define slkGetPacketDest(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketSrc(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketType(commandP) \ + slkGetPacketByteVal(commandP) + + +#define slkGetPacketBodySize(lengthP) \ + slkGetPacketWordVal(lengthP) + +#define slkGetPacketTransId(transIDP) \ + slkGetPacketByteVal(transIDP) + +#define slkGetPacketHdrChecksum(checksumP) \ + slkGetPacketByteVal(checksumP) + + +#define slkGetPacketTotalChecksum(checksumP) \ + slkGetPacketWordVal(checksumP) + + + + + + +//-------------------------------------------------------------------- +// macros to set packet values +//-------------------------------------------------------------------- + + +#define slkSetPacketByteVal(srcByteVal, destP) \ + ( *(BytePtr)(destP) = (Byte)(srcByteVal) ) + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketWordVal(srcWordVal, destP) \ + \ + do { \ + Word ___srcVal; \ + BytePtr ___srcValP; \ + \ + ___srcVal = (Word)(srcWordVal); \ + ___srcValP = (BytePtr)(&___srcVal); \ + \ + ((BytePtr)(destP))[0] = ___srcValP[1]; \ + ((BytePtr)(destP))[1] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketWordVal(srcWordVal, destP) \ + ( *((WordPtr)(destP)) = (Word)(srcWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + do { \ + DWord ___srcVal; \ + BytePtr ___srcValP; \ + \ + ___srcVal = (DWord)(srcDWordVal); \ + ___srcValP = (BytePtr)(&___srcVal); \ + \ + ((BytePtr)(destP))[0] = ___srcValP[3]; \ + ((BytePtr)(destP))[1] = ___srcValP[2]; \ + ((BytePtr)(destP))[2] = ___srcValP[1]; \ + ((BytePtr)(destP))[3] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + ( *((DWordPtr)(destP)) = (DWord)(srcDWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + + +#define slkSetPacketSignature1(magic, destP) \ + slkSetPacketWordVal(magic, destP) + +#define slkSetPacketSignature2(magic, destP) \ + slkSetPacketByteVal(magic, destP) + + +#define slkSetPacketDest(dest, destP) \ + slkSetPacketByteVal(dest, destP) + +#define slkSetPacketSrc(src, destP) \ + slkSetPacketByteVal(src, destP) + + +#define slkSetPacketType(type, destP) \ + slkSetPacketByteVal(type, destP) + + +#define slkSetPacketBodySize(numBytes, destP) \ + slkSetPacketWordVal(numBytes, destP) + + +#define slkSetPacketTransId(transID, destP) \ + slkSetPacketByteVal(transID, destP) + +#define slkSetPacketHdrChecksum(checksum, destP) \ + slkSetPacketByteVal(checksum, destP) + +#define slkSetPacketTotalChecksum(checksum, destP) \ + slkSetPacketWordVal(checksum, destP) + + + + + + +/******************************************************************* + * Serial Link Manager Errors + * the constant slkErrorClass is defined in SystemMgr.h + *******************************************************************/ +#define slkErrChecksum (slkErrorClass | 1) +#define slkErrFormat (slkErrorClass | 2) +#define slkErrBuffer (slkErrorClass | 3) +#define slkErrTimeOut (slkErrorClass | 4) +#define slkErrHandle (slkErrorClass | 5) +#define slkErrBodyLimit (slkErrorClass | 6) +#define slkErrTransId (slkErrorClass | 7) +#define slkErrResponse (slkErrorClass | 8) +#define slkErrNoDefaultProc (slkErrorClass | 9) +#define slkErrWrongPacketType (slkErrorClass | 10) +#define slkErrBadParam (slkErrorClass | 11) +#define slkErrAlreadyOpen (slkErrorClass | 12) +#define slkErrOutOfSockets (slkErrorClass | 13) +#define slkErrSocketNotOpen (slkErrorClass | 14) +#define slkErrWrongDestSocket (slkErrorClass | 15) +#define slkErrWrongPktType (slkErrorClass | 16) +#define slkErrBusy (slkErrorClass | 17) // called while sending a packet + // only returned on single-threaded + // emulation implementations +#define slkErrNotOpen (slkErrorClass | 18) + + + +/******************************************************************* + * Type definition for a Serial Link Socket Listener + * + *******************************************************************/ +typedef void (*SlkSocketListenerProcPtr) + (SlkPktHeaderPtr headerP, void* bodyP); + +typedef struct SlkSocketListenType { + SlkSocketListenerProcPtr listenerP; + SlkPktHeaderPtr headerBufferP; // App allocated buffer for header + void* bodyBufferP; // App allocated buffer for body + ULong bodyBufferSize; + } SlkSocketListenType; +typedef SlkSocketListenType* SlkSocketListenPtr; + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// Initializes the Serial Link Manager +//------------------------------------------------------------------- +Err SlkOpen(void) + SYS_TRAP(sysTrapSlkOpen); + +//------------------------------------------------------------------- +// Close down the Serial Link Manager +//------------------------------------------------------------------- +Err SlkClose(void) + SYS_TRAP(sysTrapSlkClose); + + + + +//------------------------------------------------------------------- +// Open up another Serial Link socket. The caller must have already +// opened the comm library and set it to the right settings. +//------------------------------------------------------------------- +Err SlkOpenSocket(UInt libRefNum, UIntPtr socketP, Boolean staticSocket) + SYS_TRAP(sysTrapSlkOpenSocket); + +//------------------------------------------------------------------- +// Close up a Serial Link socket. +// Warning: This routine is assymetrical with SlkOpenSocket because it +// WILL CLOSE the library for the caller (unless the refNum is the +// refNum of the debugger comm library). +//------------------------------------------------------------------- +Err SlkCloseSocket(UInt socket) + SYS_TRAP(sysTrapSlkCloseSocket); + + +//------------------------------------------------------------------- +// Get the library refNum for a particular Socket +//------------------------------------------------------------------- +Err SlkSocketRefNum(UInt socket, UIntPtr refNumP) + SYS_TRAP(sysTrapSlkSocketRefNum); + + +//------------------------------------------------------------------- +// Set the in-packet timeout for a socket +//------------------------------------------------------------------- +Err SlkSocketSetTimeout(UInt socket, Long timeout) + SYS_TRAP(sysTrapSlkSocketSetTimeout); + + + + + +//------------------------------------------------------------------- +// Flush a Socket +//------------------------------------------------------------------- +Err SlkFlushSocket(UInt socket, Long timeout) + SYS_TRAP(sysTrapSlkFlushSocket); + + +//------------------------------------------------------------------- +// Set up a Socket Listener +//------------------------------------------------------------------- +Err SlkSetSocketListener(UInt socket, SlkSocketListenPtr socketP) + SYS_TRAP(sysTrapSlkSetSocketListener); + + +//------------------------------------------------------------------- +// Sends a packet's header, body, footer. Stuffs the header's +// magic number and checksum fields. Expects all other +// header fields to be filled in by caller. +// errors returned: dseHandle, dseLine, dseIO, dseParam, dseBodyLimit, +// dseOther +//------------------------------------------------------------------- +Err SlkSendPacket(SlkPktHeaderPtr headerP, SlkWriteDataPtr writeList) + SYS_TRAP(sysTrapSlkSendPacket); + + +//------------------------------------------------------------------- +// Receives and validates an entire packet. +// errors returned: dseHandle, dseParam, dseLine, dseIO, dseFormat, +// dseChecksum, dseBuffer, dseBodyLimit, dseTimeOut, +// dseOther +//------------------------------------------------------------------- +Err SlkReceivePacket( UInt socket, Boolean andOtherSockets, + SlkPktHeaderPtr headerP, void* bodyP, UInt bodySize, + Long timeout) + SYS_TRAP(sysTrapSlkReceivePacket); + + +//------------------------------------------------------------------- +// Do Default processing of a System packet +//------------------------------------------------------------------- +Err SlkSysPktDefaultResponse(SlkPktHeaderPtr headerP, void* bodyP) + SYS_TRAP(sysTrapSlkSysPktDefaultResponse); + +//------------------------------------------------------------------- +// Do RPC call +//------------------------------------------------------------------- +Err SlkProcessRPC(SlkPktHeaderPtr headerP, void* bodyP) + SYS_TRAP(sysTrapSlkProcessRPC); + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIAL_LINK_H diff --git a/sdk-2/include/Core/System/SerialLinkPrv.h b/sdk-2/include/Core/System/SerialLinkPrv.h new file mode 100644 index 0000000..48afdfe --- /dev/null +++ b/sdk-2/include/Core/System/SerialLinkPrv.h @@ -0,0 +1,81 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialLinkPrv.c + * + * Description: + * Private Serial Link includes + * + * History: + * 2/6/95 replaces DSerial.h from Debugger + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __SERIALLINKPRV_H +#define __SERIALLINKPRV_H + +#include + + +//************************************************************************* +// Misc Constants +//************************************************************************* +// Default timeout value once into receiving a packet in ticks +#define slkDefaultInPktTimeout (sysTicksPerSecond*2) + + + + +/******************************************************************* + * Serial Link Globals + * + *******************************************************************/ +#define slkMaxSockets 5 // max # of sockets +#define slkMaxRefNums slkMaxSockets // max # of refNums in use at any one time +#define slkAnySocket 0xFF + +#define slkEmptyRefNum 0xFF // used to track empty refInfos + +// We keep an array of these (slkMaxSockets in size) to track which +// librarie's we've received packet headers for. Since we can have up +// to slkMaxSockets unique refNums in use at any one time, we must make +// the array at least that size. +typedef struct SlkRefInfoType { + Byte refNum; // refNum of library, or 0xFF if empty + SByte destID; // dest socketID, or -1 if none + } SlkRefInfoType; +typedef SlkRefInfoType* SlkRefInfoPtr; + +typedef struct SlkGlobalsType { + UInt openCount; + + Byte socketRefNum[slkMaxSockets]; + Boolean socketOpen[slkMaxSockets]; + SlkSocketListenPtr socketListenP[slkMaxSockets]; + Word socketTimeout[slkMaxSockets]; // inPacket timeout + + + // We can keep track of packets coming in for up to slkMaxRefNums libraries. + // This array holds the destination socket ID for packets received from + // each library. + SlkRefInfoType refInfo[slkMaxRefNums]; + + Byte transId; // next transaction ID + DWord xmitSemaphoreID; // Semaphore ID for transmitting + Word numReceived; // # of packets received since serial link + // was opened. + } SlkGlobalsType; + +typedef SlkGlobalsType* SlkGlobalsPtr; + + + +#endif //__SERIALLINKPRV_H + +#endif //NON_PORTABLE diff --git a/sdk-2/include/Core/System/SerialMgr.h b/sdk-2/include/Core/System/SerialMgr.h new file mode 100644 index 0000000..ce041f1 --- /dev/null +++ b/sdk-2/include/Core/System/SerialMgr.h @@ -0,0 +1,322 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SerialMgr.h + * + * Description: + * Include file for Serial manager + * + * History: + * 2/7/95 Created by Ron Marianetti + * 7/6/95 vmk added serDefaultSettings + * + *******************************************************************/ + +#ifndef __SERIAL_MGR_H +#define __SERIAL_MGR_H + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Serial Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ +#pragma mark -Error Codes- + +#define serErrBadParam (serErrorClass | 1) +#define serErrBadPort (serErrorClass | 2) +#define serErrNoMem (serErrorClass | 3) +#define serErrBadConnID (serErrorClass | 4) +#define serErrTimeOut (serErrorClass | 5) +#define serErrLineErr (serErrorClass | 6) +#define serErrAlreadyOpen (serErrorClass | 7) +#define serErrStillOpen (serErrorClass | 8) +#define serErrNotOpen (serErrorClass | 9) +#define serErrNotSupported (serErrorClass | 10) // functionality not supported + + +/******************************************************************** + * Serial Settings Descriptor + ********************************************************************/ +#pragma mark -Configuration Settings- + +typedef struct SerSettingsType { + ULong baudRate; // baud rate + ULong flags; // miscellaneous settings + Long ctsTimeout; // max # of ticks to wait for CTS to become asserted + // before transmitting; used only when + // configured with serSettingsFlagCTSAutoM. + } SerSettingsType; +typedef SerSettingsType* SerSettingsPtr; + +#define serSettingsFlagStopBitsM 0x00000001 // mask for stop bits field +#define serSettingsFlagStopBits1 0x00000000 // 1 stop bits +#define serSettingsFlagStopBits2 0x00000001 // 2 stop bits +#define serSettingsFlagParityOnM 0x00000002 // mask for parity on +#define serSettingsFlagParityEvenM 0x00000004 // mask for parity even +#define serSettingsFlagXonXoffM 0x00000008 // mask for Xon/Xoff flow control +#define serSettingsFlagRTSAutoM 0x00000010 // mask for RTS rcv flow control +#define serSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control +#define serSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char +#define serSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char +#define serSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char +#define serSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char +#define serSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char + + +// Default settings +#define serDefaultSettings (serSettingsFlagBitsPerChar8 | \ + serSettingsFlagStopBits1 | \ + serSettingsFlagRTSAutoM) + +#define serDefaultCTSTimeout (5*sysTicksPerSecond); + +// +// mask values for the lineErrors from SerGetStatus +// +#pragma mark -Line Errors- + +#define serLineErrorParity 0x0001 // parity error +#define serLineErrorHWOverrun 0x0002 // HW overrun +#define serLineErrorFraming 0x0004 // framing error +#define serLineErrorBreak 0x0008 // break signal asserted +#define serLineErrorHShake 0x0010 // line hand-shake error +#define serLineErrorSWOverrun 0x0020 // HW overrun + + + + +/******************************************************************** + * Type of a wakeup handler procedure which can be installed through the + * SerSetWakeupHandler() call. + ********************************************************************/ +typedef void (*SerWakeupHandler) (DWord refCon); + +/******************************************************************** + * Type of an emulator-mode only blocking hook routine installed via + * SerControl function serCtlEmuSetBlockingHook. This is supported only + * under emulation mode. The argument to the function is the value + * specified in the SerCallbackEntryType structure. The callback returns + * true if serial manager should abort the current blocking action, such + * as when an app quit event has been received; under normal conditions, + * the callback returns true. The callback can additionally process + * events to enable user interaction with the UI. + ********************************************************************/ +typedef Boolean (*SerBlockingHookHandler) (DWord userRef); + + + + +/******************************************************************** + * Serial Library Control Enumerations (Pilot 2.0) + ********************************************************************/ +#pragma mark -Control Enumerations- + +/******************************************************************** + * Structure for specifying callback routines. + ********************************************************************/ +typedef struct SerCallbackEntryType { + Ptr funcP; // function pointer + DWord userRef; // ref value to pass to callback + } SerCallbackEntryType; +typedef SerCallbackEntryType* SerCallbackEntryPtr; + +// v2.0 extension +// DOLATER... add DTR control and status +typedef enum SerCtlEnum { + serCtlFirstReserved = 0, // RESERVE 0 + + serCtlStartBreak, // 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, // turn RS232 break signal off: + // valueP = 0, valueLenP = 0 + + serCtlBreakStatus, // Get RS232 break signal status(on or off): + // valueP = ptr to Word for returning status(0 = off, !0 = on) + // *valueLenP = sizeof(Word) + + serCtlStartLocalLoopback, // Start local loopback test + // valueP = 0, valueLenP = 0 + + serCtlStopLocalLoopback, // Stop local loopback test + // valueP = 0, valueLenP = 0 + + serCtlMaxBaud, // Get maximum supported baud rate: + // valueP = ptr to DWord for returned baud + // *valueLenP = sizeof(DWord) + + serCtlHandshakeThreshold, // retrieve HW handshake threshold; this is the maximum baud rate + // which does not require hardware handshaking + // valueP = ptr to DWord for returned baud + // *valueLenP = sizeof(DWord) + + serCtlEmuSetBlockingHook, // Set a blocking hook routine FOR EMULATION + // MODE ONLY - NOT SUPPORTED ON THE PILOT + //PASS: + // valueP = ptr to SerCallbackEntryType + // *valueLenP = sizeof(SerCallbackEntryType) + //RETURNS: + // the old settings in the first argument + + + + serCtlLAST // ADD NEW ENTRIES BEFORE THIS ONE + } SerCtlEnum; + + + +/******************************************************************** + * Serial Library Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#pragma mark -API Functions- + +#ifdef __cplusplus +extern "C" { +#endif + +// Used by mac applications to map the pilot serial port to a particular +// macintosh port. +UInt SerSetMapPort( UInt pilotPort, UInt macPort ); + +// Acquires and opens a serial port with given baud and default settings. +Err SerOpen(UInt refNum, UInt port, ULong baud) + SYS_TRAP(sysLibTrapOpen); + +// Used by debugger to re-initialize serial port if necessary +Err SerDbgAssureOpen(UInt refNum, UInt port, ULong baud); + +// Closes the serial connection previously opened with SerOpen. +Err SerClose(UInt refNum) + SYS_TRAP(sysLibTrapClose); + +// Puts serial library to sleep +Err SerSleep(UInt refNum) + SYS_TRAP(sysLibTrapSleep); + +// Wake Serial library +Err SerWake(UInt refNum) + SYS_TRAP(sysLibTrapWake); + +// Get attributes of the serial connection +Err SerGetSettings(UInt refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom); + +// Set attributes of the serial connection +Err SerSetSettings(UInt refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom+1); + +// Return status of serial connection +Word SerGetStatus(UInt refNum, BooleanPtr ctsOnP, + BooleanPtr dsrOnP) + SYS_TRAP(sysLibTrapCustom+2); + +// Reset error condition of serial connection +Err SerClearErr(UInt refNum) + SYS_TRAP(sysLibTrapCustom+3); + + + + +// Sends a buffer of data (may queue it up and return). +Err SerSend10(UInt refNum, VoidPtr bufP, ULong size) + SYS_TRAP(sysLibTrapCustom+4); + +// Waits until the serial transmit buffer empties. +Err SerSendWait(UInt refNum, Long timeout) + SYS_TRAP(sysLibTrapCustom+5); + +// Returns how many characters are left in the send queue waiting +// for transmission +Err SerSendCheck(UInt refNum, ULongPtr numBytesP) + SYS_TRAP(sysLibTrapCustom+6); + +// Flushes the data out of the transmit buffer +Err SerSendFlush(UInt refNum) + SYS_TRAP(sysLibTrapCustom+7); + + + + +// Receives a buffer of data of the given size. +Err SerReceive10(UInt refNum, VoidPtr bufP, ULong bytes, Long timeout) + SYS_TRAP(sysLibTrapCustom+8); + +// Waits for at least 'bytes' bytes of data to arrive at the serial input. +// but does not read them in +Err SerReceiveWait(UInt refNum, ULong bytes, Long timeout) + SYS_TRAP(sysLibTrapCustom+9); + +// Returns how many characters are in the receive queue +Err SerReceiveCheck(UInt refNum, ULongPtr numBytesP) + SYS_TRAP(sysLibTrapCustom+10); + +// Flushes any data coming into the serial port, discarding the data. +void SerReceiveFlush(UInt refNum, Long timeout) + SYS_TRAP(sysLibTrapCustom+11); + + +// Specify a new input buffer. To restore the original buffer, pass +// bufSize = 0. +Err SerSetReceiveBuffer(UInt refNum, VoidPtr bufP, UInt bufSize) + SYS_TRAP(sysLibTrapCustom+12); + + +// The receive character interrupt service routine, called by kernel when +// a UART interrupt is detected. DOLATER... generalize ISP's for multiple Serial libs +Boolean SerReceiveISP(void) + SYS_TRAP(sysTrapSerReceiveISP); + + + +// "Back Door" into the serial receive queue. Used by applications (like TCP Media layers) +// that need faster access to received characters +Err SerReceiveWindowOpen(UInt refNum, BytePtr* bufPP, DWordPtr sizeP) + SYS_TRAP(sysLibTrapCustom+13); + +Err SerReceiveWindowClose(UInt refNum, DWord bytesPulled) + SYS_TRAP(sysLibTrapCustom+14); + +// Can be called by applications that need an alternate wakeup mechanism +// when characters get enqueued by the interrupt routine. +Err SerSetWakeupHandler(UInt refNum, SerWakeupHandler procP, + DWord refCon) + SYS_TRAP(sysLibTrapCustom+15); + +// Called to prime wakeup handler +Err SerPrimeWakeupHandler(UInt refNum, Word minBytes) + SYS_TRAP(sysLibTrapCustom+16); + +// Called to prime wakeup handler +// (v2.0 extension) +Err SerControl(UInt refNum, Word op, VoidPtr valueP, WordPtr valueLenP) + SYS_TRAP(sysLibTrapCustom+17); + + +// Sends a buffer of data (may queue it up and return). +ULong SerSend(UInt refNum, VoidPtr bufP, ULong count, Err* errP) + SYS_TRAP(sysLibTrapCustom+18); + +// Receives a buffer of data of the given size. +ULong SerReceive(UInt refNum, VoidPtr bufP, ULong count, Long timeout, Err* errP) + SYS_TRAP(sysLibTrapCustom+19); + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIAL_MGR_H diff --git a/sdk-2/include/Core/System/SoundMgr.h b/sdk-2/include/Core/System/SoundMgr.h new file mode 100644 index 0000000..cbf817f --- /dev/null +++ b/sdk-2/include/Core/System/SoundMgr.h @@ -0,0 +1,161 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SoundMgr.h + * + * Description: + * Include file for Sound Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __SOUNDMGR_H__ +#define __SOUNDMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Sound Manager constants + * + *************************************************************/ + +// Sound Manager max and default volume levels +#define sndMaxAmp 64 +//#define sndVolumeMask 0x0ff +#define sndDefaultAmp sndMaxAmp + + +/************************************************************ + * Sound Manager data structures + * + *************************************************************/ + +// +// Command numbers for SndCommandType's cmd field +// +typedef enum SndCmdIDType { + + sndCmdFreqDurationAmp = 1 // play a sound + // param1 = frequency in Hz + // param2 = duration in milliseconds + // param3 = amplitude (0 - sndMaxAmp) + + } SndCmdIDType; + +// +// SndCommandType: used by SndDoCmd() +// + +typedef struct SndCommandType { +SndCmdIDType cmd; // command id +Long param1; // first parameter +UInt param2; // second parameter +UInt param3; // third parameter +} SndCommandType; + +typedef SndCommandType* SndCommandPtr; + + +// +// Beep numbers used by SndSysBeep() +// + +typedef enum SndSysBeepType { + sndInfo = 1, + sndWarning, + sndError, + sndStartUp, + sndAlarm, + sndConfirmation, + sndClick + } SndSysBeepType; + + + +/************************************************************ + * Sound Manager result codes + * (sndErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define sndErrBadParam (sndErrorClass | 1) +#define sndErrBadChannel (sndErrorClass | 2) +#define sndErrMemory (sndErrorClass | 3) +#define sndErrOpen (sndErrorClass | 4) +#define sndErrQFull (sndErrorClass | 5) +#define sndErrQEmpty (sndErrorClass | 6) // internal + + + +/******************************************************************** + * Sound Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- + +// Initializes the Sound Manager. Should only be called by +// Pilot initialization code. +Err SndInit(void) SYS_TRAP(sysTrapSndInit); + +// Frees the Sound Manager. +//void SndFree(void) SYS_TRAP(sysTrapSndFree); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// Sets default sound volume levels +// +// Any parameter may be passed as NULL +void SndSetDefaultVolume(UIntPtr alarmAmpP, UIntPtr sysAmpP, UIntPtr defAmpP) + SYS_TRAP(sysTrapSndSetDefaultVolume); + +// Gets default sound volume levels +// +// Any parameter may be passed as NULL +void SndGetDefaultVolume(UIntPtr alarmAmpP, UIntPtr sysAmpP, UIntPtr defAmpP) + SYS_TRAP(sysTrapSndGetDefaultVolume); + +// Executes a sound command on the given sound channel (pass +// channelP = 0 to use the shared channel). +Err SndDoCmd(VoidPtr /*SndChanPtr*/ channelP, SndCommandPtr cmdP, Boolean noWait) + SYS_TRAP(sysTrapSndDoCmd); + +// Plays one of several defined system beeps/sounds (see sndSysBeep... +// constants). +void SndPlaySystemSound(SndSysBeepType beepID) + SYS_TRAP(sysTrapSndPlaySystemSound); + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Sound Manager Macros + * + *************************************************************/ + +#endif // __SOUND_MGR_H__ + diff --git a/sdk-2/include/Core/System/SoundPrv.h b/sdk-2/include/Core/System/SoundPrv.h new file mode 100644 index 0000000..38ee7f9 --- /dev/null +++ b/sdk-2/include/Core/System/SoundPrv.h @@ -0,0 +1,61 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SoundPrv.h + * + * Description: + * Private Include file for Sound Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __SOUNDPRV_H__ +#define __SOUNDPRV_H__ + + + +/************************************************************ + * Sound Manager constants + *************************************************************/ + +#define sndSamplingRate 8000 // 8 kHz + + +// DOLATER: determine appropriate values experimentally (TBD) +#define sndBeepDurationMSec 70 // msec +#define sndConfirmationDurationMSec 70 // msec +#define sndClickDurationMSec 9 // msec + +// These frequencies are more audible on the current hardware. +#define sndInfoFreq 500 // Hz +#define sndWarningFreq 500 // Hz +#define sndErrorFreq 500 // Hz +#define sndConfirmationFreq 500 // Hz +#define sndStartUpFreq 1000 // Hz +#define sndClickFreq 200 // Hz + + +/******************************************************************* + * Sound Manager Globals + * + *******************************************************************/ +typedef struct SndGlobalsType { + Long smID; // semaphore id for data access integrity + Byte sysAmp; // system sound amplitude(0-sndMaxVolume) + Byte alarmAmp; // alarm sound amplitude(0-sndMaxVolume) + Byte defAmp; // default amplitude for other sounds(0-sndMaxVolume) + } SndGlobalsType; + +typedef SndGlobalsType* SndGlobalsPtr; + + +#endif // __SOUNDPRV_H__ +#endif // NON_PORTABLE diff --git a/sdk-2/include/Core/System/StringMgr.h b/sdk-2/include/Core/System/StringMgr.h new file mode 100644 index 0000000..c85d239 --- /dev/null +++ b/sdk-2/include/Core/System/StringMgr.h @@ -0,0 +1,98 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * StringMgr.h + * + * Description: + * String manipulation functions + * + * History: + * 11/09/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + + + +#ifndef __STRINGMGR_H__ +#define __STRINGMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +#ifdef __cplusplus +extern "C" { +#endif + +// String Manipulation routines +CharPtr StrCopy(CharPtr dst, const Char* src) + SYS_TRAP(sysTrapStrCopy); + +CharPtr StrNCopy(CharPtr dst, const Char* src, Word n) + SYS_TRAP(sysTrapStrNCopy); + +CharPtr StrCat(CharPtr dst, const Char* src) + SYS_TRAP(sysTrapStrCat); + +CharPtr StrNCat(CharPtr dst, const Char* src, Word n) + SYS_TRAP(sysTrapStrNCat); + +UInt StrLen(const Char* src) + SYS_TRAP(sysTrapStrLen); + +Int StrCompare(const Char* s1, const Char* s2) + SYS_TRAP(sysTrapStrCompare); + +Int StrNCompare(const Char* s1, const Char* s2, DWord n) + SYS_TRAP(sysTrapStrNCompare); + +Int StrCaselessCompare(const Char* s1, const Char* s2) + SYS_TRAP(sysTrapStrCaselessCompare); + +Int StrNCaselessCompare(const Char* s1, const Char* s2, DWord n) + SYS_TRAP(sysTrapStrNCaselessCompare); + +CharPtr StrToLower(CharPtr dst, const Char* src) + SYS_TRAP(sysTrapStrToLower); + +CharPtr StrIToA(CharPtr s, Long i) + SYS_TRAP(sysTrapStrIToA); + +CharPtr StrIToH(CharPtr s, ULong i) + SYS_TRAP(sysTrapStrIToH); + +CharPtr StrLocalizeNumber(CharPtr s, Char thousandSeparator, Char decimalSeparator) + SYS_TRAP(sysTrapStrLocalizeNumber); + +CharPtr StrDelocalizeNumber(CharPtr s, Char thousandSeparator, Char decimalSeparator) + SYS_TRAP(sysTrapStrDelocalizeNumber); + +CharPtr StrChr (const Char* str, Int chr) + SYS_TRAP(sysTrapStrChr); + +CharPtr StrStr (const Char* str, const Char* token) + SYS_TRAP(sysTrapStrStr); + +Long StrAToI (const Char* str) + SYS_TRAP(sysTrapStrAToI); + +SWord StrPrintF(CharPtr s, const Char* formatStr, ...) + SYS_TRAP(sysTrapStrPrintF); + +SWord StrVPrintF(CharPtr s, const Char* formatStr, VoidPtr arg) + SYS_TRAP(sysTrapStrVPrintF); + +#ifdef __cplusplus +} +#endif + + + + +#endif //__STRINGMGR_H diff --git a/sdk-2/include/Core/System/SysAll.h b/sdk-2/include/Core/System/SysAll.h new file mode 100644 index 0000000..f365d4c --- /dev/null +++ b/sdk-2/include/Core/System/SysAll.h @@ -0,0 +1,89 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysAll.h + * + * Description: + * Includes all system header files in order to help compiler + * do pre-compiled headers + * + * History: + * 11/17/94 RM - Created by Ron Marianetti + * 2/24/97 roger - changed to handle c++ versions. + * 4/16/97 SCL - Added + * + *******************************************************************/ + +#ifndef __SYSALL_H__ +#define __SYSALL_H__ + + +//********************************************************************* +// If not included from Pilot.h, as is the case when compiling UI modules, +// use the SysAll pre-compiled header file. +//********************************************************************* +#ifndef __PILOT_H__ + #ifndef PILOT_PRECOMPILED_HEADERS_OFF + + // Use Metrowerk's precompiled headers option + #if defined(__MWERKS__) + #if !__option(precompile) + #if __PALMOS_TRAPS__ + #ifdef __cplusplus + #include "SysAll.h++.mch" + #else + #include "SysAll.h.mch" + #endif + #else + #ifdef CMD_LINE_BUILD + #ifdef __cplusplus + #include "SysAll.h++.mpw.mch" + #else + #include "SysAll.h.mpw.mch" + #endif + #else + #ifdef __cplusplus + #include "SysAll.h++.sim.mch" + #else + #include "SysAll.h.sim.mch" + #endif + #endif + #endif + #define __INCLUDED_SYSALL_H_OBJ__ + #endif + #endif + + #endif +#endif + + +// Fastest compilation speed is obtained by not including these +// headers when the pre-compiled header is used. +#ifndef __INCLUDED_SYSALL_H_OBJ__ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#endif + + +#endif // __SYSALL_H__ diff --git a/sdk-2/include/Core/System/SysAll.pch b/sdk-2/include/Core/System/SysAll.pch new file mode 100644 index 0000000..d4dc350 --- /dev/null +++ b/sdk-2/include/Core/System/SysAll.pch @@ -0,0 +1,40 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysAll.pch + * + * Description: + * Source file used to generate pre-compiled headers for Pilot + * System Modules + * + * History: + * 6/ 6/95 RM - Created by Ron Marianetti + * 4/24/97 SL - Changes for PalmOS 2.0 SDK + * + *******************************************************************/ + +// By including this module in your CodeWarrior project. You can automatically +// regenerate the pre-compiled header file used by the System modules called +// SysAll.h.obj +#ifdef CMD_LINE_BUILD + #pragma precompile_target ":Obj:SysAll.h.mpw.mch" +#else + #if __PALMOS_TRAPS__ + #pragma precompile_target ":Obj:SysAll.h.mch" + #else + #pragma precompile_target ":Obj:SysAll.h.sim.mch" + #endif +#endif + +// Define this so that SysAll.h doesn't try to include the pre-compiled header +// that we're currently building. +#define BUILDING_PRECOMPILED_HEADER + + +// These are the Pilot-only header files. +#include + diff --git a/sdk-2/include/Core/System/SysAll.pch++ b/sdk-2/include/Core/System/SysAll.pch++ new file mode 100644 index 0000000..41a19d4 --- /dev/null +++ b/sdk-2/include/Core/System/SysAll.pch++ @@ -0,0 +1,40 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysAll.pch++ + * + * Description: + * Source file used to generate pre-compiled headers for Pilot + * System Modules + * + * History: + * 2/24/97 roger - Created to generate headers in c++ name mangling + * 4/24/97 SL - Changes for PalmOS 2.0 SDK + * + *******************************************************************/ + +// By including this module in your CodeWarrior project. You can automatically +// regenerate the pre-compiled header file used by the System modules called +// SysAll.h.obj +#ifdef CMD_LINE_BUILD + #pragma precompile_target ":Obj:SysAll.h++.mpw.mch" +#else + #if __PALMOS_TRAPS__ + #pragma precompile_target ":Obj:SysAll.h++.mch" + #else + #pragma precompile_target ":Obj:SysAll.h++.sim.mch" + #endif +#endif + +// Define this so that SysAll.h doesn't try to include the pre-compiled header +// that we're currently building. +#define BUILDING_PRECOMPILED_HEADER + + +// These are the Pilot-only header files. +#include + diff --git a/sdk-2/include/Core/System/SysConfigPrv.h b/sdk-2/include/Core/System/SysConfigPrv.h new file mode 100644 index 0000000..dacec48 --- /dev/null +++ b/sdk-2/include/Core/System/SysConfigPrv.h @@ -0,0 +1,49 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysConfigPrv.h + * + * Description: + * Private system configuration defines + * + * History: + * 8/23/96 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __SYSCONFIGPRV_H__ +#define __SYSCONFIGPRV_H__ + + + + +/************************************************************ + * Private Memory Manager Constants + *************************************************************/ +// Default size of the dynamic heap +// This macro accepts the total RAM in card 0 as a parameter and returns +// the number of bytes to assign to the dynamic heap +#ifndef BIG_HEAP +#error Build option BIG_HEAP not setup +#endif +#if BIG_HEAP + #define memCalcDynamicRAMSize(totalSize) \ + ((totalSize > 0x20000) ? (0x010000) : (0x008000)) // leave at 32K until ROM2.0B +#else + #define memCalcDynamicRAMSize(totalSize) \ + ((totalSize > 0x20000) ? (0x008000) : (0x008000)) // leave at 32K until ROM2.0B +#endif + +#define memCalcDynamicHeapSize(totalSize) \ + (memCalcDynamicRAMSize(totalSize)-sysLowMemSize) + + + +#endif // __SYSCONFIGPRV_H__ +#endif //NON_PORTABLE diff --git a/sdk-2/include/Core/System/SysEvtMgr.h b/sdk-2/include/Core/System/SysEvtMgr.h new file mode 100644 index 0000000..15812dc --- /dev/null +++ b/sdk-2/include/Core/System/SysEvtMgr.h @@ -0,0 +1,174 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysEvtMgr.h + * + * Description: + * Header for the System Event Manager + * + * History: + * 3/22/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __SYSEVTMGR_H__ +#define __SYSEVTMGR_H__ + +#include + +/************************************************************ + * System Event Manager Errors + *************************************************************/ +#define evtErrParamErr (evtErrorClass | 1) +#define evtErrQueueFull (evtErrorClass | 2) +#define evtErrQueueEmpty (evtErrorClass | 3) + + +/************************************************************ + * System Event Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err EvtSysInit(void) + SYS_TRAP(sysTrapEvtSysInit); + +// Return next "System" event. This routine will send strokes to Graffiti as necessary +// and return a key event. Otherwise, it will return a simple pen down or pen +// up event, or put the processor to sleep for a max time of 'timeout' if +// no events are available. +void EvtGetSysEvent(EventPtr eventP, Long timeout) + SYS_TRAP(sysTrapEvtGetSysEvent); + + +// Return true if there is a low level system event (pen or key) available +Boolean EvtSysEventAvail(Boolean ignorePenUps) + SYS_TRAP(sysTrapEvtSysEventAvail); + + + +// Translate a stroke in the silk screen area to a key event +Err EvtProcessSoftKeyStroke(PointType* startPtP, PointType* endPtP) + SYS_TRAP(sysTrapEvtProcessSoftKeyStroke); + + +//----------------------------------------------------------------- +// Pen Queue Utilties +//------------------------------------------------------------------ + +// Replace current pen queue with another of the given size +Err EvtSetPenQueuePtr(Ptr penQueueP, ULong size) + SYS_TRAP(sysTrapEvtSetPenQueuePtr); + +// Return size of current pen queue in bytes +ULong EvtPenQueueSize(void) + SYS_TRAP(sysTrapEvtPenQueueSize); + +// Flush the pen queue +Err EvtFlushPenQueue(void) + SYS_TRAP(sysTrapEvtFlushPenQueue); + + +// Append a point to the pen queue. Passing -1 for x and y means +// pen-up (terminate the current stroke). Called by digitizer interrupt routine +Err EvtEnqueuePenPoint(PointType* ptP) + SYS_TRAP(sysTrapEvtEnqueuePenPoint); + + +// Return the stroke info for the next stroke in the pen queue. This MUST +// be the first call when removing a stroke from the queue +Err EvtDequeuePenStrokeInfo(PointType* startPtP, PointType* endPtP) + SYS_TRAP(sysTrapEvtDequeuePenStrokeInfo); + +// Dequeue the next point from the pen queue. Returns non-0 if no +// more points. The point returned will be (-1,-1) at the end +// of the stroke. +Err EvtDequeuePenPoint(PointType* retP) + SYS_TRAP(sysTrapEvtDequeuePenPoint); + + +// Flush the entire stroke from the pen queue and dispose it +Err EvtFlushNextPenStroke() + SYS_TRAP(sysTrapEvtFlushNextPenStroke); + + + + +//----------------------------------------------------------------- +// Key Queue Utilties +//------------------------------------------------------------------ + +// Replace current key queue with another of the given size. This routine will +// intialize the given key queue before installing it +Err EvtSetKeyQueuePtr(Ptr keyQueueP, ULong size) + SYS_TRAP(sysTrapEvtSetKeyQueuePtr); + +// Return size of current key queue in bytes +ULong EvtKeyQueueSize(void) + SYS_TRAP(sysTrapEvtKeyQueueSize); + +// Flush the key queue +Err EvtFlushKeyQueue(void) + SYS_TRAP(sysTrapEvtFlushKeyQueue); + + +// Append a key to the key queue. +Err EvtEnqueueKey(UInt ascii, UInt keycode, UInt modifiers) + SYS_TRAP(sysTrapEvtEnqueueKey); + +// Return true of key queue empty. +Boolean EvtKeyQueueEmpty(void) + SYS_TRAP(sysTrapEvtKeyQueueEmpty); + + +// Pop off the next key event from the key queue and fill in the given +// event record structure. Returns non-zero if there aren't any keys in the +// key queue. If peek is non-zero, key will be left in key queue. +Err EvtDequeueKeyEvent(EventPtr eventP, Word peek) + SYS_TRAP(sysTrapEvtDequeueKeyEvent); + + +//----------------------------------------------------------------- +// General Utilities +//------------------------------------------------------------------ +// Force the system to wake-up. This will result in a null event being +// sent to the current app. +Err EvtWakeup(void) + SYS_TRAP(sysTrapEvtWakeup); + +// Reset the auto-off timer. This is called by the SerialLink Manager in order +// so we don't auto-off while receiving data over the serial port. +Err EvtResetAutoOffTimer(void) + SYS_TRAP(sysTrapEvtResetAutoOffTimer); + + +// Set Graffiti enabled or disabled. +void EvtEnableGraffiti(Boolean enable) + SYS_TRAP(sysTrapEvtEnableGraffiti); + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _EvtEnqueuePenPoint \ + ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint) + + + +#endif //__SYSEVTMGR_H__ + + + diff --git a/sdk-2/include/Core/System/SysEvtPrv.h b/sdk-2/include/Core/System/SysEvtPrv.h new file mode 100644 index 0000000..b0f02fa --- /dev/null +++ b/sdk-2/include/Core/System/SysEvtPrv.h @@ -0,0 +1,217 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysEvtPrv.h + * + * Description: + * Private Header for the System Event Manager + * + * History: + * 8/10/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __SYSEVTPRV_H__ +#define __SYSEVTPRV_H__ + + + + +/************************************************************ + * Structure of a Pen Capture Queue + * + * This structure is used to hold one or more pen strokes + * and is filled by the digitizer interrupt routine and emptied + * by application level code. + * + * A default size queue is allocated by the system and used to capture + * strokes for subsequent processing by the Graffiti recognizer + * or the hard icon recognizer. This queue pointer is stored in + * the System Event Manager Globals. + * + * Optionally, applications can replace the system pen queue with + * one of their own if it they need to hold larger strokes + * or more of them. + * + * + * Stroke data is stored in compressed form in this queue - refer + * to the comments on the routine EvtEnqueuPenPoint for the format + * of the queue data. + *************************************************************/ +typedef struct PenQueueType { + Int start; // start byte offset + Int end; // end byte offset + Int size; // size of queue in bytes + + UInt strokeCount; // # of complete strokes currently in pen queue + Boolean returnedPenDown; // set after we return a pen-down event for + // the next stroke in the queue. Cleared after + // we return the pen-up for the stroke. + + PointType addLast; // last point captured + Int addStrokeStart; // offset in queue to start of stroke + // currently being added to queue + // -1 : no stroke being captured + + + UInt strokesRemoved; // running count: # of strokes removed from queue. + UInt strokesAdded; // running count: # of strokes added to queue. + + Int rmvStrokeStage; // -1 : not started + // 0 : returned stroke info + // 1 : returned start point + + PointType rmvLast; // last point dequeued + PointType rmvStartPt; // copy of start point of stroke currently + // being removed. + + Byte data[1]; // 'size' bytes of data + } PenQueueType; +typedef PenQueueType* PenQueuePtr; + + + +/************************************************************ + * Structure of the Key Queue + * + * This structure is used to hold one or more keystrokes + * and is filled by numerous places including the low level + * hardware key interrupt routine, the Graffiti recognizer, and + * the digitizer buttons recognizer. + * + * A default size queue is allocated by the system. + * This queue pointer is stored in the System Event Manager globals. + * + * Optionally, applications can replace the system key queue with + * one of their own if it they need to hold more keys in the queue + * at one time. This may be necessary when processing large macro + * strings from Graffiti. + * + * Key data is stored in compressed form in this queue. Refer to + * the comments for the function EvtEnqueueKeyString for the format + * of the compressed data. + * + *************************************************************/ +typedef struct KeyQueueType { + UInt start; // start byte offset + UInt end; // end byte offset + UInt size; // size of queue in bytes + + Byte data[1]; // 'size' bytes of data + } KeyQueueType; +typedef KeyQueueType* KeyQueuePtr; + + + + + +/************************************************************ + * 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. + *************************************************************/ +typedef struct PenBtnInfoType { + RectangleType boundsR; // bounding rectangle of button + UInt asciiCode; // ascii code for key event + UInt keyCode; // virtual key code for key event + UInt modifiers; // modifiers for key event + } PenBtnInfoType; +typedef PenBtnInfoType* PenBtnInfoPtr; + + + + +/************************************************************ + * Key constants + *************************************************************/ +#define evtKeyStringEscape 0x01 // Escape byte for encoded key strings + // passed to EvtEnqueueKeyString or stored + // in key queue. + + +#define evtDefaultPenQSize 0x100 +#define evtDefaultKeyQSize 0x40 + +#define evtEffectiveKeyQStorage (evtDefaultKeyQSize - sizeof(KeyQueueType)) + + +// gremlinsFlags +#define grmGremlinsOn 0x01 +#define grmEventTraceOn 0x02 +#define grmGremlinsIdle 0x04 + +/************************************************************ + * Structure of System Event Manager Globals + *************************************************************/ +typedef struct SysEvtMgrGlobalsType { + Boolean sendNullEvent; // set by EvtWakeup + Boolean enableGraffiti; // If true, enable Graffiti translation + Boolean enableSoftKeys; // If true, enable digitizer button translation + + + Boolean removeTopStroke; // if true, remove top stroke from queue + // next time EvtGetSysEvent is called; + PenQueuePtr penQP; // pointer to current pen queue + UInt penQStrokesRemoved; // saved value of penQP->strokesRemoved. Used to + // determine if app removed stroke from penUp + // event or not. + + KeyQueuePtr keyQP; // pointer to current key queue + + RectangleType writingR; // enclosing rect for writing area + UInt appAreaBottom; // bottom coordinate of application area. + + UInt penX; // current pen location and state + UInt penY; + Boolean penDown; + Boolean displayingBatteryAlert; // to avoid re-entering battery dialog + + UInt lastPenX; // last pen location and state + UInt lastPenY; + Boolean lastPenDown; + + // This boolean is set by the Remote Screen Driver timer procedure periodically + // to force the event manager to call ScrSendUpdateArea which will send the update + // area of the screen to the host. + Boolean needRemoteScrUpdate; // If true, call ScrSendUpdateArea + + + Byte gremlinsFlags; // flag to indicate if gremlins is running and + // if we'er doing an event trace. + + Boolean idle; + + } SysEvtMgrGlobalsType; + +typedef SysEvtMgrGlobalsType* SysEvtMgrGlobalsPtr; + + + +/************************************************************ + * System Event Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + +// Return pointer to the pen based button list +PenBtnInfoPtr EvtGetPenBtnList(UIntPtr numButtons) + SYS_TRAP(sysTrapEvtGetPenBtnList); + + +#ifdef __cplusplus +} +#endif + + +#endif //__SYSEVTPRV_H__ + +#endif // NON_PORTABLE + diff --git a/sdk-2/include/Core/System/SysTraps.h b/sdk-2/include/Core/System/SysTraps.h new file mode 100644 index 0000000..e92e4f2 --- /dev/null +++ b/sdk-2/include/Core/System/SysTraps.h @@ -0,0 +1,983 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysTraps.h + * + * Description: + * Pilot Traps + * + * History: + * 6/13/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + + #ifndef __SYSTRAPS_H_ + #define __SYSTRAPS_H_ + +// Include elementary types +#include +#include + +// Regular traps start here and go up by 1's +#define sysTrapBase 0xA000 +typedef enum { + sysTrapMemInit = sysTrapBase, + sysTrapMemInitHeapTable, + sysTrapMemStoreInit, + sysTrapMemCardFormat, + sysTrapMemCardInfo, + sysTrapMemStoreInfo, + sysTrapMemStoreSetInfo, + sysTrapMemNumHeaps, + sysTrapMemNumRAMHeaps, + sysTrapMemHeapID, + sysTrapMemHeapPtr, + sysTrapMemHeapFreeBytes, + sysTrapMemHeapSize, + sysTrapMemHeapFlags, + sysTrapMemHeapCompact, + sysTrapMemHeapInit, + sysTrapMemHeapFreeByOwnerID, + sysTrapMemChunkNew, + sysTrapMemChunkFree, + sysTrapMemPtrNew, + sysTrapMemPtrRecoverHandle, + sysTrapMemPtrFlags, + sysTrapMemPtrSize, + sysTrapMemPtrOwner, + sysTrapMemPtrHeapID, + sysTrapMemPtrCardNo, + sysTrapMemPtrToLocalID, + sysTrapMemPtrSetOwner, + sysTrapMemPtrResize, + sysTrapMemPtrResetLock, + sysTrapMemHandleNew, + sysTrapMemHandleLockCount, + sysTrapMemHandleToLocalID, + sysTrapMemHandleLock, + sysTrapMemHandleUnlock, + sysTrapMemLocalIDToGlobal, + sysTrapMemLocalIDKind, + sysTrapMemLocalIDToPtr, + sysTrapMemMove, + sysTrapMemSet, + sysTrapMemStoreSearch, + sysTrapMemPtrDataStorage, + sysTrapMemKernelInit, + sysTrapMemHandleFree, + sysTrapMemHandleFlags, + sysTrapMemHandleSize, + sysTrapMemHandleOwner, + sysTrapMemHandleHeapID, + sysTrapMemHandleDataStorage, + sysTrapMemHandleCardNo, + sysTrapMemHandleSetOwner, + sysTrapMemHandleResize, + sysTrapMemHandleResetLock, + sysTrapMemPtrUnlock, + sysTrapMemLocalIDToLockedPtr, + sysTrapMemSetDebugMode, + sysTrapMemHeapScramble, + sysTrapMemHeapCheck, + sysTrapMemNumCards, + sysTrapMemDebugMode, + sysTrapMemSemaphoreReserve, + sysTrapMemSemaphoreRelease, + sysTrapMemHeapDynamic, + sysTrapMemNVParams, + + + sysTrapDmInit, + sysTrapDmCreateDatabase, + sysTrapDmDeleteDatabase, + sysTrapDmNumDatabases, + sysTrapDmGetDatabase, + sysTrapDmFindDatabase, + sysTrapDmDatabaseInfo, + sysTrapDmSetDatabaseInfo, + sysTrapDmDatabaseSize, + sysTrapDmOpenDatabase, + sysTrapDmCloseDatabase, + sysTrapDmNextOpenDatabase, + sysTrapDmOpenDatabaseInfo, + sysTrapDmResetRecordStates, + sysTrapDmGetLastErr, + sysTrapDmNumRecords, + sysTrapDmRecordInfo, + sysTrapDmSetRecordInfo, + sysTrapDmAttachRecord, + sysTrapDmDetachRecord, + sysTrapDmMoveRecord, + sysTrapDmNewRecord, + sysTrapDmRemoveRecord, + sysTrapDmDeleteRecord, + sysTrapDmArchiveRecord, + sysTrapDmNewHandle, + sysTrapDmRemoveSecretRecords, + sysTrapDmQueryRecord, + sysTrapDmGetRecord, + sysTrapDmResizeRecord, + sysTrapDmReleaseRecord, + sysTrapDmGetResource, + sysTrapDmGet1Resource, + sysTrapDmReleaseResource, + sysTrapDmResizeResource, + sysTrapDmNextOpenResDatabase, + sysTrapDmFindResourceType, + sysTrapDmFindResource, + sysTrapDmSearchResource, + sysTrapDmNumResources, + sysTrapDmResourceInfo, + sysTrapDmSetResourceInfo, + sysTrapDmAttachResource, + sysTrapDmDetachResource, + sysTrapDmNewResource, + sysTrapDmRemoveResource, + sysTrapDmGetResourceIndex, + sysTrapDmQuickSort, + sysTrapDmQueryNextInCategory, + sysTrapDmNumRecordsInCategory, + sysTrapDmPositionInCategory, + sysTrapDmSeekRecordInCategory, + sysTrapDmMoveCategory, + sysTrapDmOpenDatabaseByTypeCreator, + sysTrapDmWrite, + sysTrapDmStrCopy, + sysTrapDmGetNextDatabaseByTypeCreator, + sysTrapDmWriteCheck, + sysTrapDmMoveOpenDBContext, + sysTrapDmFindRecordByID, + sysTrapDmGetAppInfoID, + sysTrapDmFindSortPositionV10, + sysTrapDmSet, + sysTrapDmCreateDatabaseFromImage, + + + sysTrapDbgSrcMessage, + sysTrapDbgMessage, + sysTrapDbgGetMessage, + sysTrapDbgCommSettings, + + sysTrapErrDisplayFileLineMsg, + sysTrapErrSetJump, + sysTrapErrLongJump, + sysTrapErrThrow, + sysTrapErrExceptionList, + + sysTrapSysBroadcastActionCode, + sysTrapSysUnimplemented, + sysTrapSysColdBoot, + sysTrapSysReset, + sysTrapSysDoze, + sysTrapSysAppLaunch, + sysTrapSysAppStartup, + sysTrapSysAppExit, + sysTrapSysSetA5, + sysTrapSysSetTrapAddress, + sysTrapSysGetTrapAddress, + sysTrapSysTranslateKernelErr, + sysTrapSysSemaphoreCreate, + sysTrapSysSemaphoreDelete, + sysTrapSysSemaphoreWait, + sysTrapSysSemaphoreSignal, + sysTrapSysTimerCreate, + sysTrapSysTimerWrite, + sysTrapSysTaskCreate, + sysTrapSysTaskDelete, + sysTrapSysTaskTrigger, + sysTrapSysTaskID, + sysTrapSysTaskUserInfoPtr, + sysTrapSysTaskDelay, + sysTrapSysTaskSetTermProc, + sysTrapSysUILaunch, + sysTrapSysNewOwnerID, + sysTrapSysSemaphoreSet, + sysTrapSysDisableInts, + sysTrapSysRestoreStatus, + sysTrapSysUIAppSwitch, + sysTrapSysCurAppInfoP, + sysTrapSysHandleEvent, + sysTrapSysInit, + sysTrapSysQSort, + sysTrapSysCurAppDatabase, + sysTrapSysFatalAlert, + sysTrapSysResSemaphoreCreate, + sysTrapSysResSemaphoreDelete, + sysTrapSysResSemaphoreReserve, + sysTrapSysResSemaphoreRelease, + sysTrapSysSleep, + sysTrapSysKeyboardDialogV10, + sysTrapSysAppLauncherDialog, + sysTrapSysSetPerformance, + sysTrapSysBatteryInfo, + sysTrapSysLibInstall, + sysTrapSysLibRemove, + sysTrapSysLibTblEntry, + sysTrapSysLibFind, + sysTrapSysBatteryDialog, + sysTrapSysCopyStringResource, + sysTrapSysKernelInfo, + sysTrapSysLaunchConsole, + sysTrapSysTimerDelete, + sysTrapSysSetAutoOffTime, + sysTrapSysFormPointerArrayToStrings, + sysTrapSysRandom, + sysTrapSysTaskSwitching, + sysTrapSysTimerRead, + + + sysTrapStrCopy, + sysTrapStrCat, + sysTrapStrLen, + sysTrapStrCompare, + sysTrapStrIToA, + sysTrapStrCaselessCompare, + sysTrapStrIToH, + sysTrapStrChr, + sysTrapStrStr, + sysTrapStrAToI, + sysTrapStrToLower, + + sysTrapSerReceiveISP, + + sysTrapSlkOpen, + sysTrapSlkClose, + sysTrapSlkOpenSocket, + sysTrapSlkCloseSocket, + sysTrapSlkSocketRefNum, + sysTrapSlkSocketSetTimeout, + sysTrapSlkFlushSocket, + sysTrapSlkSetSocketListener, + sysTrapSlkSendPacket, + sysTrapSlkReceivePacket, + sysTrapSlkSysPktDefaultResponse, + sysTrapSlkProcessRPC, + + + sysTrapConPutS, + sysTrapConGetS, + + sysTrapFplInit, + sysTrapFplFree, + sysTrapFplFToA, + sysTrapFplAToF, + sysTrapFplBase10Info, + sysTrapFplLongToFloat, + sysTrapFplFloatToLong, + sysTrapFplFloatToULong, + sysTrapFplMul, + sysTrapFplAdd, + sysTrapFplSub, + sysTrapFplDiv, + + sysTrapScrInit, + sysTrapScrCopyRectangle, + sysTrapScrDrawChars, + sysTrapScrLineRoutine, + sysTrapScrRectangleRoutine, + sysTrapScrScreenInfo, + sysTrapScrDrawNotify, + sysTrapScrSendUpdateArea, + sysTrapScrCompressScanLine, + sysTrapScrDeCompressScanLine, + + + sysTrapTimGetSeconds, + sysTrapTimSetSeconds, + sysTrapTimGetTicks, + sysTrapTimInit, + sysTrapTimSetAlarm, + sysTrapTimGetAlarm, + sysTrapTimHandleInterrupt, + sysTrapTimSecondsToDateTime, + sysTrapTimDateTimeToSeconds, + sysTrapTimAdjust, + sysTrapTimSleep, + sysTrapTimWake, + + sysTrapCategoryCreateListV10, + sysTrapCategoryFreeListV10, + sysTrapCategoryFind, + sysTrapCategoryGetName, + sysTrapCategoryEditV10, + sysTrapCategorySelectV10, + sysTrapCategoryGetNext, + sysTrapCategorySetTriggerLabel, + sysTrapCategoryTruncateName, + + sysTrapClipboardAddItem, + sysTrapClipboardCheckIfItemExist, + sysTrapClipboardGetItem, + + sysTrapCtlDrawControl, + sysTrapCtlEraseControl, + sysTrapCtlHideControl, + sysTrapCtlShowControl, + sysTrapCtlGetValue, + sysTrapCtlSetValue, + sysTrapCtlGetLabel, + sysTrapCtlSetLabel, + sysTrapCtlHandleEvent, + sysTrapCtlHitControl, + sysTrapCtlSetEnabled, + sysTrapCtlSetUsable, + sysTrapCtlEnabled, + + + sysTrapEvtInitialize, + sysTrapEvtAddEventToQueue, + sysTrapEvtCopyEvent, + sysTrapEvtGetEvent, + sysTrapEvtGetPen, + sysTrapEvtSysInit, + sysTrapEvtGetSysEvent, + sysTrapEvtProcessSoftKeyStroke, + sysTrapEvtGetPenBtnList, + sysTrapEvtSetPenQueuePtr, + sysTrapEvtPenQueueSize, + sysTrapEvtFlushPenQueue, + sysTrapEvtEnqueuePenPoint, + sysTrapEvtDequeuePenStrokeInfo, + sysTrapEvtDequeuePenPoint, + sysTrapEvtFlushNextPenStroke, + sysTrapEvtSetKeyQueuePtr, + sysTrapEvtKeyQueueSize, + sysTrapEvtFlushKeyQueue, + sysTrapEvtEnqueueKey, + sysTrapEvtDequeueKeyEvent, + sysTrapEvtWakeup, + sysTrapEvtResetAutoOffTimer, + sysTrapEvtKeyQueueEmpty, + sysTrapEvtEnableGraffiti, + + + sysTrapFldCopy, + sysTrapFldCut, + sysTrapFldDrawField, + sysTrapFldEraseField, + sysTrapFldFreeMemory, + sysTrapFldGetBounds, + sysTrapFldGetTextPtr, + sysTrapFldGetSelection, + sysTrapFldHandleEvent, + sysTrapFldPaste, + sysTrapFldRecalculateField, + sysTrapFldSetBounds, + sysTrapFldSetText, + sysTrapFldGetFont, + sysTrapFldSetFont, + sysTrapFldSetSelection, + sysTrapFldGrabFocus, + sysTrapFldReleaseFocus, + sysTrapFldGetInsPtPosition, + sysTrapFldSetInsPtPosition, + sysTrapFldSetScrollPosition, + sysTrapFldGetScrollPosition, + sysTrapFldGetTextHeight, + sysTrapFldGetTextAllocatedSize, + sysTrapFldGetTextLength, + sysTrapFldScrollField, + sysTrapFldScrollable, + sysTrapFldGetVisibleLines, + sysTrapFldGetAttributes, + sysTrapFldSetAttributes, + sysTrapFldSendChangeNotification, + sysTrapFldCalcFieldHeight, + sysTrapFldGetTextHandle, + sysTrapFldCompactText, + sysTrapFldDirty, + sysTrapFldWordWrap, + sysTrapFldSetTextAllocatedSize, + sysTrapFldSetTextHandle, + sysTrapFldSetTextPtr, + sysTrapFldGetMaxChars, + sysTrapFldSetMaxChars, + sysTrapFldSetUsable, + sysTrapFldInsert, + sysTrapFldDelete, + sysTrapFldUndo, + sysTrapFldSetDirty, + sysTrapFldSendHeightChangeNotification, + sysTrapFldMakeFullyVisible, + + + sysTrapFntGetFont, + sysTrapFntSetFont, + sysTrapFntGetFontPtr, + sysTrapFntBaseLine, + sysTrapFntCharHeight, + sysTrapFntLineHeight, + sysTrapFntAverageCharWidth, + sysTrapFntCharWidth, + sysTrapFntCharsWidth, + sysTrapFntDescenderHeight, + sysTrapFntCharsInWidth, + sysTrapFntLineWidth, + + + + sysTrapFrmInitForm, + sysTrapFrmDeleteForm, + sysTrapFrmDrawForm, + sysTrapFrmEraseForm, + sysTrapFrmGetActiveForm, + sysTrapFrmSetActiveForm, + sysTrapFrmGetActiveFormID, + sysTrapFrmGetUserModifiedState, + sysTrapFrmSetNotUserModified, + sysTrapFrmGetFocus, + sysTrapFrmSetFocus, + sysTrapFrmHandleEvent, + sysTrapFrmGetFormBounds, + sysTrapFrmGetWindowHandle, + sysTrapFrmGetFormId, + sysTrapFrmGetFormPtr, + sysTrapFrmGetNumberOfObjects, + sysTrapFrmGetObjectIndex, + sysTrapFrmGetObjectId, + sysTrapFrmGetObjectType, + sysTrapFrmGetObjectPtr, + sysTrapFrmHideObject, + sysTrapFrmShowObject, + sysTrapFrmGetObjectPosition, + sysTrapFrmSetObjectPosition, + sysTrapFrmGetControlValue, + sysTrapFrmSetControlValue, + sysTrapFrmGetControlGroupSelection, + sysTrapFrmSetControlGroupSelection, + sysTrapFrmCopyLabel, + sysTrapFrmSetLabel, + sysTrapFrmGetLabel, + sysTrapFrmSetCategoryLabel, + sysTrapFrmGetTitle, + sysTrapFrmSetTitle, + sysTrapFrmAlert, + sysTrapFrmDoDialog, + sysTrapFrmCustomAlert, + sysTrapFrmHelp, + sysTrapFrmUpdateScrollers, + sysTrapFrmGetFirstForm, + sysTrapFrmVisible, + sysTrapFrmGetObjectBounds, + sysTrapFrmCopyTitle, + sysTrapFrmGotoForm, + sysTrapFrmPopupForm, + sysTrapFrmUpdateForm, + sysTrapFrmReturnToForm, + sysTrapFrmSetEventHandler, + sysTrapFrmDispatchEvent, + sysTrapFrmCloseAllForms, + sysTrapFrmSaveAllForms, + sysTrapFrmGetGadgetData, + sysTrapFrmSetGadgetData, + sysTrapFrmSetCategoryTrigger, + + + sysTrapUIInitialize, + sysTrapUIReset, + + sysTrapInsPtInitialize, + sysTrapInsPtSetLocation, + sysTrapInsPtGetLocation, + sysTrapInsPtEnable, + sysTrapInsPtEnabled, + sysTrapInsPtSetHeight, + sysTrapInsPtGetHeight, + sysTrapInsPtCheckBlink, + + sysTrapLstSetDrawFunction, + sysTrapLstDrawList, + sysTrapLstEraseList, + sysTrapLstGetSelection, + sysTrapLstGetSelectionText, + sysTrapLstHandleEvent, + sysTrapLstSetHeight, + sysTrapLstSetSelection, + sysTrapLstSetListChoices, + sysTrapLstMakeItemVisible, + sysTrapLstGetNumberOfItems, + sysTrapLstPopupList, + sysTrapLstSetPosition, + + sysTrapMenuInit, + sysTrapMenuDispose, + sysTrapMenuHandleEvent, + sysTrapMenuDrawMenu, + sysTrapMenuEraseStatus, + sysTrapMenuGetActiveMenu, + sysTrapMenuSetActiveMenu, + + + sysTrapRctSetRectangle, + sysTrapRctCopyRectangle, + sysTrapRctInsetRectangle, + sysTrapRctOffsetRectangle, + sysTrapRctPtInRectangle, + sysTrapRctGetIntersection, + + + sysTrapTblDrawTable, + sysTrapTblEraseTable, + sysTrapTblHandleEvent, + sysTrapTblGetItemBounds, + sysTrapTblSelectItem, + sysTrapTblGetItemInt, + sysTrapTblSetItemInt, + sysTrapTblSetItemStyle, + sysTrapTblUnhighlightSelection, + sysTrapTblSetRowUsable, + sysTrapTblGetNumberOfRows, + sysTrapTblSetCustomDrawProcedure, + sysTrapTblSetRowSelectable, + sysTrapTblRowSelectable, + sysTrapTblSetLoadDataProcedure, + sysTrapTblSetSaveDataProcedure, + sysTrapTblGetBounds, + sysTrapTblSetRowHeight, + sysTrapTblGetColumnWidth, + sysTrapTblGetRowID, + sysTrapTblSetRowID, + sysTrapTblMarkRowInvalid, + sysTrapTblMarkTableInvalid, + sysTrapTblGetSelection, + sysTrapTblInsertRow, + sysTrapTblRemoveRow, + sysTrapTblRowInvalid, + sysTrapTblRedrawTable, + sysTrapTblRowUsable, + sysTrapTblReleaseFocus, + sysTrapTblEditing, + sysTrapTblGetCurrentField, + sysTrapTblSetColumnUsable, + sysTrapTblGetRowHeight, + sysTrapTblSetColumnWidth, + sysTrapTblGrabFocus, + sysTrapTblSetItemPtr, + sysTrapTblFindRowID, + sysTrapTblGetLastUsableRow, + sysTrapTblGetColumnSpacing, + sysTrapTblFindRowData, + sysTrapTblGetRowData, + sysTrapTblSetRowData, + sysTrapTblSetColumnSpacing, + + + + sysTrapWinCreateWindow, + sysTrapWinCreateOffscreenWindow, + sysTrapWinDeleteWindow, + sysTrapWinInitializeWindow, + sysTrapWinAddWindow, + sysTrapWinRemoveWindow, + sysTrapWinSetActiveWindow, + sysTrapWinSetDrawWindow, + sysTrapWinGetDrawWindow, + sysTrapWinGetActiveWindow, + sysTrapWinGetDisplayWindow, + sysTrapWinGetFirstWindow, + sysTrapWinEnableWindow, + sysTrapWinDisableWindow, + sysTrapWinGetWindowFrameRect, + sysTrapWinDrawWindowFrame, + sysTrapWinEraseWindow, + sysTrapWinSaveBits, + sysTrapWinRestoreBits, + sysTrapWinCopyRectangle, + sysTrapWinScrollRectangle, + sysTrapWinGetDisplayExtent, + sysTrapWinGetWindowExtent, + sysTrapWinDisplayToWindowPt, + sysTrapWinWindowToDisplayPt, + sysTrapWinGetClip, + sysTrapWinSetClip, + sysTrapWinResetClip, + sysTrapWinClipRectangle, + sysTrapWinDrawLine, + sysTrapWinDrawGrayLine, + sysTrapWinEraseLine, + sysTrapWinInvertLine, + sysTrapWinFillLine, + sysTrapWinDrawRectangle, + sysTrapWinEraseRectangle, + sysTrapWinInvertRectangle, + sysTrapWinDrawRectangleFrame, + sysTrapWinDrawGrayRectangleFrame, + sysTrapWinEraseRectangleFrame, + sysTrapWinInvertRectangleFrame, + sysTrapWinGetFramesRectangle, + sysTrapWinDrawChars, + sysTrapWinEraseChars, + sysTrapWinInvertChars, + sysTrapWinGetPattern, + sysTrapWinSetPattern, + sysTrapWinSetUnderlineMode, + sysTrapWinDrawBitmap, + sysTrapWinModal, + sysTrapWinGetWindowBounds, + sysTrapWinFillRectangle, + sysTrapWinDrawInvertedChars, + + + + sysTrapPrefOpenPreferenceDBV10, + sysTrapPrefGetPreferences, + sysTrapPrefSetPreferences, + sysTrapPrefGetAppPreferencesV10, + sysTrapPrefSetAppPreferencesV10, + + + sysTrapSndInit, + sysTrapSndSetDefaultVolume, + sysTrapSndGetDefaultVolume, + sysTrapSndDoCmd, + sysTrapSndPlaySystemSound, + + + sysTrapAlmInit, + sysTrapAlmCancelAll, + sysTrapAlmAlarmCallback, + sysTrapAlmSetAlarm, + sysTrapAlmGetAlarm, + sysTrapAlmDisplayAlarm, + sysTrapAlmEnableNotification, + + + sysTrapHwrGetRAMMapping, + sysTrapHwrMemWritable, + sysTrapHwrMemReadable, + sysTrapHwrDoze, + sysTrapHwrSleep, + sysTrapHwrWake, + sysTrapHwrSetSystemClock, + sysTrapHwrSetCPUDutyCycle, + sysTrapHwrLCDInit, + sysTrapHwrLCDSleep, + sysTrapHwrTimerInit, + sysTrapHwrCursor, + sysTrapHwrBatteryLevel, + sysTrapHwrDelay, + sysTrapHwrEnableDataWrites, + sysTrapHwrDisableDataWrites, + sysTrapHwrLCDBaseAddr, + sysTrapHwrLCDDrawBitmap, + sysTrapHwrTimerSleep, + sysTrapHwrTimerWake, + sysTrapHwrLCDWake, + sysTrapHwrIRQ1Handler, + sysTrapHwrIRQ2Handler, + sysTrapHwrIRQ3Handler, + sysTrapHwrIRQ4Handler, + sysTrapHwrIRQ5Handler, + sysTrapHwrIRQ6Handler, + sysTrapHwrDockSignals, + sysTrapHwrPluggedIn, + + + sysTrapCrc16CalcBlock, + + + sysTrapSelectDayV10, + sysTrapSelectTime, + + sysTrapDayDrawDaySelector, + sysTrapDayHandleEvent, + sysTrapDayDrawDays, + sysTrapDayOfWeek, + sysTrapDaysInMonth, + sysTrapDayOfMonth, + + sysTrapDateDaysToDate, + sysTrapDateToDays, + sysTrapDateAdjust, + sysTrapDateSecondsToDate, + sysTrapDateToAscii, + sysTrapDateToDOWDMFormat, + sysTrapTimeToAscii, + + + sysTrapFind, + sysTrapFindStrInStr, + sysTrapFindSaveMatch, + sysTrapFindGetLineBounds, + sysTrapFindDrawHeader, + + sysTrapPenOpen, + sysTrapPenClose, + sysTrapPenGetRawPen, + sysTrapPenCalibrate, + sysTrapPenRawToScreen, + sysTrapPenScreenToRaw, + sysTrapPenResetCalibration, + sysTrapPenSleep, + sysTrapPenWake, + + + sysTrapResLoadForm, + sysTrapResLoadMenu, + + sysTrapFtrInit, + sysTrapFtrUnregister, + sysTrapFtrGet, + sysTrapFtrSet, + sysTrapFtrGetByIndex, + + + + sysTrapGrfInit, + sysTrapGrfFree, + sysTrapGrfGetState, + sysTrapGrfSetState, + sysTrapGrfFlushPoints, + sysTrapGrfAddPoint, + sysTrapGrfInitState, + sysTrapGrfCleanState, + sysTrapGrfMatch, + sysTrapGrfGetMacro, + sysTrapGrfFilterPoints, + sysTrapGrfGetNumPoints, + sysTrapGrfGetPoint, + sysTrapGrfFindBranch, + sysTrapGrfMatchGlyph, + sysTrapGrfGetGlyphMapping, + sysTrapGrfGetMacroName, + sysTrapGrfDeleteMacro, + sysTrapGrfAddMacro, + sysTrapGrfGetAndExpandMacro, + sysTrapGrfProcessStroke, + sysTrapGrfFieldChange, + + + sysTrapGetCharSortValue, + sysTrapGetCharAttr, + sysTrapGetCharCaselessValue, + + + sysTrapPwdExists, + sysTrapPwdVerify, + sysTrapPwdSet, + sysTrapPwdRemove, + + sysTrapGsiInitialize, + sysTrapGsiSetLocation, + sysTrapGsiEnable, + sysTrapGsiEnabled, + sysTrapGsiSetShiftState, + + sysTrapKeyInit, + sysTrapKeyHandleInterrupt, + sysTrapKeyCurrentState, + sysTrapKeyResetDoubleTap, + sysTrapKeyRates, + sysTrapKeySleep, + sysTrapKeyWake, + + + sysTrapDlkControl, // was sysTrapCmBroadcast + + sysTrapDlkStartServer, + sysTrapDlkGetSyncInfo, + sysTrapDlkSetLogEntry, + + sysTrapUnused2, // *DO NOT RE-USE UNTIL 3.0* was sysTrapPsrInit (vmk 7/16/96) + sysTrapSysLibLoad, // was sysTrapPsrClose, + sysTrapUnused4, // was sysTrapPsrGetCommand, + sysTrapUnused5, // was sysTrapPsrSendReply, + + sysTrapAbtShowAbout, + + sysTrapMdmDial, + sysTrapMdmHangUp, + + sysTrapDmSearchRecord, + + sysTrapSysInsertionSort, + sysTrapDmInsertionSort, + + sysTrapLstSetTopItem, + + sysTrapSclSetScrollBar, + sysTrapSclDrawScrollBar, + sysTrapSclHandleEvent, + + sysTrapSysMailboxCreate, + sysTrapSysMailboxDelete, + sysTrapSysMailboxFlush, + sysTrapSysMailboxSend, + sysTrapSysMailboxWait, + + sysTrapSysTaskWait, + sysTrapSysTaskWake, + sysTrapSysTaskWaitClr, + sysTrapSysTaskSuspend, + sysTrapSysTaskResume, + + sysTrapCategoryCreateList, + sysTrapCategoryFreeList, + sysTrapCategoryEdit, + sysTrapCategorySelect, + + sysTrapDmDeleteCategory, + + sysTrapSysEvGroupCreate, + sysTrapSysEvGroupSignal, + sysTrapSysEvGroupRead, + sysTrapSysEvGroupWait, + + sysTrapEvtEventAvail, + sysTrapEvtSysEventAvail, + sysTrapStrNCopy, + + sysTrapKeySetMask, + + sysTrapSelectDay, + + sysTrapPrefGetPreference, + sysTrapPrefSetPreference, + sysTrapPrefGetAppPreferences, + sysTrapPrefSetAppPreferences, + + sysTrapFrmPointInTitle, + + sysTrapStrNCat, + + sysTrapMemCmp, + + sysTrapTblSetColumnEditIndicator, + + sysTrapFntWordWrap, + + sysTrapFldGetScrollValues, + + sysTrapSysCreateDataBaseList, + sysTrapSysCreatePanelList, + + sysTrapDlkDispatchRequest, + + sysTrapStrPrintF, + sysTrapStrVPrintF, + + sysTrapPrefOpenPreferenceDB, + + sysTrapSysGraffitiReferenceDialog, + + sysTrapSysKeyboardDialog, + + sysTrapFntWordWrapReverseNLines, + sysTrapFntGetScrollValues, + + sysTrapTblSetRowStaticHeight, + sysTrapTblHasScrollBar, + + sysTrapSclGetScrollBar, + + sysTrapFldGetNumberOfBlankLines, + + sysTrapSysTicksPerSecond, + sysTrapHwrBacklight, + sysTrapDmDatabaseProtect, + + sysTrapTblSetBounds, + + sysTrapStrNCompare, + sysTrapStrNCaselessCompare, + + sysTrapPhoneNumberLookup, + + sysTrapFrmSetMenu, + + sysTrapEncDigestMD5, + + sysTrapDmFindSortPosition, + + sysTrapSysBinarySearch, + sysTrapSysErrString, + sysTrapSysStringByIndex, + + sysTrapEvtAddUniqueEventToQueue, + + sysTrapStrLocalizeNumber, + sysTrapStrDelocalizeNumber, + sysTrapLocGetNumberSeparators, + + sysTrapMenuSetActiveMenuRscID, + + sysTrapLstScrollList, + + sysTrapCategoryInitialize, + + sysTrapEncDigestMD4, + sysTrapEncDES, + + sysTrapLstGetVisibleItems, + + sysTrapWinSetWindowBounds, + + sysTrapCategorySetName, + + sysTrapFldSetInsertionPoint, + + sysTrapFrmSetObjectBounds, + + sysTrapWinSetColors, + + sysTrapFlpDispatch, + sysTrapFlpEmDispatch, + + // WARNING!! LEAVE THIS ONE AT THE END AND ALWAYS ADD NEW TRAPS TO + // THE END OF THE TRAP TABLE BUT RIGHT BEFORE THIS TRAP!!!!!!!!! + sysTrapLastTrapNumber + } SysTrapNumber; + +#define sysNumTraps (sysTrapLastTrapNumber - sysTrapBase) + + + +//-------------------------------------------------------------------- +// Define Library Trap Numbers +//-------------------------------------------------------------------- +// Library traps start here and go up by 1's +#define sysLibTrapBase 0xA800 +typedef enum { + sysLibTrapName = sysLibTrapBase, + sysLibTrapOpen, + sysLibTrapClose, + sysLibTrapSleep, + sysLibTrapWake, + sysLibTrapCustom + } SysLibTrapNumber; + + + + +/************************************************************ + * Pilot specific TRAP instruction numbers + *************************************************************/ +#define sysDbgBreakpointTrapNum 0 // For soft breakpoints +#define sysDbgTrapNum 8 // For compiled breakpoints +#define sysDispatchTrapNum 15 // Trap dispatcher + +#ifdef __GNUC__ + + #define SYS_TRAP(trapNum) \ + __attribute__ ((systrap (trapNum))) + +#else + + #define SYS_TRAP(trapNum) \ + TWOWORD_INLINE(m68kTrapInstr+sysDispatchTrapNum,trapNum) + +#endif + + +#define ASM_SYS_TRAP(trapNum) \ + DC.W m68kTrapInstr+sysDispatchTrapNum; \ + DC.W trapNum + + +#endif //__SYSTRAPS_H_ + + diff --git a/sdk-2/include/Core/System/SysUtils.h b/sdk-2/include/Core/System/SysUtils.h new file mode 100644 index 0000000..3a42ba0 --- /dev/null +++ b/sdk-2/include/Core/System/SysUtils.h @@ -0,0 +1,90 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SysUtils.h + * + * Description: + * These are miscellaneous routines. + * + * History: + * 4/27/95 roger Initial version. + * + *******************************************************************/ + +#ifndef __SYSUTILS_H__ +#define __SYSUTILS_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +//typedef Int _comparF (const void *, const void *, Int other); +typedef Int _comparF (VoidPtr, VoidPtr, Long other); +typedef _comparF * CmpFuncPtr; + +typedef Int _searchF (const VoidPtr, const VoidPtr, Long other); +typedef _searchF * SearchFuncPtr; + +/************************************************************ + * Constants + *************************************************************/ +#define sysRandomMax 0x7FFF // Max value returned from SysRandom() + + +/************************************************************ + * Macros + *************************************************************/ +#define Abs(a) ((a >= 0) ? a : (-a)) + +/************************************************************ + * procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Boolean SysBinarySearch (VoidPtr baseP, Int numOfElements, Int width, + SearchFuncPtr searchF, const VoidPtr searchData, + const Long other, ULongPtr position, Boolean findFirst) + SYS_TRAP(sysTrapSysBinarySearch); + +void SysInsertionSort (VoidPtr baseP, Int numOfElements, Int width, + _comparF *comparF, const Long other) + SYS_TRAP(sysTrapSysInsertionSort); + +void SysQSort (VoidPtr baseP, Int numOfElements, Int width, + _comparF *comparF, const Long other) + SYS_TRAP(sysTrapSysQSort); + +void SysCopyStringResource (CharPtr string, UInt theID) + SYS_TRAP(sysTrapSysCopyStringResource); + +VoidHand SysFormPointerArrayToStrings(CharPtr c, Int stringCount) + SYS_TRAP(sysTrapSysFormPointerArrayToStrings); + + +// Return a random number ranging from 0 to sysRandomMax. +// Normally, 0 is passed unless you want to start with a new seed. +Int SysRandom(ULong newSeed) + SYS_TRAP(sysTrapSysRandom); + + +CharPtr SysStringByIndex(Word resID, Word index, CharPtr strP, Word maxLen) + SYS_TRAP(sysTrapSysStringByIndex); + +CharPtr SysErrString(Err err, CharPtr strP, Word maxLen) + SYS_TRAP(sysTrapSysErrString); + + +#ifdef __cplusplus +} +#endif + +#endif // __SYSUTILS_H__ + diff --git a/sdk-2/include/Core/System/SystemMgr.h b/sdk-2/include/Core/System/SystemMgr.h new file mode 100644 index 0000000..4a841a7 --- /dev/null +++ b/sdk-2/include/Core/System/SystemMgr.h @@ -0,0 +1,874 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SystemMgr.h + * + * Description: + * Pilot system equates + * + * History: + * 10/27/94 RM - Created by Ron Marianetti + * 10/ 7/96 SCL - Added sysAppLaunchFlagDataRelocated flag + * 11/13/96 vmk - Added sysErrDelayWakened error code + * + *******************************************************************/ + + #ifndef __SYSTEMMGR_H__ + #define __SYSTEMMGR_H__ + +// Include elementary types +#include +#include // Trap Numbers. + +// Other types +#include // Resource definitions. + + +// UI Headers +#include +#include +#include +#include +#include +#include +#include +#include // for DmOpenRef + + + +/************************************************************ + * System Constants + *************************************************************/ +// Define the number of ticks/second +#if EMULATION_LEVEL == EMULATION_MAC + #define sysTicksPerSecond 60 // 60/sec on Macintosh +#elif EMULATION_LEVEL == EMULATION_NONE + #define sysTicksPerSecond 100 // 100/sec on Pilot +#elif EMULATION_LEVEL == EMULATION_WINDOWS + #define sysTicksPerSecond 1000 // 1000/sec on Windows PC +#else + #error +#endif + + + + +/************************************************************ + * 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. + * + *************************************************************/ + +// System SysAppLaunch Commands +#define sysAppLaunchCmdNormalLaunch 0 // Normal Launch + +#define sysAppLaunchCmdFind 1 // Find string + +#define sysAppLaunchCmdGoTo 2 // Launch and go to a particular record + +#define sysAppLaunchCmdSyncNotify 3 // Sent to apps whose databases changed during + // HotSync after the sync has been completed, + // including when the app itself has been installed + // by HotSync. The data database(s) must have the + // same creator ID as the application for this + // mechanism to function correctly. This is a + // good opportunity to update/initialize/validate + // the app's data, such as resorting records, + // setting alarms, etc. + // + // Parameter block: None. + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a + // direct function call into the app's + // PilotMain function from the background + // thread of the HotSync application. + + +#define sysAppLaunchCmdTimeChange 4 // Sent to all applications and preference + // panels when the system time is changed. + // This notification is the right place to + // update alarms and other time-related + // activities and resources. + // + // Parameter block: None. + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdSystemReset 5 // Sent to all applications and preference + // panels when the system is either soft-reset + // or hard-reset. This notification is the + // right place to initialize and/or validate + // your application's preferences/features/ + // database(s) as well as to update alarms and + // other time-related activities and resources. + // + // Parameter block: SysAppLaunchCmdSystemResetType + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdAlarmTriggered 6 // Sent to an application at the time its + // alarm time expires (even when another app + // is already displaying its alarm dialog box). + // This call is intended to allow the app to + // perform some very quick activity, such as + // scheduling the next alarm or performing a + // quick maintenance task. The handler for + // sysAppLaunchCmdAlarmTriggered must take as + // little time as possible and is *not* allowed + // to block (this would delay notification for + // alarms set by other applications). + // + // Parameter block: SysAlarmTriggeredParamType + // (defined in AlarmMgr.h) + // Restrictions: No accessing of global or + // static variables unless sysAppLaunchFlagSubCall + // flag is set, as discussed above. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdDisplayAlarm 7 // Sent to an application when it is time + // to display the alarm UI. The application + // is responsible for making any alarm sounds + // and for displaying the alarm UI. + // sysAppLaunchCmdDisplayAlarm calls are ordered + // chronoligically and are not overlapped. + // This means that your app will receive + // sysAppLaunchCmdDisplayAlarm only after + // all earlier alarms have been displayed. + // + // Parameter block: SysDisplayAlarmParamType + // (defined in AlarmMgr.h) + // Restrictions: No accessing of global or + // static variables unless sysAppLaunchFlagSubCall + // flag is set, as discussed above. UI calls are + // allowed to display the app's alarm dialog. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdCountryChange 8 // The country has changed + +#define sysAppLaunchCmdSyncRequestLocal 9 // Sent to the HotSync application to request a + // local HotSync. ("HotSync" button was pressed.) + +#define sysAppLaunchCmdSyncRequest sysAppLaunchCmdSyncRequestLocal // for backward compatibility + +#define sysAppLaunchCmdSaveData 10 // Sent to running app before sysAppLaunchCmdFind + // or other action codes that will cause data + // searches or manipulation. + +#define sysAppLaunchCmdInitDatabase 11 // Sent to an application when a database with + // a matching Creator ID is created during + // HotSync (in response to a "create db" + // request). This allows the application to + // initialize a newly-created database during + // HotSync. This might include creating some + // default records, setting up the database's + // application and sort info blocks, etc. + // + // Parameter block: SysAppLaunchCmdInitDatabaseType + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a + // direct function call into the app's + // PilotMain function from the background + // thread of the HotSync application. + +#define sysAppLaunchCmdSyncCallApplicationV10 12 // Used by DesktopLink Server command "call application"; + // Pilot v1.0 only!!! + +//------------------------------------------------------------------------ +// New launch codes defined for PalmOS 2.0 +//------------------------------------------------------------------------ + +#define sysAppLaunchCmdPanelCalledFromApp 13 // The panel should display a done + // button instead of the pick list. + // The Done button will return the user + // to the last app. + +#define sysAppLaunchCmdReturnFromPanel 14 // A panel returned to this app + +#define sysAppLaunchCmdLookup 15 // Lookup info managed by an app + +#define sysAppLaunchCmdSystemLock 16 // Lock the system until a password is entered. + +#define sysAppLaunchCmdSyncRequestRemote 17 // Sent to the HotSync application to request + // a remote HotSync. ("Remote HotSync" button + // was pressed.) + +#define sysAppLaunchCmdHandleSyncCallApp 18 // Pilot v2.0 and greater. Sent by DesktopLink Server to an application to handle + // the "call application" command; use DlkControl with + // control code dlkCtlSendCallAppReply to send the reply(see DLServer.h). + // This action code replaces the v1.0 code sysAppLaunchCmdSyncCallApplication. + // vmk 11/26/96 + +#define sysAppLaunchCmdAddRecord 19 // Add a record to an applications's database. + +#define sysAppLaunchCmdFailedAppNotify 24 // An app just switched to failed. + + +//------------------------------------------------------------------------ +// Standard Service Panel launch codes (used by network panel, dialer panel, etc) +// (DOLATER... reserve a range of codes and document parameter block structures) +//------------------------------------------------------------------------ +#define sysSvcLaunchCmdSetServiceID 20 +#define sysSvcLaunchCmdGetServiceID 21 +#define sysSvcLaunchCmdGetServiceList 22 +#define sysSvcLaunchCmdGetServiceInfo 23 + + +//------------------------------------------------------------------------ +// Standard Dialer Service launch codes +// (DOLATER... reserve a range of codes and document parameter block structures) +//------------------------------------------------------------------------ + +#define sysDialLaunchCmdDial 30 // Dial the modem (optionally display dial progress UI) + // given service ID and serial library refnum. + +#define sysDialLaunchCmdHangUp 31 // Hang up the modem (optionally display disconnect + // progress UI), given service ID and serial library + // refnum. + + +//------------------------------------------------------------------------ +// Custom action code base (custom action codes begin at this value) +//------------------------------------------------------------------------ +#define sysAppLaunchCmdCustomBase 0x8000 + +// Your custom launch codes can be defined like this: +// +// typedef enum { +// myAppCmdDoSomething = sysAppLaunchCmdCustomBase, +// myAppCmdDoSomethingElse, +// myAppCmdEtcetera +// +// } MyAppCustomActionCodes; + + + +//------------------------------------------------------------------------ +// SysAppLaunch flags (passed to PilotMain) +//------------------------------------------------------------------------ + +#define sysAppLaunchFlagNewThread 0x01 // create a new thread for application + // - implies sysAppLaunchFlagNewStack +#define sysAppLaunchFlagNewStack 0x02 // create separate stack for application +#define sysAppLaunchFlagNewGlobals 0x04 // create new globals world for application + // - implies new owner ID for Memory chunks +#define sysAppLaunchFlagUIApp 0x08 // notifies launch routine that this is a UI app being + // launched. +#define sysAppLaunchFlagSubCall 0x10 // notifies launch routine that the app is calling it's + // entry point as a subroutine call. This tells the launch + // code that it's OK to keep the A5 (globals) pointer valid + // through the call. +#define sysAppLaunchFlagDataRelocated 0x80 // global data (static ptrs) have been "relocated" + // by either SysAppStartup or StartupCode.c + +//------------------------------------------------------------------- +// Parameter blocks for action codes +// NOTE: The parameter block for the sysAppLaunchCmdFind and sysAppLaunchCmdGoTo +// action codes are defined in "Find.h"; +//--------------------------------------------------------------------------- + +// For sysAppLaunchCmdSaveData +typedef struct { + Boolean uiComing; // true if system dialog will be put up + // before coming action code arrives. + } SysAppLaunchCmdSaveDataType; + +// For sysAppLaunchCmdSystemReset +typedef struct { + Boolean hardReset; // true if system was hardReset, false if soft-reset. + Boolean createDefaultDB; // true if app should create default database. + } SysAppLaunchCmdSystemResetType; + + +// For sysAppLaunchCmdInitDatabase +typedef struct SysAppLaunchCmdInitDatabaseType { + DmOpenRef dbP; // Handle of the newly-created database, + // already open for read/write access. + // IMPORTANT: The handler *MUST* leave + // this database handle open on return. + ULong creator; // Creator ID of the newly-created database + ULong type; // Type ID of the newly-created database + UInt version; // Version number of the newly-created database + } SysAppLaunchCmdInitDatabaseType; + + +// For sysAppLaunchCmdSyncCallApplicationV10 +// This structure used on Pilot v1.0 only. See sysAppLaunchCmdHandleSyncCallApp +// for later platforms. +typedef struct SysAppLaunchCmdSyncCallApplicationTypeV10 { + Word action; // call action id (app-specific) + Word paramSize; // parameter size + VoidPtr paramP; // ptr to parameter + Byte remoteSocket; // remote socket id + Byte tid; // command transaction id + Boolean handled; // if handled, MUST be set true by the app + } SysAppLaunchCmdSyncCallApplicationTypeV10; + + +// For sysAppLaunchCmdHandleSyncCallApp (Pilot v2.0 and greater). +// This structure replaces SysAppLaunchCmdSyncCallApplicationType +// which was used in Pilot v1.0 +typedef struct SysAppLaunchCmdHandleSyncCallAppType { + Word pbSize; // this parameter block size (set to sizeof SysAppLaunchCmdHandleSyncCallAppType) + Word action; // call action id (app-specific) + VoidPtr paramP; // ptr to parameter + DWord dwParamSize; // parameter size + VoidPtr dlRefP; // DesktopLink reference pointer for passing + // to DlkControl()'s dlkCtlSendCallAppReply code + + Boolean handled; // initialized to FALSE by DLServer; if + // handled, MUST be set TRUE by the app(the + // handler MUST call DlkControl with + // control code dlkCtlSendCallAppReply); + // if the handler is not going to send a reply, + // it should leave this field set to FALSE, in which + // case DesktopLink Server will send the default + // "unknown request" reply. + + Err replyErr; // error from dlkCtlSendCallAppReply + + // RESERVED FOR FUTURE EXTENSIONS + DWord dwReserved1; // RESERVED -- set to null!!! + DWord dwReserved2; // RESERVED -- set to null!!! + + // Target executable creator and type for testing the mechanism + // in EMULATION MODE ONLY!!! + #if EMULATION_LEVEL != EMULATION_NONE + DWord creator; + DWord type; + #endif + + } SysAppLaunchCmdHandleSyncCallAppType; + +// For sysAppLaunchCmdFailedAppNotify +typedef struct + { + DWord creator; + DWord type; + Err result; + } SysAppLaunchCmdFailedAppNotifyType; + + +/************************************************************ + * Function prototype for libraries + *************************************************************/ + +// ***IMPORTANT*** +// ***IMPORTANT*** +// ***IMPORTANT*** +// +// The assembly level TrapDispatcher() function uses a hard-coded value for +// the size of the structure SysLibTblEntryType to obtain a pointer to a +// library entry in the library table. Therefore, any changes to this structure, +// require corresponding changes in TrapDispatcher() in ROMBoot.c. Furthermore, +// it is advantageous to keep the size of the structure a power of 2 as this +// improves performance by allowing the entry offset to be calculated by shifting +// left instead of using the multiply instruction. vmk 8/27/96 (yes, I fell into +// this trap myself) +typedef struct SysLibTblEntryType { + Ptr* dispatchTblP; // pointer to library dispatch table + void* globalsP; // Library globals + + // New INTERNAL fields for v2.0 (vmk 8/27/96): + LocalID dbID; // database id of the library + VoidPtr codeRscH; // library code resource handle for RAM-based libraries + } SysLibTblEntryType; +typedef SysLibTblEntryType* SysLibTblEntryPtr; + +// Library entry point procedure +typedef Err (*SysLibEntryProcPtr)(UInt refNum, SysLibTblEntryPtr entryP); + +// This library refNum is reserved for the Debugger comm library +#define sysDbgCommLibraryRefNum 0 + +// This refNum signals an invalid refNum +#define sysInvalidRefNum 0xFFFF + + +/************************************************************ + * Function prototype for Kernel + *************************************************************/ +// Task termination procedure prototype for use with SysTaskSetTermProc +typedef void (*SysTermProcPtr)(ULong taskID, Long reason); + +// Timer procedure for use with SysTimerCreate +typedef void (*SysTimerProcPtr)(Long timerID, Long param); + + + + +/************************************************************ + * Error Classes for each manager + *************************************************************/ +#define memErrorClass 0x0100 // Memory Manager +#define dmErrorClass 0x0200 // Data Manager +#define serErrorClass 0x0300 // Serial Manager +#define slkErrorClass 0x0400 // Serial Link Manager +#define sysErrorClass 0x0500 // System Manager +#define fplErrorClass 0x0600 // Floating Point Library +#define flpErrorClass 0x0680 // New Floating Point Library +#define evtErrorClass 0x0700 // System Event Manager +#define sndErrorClass 0x0800 // Sound Manager +#define almErrorClass 0x0900 // Alarm Manager +#define timErrorClass 0x0A00 // Time Manager +#define penErrorClass 0x0B00 // Pen Manager +#define ftrErrorClass 0x0C00 // Feature Manager +#define cmpErrorClass 0x0D00 // Connection Manager +#define dlkErrorClass 0x0E00 // Desktop Link Manager +#define padErrorClass 0x0F00 // PAD Manager +#define grfErrorClass 0x1000 // Graffiti Manager +#define mdmErrorClass 0x1100 // Modem Manager +#define netErrorClass 0x1200 // Net Library +#define htalErrorClass 0x1300 // HTAL Library + +#define appErrorClass 0x8000 // Application-defined errors + +/************************************************************ + * System Errors + *************************************************************/ +#define sysErrTimeout (sysErrorClass | 1) +#define sysErrParamErr (sysErrorClass | 2) +#define sysErrNoFreeResource (sysErrorClass | 3) +#define sysErrNoFreeRAM (sysErrorClass | 4) +#define sysErrNotAllowed (sysErrorClass | 5) +#define sysErrSemInUse (sysErrorClass | 6) +#define sysErrInvalidID (sysErrorClass | 7) +#define sysErrOutOfOwnerIDs (sysErrorClass | 8) +#define sysErrNoFreeLibSlots (sysErrorClass | 9) +#define sysErrLibNotFound (sysErrorClass | 10) +#define sysErrDelayWakened (sysErrorClass | 11) // SysTaskDelay wakened by SysTaskWake before delay completed. +#define sysErrRomIncompatible (sysErrorClass | 12) + +/************************************************************ + * System Features + *************************************************************/ +#define sysFtrCreator sysFileCSystem // Feature Creator +#define sysFtrNumROMVersion 1 // ROM Version + // 0xMMmfsbbb, where MM is major version, m is minor version + // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development, + // bbb is build number for non-releases + // V1.12b3 would be: 0x01122003 + // V2.00a2 would be: 0x02001002 + // V1.01 would be: 0x01013000 +#define sysFtrNumProductID 2 // Product id + // 0xMMMMRRRR, where MMMM is the model and RRRR + // is the revision. +#define sysFtrNumBacklight 3 // Backlight + // bit 0: 1 if present. 0 if Feature does not exist or backlight is not present +#define sysFtrNumEncryption 4 // Which encryption schemes are present +#define sysFtrNumEncryptionMaskDES 0x00000001 // bit 0: 1 if DES is present + + +/************************************************************ + * Macros for extracting and combining ROM/OS version components + *************************************************************/ + +// ROM/OS stage numbers +#define sysROMStageDevelopment (0) +#define sysROMStageAlpha (1) +#define sysROMStageBeta (2) +#define sysROMStageRelease (3) + + +// MACRO: sysMakeROMVersion +// +// Builds a ROM version value from the major, minor, fix, stage, and build numbers +// +#define sysMakeROMVersion(major, minor, fix, stage, buildNum) \ + ( \ + (((DWord)((Byte)(major) & 0x0FF)) << 24) | \ + (((DWord)((Byte)(minor) & 0x00F)) << 20) | \ + (((DWord)((Byte)(fix) & 0x00F)) << 16) | \ + (((DWord)((Byte)(stage) & 0x00F)) << 12) | \ + (((DWord)((Word)(buildNum) & 0x0FFF))) \ + ) + + +// Macros for parsing the ROM version number +// (the system OS version is obtained by calling +// FtrGet(sysFtrCreator, sysFtrNumROMVersion, dwOSVerP), where dwOSVerP is +// a pointer to to a DWord variable that is to receive the OS version number) +#define sysGetROMVerMajor(dwROMVer) (((Word)((dwROMVer) >> 24)) & 0x00FF) +#define sysGetROMVerMinor(dwROMVer) (((Word)((dwROMVer) >> 20)) & 0x000F) +#define sysGetROMVerFix(dwROMVer) (((Word)((dwROMVer) >> 16)) & 0x000F) +#define sysGetROMVerStage(dwROMVer) (((Word)((dwROMVer) >> 12)) & 0x000F) +#define sysGetROMVerBuild(dwROMVer) (((Word)(dwROMVer)) & 0x0FFF) + + + +/************************************************************ + * System Types + *************************************************************/ + +// Types of batteries installed. +typedef enum { + sysBatteryKindAlkaline=0, + sysBatteryKindNiCad, + sysBatteryKindLithium + } SysBatteryKind; + + +// SysCreateDataBaseList can generate a list of database. +typedef struct + { + Char name[dmDBNameLength]; + ULong creator; + ULong type; + UInt version; + LocalID dbID; + UInt cardNo; + BitmapPtr iconP; + } SysDBListItemType; + + +// Structure of a generic message that can be send to a mailbox +// through the SysMailboxSend call. Note, this structure MUST +// be CJ_MAXMSZ bytes large, where CJ_MAXMSZ is defined in +// the AMX includes. +typedef struct { + DWord data[3]; + } SysMailboxMsgType; + + +// Constants used by the SysEvGroupSignal call +#define sysEvGroupSignalConstant 0 +#define sysEvGroupSignalPulse 1 + +// Constants used by the SysEvGroupWait call +#define sysEvGroupWaitOR 0 +#define sysEvGroupWaitAND 1 + + + +/************************************************************ + * System Pre-defined "file descriptors" + * These are used by applications that use the Net Library's + * NetLibSelect() call + *************************************************************/ +#define sysFileDescStdIn 0 + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Prototype for Pilot applications entry point +DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags); + + +void SysUnimplemented(void) + SYS_TRAP(sysTrapSysUnimplemented); + +void SysColdBoot(Ptr card0P, ULong card0Size, + Ptr card1P, ULong card1Size, + DWord sysCardHeaderOffset) + SYS_TRAP(sysTrapSysColdBoot); + +void SysInit(void) + SYS_TRAP(sysTrapSysInit); + +void SysReset(void) + SYS_TRAP(sysTrapSysReset); + +void SysPowerOn(Ptr card0P, ULong card0Size, + Ptr card1P, ULong card1Size, + DWord sysCardHeaderOffset, Boolean reFormat); + + +void SysDoze(Boolean onlyNMI) + SYS_TRAP(sysTrapSysDoze); + +Err SysSetPerformance(ULongPtr sysClockP, UIntPtr cpuDutyP) + SYS_TRAP(sysTrapSysSetPerformance); + +void SysSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapSysSleep); + +UInt SysBatteryInfo(Boolean set, UIntPtr warnThresholdP, UIntPtr criticalThresholdP, + UIntPtr maxTicksP, SysBatteryKind* kindP, Boolean* pluggedIn) + SYS_TRAP(sysTrapSysBatteryInfo); + +UInt SysSetAutoOffTime(UInt seconds) + SYS_TRAP(sysTrapSysSetAutoOffTime); + +Word SysTicksPerSecond(void) + SYS_TRAP(sysTrapSysTicksPerSecond); + +Err SysLaunchConsole(void) + SYS_TRAP(sysTrapSysLaunchConsole); + +Boolean SysHandleEvent(EventPtr eventP) + SYS_TRAP(sysTrapSysHandleEvent); + +void SysUILaunch(void) + SYS_TRAP(sysTrapSysUILaunch); + +Err SysUIAppSwitch(UInt cardNo, LocalID dbID, Word cmd, Ptr cmdPBP) + SYS_TRAP(sysTrapSysUIAppSwitch); + +Err SysCurAppDatabase(UIntPtr cardNoP, LocalID* dbIDP) + SYS_TRAP(sysTrapSysCurAppDatabase); + +Err SysBroadcastActionCode(Word cmd, Ptr cmdPBP) + SYS_TRAP(sysTrapSysBroadcastActionCode); + +Err SysAppLaunch(UInt cardNo, LocalID dbID, UInt launchFlags, + Word cmd, Ptr cmdPBP, DWord* resultP) + SYS_TRAP(sysTrapSysAppLaunch); + +UInt SysNewOwnerID(void) + SYS_TRAP(sysTrapSysNewOwnerID); + +DWord SysSetA5(DWord newValue) + SYS_TRAP(sysTrapSysSetA5); + + +Ptr SysCardImageInfo(UInt cardNo, ULongPtr sizeP); + +void SysCardImageDeleted(UInt cardNo); + +// System Dialogs +void SysBatteryDialog(void) + SYS_TRAP(sysTrapSysBatteryDialog); + +// Utilities +Err SysSetTrapAddress(UInt trapNum, VoidPtr procP) + SYS_TRAP(sysTrapSysSetTrapAddress); + +VoidPtr SysGetTrapAddress(UInt trapNum) + SYS_TRAP(sysTrapSysGetTrapAddress); + +Word SysDisableInts(void) + SYS_TRAP(sysTrapSysDisableInts); + +void SysRestoreStatus(Word status) + SYS_TRAP(sysTrapSysRestoreStatus); + + +// Library Management +Err SysLibInstall(SysLibEntryProcPtr libraryP, UIntPtr refNumP) + SYS_TRAP(sysTrapSysLibInstall); + +Err SysLibLoad(DWord libType, DWord libCreator, UIntPtr refNumP) + SYS_TRAP(sysTrapSysLibLoad); + + +Err SysLibRemove(UInt refNum) + SYS_TRAP(sysTrapSysLibRemove); + +Err SysLibFind(CharPtr nameP, UIntPtr refNumP) + SYS_TRAP(sysTrapSysLibFind); + +SysLibTblEntryPtr SysLibTblEntry(UInt refNum) + SYS_TRAP(sysTrapSysLibTblEntry); + +// Generic Library calls +Err SysLibOpen(UInt refNum) + SYS_TRAP(sysLibTrapOpen); +Err SysLibClose(UInt refNum) + SYS_TRAP(sysLibTrapClose); +Err SysLibSleep(UInt refNum) + SYS_TRAP(sysLibTrapSleep); +Err SysLibWake(UInt refNum) + SYS_TRAP(sysLibTrapWake); + + +//----------------------------------------------------- +// Kernel Prototypes +//----------------------------------------------------- +// Task Creation and deleation +Err SysTranslateKernelErr(Err err) + SYS_TRAP(sysTrapSysTranslateKernelErr); + +Err SysTaskCreate(DWordPtr taskIDP, DWordPtr creator, ProcPtr codeP, + Ptr stackP, DWord stackSize, DWord attr, DWord priority, + DWord tSlice) + SYS_TRAP(sysTrapSysTaskCreate); + +Err SysTaskDelete(DWord taskID, DWord priority) + SYS_TRAP(sysTrapSysTaskDelete); + +Err SysTaskTrigger(DWord taskID) + SYS_TRAP(sysTrapSysTaskTrigger); + +ULong SysTaskID() + SYS_TRAP(sysTrapSysTaskID); + +Err SysTaskDelay(SDWord delay) + SYS_TRAP(sysTrapSysTaskDelay); + +Err SysTaskSetTermProc(DWord taskID, SysTermProcPtr termProcP) + SYS_TRAP(sysTrapSysTaskSetTermProc); + +Err SysTaskSwitching(Boolean enable) + SYS_TRAP(sysTrapSysTaskSwitching); + +Err SysTaskWait(SDWord timeout) + SYS_TRAP(sysTrapSysTaskWait); + +Err SysTaskWake(DWord taskID) + SYS_TRAP(sysTrapSysTaskWake); + +Err SysTaskWaitClr(void) + SYS_TRAP(sysTrapSysTaskWaitClr); + +Err SysTaskSuspend(DWord taskID) + SYS_TRAP(sysTrapSysTaskSuspend); + +Err SysTaskResume(DWord taskID) + SYS_TRAP(sysTrapSysTaskResume); + + +// Counting Semaphores +Err SysSemaphoreCreate(DWordPtr smIDP, DWordPtr tagP, SDWord initValue) + SYS_TRAP(sysTrapSysSemaphoreCreate); + +Err SysSemaphoreDelete(DWord smID) + SYS_TRAP(sysTrapSysSemaphoreDelete); + +Err SysSemaphoreWait(DWord smID, DWord priority, SDWord timeout) + SYS_TRAP(sysTrapSysSemaphoreWait); + +Err SysSemaphoreSignal(DWord smID) + SYS_TRAP(sysTrapSysSemaphoreSignal); + +Err SysSemaphoreSet(DWord smID) + SYS_TRAP(sysTrapSysSemaphoreSet); + + +// Resource Semaphores +Err SysResSemaphoreCreate(DWordPtr smIDP, DWordPtr tagP) + SYS_TRAP(sysTrapSysResSemaphoreCreate); + +Err SysResSemaphoreDelete(DWord smID) + SYS_TRAP(sysTrapSysResSemaphoreDelete); + +Err SysResSemaphoreReserve(DWord smID, DWord priority, SDWord timeout) + SYS_TRAP(sysTrapSysResSemaphoreReserve); + +Err SysResSemaphoreRelease(DWord smID) + SYS_TRAP(sysTrapSysResSemaphoreRelease); + + + +// Timers +Err SysTimerCreate(DWordPtr timerIDP, DWordPtr tagP, + SysTimerProcPtr timerProc, DWord periodicDelay, + DWord param) + SYS_TRAP(sysTrapSysTimerCreate); + +Err SysTimerDelete(DWord timerID) + SYS_TRAP(sysTrapSysTimerDelete); + +Err SysTimerWrite(DWord timerID, DWord value) + SYS_TRAP(sysTrapSysTimerWrite); + +Err SysTimerRead(DWord timerID, DWordPtr valueP) + SYS_TRAP(sysTrapSysTimerRead); + + +// Information +Err SysKernelInfo(VoidPtr paramP) + SYS_TRAP(sysTrapSysKernelInfo); + +Boolean SysCreateDataBaseList(ULong type, ULong creator, WordPtr dbCount, + Handle *dbIDs, Boolean lookupName) + SYS_TRAP(sysTrapSysCreateDataBaseList); + +Boolean SysCreatePanelList(WordPtr panelCount, Handle *panelIDs) + SYS_TRAP(sysTrapSysCreatePanelList); + + +// Mailboxes +Err SysMailboxCreate(DWordPtr mbIDP, DWordPtr tagP, DWord depth) + SYS_TRAP(sysTrapSysMailboxCreate); + +Err SysMailboxDelete(DWord mbID) + SYS_TRAP(sysTrapSysMailboxDelete); + +Err SysMailboxFlush(DWord mbID) + SYS_TRAP(sysTrapSysMailboxFlush); + +Err SysMailboxSend(DWord mbID, VoidPtr msgP, DWord wAck) + SYS_TRAP(sysTrapSysMailboxSend); + +Err SysMailboxWait(DWord mbID, VoidPtr msgP, DWord priority, + SDWord timeout) + SYS_TRAP(sysTrapSysMailboxWait); + +// Event Groups +Err SysEvGroupCreate(DWordPtr evIDP, DWordPtr tagP, DWord init) + SYS_TRAP(sysTrapSysEvGroupCreate); + +//Err SysEvGroupDelete(DWord evID) // save trap table space - don't need + //SYS_TRAP(sysTrapSysEvGroupDelete); + +Err SysEvGroupSignal(DWord evID, DWord mask, DWord value, SDWord type) + SYS_TRAP(sysTrapSysEvGroupSignal); + +Err SysEvGroupRead(DWord evID, DWordPtr valueP) + SYS_TRAP(sysTrapSysEvGroupRead); + +Err SysEvGroupWait(DWord evID, DWord mask, DWord value, SDWord matchType, + SDWord timeout) + SYS_TRAP(sysTrapSysEvGroupWait); + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _SysSemaphoreSignal \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSignal) + +#define _SysSemaphoreSet \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSet) + +#define _SysDoze \ + ASM_SYS_TRAP(sysTrapSysDoze) + + +#endif //__SYSTEMMGR_H__ diff --git a/sdk-2/include/Core/System/SystemMgr.rh b/sdk-2/include/Core/System/SystemMgr.rh new file mode 100644 index 0000000..be4ce10 --- /dev/null +++ b/sdk-2/include/Core/System/SystemMgr.rh @@ -0,0 +1,211 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SystemMgr.rh + * + * Description: + * Include file for both PilotRez 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: + * 2/27/95 Created by Ron Marianetti + * 8/4/95 vmk Added system resource id for Desktop Link user info + * + *******************************************************************/ + +#ifndef __SYSTEMMGR_RH__ +#define __SYSTEMMGR_RH__ + +//----------------------------------------------------------- +// This section is common to both the C and Resource Compiler +//----------------------------------------------------------- + +//................................................................ +// File types and creators +// +// Each database shall have a creator ID and a type. +// +// The creator ID shall establish which application, patch, or extension +// a particular database is associated with. The creator ID should identify +// the application/patch/extension, NOT who created it. +// +// The type will determine which part of an application, +// patch, or extension a particular database is. +// +// There can be only one database per application, patch, or extension +// which has type 'application', 'patch', or 'extension'. +// +// Creators: +// +// ROM-based applications created by Palm Computing have all-lower case +// creator ID's. Third-party applications have creator ID's which +// are either all caps, or mixed case. The same requirements go for +// system patches and extensions. +// +// All applications, system patches and extensions shall have unique creator +// ID's. +// +// Types: +// +// 'Application', 'Extension', and 'Patch' file/database types for ROM-based +// apps shall be all-lower case (they are defined below). Other +// file/database types must be mixed-case, +// or all caps. These other types are internal to the applications, and +// therefore the system is unconcerned with their exact values. +//................................................................ +#define sysFileCSystem 'psys' // Creator type for System files +#define sysFileCGraffiti 'graf' // Creator type for Graffiti databases +#define sysFileCSystemPatch 'ptch' // Creator for System resource file patches + +#define sysFileCCalculator 'calc' // Creator type for Calculator App +#define sysFileCSecurity 'secr' // Creator type for Security App +#define sysFileCPreferences 'pref' // Creator type for Preferences App +#define sysFileCAddress 'addr' // Creator type for Address App +#define sysFileCToDo 'todo' // Creator type for To Do App +#define sysFileCDatebook 'date' // Creator type for Datebook App +#define sysFileCMemo 'memo' // Creator type for MemoPad App +#define sysFileCSync 'sync' // Creator type for HotSync App +#define sysFileCMemory 'memr' // Creator type for Memory App +#define sysFileCMail 'mail' // Creator type for Mail App +#define sysFileCExpense 'exps' // Creator type for Expense App + +// Demo Apps +#define sysFileCGraffitiDemo 'gdem' // Creator type for Graffiti Demo +#define sysFileCMailDemo 'mdem' // Creator type for Mail Demo + +#define sysFileCFirstApp sysFileCPreferences // Creator type for First App after reset +#define sysFileCDefaultApp sysFileCMemory // Creator type for Default app +#define sysFileCNullApp '0000' // Creator type for non-existing app + +#define sysFileCDigitizer 'digi' // Creator type for Digitizer Panel +#define sysFileCGeneral 'gnrl' // Creator type for General Panel +#define sysFileCFormats 'frmt' // Creator type for Formats Panel +#define sysFileCShortCuts 'shct' // Creator type for ShortCuts Panel +#define sysFileCButtons 'bttn' // Creator type for Buttons Panel +#define sysFileCOwner 'ownr' // Creator type for Owner Panel +#define sysFileCModemPanel 'modm' // Creator type for Modem Panel +#define sysFileCDialPanel 'dial' // Creator type for Dial Panel +#define sysFileCNetworkPanel 'netw' // Creator type for Network Panel +#define sysFileCPADHtal 'hpad' // Creator type for PAD HTAL lirary +#define sysFileCTCPHtal 'htcp' // Creator type for TCP HTAL lirary +#define sysFileCMineHunt 'mine' // Creator type for MineHunt App +#define sysFileCPuzzle15 'puzl' // Creator type for Puzzle "15" App +#define sysFileCOpenLibInfo 'olbi' // Creator type for Feature Manager features + // used for saving open library info under PalmOS v1.x + + +// Libraries. If the resource used by these are expected to be treated as part of +// the system's usage then the Memory app must be changed. +#define sysFileCNet 'netl' // Net Library + + +#define sysFileTSystem 'rsrc' // File type for Main System File +#define sysFileTSystemPatch 'ptch' // File type for System resource file patches +#define sysFileTKernel 'krnl' // File type for System Kernel (AMX) +#define sysFileTUIAppShell 'uish' // File type for UI Application Shell +#define sysFileTExtension 'extn' // File type for System Extensions +#define sysFileTApplication 'appl' // File type for applications +#define sysFileTPanel 'panl' // File type for preference panels +#define sysFileTSavedPreferences 'sprf' // File type for saved preferences +#define sysFileTPreferences 'pref' // File type for preferences + +#define sysFileTGraffitiMacros 'macr' // Graffiti Macros database + +#define sysFileTHtalLib 'htal' // HTAL library + + +//................................................................ +// Resource types and IDs +//................................................................ +#define sysResTBootCode 'boot' // Resource type of boot resources +#define sysResIDBootReset 10000 // Reset code +#define sysResIDBootInitCode 10001 // Init code +#define sysResIDBootSysCodeStart 10100 // System code resources start here +#define sysResIDBootSysCodeMin 10102 // IDs 'Start' to this must exist!! +#define sysResIDBootUICodeStart 10200 // UI code resources start here +#define sysResIDBootUICodeMin 10203 // IDs 'Start' to this must exist!! + +#define sysResTAppPrefs 'pref' // Resource type of App preferences resources + +#define sysResTAppCode 'code' // Resource type of App code resources +#define sysResTAppGData 'data' // Resource type of App global data resources + +#define sysResTExtensionCode 'extn' // Resource type of Extensions code + +#define sysResTFeatures 'feat' // Resource type of System features table +#define sysResIDFeatures 10000 // Resource ID of System features table + +#define sysResTCountries 'cnty' // Resource type of System countries table +#define sysResIDCountries 10000 // Resource ID of System countries table + +#define sysResTLibrary 'libr' // Resource type of System Libraries + +#define sysResTGrfTemplate 'tmpl' // Graffiti templates "file" +#define sysResIDGrfTemplate 10000 // Graffiti templates "file" ID +#define sysResTGrfDictionary 'dict' // Graffiti dictionary "file" +#define sysResIDGrfDictionary 10000 // Graffiti dictionary "file" ID +#define sysResIDGrfDefaultMacros 10000 // sysResTDefaultDB resource with Graffiti Macros database + +#define sysResTDefaultDB 'dflt' // Default database resource type +#define sysResIDDefaultDB 1 // resource ID of sysResTDefaultDB in each app + +#define sysResTErrStrings 'tSTL' // list of error strings +#define sysResIDErrStrings 10000 // resource ID is (errno>>8)+sysResIDErrStrings + +// System Preferences +#define sysResTSysPref sysFileCSystem +#define sysResIDSysPrefMain 0 // Main preferences +#define sysResIDSysPrefPassword 1 // Password +#define sysResIDSysPrefFindStr 2 // Find string +#define sysResIDSysPrefCalibration 3 // Digitizer calibration. +#define sysResIDDlkUserInfo 4 // Desktop Link user information. +#define sysResIDDlkLocalPC 5 // Desktop Link local PC host name +#define sysResIDDlkCondFilterTab 6 // Desktop Link conduit filter table +#define sysResIDModemMgrPref 7 // Modem Manager preferences +#define sysResIDDlkLocalPCAddr 8 // Desktop Link local PC host address +#define sysResIDDlkLocalPCMask 9 // Desktop Link local PC host subnet mask + + +//----------------------------------------------------------- +// This section is only valid when running the resource compiler +//----------------------------------------------------------- +#ifdef RESOURCE_COMPILER + +// Definition of the Pilot Preferences Resource. This must match +// the definition of the structure SysAppPrefs in SystemMgr.h +resdef { + word priority; // AMX task priority + long stackSize; // required stack size + long minHeapSpace; // min required free space in heap + } sysResTAppPrefs; + + +// Definition of the ROM - Based Feature table +resdef { + word featureNum; // Feature number + long featureValue; // Feature value + } 'FITM'; + +resdef { + long creator; // creator type + word len(featureItems); + resource 'FITM' featureItems[]; + } 'CITM'; + +resdef { + word len(creatorItems); + resource 'CITM' creatorItems[]; + } sysResTFeatures; + + +#endif + + +#endif //__SYSTEMMGR_RH__ + diff --git a/sdk-2/include/Core/System/SystemPkt.h b/sdk-2/include/Core/System/SystemPkt.h new file mode 100644 index 0000000..6b8ad86 --- /dev/null +++ b/sdk-2/include/Core/System/SystemPkt.h @@ -0,0 +1,389 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SystemPkt.h + * + * Description: + * Structure of System Packets for the Serial Link Manager. These + * packets are used by the Debugger, Console, and Remote UI modules + * for communication with the host computer. + * + * History: + * 6/26/95 RM - Created by Ron Marianetti + * + * + *******************************************************************/ + + +#ifndef __SYSTEM_PKT_H__ +#define __SYSTEM_PKT_H__ + +#include + + +//************************************************************************* +// Constants for System Packets +// +//************************************************************************* + +// Max # of bytes we can read/write at a time with the ReadMem and WriteMem +// commands; +#define sysPktMaxMemChunk 256 + +// Maximum body size for System Packets. This is big enough to have +// 256 bytes of data for the Read and Write Mem command plus whatever other +// parameters are in the body for these commands. +#define sysPktMaxBodySize (sysPktMaxMemChunk+16) + + +// Default nitial timeout value for packet receive routines in ticks +#define sysPktInitialTimeout (sysTicksPerSecond*10) + + + +//************************************************************************* +// Packet Body Structure +//************************************************************************* + +// Common fields at the start of every body +#define _sysPktBodyCommon \ + Byte command; \ + Byte _filler + + +// Generic System Packet Body +typedef struct SysPktBodyType { + _sysPktBodyCommon; + Byte data[sysPktMaxBodySize-2]; + } SysPktBodyType; +typedef SysPktBodyType* SysPktBodyPtr; + + + +//************************************************************************* +// The max size of the array of SlkWriteDataTypes used by System Packet +// assembly routines in order to minimize stack usage. +//************************************************************************* +#define sysPktMaxBodyChunks 3 + + + +//************************************************************************* +// packet commands +//************************************************************************* + +//-------------------------------------------------------------------- +// get state command +//-------------------------------------------------------------------- +#define sysPktStateCmd 0x00 +#define sysPktStateRsp 0x80 + +//-------------------------------------------------------------------- +// read memory command +//-------------------------------------------------------------------- +#define sysPktReadMemCmd 0x01 +#define sysPktReadMemRsp 0x81 + +typedef struct SysPktReadMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to read + Word numBytes; // # of bytes to read + } SysPktReadMemCmdType; +typedef SysPktReadMemCmdType* SysPktReadMemCmdPtr; + +typedef struct SysPktReadMemRspType { + _sysPktBodyCommon; // Common Body header + // Byte data[?]; // variable size + } SysPktReadMemRspType; +typedef SysPktReadMemRspType* SysPktReadMemRspPtr; + + +//-------------------------------------------------------------------- +// write memory command +//-------------------------------------------------------------------- +#define sysPktWriteMemCmd 0x02 +#define sysPktWriteMemRsp 0x82 + +typedef struct SysPktWriteMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to write + Word numBytes; // # of bytes to write + // Byte data[?]; // variable size data + } SysPktWriteMemCmdType; +typedef SysPktWriteMemCmdType* SysPktWriteMemCmdPtr; + +typedef struct SysPktWriteMemRspType { + _sysPktBodyCommon; // Common Body header + } SysPktWriteMemRspType; +typedef SysPktWriteMemRspType* SysPktWriteMemRspPtr; + + +//-------------------------------------------------------------------- +// single-step command +//-------------------------------------------------------------------- +#define sysPktSingleStepCmd 0x03 +// no response + +//-------------------------------------------------------------------- +// get routine name command +//-------------------------------------------------------------------- +#define sysPktGetRtnNameCmd 0x04 +#define sysPktGetRtnNameRsp 0x84 + +//-------------------------------------------------------------------- +// read registers command +//-------------------------------------------------------------------- +#define sysPktReadRegsCmd 0x05 +#define sysPktReadRegsRsp 0x85 + + +//-------------------------------------------------------------------- +// write registers command +//-------------------------------------------------------------------- +#define sysPktWriteRegsCmd 0x06 +#define sysPktWriteRegsRsp 0x86 + +//-------------------------------------------------------------------- +// continue command +//-------------------------------------------------------------------- +#define sysPktContinueCmd 0x07 +// no response + + +//-------------------------------------------------------------------- +// Remote Procedure call +//-------------------------------------------------------------------- +#define sysPktRPCCmd 0x0A +#define sysPktRPCRsp 0x8A + +typedef struct SysPktRPCParamInfo { + Byte byRef; // true if param is by reference + Byte size; // # of Words of paramData + Word data[1]; // variable length array of paramData + } SysPktRPCParamType; + +typedef struct SysPktRPCType { + _sysPktBodyCommon; // Common Body header + Word trapWord; // which trap to execute + DWord resultD0; // result from D0 placed here + DWord resultA0; // result from A0 placed here + Word numParams; // how many parameters follow + // Following is a variable length array ofSlkRPCParamInfo's + SysPktRPCParamType param[1]; + } SysPktRPCType; + + +//-------------------------------------------------------------------- +// Set/Get breakpoints +//-------------------------------------------------------------------- +#define sysPktGetBreakpointsCmd 0x0B +#define sysPktGetBreakpointsRsp 0x8B +#define sysPktSetBreakpointsCmd 0x0C +#define sysPktSetBreakpointsRsp 0x8C + + +//-------------------------------------------------------------------- +// Remote UI Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktRemoteUIUpdCmd 0x0C + +typedef struct SysPktRemoteUIUpdCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from traget to host after drawing operations + Word rowBytes; // rowbytes of update area + Word fromY; // top of update rect + Word fromX; // left of update rect + Word toY; // top of screen rect + Word toX; // left of screen rect + Word height; // bottom of update rect + Word width; // right of update rect + + // The actual pixels of the update area follow + Word pixels; // variable length... + + } SysPktRemoteUIUpdCmdType; + + +#define sysPktRemoteEvtCmd 0x0D + +typedef struct SysPktRemoteEvtCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from host to target to feed pen and keyboard + // events. They do not require a response. + Boolean penDown; // true if pen down + SWord penX; // X location of pen + SWord penY; // Y location of pen + + Boolean keyPress; // true if key event follows + Word keyModifiers; // keyboard modifiers + Word keyAscii; // key ascii code + Word keyCode; // key virtual code + + } SysPktRemoteEvtCmdType; + + +//-------------------------------------------------------------------- +// Enable/Disable DbgBreak's command +//-------------------------------------------------------------------- +#define sysPktDbgBreakToggleCmd 0x0D +#define sysPktDbgBreakToggleRsp 0x8D + + +//-------------------------------------------------------------------- +// Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns info on the flash in: +// manuf - manufacturer code +// device - device code +//-------------------------------------------------------------------- +#define sysPktFlashCmd 0x0E +#define sysPktFlashRsp 0x8E + + +//-------------------------------------------------------------------- +// Get/Set communication parameters +//-------------------------------------------------------------------- +#define sysPktCommCmd 0x0F +#define sysPktCommRsp 0x8F + +typedef struct SysPktCommCmdType { + _sysPktBodyCommon; // Common Body header + Boolean set; // true to change parameters + ULong baudRate; // new baud rate + ULong flags; // new flags + } SysPktCommCmdType; +typedef SysPktCommCmdType* SysPktCommCmdPtr; + +typedef struct SysPktCommRspType { + _sysPktBodyCommon; // Common Body header + ULong baudRate; // current baud rate + ULong flags; // current flags + } SysPktCommRspType; +typedef SysPktCommRspType* SysPktCommRspPtr; + + +//-------------------------------------------------------------------- +// Get/Set Trap Breaks +//-------------------------------------------------------------------- +#define sysPktGetTrapBreaksCmd 0x10 +#define sysPktGetTrapBreaksRsp 0x90 +#define sysPktSetTrapBreaksCmd 0x11 +#define sysPktSetTrapBreaksRsp 0x91 + + +//-------------------------------------------------------------------- +// Gremlins Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktGremlinsCmd 0x12 + +typedef struct SysPktGremlinsCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from target to host to send Gremlins stuff + Word action; + Byte data[32]; + + } SysPktGremlinsCmdType; + +// Gremlins action codes +#define sysPktGremlinsIdle 1 +#define sysPktGremlinsEvent 2 + + +//-------------------------------------------------------------------- +// Find data - searches a range of addresses for data +//-------------------------------------------------------------------- +#define sysPktFindCmd 0x13 +#define sysPktFindRsp (sysPktFindCmd | 0x80) + +typedef struct SysPktFindCmdType { + _sysPktBodyCommon; // Common Body header + + DWord firstAddr; // first address to search + DWord lastAddr; // last address to begin searching + Word numBytes; // number of data bytes to match + Boolean caseInsensitive; // if true, perform a case-insensitive search + } SysPktFindCmdType; +typedef SysPktFindCmdType* SysPktFindCmdPtr; + +typedef struct SysPktFindRspType { + _sysPktBodyCommon; // Common Body header + + DWord addr; // address where data was found + Boolean found; // true if data was found + + } SysPktFindRspType; +typedef SysPktFindRspType* SysPktFindRspPtr; + + +//-------------------------------------------------------------------- +// message from remote unit +//-------------------------------------------------------------------- +#define sysPktRemoteMsgCmd 0x7f + + +//-------------------------------------------------------------------- +// sysPktRemoteMsg +// Send a text message +//-------------------------------------------------------------------- +typedef struct SysPktRemoteMsgCmdType { + _sysPktBodyCommon; // Common Body header + //Byte text; // variable length text goes here + } SysPktRemoteMsgCmdType; +typedef SysPktRemoteMsgCmdType* SysPktRemoteMsgCmdPtr; + + + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//================================================================ +// +// Host Only Routines. +// +//================================================================ +#if (EMULATION_LEVEL != EMULATION_NONE) + + + //------------------------------------------------------------------- + // RPC + //------------------------------------------------------------------ + // Init preparate on an RPC packet header and body. + Err SlkRPCInitPacket(SlkPktHeaderType* headerP, UInt dstSocket, + SysPktRPCType* bodyP, UInt trapWord); + + + // Stuff a parameter into an RPC packet body + VoidPtr SlkRPCStuffParam(SysPktRPCType* bodyP, void* dataP, + Int dataSize, Boolean byRef); + + // Send RPC packet and wait for response. + Err SlkRPCExecute(SlkPktHeaderPtr headerP, SysPktRPCType* bodyP, + Boolean async); + +#endif // (EMULATION_LEVEL != EMULATION_NONE) + + +#ifdef __cplusplus +} +#endif + + + + +#endif //__SYSTEM_PKT_H__ diff --git a/sdk-2/include/Core/System/SystemPrv.h b/sdk-2/include/Core/System/SystemPrv.h new file mode 100644 index 0000000..343c441 --- /dev/null +++ b/sdk-2/include/Core/System/SystemPrv.h @@ -0,0 +1,404 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * SystemPrv.h + * + * Description: + * Private Pilot system equates + * + * History: + * 8/9/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __SYSTEMPRV_H__ +#define __SYSTEMPRV_H__ + +// Include fixed global type +#include + + +/************************************************************ + * Common Equates between Native and Emulation mode + *************************************************************/ +#define sysCardSignature 0xFEEDBEEFL // card signature long word +#define sysStoreSignature 0xFEEDFACEL // store signature long word + + +// This should be set to sizeof(LowMemType) for the final version, but +// until then we'll make it bigger than LowMemType so that we can +// add more globals without having to re-format memory cards. +#define sysLowMemSize 0x1340 // size of Low Memory Area +#define sysInitStack (sysLowMemSize+0x1000) // stack ptr during boot + + + +// The location of the Card Header (start of ROM) is plugged in at run +// time to the global variable GSysCardHeaderOffset. This MUST be done +// by the startup code. We make this a run-time variable so that the same +// executable ROM image can be run from ROM or RAM. +// #define sysCardHeaderOffset someConstant +#define sysRAMOnlyCardHeaderOffset 0x0000000L // RAM only card header created here +#define sysCardHeaderSize 0x0100 // size of card header + + +// Offset to ROM storage header from card header +#define sysROMStoreRelOffset sysCardHeaderSize +#define sysStoreHeaderSize 0x0100 // size of storage header + + +// This equate tells us how large of a heap info table to reserve in the +// globals for each card +#define sysMaxHeapsPerCard 128 // max # of heaps per card + + +// This equtes tells us the initial size of the Library table as held in +// the Low Memory area +#define sysDefaultLibraries 5 // default size of library table + + +// The default port number and baud rate for the serial port +#if HW_TARGET == HW_TARGET_TD1 +#define sysDefaultSerPort 0 // Use port #0 +#define sysDefaultSerBaud 57600 // baud rate +#else +#define sysDefaultSerPort 1 // Use port #1 +#define sysDefaultSerBaud 57600 // baud rate +#endif + + + +/************************************************************ + * Structure of the PREF resource in applications. Note, this + * structure must mirror the structure of the PREF resource + * as defined in the PilotRez include file. + *************************************************************/ +typedef struct SysAppPrefs { + Word priority; // task priority + DWord stackSize; // required stack space + DWord minHeapSpace; // minimum heap space required + } SysAppPrefsType; +typedef SysAppPrefsType* SysAppPrefsPtr; + + + +/************************************************************ + * 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 handle of the + * app, the code handle, the stack chunk pointer, the owner ID, etc. + *************************************************************/ +typedef struct SysAppInfoType { + Int cmd; // command code for app + Ptr cmdPBP; // cmd ParamBlock + UInt launchFlags; // launch flags + + Long taskID; // AMX task ID of task that app runs in + Handle codeH; // code handle of the main code segment + DmOpenRef dbP; // Application database access ptr of App + Ptr stackP; // stack chunk for the App + Ptr globalsChunkP; // globals chunk for the App + + UInt memOwnerID; // owner ID for Memory Manager chunks + Ptr dmAccessP; // pointer to linked list of opened DB's + SWord dmLastErr; // Last error from Data Manager + Ptr errExceptionP; // ErrTry,Catch exception list + } SysAppInfoType; +typedef SysAppInfoType* SysAppInfoPtr; + + +/************************************************************ + * Structure of the user info in the TCB of a task. This structure + * is stored in the xtcbuser fields of the AMX TCB for a task and + * must not exceed 4 DWords in length (the size reserved by AMX for + * user info). + *************************************************************/ +typedef struct SysTCBUserInfoType { + SysAppInfoPtr tmpAppInfoP; // used to pass appInfo to nested launches + SysAppInfoPtr rootAppInfoP; // App info for the root application on this task + DWord initialA5; // Inital value for A5 globals ptr + } SysTCBUserInfoType; +typedef SysTCBUserInfoType* SysTCBUserInfoPtr; + + +//***************************************************************** +// Structure of ParamBlock for the SysKernelInfo call +//***************************************************************** + +// Selector codes +typedef enum { + sysKernelInfoSelCurTaskInfo, + sysKernelInfoSelTaskInfo, + sysKernelInfoSelSemaphoreInfo, + sysKernelInfoSelTimerInfo + } SysKernelInfoSelector; + +typedef struct SysKernelInfoType { + SysKernelInfoSelector selector; // Which info to get + DWord id; // which object to get info on + + union { + struct { + DWord id; // ID of task + DWord nextID; // ID of next task + + DWord tag; // task tag + DWord status; // task status + DWord timer; // # ticks left if task's timeout + DWord timeSlice; // task's time slice + SWord priority; // task priority + Word attributes; // task attributes + SWord pendingCalls; // # of pending calls + DWord senderTaskID; // task ID of message sender + DWord msgExchangeID; // task's message exchange ID, if any + + DWord tcbP; // pointer to TCB + DWord stackP; // stack pointer of task + DWord stackStart; // top of task stack (where it started). + DWord stackSize; // size of stack + } task; + + struct { + DWord id; + DWord nextID; // ID of next semaphore + + DWord tag; // semaphore tag + SWord initValue; // semaphore initial value + // >= 0 for counting, -1 for resource + SWord curValue; // semaphore current value + // >0 available + // 0 not available + // -n not available, n tasks waiting + SWord nestLevel; // 0 for counting, >= 0 for resource + DWord ownerID; // owner ID + // 0 for counting or resource free + } semaphore; + + struct { + DWord id; + DWord nextID; // ID of next timer + + DWord tag; // timer tag + DWord ticksLeft; // ticks left till timer runs + DWord period; // timer period, if periodic + DWord proc; // timer procedure + } timer; + } param; + + } SysKernelInfoType; + + +typedef SysKernelInfoType* SysKernelInfoPtr; + + + + +//----------------------------------------------------------------- +// Bits for status field in task info parameter block +//------------------------------------------------------------------ +#define sysTaskStatusTriggerWait 0x01 // (CJ_MATSWTR) Task idle (waiting for trigger) +#define sysTaskStatusSuspended 0x02 // (CJ_MATSWSUS) Task suspended (waiting for resume) +#define sysTaskStatusWaiting 0x04 // (CJ_MATSWAIT) Task waiting (see other bits) +#define sysTaskStatusHalted 0x80 // (CJ_MATSWHLT) Task halted + +// If sysTaskStatusWaiting set, these bits tell why.... +#define sysTaskStatusWaitSemaphore 0x00100 // (CJ_MATSWSM) waiting on semaphore +#define sysTaskStatusWaitEvent 0x00200 // (CJ_MATSWEV) waiting on event group +#define sysTaskStatusWaitMailbox 0x00400 // (CJ_MATSWMB) waiting on mailbox +#define sysTaskStatusWaitMsgExchange 0x00800 // (CJ_MATSWMX) waiting on message exchange +#define sysTaskStatusWaitBuffer 0x01000 // (CJ_MATSWBUF) waiting on buffer +#define sysTaskStatusWaitTimer 0x08000 // (CJ_MATSWTM) waiting on timer + +#define sysTaskStatusWaitMailboxAck 0x00010000L // (CJ_MATSWMBAK) mailbox ack +#define sysTaskStatusWaitMsgXAck 0x00020000L // (CJ_MATSWMXAK) msg exchange ack +#define sysTaskStatusWaitTaskSig 0x00040000L // (CJ_MATSWSIG) task signal wait + +//----------------------------------------------------------------- +// Bits for attributes field in task info parameter block +//------------------------------------------------------------------ +#define sysTaskAttrNoHalt 0x02 // (CJ_MATAHLT) Task cannot be halted +#define sysTaskAttrMsgStack 0x08 // (CJ_MATAMSG) receives msgs on stack +#define sysTaskAttrMsgByRef 0x10 // (CJ_MATAPBR) messages passed by reference +#define sysTaskAttrMsgOnStack 0x4000 // (CJ_MATAMRDY) message ready on stack +#define sysTaskAttrMsgSenderWaiting 0x8000 // (CJ_MATAMSW) msg sender waiting for ack + + + +/************************************************************ + * This structure defines a section within the RAM storage header + * on Card#0 used to hold non-volatile System information. We store + * System information that can not be conveniently stored or accessed + * from a Database in this area because: + * 1.) it can be accessed earlier during the boot-up process and + * 2.) It can be accessed from an interrupt routine. + *************************************************************/ +typedef struct SysNVParamsType { + DWord rtcHours; // Real-Time clock hours - add to value + // in DragonBall RTC register to get + // actual date & time. + DWord rtcHourMinSecCopy; // Copy of latest value in rtcHourMinSec reg of + // DBall. Used as default RTC value on Reset. + } SysNVParamsType; +typedef SysNVParamsType* SysNVParamsPtr; + + + +/************************************************************ + * Structure of the System Globals. This is where we place + * variable size globals that the System Manager uses. This + * is currently not used but a pointer for it is reserved + * in the low memory globals + *************************************************************/ +/* +typedef struct SysGlobalsType { + } SysGlobalsType; +typedef SysGlobalsType* SysGlobalsPtr; +*/ + + + +/************************************************************ + * Assignment of bits to the event group used for implementing the + * NetLibSelect() call. This event group is also used by the System + * Event Manager (SysEvtMgr.c) and includes a bit for "stdin" + * (pen & keyboard) besides the other bits used for Net Library socket refNums. + *************************************************************/ +#define sysFileDescNet (sysFileDescStdIn+1) // first available refNum for use by + // Net library. + + +// Macro to generate a bitmask for the event group corresponding to a particular +// refNum id and boolean indicating whether it's for input or output. The outputs +// are in the upper 16 bits of the event group and the inputs are in the +// lower 16 bits. +#define sysEvtGroupMask(fd,output) \ + (output ? (0x00010000 << (fd)) : (0x00000001 << (fd)) ) + + +/************************************************************ + * This structure defines the entire the Low Memory Area + * and includes the low memory header defined in Globals.h, + * followed by some variable size globals that may change + * from rev to rev of the System Software. + * + * When emulating under Windows, this structure ends up at some random + * place in memory and the global variable GlobalsP points to it. + * + * When running in the native environment, this structure starts at + * address sysGlobalsOffset. + * + * In order to simplify the source code, macros are defined for + * accessing commonly used globals in the optimim manner for + * each environment. + *************************************************************/ +#include +#include +#include +#include +#include +typedef struct LowMemType { + + + // Fixed size globals, defined in Globals.h + LowMemHdrType fixed; + + + //--------------------------------------------------------------------------- + // These structures are always placed at the end of the LowMem area so + // that other globals don't generally have to move when their sizes change + //--------------------------------------------------------------------------- + CardInfoType memCardInfo[hwrNumCardSlots]; // Memory Card Info Array + + SlkGlobalsType slkGlobals; // Serial Link Mgr globals + + DbgGlobalsType dbgGlobals; // Debugger globals + + SysAppInfoType sysAppInfo; // SysAppInfoType for system + + Ptr sysDispatchTable[sysNumTraps]; // trap table + + } LowMemType; + + +// Access to variable size globals +#define GMemCardInfo (((LowMemType*)PilotGlobalsP)->memCardInfo) +#define GSlkGlobals (((LowMemType*)PilotGlobalsP)->slkGlobals) +#define GDbgGlobals (((LowMemType*)PilotGlobalsP)->dbgGlobals) +#define GSysAppInfo (((LowMemType*)PilotGlobalsP)->sysAppInfo) +#define GSysLibTable (((LowMemType*)PilotGlobalsP)->sysLibTable) +#define GSysDispatchTable (((LowMemType*)PilotGlobalsP)->sysDispatchTable) + + +// Flags for the GSysResetFlags global +#define sysResetFlagHardReset 0x01 // HardReset +#define sysResetFlagCreateDefaultDBs 0x02 // create default databases +#define sysResetFlagNoExtensions 0x04 // don't execute extensions + + +// Flags for the GSysPrefFlags global +#define sysPrefFlagTaxiDisable 0x0001 // Not used in >1.0 ROM. +#define sysPrefFlagEnableEasterEggs 0x0002 // Enable easter eggs +#define sysPrefFlagTaxiDisIdle 0x8000 // Disable Idle Taxi temporarily, + // (not saved in preferences) +#define sysPrefFlagTaxiDisIdleTime 0x4000 // Copy of the 16th bit of the system + // time when sysPrefFlagTaxiDisIdle bit + // was set (not saved in preferences). + + +// Flags for the GSysMiscFlags global +#define sysMiscFlagInFatalAlert 0x0001 // Currently displaying fatal alert +#define sysMiscFlagAlwaysSwitchApp 0x0002 // Inform UI App Shell to switch + // apps even if already running +#define sysMiscFlagProfile 0x0004 // true when profiling code. +#define sysMiscFlagGrfDisable 0x0008 // true when Graffiti is disabled +#define sysMiscFlagInDemoAlert 0x0010 // true when Demo unit alert is displayed + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +SysTCBUserInfoPtr SysTaskUserInfoPtr(ULong taskID) + SYS_TRAP(sysTrapSysTaskUserInfoPtr); + +Err SysAppStartup(SysAppInfoPtr* appInfoPP, Ptr* prevGlobalsP, + Ptr* globalsPtrP) + SYS_TRAP(sysTrapSysAppStartup); + +Err SysAppExit(SysAppInfoPtr appInfoP, Ptr prevGlobalsP, Ptr globalsP) + SYS_TRAP(sysTrapSysAppExit); + +SysAppInfoPtr SysCurAppInfoP(void) + SYS_TRAP(sysTrapSysCurAppInfoP); + + +#ifdef __cplusplus +} +#endif + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _SysFatalAlert \ + ASM_SYS_TRAP(sysTrapSysFatalAlert) + +#define _SysReset \ + ASM_SYS_TRAP(sysTrapSysReset) + + + +#endif //__SYSTEMPRV_H__ + +#endif // NON_PORTABLE + diff --git a/sdk-2/include/Core/System/TimeMgr.h b/sdk-2/include/Core/System/TimeMgr.h new file mode 100644 index 0000000..937ca66 --- /dev/null +++ b/sdk-2/include/Core/System/TimeMgr.h @@ -0,0 +1,77 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * TimeMgr.h + * + * Description: + * Time manager functions + * + * History: + * 1/19/95 roger - Created by Roger Flores + * + * + *******************************************************************/ + + +#ifndef __TIMEMGR_H__ +#define __TIMEMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Time Manager result codes + * (timErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define timErrMemory (timErrorClass | 1) + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err TimInit(void) SYS_TRAP(sysTrapTimInit); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// seconds since 1/1/1904 +ULong TimGetSeconds(void) + SYS_TRAP(sysTrapTimGetSeconds); + +// seconds since 1/1/1904 +void TimSetSeconds(ULong seconds) + SYS_TRAP(sysTrapTimSetSeconds); + +// ticks since power on +ULong TimGetTicks(void) + SYS_TRAP(sysTrapTimGetTicks); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __TIMEMGR_H__ + + diff --git a/sdk-2/include/Core/System/TimePrv.h b/sdk-2/include/Core/System/TimePrv.h new file mode 100644 index 0000000..06ffae3 --- /dev/null +++ b/sdk-2/include/Core/System/TimePrv.h @@ -0,0 +1,127 @@ +/******************************************************************* + * Pilot Software + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * TimePrv.h + * + * Description: + * Private Time manager functions + * + * History: + * 1/19/95 roger - Created by Roger Flores + * + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __TIMEPRV_H__ +#define __TIMEPRV_H__ + + +/******************************************************************* + * Private Time Manager Constants + * + *******************************************************************/ + +// Alarm repeat interval -- once an alarm is triggered, it will +// repeat every timAlarmRepeatSeconds until it is canceled or +// replaced with a new alarm by the Alarm Manager. This ensures +// that an alarm will not be missed by the Alarm Manager code which +// is executed on some app's UI thread. +#define timAlarmRepeatSeconds 10 + +// Alarm delta interval -- if the difference between the alarm time and the current time +// is less than this interval, the alarm will be triggered immediately. This eliminates +// a race condition which occurs when the alarm time is TOO close to the current time. +#define timAlarmMinDeltaSeconds 2 + + + +/******************************************************************* + * Time Manager Globals + * + *******************************************************************/ +typedef struct TimGlobalsType { + + ULong rtcHours; // Added to DragonBall hours to get actual time + ULong alarmSeconds; // alarm time in seconds since 1/1/1904; + // 0 = none + + //------------------------------------------------------------------------------- + // The following fields are used exclusively to work around a bug in the 0G58E version + // of the DragonBall. This bug causes the rtcHourMinSec register in the DragonBall to + // occasionally be "out of date" when read and also prevents alarms from going off + // if we're in sleep mode. To get around this bug, we use the 1 minute interrupt while + // we're in sleep mode to wake up periodically and see if any alarms need to go off and + // we use the 1 second interrupt when we're awake to update our own copy of the hours, + // minutes and seconds. + //------------------------------------------------------------------------------- + Boolean rtcBugWorkaround; // true to work around bug in 0G58E version + // of dragonball. + Boolean rtcBugAsleep; // true if we're in sleep mode + + // Our copy of the time that we maintain through the 1 second and minute interrupts + ULong rtcBugAlarm; // when alarm should be triggerred. + ULong rtcBugSeconds; // seconds since 1/1/1904 + // IMPORTANT: The boolean rtcBugFastMinuteCalc MUST + // be cleared whenever rtcBugSeconds is changed!!!!!!! + ULong rtcBugLastSeconds; // seconds after last 1 sec. or min. interrupt. + Boolean rtcBugFastMinuteCalc; // true when current time is on a minute + // boundary. Used by TimHandleInterrupt speed up + // the next minute calculation. + } TimGlobalsType; + +typedef TimGlobalsType* TimGlobalsPtr; + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// +// IMPORTANT: TimSetAlarm() and TimGetAlarm() are reserved for use by the +// Alarm Manager! +// + +// set an alarm in seconds since 1/1/1904 +// (reserved for Alarm Manager use only) +ULong TimSetAlarm(ULong seconds) + SYS_TRAP(sysTrapTimSetAlarm); + +// get the current alarm setting in seconds since 1/1/1904 +// (reserved for Alarm Manager use only) +ULong TimGetAlarm(void) + SYS_TRAP(sysTrapTimGetAlarm); + +Err TimSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapTimSleep); + +Err TimWake(void) + SYS_TRAP(sysTrapTimWake); + + +//------------------------------------------------------------------- +// Interrupt Service routine +//------------------------------------------------------------------- +void TimHandleInterrupt(Boolean periodicUpdate) + SYS_TRAP(sysTrapTimHandleInterrupt); + + +#ifdef __cplusplus +} +#endif + + + + +#endif // __TIMEMGR_H__ + + +#endif // NON_PORTABLE diff --git a/sdk-2/include/Core/System/Unix/arpa_inet.h b/sdk-2/include/Core/System/Unix/arpa_inet.h new file mode 100644 index 0000000..8a02420 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/arpa_inet.h @@ -0,0 +1,66 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: arpa/inet.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + +/* @(#)inet.h 1.8 88/08/19 SMI; from UCB 5.1 5/30/85 */ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * External definitions for + * functions in inet(3N) + */ + +#ifndef __UNIXINET_H__ +#define __UNIXINET_H__ + +#include + +//=========================================================================== +// Macros that convert Unix calls into native Pilot calls. +//=========================================================================== +// Convert a dotted decimal string representation into an IP address. +// return -1 on error +#define inet_addr(s) \ + NetLibAddrAToIN(AppNetRefnum, s) + +// Return a dotted decimal string representation of an IP address +#define inet_ntoa(in) \ + NetLibAddrINToA(AppNetRefnum, (in).s_addr, AppINETString) + + +//=========================================================================== +// Functions implemented through glue code +//=========================================================================== + +// Merge network number and local network address into an IP address +struct in_addr inet_makeaddr(DWord net, DWord lna); + +// Return the NBO network number of the dotted decimal string +DWord inet_network(CharPtr s); + +// Return the local network address of an IP address +DWord inet_lnaof(struct in_addr in); + +// Return the network number of an IP address +DWord inet_netof(struct in_addr in); + +#endif /*__UNIXINET_H__*/ + + + + + diff --git a/sdk-2/include/Core/System/Unix/gcc_stdarg.h b/sdk-2/include/Core/System/Unix/gcc_stdarg.h new file mode 100644 index 0000000..e4833f4 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/gcc_stdarg.h @@ -0,0 +1,2 @@ +/* wrapper for the native stdarg */ +#include diff --git a/sdk-2/include/Core/System/Unix/header.gcc b/sdk-2/include/Core/System/Unix/header.gcc new file mode 100644 index 0000000..bd77e74 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/header.gcc @@ -0,0 +1,17 @@ +arpa/inet.h arpa_inet.h +netinet/in.h netinet_in.h +netinet/ip.h netinet_ip.h +netinet/systm.h netinet_systm.h +netinet/tcp.h netinet_tcp.h +sys/errno.h sys_errno.h +sys/socket.h sys_socket.h +sys/socketvar.h sys_socketvar.h +sys/time.h sys_time.h +sys/types.h sys_types.h +sys/uio.h sys_uio.h +fcntl.h unix_fcntl.h +netdb.h unix_netdb.h +unix_stdarg.h gcc_stdarg.h +stdio.h unix_stdio.h +stdlib.h unix_stdlib.h +string.h unix_string.h diff --git a/sdk-2/include/Core/System/Unix/netdb.h b/sdk-2/include/Core/System/Unix/netdb.h new file mode 100644 index 0000000..dbcd4a4 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/netdb.h @@ -0,0 +1,116 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: netdb.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + +/* @(#)netdb.h 1.11 88/08/19 SMI from UCB 5.9 4/5/88 */ +/* + * Copyright (c) 1980,1983,1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + + + +#ifndef __UNIXNETDB_H__ +#define __UNIXNETDB_H__ + + +/* + * Structures returned by network data base library. + * All addresses are supplied in host order, and + * returned in network order (suitable for use in system calls). + */ + +struct hostent { + Char *h_name; /* official name of host */ + Char **h_aliases; /* alias list */ + Word h_addrtype; /* host address type */ + Word h_length; /* length of address */ + Char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + Char *n_name; /* official name of net */ + Char **n_aliases; /* alias list */ + Word n_addrtype; /* net address type */ + DWord n_net; /* network # */ +}; + +struct servent { + Char *s_name; /* official service name */ + Char **s_aliases; /* alias list */ + Word s_port; /* port # */ + Char *s_proto; /* protocol to use */ +}; + +struct protoent { + Char *p_name; /* official protocol name */ + Char **p_aliases; /* alias list */ + Word p_proto; /* protocol # */ +}; + +struct rpcent { + Char *r_name; /* name of server for this rpc program */ + Char **r_aliases; /* alias list */ + SWord r_number; /* rpc program number */ +}; + + +// Supported calls +#define gethostbyname(nameP) \ + ((struct hostent*)NetLibGetHostByName(AppNetRefnum, nameP,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define gethostbyaddr(addr,len,type) \ + ((struct hostent*)NetLibGetHostByAddr(AppNetRefnum, (BytePtr)addr,len,type,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define getservbyname(serv,proto) \ + ((struct servent*)NetLibGetServByName(AppNetRefnum, serv,proto,&AppServInfo,AppNetTimeout,&h_errno)) + + +// Unsupported calls +// struct hostent *gethostent(); +// struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); +// struct servent *getservbyport(), *getservent(); +// struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); +// struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver) + */ + +extern Err h_errno; + +#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + + +#endif // __UNIXNETDB_H__ + + + diff --git a/sdk-2/include/Core/System/Unix/netinet_in.h b/sdk-2/include/Core/System/Unix/netinet_in.h new file mode 100644 index 0000000..43fa2c0 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/netinet_in.h @@ -0,0 +1,196 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: netinet/in.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)in.h 1.19 90/07/27 SMI; from UCB 7.5 2/22/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981. + */ + +#ifndef __UNIXIN_H__ +#define __UNIXIN_H__ + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group control protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_HELLO 63 /* "hello" routing protocol */ +#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + +/* + * Port/socket numbers: network standard functions + */ +#define IPPORT_ECHO 7 +#define IPPORT_DISCARD 9 +#define IPPORT_SYSTAT 11 +#define IPPORT_DAYTIME 13 +#define IPPORT_NETSTAT 15 +#define IPPORT_FTP 21 +#define IPPORT_TELNET 23 +#define IPPORT_SMTP 25 +#define IPPORT_TIMESERVER 37 +#define IPPORT_NAMESERVER 42 +#define IPPORT_WHOIS 43 +#define IPPORT_MTP 57 + +/* + * Port/socket numbers: host specific functions + */ +#define IPPORT_TFTP 69 +#define IPPORT_RJE 77 +#define IPPORT_FINGER 79 +#define IPPORT_TTYLINK 87 +#define IPPORT_SUPDUP 95 + +/* + * UNIX TCP sockets + */ +#define IPPORT_EXECSERVER 512 +#define IPPORT_LOGINSERVER 513 +#define IPPORT_CMDSERVER 514 +#define IPPORT_EFSSERVER 520 + +/* + * UNIX UDP sockets + */ +#define IPPORT_BIFFUDP 512 +#define IPPORT_WHOSERVER 513 +#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Link numbers + */ +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 + +/* + * Internet address + * This definition contains obsolete fields for compatibility + * with SunOS 3.x and 4.2bsd. The presence of subnets renders + * divisions into fixed fields misleading at best. New code + * should use only the s_addr field. + */ +struct in_addr { + union { + struct { Byte s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { Word s_w1,s_w2; } S_un_w; + DWord S_addr; + } S_un; +#define s_addr S_un.S_addr /* should be used for all code */ +#define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */ +#define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */ +#define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */ +#define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */ +#define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */ +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_NONE (u_long)0xFFFFFFFF /* error from inet_aton */ +#define INADDR_LOOPBACK (u_long)0x7F000001 +#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Define a macro to stuff the loopback address into an Internet address + */ +#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ + (a)->sin_family = AF_INET;} + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + short sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + */ +#define IP_OPTIONS netSocketOptIPOptions /* set/get IP per-packet options */ + +/* + * Macros for number representation conversion. + */ +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + + +#endif /*!__IN_H__*/ diff --git a/sdk-2/include/Core/System/Unix/netinet_ip.h b/sdk-2/include/Core/System/Unix/netinet_ip.h new file mode 100644 index 0000000..89e0cbe --- /dev/null +++ b/sdk-2/include/Core/System/Unix/netinet_ip.h @@ -0,0 +1,133 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: netinet/ip.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)ip.h 1.13 88/08/19 SMI; from UCB 7.6.1.1 3/15/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ + +#ifndef __UNIX_NETINET_IP_H +#define __UNIX_NETINET_IP_H + +#define IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + * + * We declare ip_len and ip_off to be short, rather than u_short + * pragmatically since otherwise unsigned comparisons can result + * against negative integers quite easily, and fail in subtle ways. + */ +struct ip { + u_char ip_v:4, /* version */ + ip_hl:4; /* header length */ + u_char ip_tos; /* type of service */ + short ip_len; /* total length */ + u_short ip_id; /* identification */ + short ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + u_char ipt_code; /* IPOPT_TS */ + u_char ipt_len; /* size of structure (variable) */ + u_char ipt_ptr; /* index of current entry */ + u_char ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ + union ipt_timestamp { + n_long ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + n_long ipt_time; + } ipt_ta[1]; + } ipt_timestamp; +}; + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 2 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +#endif /*!__UNIX_NETINET_IP_H*/ diff --git a/sdk-2/include/Core/System/Unix/netinet_systm.h b/sdk-2/include/Core/System/Unix/netinet_systm.h new file mode 100644 index 0000000..057cf75 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/netinet_systm.h @@ -0,0 +1,43 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: netinet/in_systm.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)in_systm.h 1.8 88/08/19 SMI; from UCB 7.1 6/5/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +#ifndef __UNIX_NETINET_IN_SYSTM_H +#define __UNIX_NETINET_IN_SYSTM_H + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +typedef u_short n_short; /* short as received from the net */ +typedef u_long n_long; /* long as received from the net */ + +typedef u_long n_time; /* ms since 00:00 GMT, byte rev */ + +#endif /*!__UNIX_NETINET_IN_SYSTM_H*/ diff --git a/sdk-2/include/Core/System/Unix/netinet_tcp.h b/sdk-2/include/Core/System/Unix/netinet_tcp.h new file mode 100644 index 0000000..472313e --- /dev/null +++ b/sdk-2/include/Core/System/Unix/netinet_tcp.h @@ -0,0 +1,70 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: netinet/tcp.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)tcp.h 1.11 88/08/19 SMI; from UCB 7.2 10/28/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __UNIXTCP_H__ +#define __UNIXTCP_H__ + +typedef DWord tcp_seq; +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + Word th_sport; /* source port */ + Word th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ + Byte th_off:4, /* data offset */ + th_x2:4; /* (unused) */ + Byte th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + Word th_win; /* window */ + Word th_sum; /* checksum */ + Word th_urp; /* urgent pointer */ +}; + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + */ +#ifdef lint +#define TCP_MSS 536 +#else +#define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) +#endif + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY netSocketOptTCPNoDelay /* don't delay send to coalesce packets */ +#define TCP_MAXSEG netSocketOptTCPMaxSeg /* set maximum segment size */ + +#endif /*!__UNIXTCP_H__*/ diff --git a/sdk-2/include/Core/System/Unix/sys_errno.h b/sdk-2/include/Core/System/Unix/sys_errno.h new file mode 100644 index 0000000..531ca8a --- /dev/null +++ b/sdk-2/include/Core/System/Unix/sys_errno.h @@ -0,0 +1,147 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/errno.h + * AUTHOR: Ron Marianetti 5/23/96 + * + * DESCRIPTION: + * This module contains the equivalent of the unix header + * for use in Pilot applications that wish to use the Berkeley sockets API + * + **********************************************************************/ +/* @(#)errno.h 2.14 90/01/23 SMI; from UCB 4.1 82/12/28 */ + +/* + * If error codes are added or changed here, they should be updated in + * /usr/src/lib/libc/gen/common/errlst.c as well. + */ + +/* + * Error codes. DOLATER.... map these to Net error codes.... + */ + +#ifndef _sys_errno_h +#define _sys_errno_h + +#define EPERM 1 /* Not owner */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR netErrTimeout /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No children */ +#define EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Not enough core */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Mount device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory*/ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ + +/* math software */ +#define EDOM 33 /* Argument too large */ +#define ERANGE 34 /* Result too large */ + +/* non-blocking and interrupt i/o */ +#define EWOULDBLOCK netErrWouldBlock /* Operation would block */ +#define EINPROGRESS netErrSocketBusy /* Operation now in progress */ +#define EALREADY netErrAlreadyInProgress /* Operation already in progress */ +/* ipc/network software */ + + /* argument errors */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported on socket */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by proto +col family */ +#define EADDRINUSE netErrPortInUse /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ + + /* operational errors */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH netErrNoInterfaces /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN netErrSocketAlreadyConnected /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT netErrTimeout /* Connection timed out */ +#define ECONNREFUSED 61 /* Connection refused */ + + /* */ +#define ELOOP 62 /* Too many levels of symbolic links */ +#define ENAMETOOLONG 63 /* File name too long */ + +/* should be rearranged */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ + +/* quotas & mush */ +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disc quota exceeded */ + +/* Network File System */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ + +/* streams */ +#define ENOSTR 72 /* Device is not a stream */ +#define ETIME 73 /* Timer expired */ +#define ENOSR 74 /* Out of streams resources */ +#define ENOMSG 75 /* No message of desired type */ +#define EBADMSG 76 /* Trying to read unreadable message */ + +/* SystemV IPC */ +#define EIDRM 77 /* Identifier removed */ + +/* SystemV Record Locking */ +#define EDEADLK 78 /* Deadlock condition. */ +#define ENOLCK 79 /* No record locks available. */ + +/* RFS */ +#define ENONET 80 /* Machine is not on the network */ +#define ERREMOTE 81 /* Object is remote */ +#define ENOLINK 82 /* the link has been severed */ +#define EADV 83 /* advertise error */ +#define ESRMNT 84 /* srmount error */ +#define ECOMM 85 /* Communication error on send */ +#define EPROTO 86 /* Protocol error */ +#define EMULTIHOP 87 /* multihop attempted */ +#define EDOTDOT 88 /* Cross mount point (not an error) */ +#define EREMCHG 89 /* Remote address changed */ + +/* POSIX */ +#define ENOSYS 90 /* function not implemented */ + +#endif /*!_sys_errno_h*/ diff --git a/sdk-2/include/Core/System/Unix/sys_socket.h b/sdk-2/include/Core/System/Unix/sys_socket.h new file mode 100644 index 0000000..c6f4d8b --- /dev/null +++ b/sdk-2/include/Core/System/Unix/sys_socket.h @@ -0,0 +1,286 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/socket.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +#ifndef __SOCKET_H__ +#define __SOCKET_H__ + +// Include System headers +#include + +// Include the Pilot Net Manager defines +#include + +// Include other Unix headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// This is a set of unix calls that get stubbed out or replaced by +// PilotOS calls. +// +// Although these don't really "belong" here, it seems like the best solution +// rather than having a ton of other unix like header files that don't +// provide all the functionality that unix does. +#define sleep(x) SysTaskDelay(x*sysTicksPerSecond) +#define isatty(x) 1 +#define fork() -1 // can't support fork +#define abort(x) + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB +#define getenv(x) 0 +#endif + +/*=================================================================== + * Definitions related to sockets: types, address families, options. + ===================================================================*/ + +/* + * Types + */ +#define SOCK_STREAM netSocketTypeStream /* stream socket */ +#define SOCK_DGRAM netSocketTypeDatagram /* datagram socket */ +#define SOCK_RAW netSocketTypeRaw /* raw-protocol interface */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG netSocketOptSockDebug /* turn on debugging info recording */ +#define SO_ACCEPTCONN netSocketOptSockAcceptConn /* socket has had listen() */ +#define SO_REUSEADDR netSocketOptSockReuseAddr /* allow local address reuse */ +#define SO_KEEPALIVE netSocketOptSockKeepAlive /* keep connections alive */ +#define SO_DONTROUTE netSocketOptSockDontRoute /* just use interface addresses */ +#define SO_BROADCAST netSocketOptSockBroadcast /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK netSocketOptSockUseLoopback /* bypass hardware when possible */ +#define SO_LINGER netSocketOptSockLinger /* linger on close if data present */ +#define SO_OOBINLINE netSocketOptSockOOBInLine /* leave received OOB data in line */ +/* + * N.B.: The following definition is present only for compatibility + * with release 3.0. It will disappear in later releases. + */ +#define SO_DONTLINGER (~SO_LINGER) /* ~SO_LINGER */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF netSocketOptSockSndBufSize /* send buffer size */ +#define SO_RCVBUF netSocketOptSockRcvBufSize /* receive buffer size */ +#define SO_SNDLOWAT netSocketOptSockSndLowWater /* send low-water mark */ +#define SO_RCVLOWAT netSocketOptSockRcvLowWater /* receive low-water mark */ +#define SO_SNDTIMEO netSocketOptSockSndTimeout /* send timeout */ +#define SO_RCVTIMEO netSocketOptSockRcvTimeout /* receive timeout */ +#define SO_ERROR netSocketOptSockErrorStatus /* get error status and clear */ +#define SO_TYPE netSocketOptSockSocketType /* get socket type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + SWord l_onoff; /* option on/off */ + SWord l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET netSocketOptLevelSocket /* options for socket level */ + +/* + * Address families. + */ +#define AF_INET netSocketAddrINET /* internetwork: UDP, TCP, etc. */ + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + SWord sa_family; /* address family */ + Byte sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + Word sp_family; /* address family */ + Word sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_INET AF_INET + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct msghdr { + CharPtr msg_name; /* optional address */ + SWord msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + SWord msg_iovlen; /* # elements in msg_iov */ + CharPtr msg_accrights; /* access rights sent/received */ + SWord msg_accrightslen; + }; + +#define MSG_OOB netIOFlagOutOfBand /* process out-of-band data */ +#define MSG_PEEK netIOFlagPeek /* peek at incoming message */ +#define MSG_DONTROUTE netIOFlagDontRoute /* send without using routing tables */ + +#define MSG_MAXIOVLEN netIOVecMaxLen + + +//=========================================================================== +// Globals used by the Sockets API. These are declard in the Socket.c module +// which must be linked in with any application that uses the sockets API. +//=========================================================================== +extern Err errno; +extern Long AppNetTimeout; +extern Char AppINETString[]; +extern NetHostInfoBufType AppHostInfo; +extern NetServInfoBufType AppServInfo; +extern Word AppNetRefnum; + + +//=========================================================================== +// Macros that convert BSD Sockets calls into native Pilot calls. +//=========================================================================== +#define accept(socket,addr,addrlen) \ + NetLibSocketAccept(AppNetRefnum,socket,(NetSocketAddrType*)addr,(SWordPtr)addrlen,AppNetTimeout,&errno) + +#define bind(socket,localaddr,addrlen) \ + NetLibSocketBind(AppNetRefnum, socket,(void*)localaddr,addrlen,AppNetTimeout,&errno) + +#define close(socket) \ + NetLibSocketClose(AppNetRefnum, socket,AppNetTimeout,&errno) + +#define connect(socket,addr,addrlen) \ + NetLibSocketConnect(AppNetRefnum, socket,(void*)addr,addrlen,AppNetTimeout,&errno) + +#define getsockopt(socket,level,opt,optvalP,optlenP) \ + NetLibSocketOptionGet(AppNetRefnum, socket,level,opt,optvalP,(WordPtr)optlenP,AppNetTimeout,&errno) + +#define listen(socket,queuelen) \ + NetLibSocketListen(AppNetRefnum, socket,queuelen,AppNetTimeout,&errno) + +#define read(socket,buffer,buflen) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,0,0,0,AppNetTimeout,&errno) + +#define recv(socket,buffer,buflen,flags) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,flags,0,0,AppNetTimeout,&errno) + +#define recvfrom(socket,buffer,buflen,flags,from,fromlen) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,flags,from,(WordPtr)fromlen,AppNetTimeout,&errno) + +#define recvmsg(socket,msg,flags) \ + NetLibReceivePB(AppNetRefnum, socket,(NetIOParamType*)msg,flags,AppNetTimeout,&errno) + +#define send(socket,buf,buflen,flags) \ + NetLibSend(AppNetRefnum, socket,buf,buflen,flags,0,0,AppNetTimeout,&errno) + +#define sendmsg(socket,msg,flags) \ + NetLibSendPB(AppNetRefnum, socket,(NetIOParamType*)msg,flags,AppNetTimeout,&errno) + +#define sendto(socket,buf,buflen,flags,to,tolen) \ + NetLibSend(AppNetRefnum, socket,buf,buflen,flags,to,tolen,AppNetTimeout,&errno) + +#define setsockopt(socket,level,opt,optvalP,optlen) \ + NetLibSocketOptionSet(AppNetRefnum, socket,level,opt,optvalP,optlen,AppNetTimeout,&errno) + +#define shutdown(socket,direction) \ + NetLibSocketShutdown(AppNetRefnum, socket,direction,AppNetTimeout,&errno) + +#define socket(domain,type,protocol) \ + NetLibSocketOpen(AppNetRefnum, domain,type,protocol,AppNetTimeout,&errno) + +#define write(socket,buf,buflen) \ + NetLibSend(AppNetRefnum, socket,(const VoidPtr)buf,buflen,0,0,0,AppNetTimeout,&errno) + +#define getpeername(socket,nameP,nameLenP) \ + NetLibSocketAddr(AppNetRefnum, socket, 0, 0, (NetSocketAddrType*)nameP, (SWordPtr)nameLenP, AppNetTimeout, &errno) + +#define getsockname(socket,nameP,nameLenP) \ + NetLibSocketAddr(AppNetRefnum, socket, (NetSocketAddrType*)nameP, (SWordPtr)nameLenP, 0, 0, AppNetTimeout, &errno) + + +//=========================================================================== +// Sockets API calls that go through glue +//=========================================================================== +SWord getdomainname(CharPtr nameP, SWord namelen); + +SWord setdomainname(CharPtr nameP, SWord namelen); + +SWord gethostname(CharPtr nameP, SWord namelen); + +SWord sethostname(CharPtr nameP, SWord namelen); + +SWord select(SWord width, fd_set* readfds, fd_set* writefds, + fd_set* exceptfds, struct timeval* timeout); + +SWord gettimeofday(struct timeval* tp, struct timezone* tzp); + +SWord settimeofday(struct timeval* tp, struct timezone* tzp); + + + +VoidPtr MemCalloc(DWord nmemb, DWord size); + +VoidPtr MemRealloc(VoidPtr p, DWord size); + + + +//=========================================================================== +// These are high level convenience functions. +//=========================================================================== +// Open up a TCP socket and connect to the given host. If port is 0, the port +// number will be looked up by the serviceName parameter. Returns socket +// descriptor or -1 on error +NetSocketRef NetUTCPOpen(CharPtr hostName, CharPtr serviceName, SWord port); + +// Read N bytes from a descriptor. This call automatically makes repeated read +// calls to the socket until all N bytes have been received +// Returns number of bytes read or -1 if error +SDWord NetUReadN(NetSocketRef fd, BytePtr bufP, DWord numBytes); + + +// Write N bytes to a descriptor. This call automatically makes repeated write +// calls to the socket until all N bytes have been sent +// Returns number of bytes written or -1 if error +SDWord NetUWriteN(NetSocketRef fd, BytePtr bufP, DWord numBytes); + + + + + +#endif /*!__SOCKET_H__*/ diff --git a/sdk-2/include/Core/System/Unix/sys_socketvar.h b/sdk-2/include/Core/System/Unix/sys_socketvar.h new file mode 100644 index 0000000..7375e95 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/sys_socketvar.h @@ -0,0 +1,39 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/socketvar.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +#ifndef __UNIXSOCKETVAR_H__ +#define __UNIXSOCKETVAR_H__ + + +/* + * Socket state bits. + */ +#define SS_NOFDREF 0x001 /* no file table ref any more */ +#define SS_ISCONNECTED 0x002 /* socket connected to a peer */ +#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */ +#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ +#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */ +#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ +#define SS_RCVATMARK 0x040 /* at mark on input */ + +#define SS_PRIV 0x080 /* privileged for broadcast, raw... */ +#define SS_NBIO 0x100 /* non-blocking ops */ +#define SS_ASYNC 0x200 /* async i/o notify */ +#define SS_PIPE 0x400 /* pipe behavior for POSIX & SVID */ + +#endif // __UNIXSOCKETVAR_H__ + + + + diff --git a/sdk-2/include/Core/System/Unix/sys_time.h b/sdk-2/include/Core/System/Unix/sys_time.h new file mode 100644 index 0000000..f970d57 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/sys_time.h @@ -0,0 +1,47 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/time.h + * AUTHOR: Ron Marianetti 5/23/96 + * + * DESCRIPTION: + * This module contains the equivalent of the unix header + * for use in Pilot applications that wish to use the Berkeley sockets API + * + **********************************************************************/ +#ifndef __UNIXTIME_H__ +#define __UNIXTIME_H__ + + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ + +struct timeval { + SDWord tv_sec; /* seconds */ + SDWord tv_usec; /* and microseconds */ +}; + + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ +#define DST_GB 7 /* Great Britain and Eire */ +#define DST_RUM 8 /* Rumania */ +#define DST_TUR 9 /* Turkey */ +#define DST_AUSTALT 10 /* Australian style with shift in 1986 */ + + +#endif __UNIXTIME_H__ diff --git a/sdk-2/include/Core/System/Unix/sys_types.h b/sdk-2/include/Core/System/Unix/sys_types.h new file mode 100644 index 0000000..bf86c6a --- /dev/null +++ b/sdk-2/include/Core/System/Unix/sys_types.h @@ -0,0 +1,61 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/types.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the Pilot equivalent of the "standard" unix + * header file + * + **********************************************************************/ +#ifndef __UNIXTYPES_H__ +#define __UNIXTYPES_H__ + +#include // Include Pilot Net Manager equates + + + +// Common Unix types +typedef Byte u_char; +typedef Word u_short; +typedef UInt u_int; +typedef DWord u_long; + +typedef Word ushort; /* System V compatibility */ +typedef UInt uint; /* System V compatibility */ + +typedef DWord size_t; // must be signed for some unix apps +#define __size_t__ + +#ifndef __DATETIME_H__ // avoid compiler warning +typedef DWord time_t; +#endif + +typedef Byte FILE; + +// File Descriptor Utilities, Pilot native forms in +typedef NetFDSetType fd_set; +#define FD_SETSIZE netFDSetSize + +#define FD_SET(n,p) netFDSet(n,p) +#define FD_CLR(n,p) netFDClr(n,p) +#define FD_ISSET(n,p) netFDIsSet(n,p) +#define FD_ZERO(p) netFDZero(p) + + +// Basic functions +#define bcopy(b1,b2,len) \ + MemMove(b2,b1,len) + +#define bzero(b,len) \ + MemSet(b,len,0) + +#define bcmp(b1,b2,len) \ + MemCmp(b1,b2,len) + + + +#endif //__UNIXTYPES_H__ diff --git a/sdk-2/include/Core/System/Unix/sys_uio.h b/sdk-2/include/Core/System/Unix/sys_uio.h new file mode 100644 index 0000000..cded0c2 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/sys_uio.h @@ -0,0 +1,33 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/uio.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)uio.h 2.9 89/06/27 SMI; from UCB 7.1 6/4/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ +#ifndef __UNIXUIO_H__ +#define __UNIXUIO_H__ + + +struct iovec { + BytePtr iov_base; + Word iov_len; +}; + + + +#endif /*__UNIXUIO_H__*/ + diff --git a/sdk-2/include/Core/System/Unix/unix_fcntl.h b/sdk-2/include/Core/System/Unix/unix_fcntl.h new file mode 100644 index 0000000..9b793d0 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/unix_fcntl.h @@ -0,0 +1,71 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/fcntl.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + +/* @(#)fcntlcom.h 1.13 91/06/18 SMI; from UCB fcntl.h 5.2 1/8/86 */ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __fcntl_h +#define __fcntl_h + +/* + * Rewack the FXXXXX values as _FXXXX so that _POSIX_SOURCE works. + */ +#define _FOPEN (-1) /* from sys/file.h, kernel use only */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FSETBLK 0x0010 /* use block offsets */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ +#define _FMARK 0x10000 /* internal; mark during gc() */ +#define _FDEFER 0x20000 /* internal; defer for next gc pass */ + + +/* + * Flags that work for fcntl(fd, F_SETFL, FXXXX) + */ +#define FAPPEND _FAPPEND +#define FSYNC _FSYNC +#define FASYNC _FASYNC +#define FNBIO _FNBIO +#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */ +#define FNDELAY _FNDELAY + + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags (close on exec) */ +#define F_SETFD 2 /* Set fildes flags (close on exec) */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ + +/* Prototypes */ +#define fcntl(a,b,c) NetFCntl(a,b,c) +SWord NetFCntl(SWord fd, SWord cmd, SWord arg); + +#endif /* !__fcntl_h */ diff --git a/sdk-2/include/Core/System/Unix/unix_netdb.h b/sdk-2/include/Core/System/Unix/unix_netdb.h new file mode 100644 index 0000000..dbcd4a4 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/unix_netdb.h @@ -0,0 +1,116 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: netdb.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + +/* @(#)netdb.h 1.11 88/08/19 SMI from UCB 5.9 4/5/88 */ +/* + * Copyright (c) 1980,1983,1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + + + +#ifndef __UNIXNETDB_H__ +#define __UNIXNETDB_H__ + + +/* + * Structures returned by network data base library. + * All addresses are supplied in host order, and + * returned in network order (suitable for use in system calls). + */ + +struct hostent { + Char *h_name; /* official name of host */ + Char **h_aliases; /* alias list */ + Word h_addrtype; /* host address type */ + Word h_length; /* length of address */ + Char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + Char *n_name; /* official name of net */ + Char **n_aliases; /* alias list */ + Word n_addrtype; /* net address type */ + DWord n_net; /* network # */ +}; + +struct servent { + Char *s_name; /* official service name */ + Char **s_aliases; /* alias list */ + Word s_port; /* port # */ + Char *s_proto; /* protocol to use */ +}; + +struct protoent { + Char *p_name; /* official protocol name */ + Char **p_aliases; /* alias list */ + Word p_proto; /* protocol # */ +}; + +struct rpcent { + Char *r_name; /* name of server for this rpc program */ + Char **r_aliases; /* alias list */ + SWord r_number; /* rpc program number */ +}; + + +// Supported calls +#define gethostbyname(nameP) \ + ((struct hostent*)NetLibGetHostByName(AppNetRefnum, nameP,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define gethostbyaddr(addr,len,type) \ + ((struct hostent*)NetLibGetHostByAddr(AppNetRefnum, (BytePtr)addr,len,type,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define getservbyname(serv,proto) \ + ((struct servent*)NetLibGetServByName(AppNetRefnum, serv,proto,&AppServInfo,AppNetTimeout,&h_errno)) + + +// Unsupported calls +// struct hostent *gethostent(); +// struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); +// struct servent *getservbyport(), *getservent(); +// struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); +// struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver) + */ + +extern Err h_errno; + +#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + + +#endif // __UNIXNETDB_H__ + + + diff --git a/sdk-2/include/Core/System/Unix/unix_stdarg.h b/sdk-2/include/Core/System/Unix/unix_stdarg.h new file mode 100644 index 0000000..6c107ef --- /dev/null +++ b/sdk-2/include/Core/System/Unix/unix_stdarg.h @@ -0,0 +1,28 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/stdarg.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + + +#ifndef __stdarg_h +#define __stdarg_h + +typedef char * va_list; // from + +#define __va_start(parm) (__std(va_list)) (&parm + 1) + +#define va_start(ap, parm) ap = __va_start(parm) +#define va_end(ap) + +#define va_arg(ap, type) (* (((type *) (ap += sizeof(type))) - 1) ) + +#endif /* !__stdarg_h */ diff --git a/sdk-2/include/Core/System/Unix/unix_stdio.h b/sdk-2/include/Core/System/Unix/unix_stdio.h new file mode 100644 index 0000000..aa581b1 --- /dev/null +++ b/sdk-2/include/Core/System/Unix/unix_stdio.h @@ -0,0 +1,73 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/stdio.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + + +#ifndef __stdio_h +#define __stdio_h + +#include + +#define EOF -1 +#define STDIN_FILENO sysFileDescStdIn + + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB + #define sprintf StrPrintF + #define vsprintf(x,y,z) StrVPrintF(x,(const CharPtr)y,z) + +#else + int vsprintf(char *, const char *, _Va_list); + +#endif + + + +// The following are macros that simply substitute an error code +// for functions which have no equivalent in the PilotOS. To +// ignore these, #define IGNORE_STDIO_STUBS ahead of this header +#ifndef IGNORE_STDIO_STUBS +#define stderr ((unsigned char*)-1) +#define stdout ((unsigned char*)-1) +#define stdin ((char*)-1) +#define STDOUT_FILENO -1 + +#define fclose(x) (-1) +#define fopen(x,y) (0) +#define tmpnam(x) (0) +#define S_ISREG(x) (0) + +#define fflush(x) 0 +#define fread(a,b,c,d) (0) +#define fwrite(a,b,c,d) (0) +#define ferror(x) (-1) + +#define unlink(s) (-1) +#define rmdir(x) (-1) +#define mkdir(x) (-1) +#define rename(x,y) (-1) +#define open(x,y) (-1) +#define getcwd(x,y) (0) + +#endif //IGNORE_STDIO_STUBS + + +// Function prototypes +int sscanf(const char *, const char *, ...); + + +#endif /* !__stdio_h */ diff --git a/sdk-2/include/Core/System/Unix/unix_stdlib.h b/sdk-2/include/Core/System/Unix/unix_stdlib.h new file mode 100644 index 0000000..8bf9b1d --- /dev/null +++ b/sdk-2/include/Core/System/Unix/unix_stdlib.h @@ -0,0 +1,32 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/stdio.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + + +#ifndef __stdlib_h +#define __stdlib_h + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB +#define malloc(x) MemPtrNew(x) +#define calloc(x,y) MemCalloc(x,y) +#define realloc(x,y) MemRealloc(x,y) +#define free(x) MemPtrFree(x) +#define atoi(x) StrAToI(x) +#define atol(x) StrAToI(x) +#endif + +#endif /* !__stdlib_h */ diff --git a/sdk-2/include/Core/System/Unix/unix_string.h b/sdk-2/include/Core/System/Unix/unix_string.h new file mode 100644 index 0000000..1fe29ad --- /dev/null +++ b/sdk-2/include/Core/System/Unix/unix_string.h @@ -0,0 +1,37 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/string.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + + +#ifndef __string_h +#define __string_h + +#include + + +#define strcpy(x,y) StrCopy((Char*)x,(Char*)y) +#define strncpy(x,y,z) StrNCopy(x,y,z) +#define strcmp(x,y) StrCompare(x,y) +#define strcat(x,y) StrCat(x,y) +#define strlen(x) StrLen((Char*)x) +#define strchr(x,y) StrChr(x,y) +#define strstr(x,y) StrStr(x,y) + +#define memcpy(x,y,z) (MemMove(x,(VoidPtr)y,z) ? x : x) +#define memset(x,y,z) (MemSet(x,z,y)) +#define memcmp(x,y,z) (MemCmp(x,y,z)) +#define index(x,y) StrChr(x,y) + + + +#endif /* !__string_h */ diff --git a/sdk-2/include/Core/UI/AboutBox.h b/sdk-2/include/Core/UI/AboutBox.h new file mode 100644 index 0000000..28cf155 --- /dev/null +++ b/sdk-2/include/Core/UI/AboutBox.h @@ -0,0 +1,23 @@ +/*********************************************************************** + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: AboutBox.h + * AUTHOR: Christopher Raff: October 25th, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines About Box routines + * + ***********************************************************************/ +#ifndef __ABOUTBOX_H__ +#define __ABOUTBOX_H__ + + +extern void AbtShowAbout (DWord creator) + SYS_TRAP(sysTrapAbtShowAbout); + + +#endif // __ABOUTBOX_H__ diff --git a/sdk-2/include/Core/UI/Category.h b/sdk-2/include/Core/UI/Category.h new file mode 100644 index 0000000..de12c6d --- /dev/null +++ b/sdk-2/include/Core/UI/Category.h @@ -0,0 +1,86 @@ +/*********************************************************************** + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: Category.h + * AUTHOR: Art Lamb: March 7, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines category structures and routines. + * + ***********************************************************************/ +#ifndef __CATEGORY_H__ +#define __CATEGORY_H__ + + +typedef struct { + Word renamedCategories; + Char categoryLabels [dmRecNumCategories] [dmCategoryLength]; + Byte categoryUniqIDs[dmRecNumCategories]; + Byte lastUniqID; // Uniq IDs generated by the device are between + // 0 - 127. Those from the PC are 128 - 255. +} AppInfoType; + +typedef AppInfoType * AppInfoPtr; + + + +extern void CategoryCreateListV10 (DmOpenRef db, ListPtr lst, + Word currentCategory, Boolean showAll) + SYS_TRAP(sysTrapCategoryCreateListV10); + +extern void CategoryCreateList (DmOpenRef db, ListPtr listP, + Word currentCategory, Boolean showAll, + Boolean showUneditables, Byte numUneditableCategories, + DWord editingStrID, Boolean resizeList) + SYS_TRAP(sysTrapCategoryCreateList); + + +extern void CategoryFreeListV10 (DmOpenRef db, ListPtr lst) + SYS_TRAP(sysTrapCategoryFreeListV10); + +extern void CategoryFreeList (DmOpenRef db, ListPtr listP, + Boolean showAll, DWord editingStrID) + SYS_TRAP(sysTrapCategoryFreeList); + +extern Word CategoryFind (DmOpenRef db, CharPtr name) + SYS_TRAP(sysTrapCategoryFind); + +extern void CategoryGetName (DmOpenRef db, Word index, CharPtr name) + SYS_TRAP(sysTrapCategoryGetName); + +extern Boolean CategoryEditV10 (DmOpenRef db, WordPtr category) + SYS_TRAP(sysTrapCategoryEditV10); + +extern Boolean CategoryEdit (DmOpenRef db, WordPtr category, DWord titleStrID) + SYS_TRAP(sysTrapCategoryEdit); + +extern Boolean CategorySelectV10 (DmOpenRef db, FormPtr frm, Word ctlID, + Word lstID, Boolean title, WordPtr categoryP, CharPtr categoryName) + SYS_TRAP(sysTrapCategorySelectV10); + +extern Boolean CategorySelect (DmOpenRef db, FormPtr frm, Word ctlID, + Word lstID, Boolean title, WordPtr categoryP, CharPtr categoryName, + Byte numUneditableCategories, DWord editingStrID) + SYS_TRAP(sysTrapCategorySelect); + +extern Word CategoryGetNext (DmOpenRef db, Word index) + SYS_TRAP(sysTrapCategoryGetNext); + +extern void CategorySetTriggerLabel (ControlPtr ctl, CharPtr name) + SYS_TRAP(sysTrapCategorySetTriggerLabel); + +extern void CategoryTruncateName (CharPtr name, Word maxWidth) + SYS_TRAP(sysTrapCategoryTruncateName); + +extern void CategoryInitialize (AppInfoPtr appInfoP, Word localizedAppInfoStrID) + SYS_TRAP(sysTrapCategoryInitialize); + + +extern void CategorySetName (DmOpenRef db, Word index, CharPtr nameP) + SYS_TRAP(sysTrapCategorySetName); + +#endif // __CATEGORY_H__ diff --git a/sdk-2/include/Core/UI/CharAttr.h b/sdk-2/include/Core/UI/CharAttr.h new file mode 100644 index 0000000..41c1645 --- /dev/null +++ b/sdk-2/include/Core/UI/CharAttr.h @@ -0,0 +1,60 @@ +/*********************************************************************** + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: CharAttr.h + * AUTHOR: Art Lamb: April 21, 1995 + * + * DECLARER: Toolbox + * + * DESCRIPTION: + * This file defines character classification and character + * conversion macros + * + **********************************************************************/ + +#ifndef _CHAR_ATTR_H +#define _CHAR_ATTR_H + +// Character attribute code bits +#define _XA 0x200 // extra alphabetic +#define _XS 0x100 // extra space +#define _BB 0x80 // BEL, BS, etc. +#define _CN 0x40 // CR, FF, HT, NL, VT +#define _DI 0x20 // '0'-'9' +#define _LO 0x10 // 'a'-'z' and lowercase extended chars. +#define _PU 0x08 // punctuation +#define _SP 0x04 // space +#define _UP 0x02 // 'A'-'Z' and uppercase extended chars. +#define _XD 0x01 // '0'-'9', 'A'-'F', 'a'-'f' + + +// Character classification macros. +// If these are used to test characters from events (keyDownEvent) +// IsAscii should be used first. +#define IsAscii(c) (c <= 255) +#define IsAlNum(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_UP|_XA)) +#define IsAlpha(attr,c) (attr[(Byte)(c)] & (_LO|_UP|_XA)) +#define IsCntrl(attr,c) (attr[(Byte)(c)] & (_BB|_CN)) +#define IsDigit(attr,c) (attr[(Byte)(c)] & _DI) +#define IsGraph(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_PU|_UP|_XA)) +#define IsLower(attr,c) (attr[(Byte)(c)] & _LO) +#define IsPrint(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_PU|_SP|_UP|_XA)) +#define IsPunct(attr,c) (attr[(Byte)(c)] & _PU) +#define IsSpace(attr,c) (attr[(Byte)(c)] & (_CN|_SP|_XS)) +#define IsUpper(attr,c) (attr[(Byte)(c)] & _UP) +#define IsHex(attr,c) (attr[(Byte)(c)] & _XD) +#define IsDelim(attr,c) (attr[(Byte)(c)] & _SP|_PU) + + +WordPtr GetCharAttr (void) + SYS_TRAP(sysTrapGetCharAttr); + +BytePtr GetCharSortValue (void) + SYS_TRAP(sysTrapGetCharSortValue); + +BytePtr GetCharCaselessValue (void) + SYS_TRAP(sysTrapGetCharCaselessValue); + +#endif /* _CHAR_ATTR_H */ diff --git a/sdk-2/include/Core/UI/Chars.h b/sdk-2/include/Core/UI/Chars.h new file mode 100644 index 0000000..c14a112 --- /dev/null +++ b/sdk-2/include/Core/UI/Chars.h @@ -0,0 +1,268 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: Chars.h + * AUTHOR: Roger Flores: November 3, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the characters in fonts. + * + **********************************************************************/ +#ifndef __CHARS_H__ +#define __CHARS_H__ + + +// Special characters +#define downArrowChr 0x1F +#define upArrowChr 0x1E +#define leftArrowChr 0x1C +#define rightArrowChr 0x1D + + +// The hardware arrow buttons generate the following Chr codes. +#define pageUpChr 0x0B +#define pageDownChr 0x0C + + +// The following are key codes used for virtual events, like +// low battery warnings, etc. These keyboard events MUST +// have the commandKeyMask bit set in the modifiers in order +// to be recognized. +#define lowBatteryChr 0x0101 // Display low battery dialog +#define enterDebuggerChr 0x0102 // Enter Debugger +#define nextFieldChr 0x0103 // Go to next field in form +#define startConsoleChr 0x0104 // Startup console task +#define menuChr 0x0105 // Ctl-A +#define commandChr 0x0106 // Ctl-C +#define confirmChr 0x0107 // Ctl-D +#define launchChr 0x0108 // Ctl-E +#define keyboardChr 0x0109 // Ctl-F popup the keyboard in appropriate mode +#define findChr 0x010A +#define calcChr 0x010B +#define prevFieldChr 0x010C +#define alarmChr 0x010D // sent before displaying an alarm +#define ronamaticChr 0x010E // stroke from graffiti area to top half of screen +#define graffitiReferenceChr 0x010F // popup the Graffiti reference +#define keyboardAlphaChr 0x0110 // popup the keyboard in alpha mode +#define keyboardNumericChr 0x0111 // popup the keyboard in number mode +#define lockChr 0x0112 // switch to the Security app and lock the device +#define backlightChr 0x0113 // toggle state of backlight +#define autoOffChr 0x0114 // power off due to inactivity timer + +// The Application launching buttons generate the following +// key codes and will also set the commandKeyMask bit in the +// modifiers field +#define hardKeyMin 0x0200 +#define hardKeyMax 0x02FF +#define hard1Chr 0x0204 +#define hard2Chr 0x0205 +#define hard3Chr 0x0206 +#define hard4Chr 0x0207 +#define hardPowerChr 0x0208 +#define hardCradleChr 0x0209 // Button on cradle pressed +#define hardCradle2Chr 0x020A // Button on cradle pressed and hwrDockInGeneric1 + // input on dock asserted (low). + +#define ChrIsHardKey(c) (((c >= hardKeyMin) && (c <= hardKeyMax)) || c == calcChr) + +// Characters from all text fonts. Resource ID's 9000, 9001, 9002 +#define nullChr 0x00 +#define backspaceChr 0x08 +#define tabChr 0x09 +#define linefeedChr 0x0A +#define crChr 0x0D +#define colonChr ':' +#define periodChr '.' +#define commaChr ',' +#define quoteChr '"' + +#define returnChr 0x0D +#define escapeChr 0x1B +#define spaceChr 0x20 +#define lastAsciiChr 0xFF + +#define numericSpaceChr 0x80 + + +#define cutChr 0x12D // Ctl-X +#define copyChr 0x12E // Ctl-C +#define pasteChr 0x12F // Ctl-V + + +// Extended characters for Windows Code Page 1252 +#define lowSingleCommaQuoteChr 0x82 +#define scriptFChr 0x83 +#define lowDblCommaQuoteChr 0x84 +#define horizEllipsisChr 0x85 +#define daggerChr 0x86 +#define dblDaggerChr 0x87 +#define circumflexChr 0x88 +#define perMilleChr 0x89 +#define upSHacekChr 0x8A +#define leftSingleGuillemetChr 0x8B +#define upOEChr 0x8C +#define diamondChr 0x8D // These 4 are not actually in the + // windows code page, but we like 'em + // anyway. +#define clubChr 0x8E +#define heartChr 0x8F +#define spadeChr 0x90 +#define singleOpenCommaQuoteChr 0x91 +#define singleCloseCommaQuoteChr 0x92 +#define dblOpenCommaQuoteChr 0x93 +#define dblCloseCommaQuoteChr 0x94 +#define bulletChr 0x95 +#define enDashChr 0x96 +#define emDashChr 0x97 +#define spacingTildeChr 0x98 +#define trademarkChr 0x99 +#define lowSHacekChr 0x9A +#define rightSingleGuillemetChr 0x9B +#define lowOEChr 0x9C +#define commandStrokeChr 0x9D +#define shortcutStrokeChr 0x9E +#define upYDiaeresisChr 0x9F +#define nonBreakSpaceChr 0xA0 +#define invertedExclamationChr 0xA1 +#define centChr 0xA2 +#define poundChr 0xA3 +#define currencyChr 0xA4 +#define yenChr 0xA5 +#define brokenVertBarChr 0xA6 +#define sectionChr 0xA7 +#define spacingDiaeresisChr 0xA8 +#define copyrightChr 0xA9 +#define feminineOrdinalChr 0xAA +#define leftGuillemetChr 0xAB +#define notChr 0xAC +#define softHyphenChr 0xAD +#define registeredChr 0xAE +#define spacingMacronChr 0xAF +#define degreeChr 0xB0 +#define plusMinusChr 0xB1 +#define superscript2Chr 0xB2 +#define superscript3Chr 0xB3 +#define spacingAcuteChr 0xB4 +#define microChr 0xB5 +#define paragraphChr 0xB6 +#define middleDotChr 0xB7 +#define spacingCedillaChr 0xB8 +#define superscript1Chr 0xB9 +#define masculineOrdinalChr 0xBA +#define rightGuillemetChr 0xBB +#define fractOneQuarterChr 0xBC +#define fractOneHalfChr 0xBD +#define fractThreeQuartersChr 0xBE +#define invertedQuestionChr 0xBF +#define upAGraveChr 0xC0 +#define upAAcuteChr 0xC1 +#define upACircumflexChr 0xC2 +#define upATildeChr 0xC3 +#define upADiaeresisChr 0xC4 +#define upARingChr 0xC5 +#define upAEChr 0xC6 +#define upCCedillaChr 0xC7 +#define upEGraveChr 0xC8 +#define upEAcuteChr 0xC9 +#define upECircumflexChr 0xCA +#define upEDiaeresisChr 0xCB +#define upIGraveChr 0xCC +#define upIAcuteChr 0xCD +#define upICircumflexChr 0xCE +#define upIDiaeresisChr 0xCF +#define upEthChr 0xD0 +#define upNTildeChr 0xD1 +#define upOGraveChr 0xD2 +#define upOAcuteChr 0xD3 +#define upOCircumflexChr 0xD4 +#define upOTildeChr 0xD5 +#define upODiaeresisChr 0xD6 +#define multiplyChr 0xD7 +#define upOSlashChr 0xD8 +#define upUGraveChr 0xD9 +#define upUAcuteChr 0xDA +#define upUCircumflexChr 0xDB +#define upUDiaeresisChr 0xDC +#define upYAcuteChr 0xDD +#define upThorn 0xDE +#define lowSharpSChr 0xDF +#define lowAGraveChr 0xE0 +#define lowAAcuteChr 0xE1 +#define lowACircumflexChr 0xE2 +#define lowATildeChr 0xE3 +#define lowADiaeresisChr 0xE4 +#define lowARingChr 0xE5 +#define lowAEChr 0xE6 +#define lowCCedillaChr 0xE7 +#define lowEGraveChr 0xE8 +#define lowEAcuteChr 0xE9 +#define lowECircumflexChr 0xEA +#define lowEDiaeresisChr 0xEB +#define lowIGraveChr 0xEC +#define lowIAcuteChr 0xED +#define lowICircumflexChr 0xEE +#define lowIDiaeresisChr 0xEF +#define lowEthChr 0xF0 +#define lowNTildeChr 0xF1 +#define lowOGraveChr 0xF2 +#define lowOAcuteChr 0xF3 +#define lowOCircumflexChr 0xF4 +#define lowOTildeChr 0xF5 +#define lowODiaeresisChr 0xF6 +#define divideChr 0xF7 +#define lowOSlashChr 0xF8 +#define lowUGraveChr 0xF9 +#define lowUAcuteChr 0xFA +#define lowUCircumflexChr 0xFB +#define lowUDiaeresisChr 0xFC +#define lowYAcuteChr 0xFD +#define lowThorn 0xFE +#define lowYDiaeresisChr 0xFF + + +// Characters in the 9 point symbol font. Resource ID 9003 +enum symbolChars { + symbolLeftArrow = 3, + symbolRightArrow, + symbolUpArrow, + symbolDownArrow, + symbolSmallDownArrow, + symbolSmallUpArrow, + symbolMemo = 9, + symbolHelp, + symbolNote, + symbolNoteSelected, + symbolCapsLock, + symbolNumLock, + symbolShiftUpper, + symbolShiftPunc, + symbolShiftExt, + symbolShiftNone, + symbolNoTime, + symbolAlarm, + symbolRepeat, + symbolCheckMark + }; + +// Character in the 7 point symbol font. Resource ID 9005 +enum symbol7Chars { + symbol7ScrollUp = 1, + symbol7ScrollDown, + symbol7ScrollUpDisabled, + symbol7ScrollDownDisabled + }; + +// Characters in the 11 point symbol font. Resource ID 9004 +enum symbol11Chars { + symbolCheckboxOff = 0, + symbolCheckboxOn, + symbol11LeftArrow, + symbol11RightArrow + }; + + +#endif // __CHARS_H__ diff --git a/sdk-2/include/Core/UI/ClipBoard.h b/sdk-2/include/Core/UI/ClipBoard.h new file mode 100644 index 0000000..2995bcd --- /dev/null +++ b/sdk-2/include/Core/UI/ClipBoard.h @@ -0,0 +1,45 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: clipBoard.h + * AUTHOR: Art Lamb: September 1, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines clipboard structures and routines. + * + ***********************************************************************/ + +#ifndef __CLIPBOARD_H__ +#define __CLIPBOARD_H__ + + +#define numClipboardForamts 3 +#define cbdMaxTextLength 1000 + + +// Clipboard standard formats +enum clipboardFormats { clipboardText, clipboardInk, clipboardBitmap }; + +typedef enum clipboardFormats ClipboardFormatType; + +typedef struct { + VoidHand item; + Word length; +} ClipboardItem; + +//---------------------------------------------------------- +// Clipboard Functions +//---------------------------------------------------------- + +extern void ClipboardAddItem + (ClipboardFormatType format, VoidPtr ptr, Word length) + SYS_TRAP(sysTrapClipboardAddItem); + +extern VoidHand ClipboardGetItem (ClipboardFormatType format, WordPtr length) + SYS_TRAP(sysTrapClipboardGetItem); + +#endif // __CLIPBOARD_H__ diff --git a/sdk-2/include/Core/UI/Control.h b/sdk-2/include/Core/UI/Control.h new file mode 100644 index 0000000..b4fcc6d --- /dev/null +++ b/sdk-2/include/Core/UI/Control.h @@ -0,0 +1,110 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: Control.h + * AUTHOR: Art Lamb: August 29, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines check box structures and routines. + * + ***********************************************************************/ +#ifndef __CONTROL_H__ +#define __CONTROL_H__ + + + +typedef struct { + Byte usable :1; // set if part of ui + Byte enabled :1; // set if interactable (not grayed out) + Byte visible :1; // set if drawn (set internally) + Byte on :1; // set if on (checked) + Byte leftAnchor :1; // set if bounds expand to the right + // clear if bounds expand to the left + Byte frame :3; +} ControlAttrType; + + +enum controlStyles {buttonCtl, pushButtonCtl, checkboxCtl, popupTriggerCtl, + selectorTriggerCtl, repeatingButtonCtl}; +typedef enum controlStyles ControlStyleType; + +enum buttonFrames {noButtonFrame, standardButtonFrame, boldButtonFrame, + rectangleButtonFrame}; +typedef enum buttonFrames ButtonFrameType; + + +typedef struct { + Word id; + RectangleType bounds; + CharPtr text; + ControlAttrType attr; + ControlStyleType style; + FontID font; + Byte group; +} ControlType; + + +typedef ControlType * ControlPtr; + + + +//---------------------------------------------------------- +// Control Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CtlDrawControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlDrawControl); + +extern void CtlEraseControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlEraseControl); + +extern void CtlHideControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlHideControl); + +extern void CtlShowControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlShowControl); + +extern Boolean CtlEnabled (ControlPtr pControl) + SYS_TRAP(sysTrapCtlEnabled); + +extern void CtlSetEnabled (ControlPtr pControl, Boolean usable) + SYS_TRAP(sysTrapCtlSetEnabled); + +extern void CtlSetUsable (ControlPtr pControl, Boolean usable) + SYS_TRAP(sysTrapCtlSetUsable); + +extern SWord CtlGetValue (ControlPtr pControl) + SYS_TRAP(sysTrapCtlGetValue); + +extern void CtlSetValue (ControlPtr pControl, SWord newValue) + SYS_TRAP(sysTrapCtlSetValue); + +extern CharPtr CtlGetLabel (ControlPtr pControl) + SYS_TRAP(sysTrapCtlGetLabel); + +extern void CtlSetLabel (ControlPtr pControl, CharPtr newLabel) + SYS_TRAP(sysTrapCtlSetLabel); + +extern void CtlHitControl (ControlPtr pControl) + SYS_TRAP(sysTrapCtlHitControl); + +extern Boolean CtlHandleEvent (ControlPtr pControl, EventPtr pEvent) + SYS_TRAP(sysTrapCtlHandleEvent); + +#ifdef __cplusplus +} +#endif + + +#endif //__CONTROL_H__ + + + diff --git a/sdk-2/include/Core/UI/Day.h b/sdk-2/include/Core/UI/Day.h new file mode 100644 index 0000000..b1a79a0 --- /dev/null +++ b/sdk-2/include/Core/UI/Day.h @@ -0,0 +1,52 @@ +/*********************************************************************** + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: Day.h + * AUTHOR: Roger Flores: May 31, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the date picker month object's structures + * and routines. + * + ***********************************************************************/ +#ifndef __DAY_H__ +#define __DAY_H__ + + +#include + +typedef enum + { + selectDayByDay, // return d/m/y + selectDayByWeek, // return d/m/y with d as same day of the week + selectDayByMonth // return d/m/y with d as same day of the month + } SelectDayType; + +typedef struct + { + RectangleType bounds; + Boolean visible; + SWord visibleMonth; // month actually displayed + SWord visibleYear; // year actually displayed + DateTimeType selected; + SelectDayType selectDayBy; + } DaySelectorType; + +typedef DaySelectorType * DaySelectorPtr; + + +void DayDrawDaySelector (DaySelectorPtr pSelector) + SYS_TRAP(sysTrapDayDrawDaySelector); + +Boolean DayHandleEvent (DaySelectorPtr pSelector, EventPtr pEvent) + SYS_TRAP(sysTrapDayHandleEvent); + +void DayDrawDays (DaySelectorPtr pSelector) + SYS_TRAP(sysTrapDayDrawDays); + + +#endif //__DAY_H__ diff --git a/sdk-2/include/Core/UI/Event.h b/sdk-2/include/Core/UI/Event.h new file mode 100644 index 0000000..cc7c170 --- /dev/null +++ b/sdk-2/include/Core/UI/Event.h @@ -0,0 +1,334 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: Event.h + * AUTHOR: Art Lamb: September 26, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines window structures and routines. + * + **********************************************************************/ + +#ifndef __EVENT_H__ +#define __EVENT_H__ + + +// Types of events +enum events { + nilEvent = 0, + penDownEvent, + penUpEvent, + penMoveEvent, + keyDownEvent, + winEnterEvent, + winExitEvent, + ctlEnterEvent, + ctlExitEvent, + ctlSelectEvent, + ctlRepeatEvent, + lstEnterEvent, + lstSelectEvent, + lstExitEvent, + popSelectEvent, + fldEnterEvent, + fldHeightChangedEvent, + fldChangedEvent, + tblEnterEvent, + tblSelectEvent, + daySelectEvent, + menuEvent, + appStopEvent, + frmLoadEvent, + frmOpenEvent, + frmGotoEvent, + frmUpdateEvent, + frmSaveEvent, + frmCloseEvent, + frmTitleEnterEvent, + frmTitleSelectEvent, + tblExitEvent, + sclEnterEvent, + sclExitEvent, + sclRepeatEvent, + + firstUserEvent = 32767 +}; + +// keyDownEvent modifers +#define shiftKeyMask 0x0001 +#define capsLockMask 0x0002 +#define numLockMask 0x0004 +#define commandKeyMask 0x0008 +#define optionKeyMask 0x0010 +#define controlKeyMask 0x0020 +#define autoRepeatKeyMask 0x0040 // True if generated due to auto-repeat +#define doubleTapKeyMask 0x0080 // True if this is a double-tap event +#define poweredOnKeyMask 0x0100 // True if this is a double-tap event + + +// Event timeouts +#define evtWaitForever -1 + + +// The event record. +typedef struct { + enum events eType; + Boolean penDown; + SWord screenX; + SWord screenY; + union data { + struct generic { + Word data1; + Word data2; + Word data3; + Word data4; + Word data5; + Word data6; + Word data7; + Word data8; + } generic; + + struct { + PointType start; // display coord. of stroke start + PointType end; // display coord. of stroke start + } penUp; + + struct { + Word chr; // ascii code + Word keyCode; // virtual key code + Word modifiers; + } keyDown; + + struct winEnter { + WinHandle enterWindow; + WinHandle exitWindow; + } winEnter; + + struct winExit { + WinHandle enterWindow; + WinHandle exitWindow; + } winExit; + + struct ctlEnter { + Word controlID; + void * pControl; + } ctlEnter; + + struct ctlSelect { + Word controlID; + void * pControl; + Boolean on; + } ctlSelect; + + struct ctlRepeat { + Word controlID; + void * pControl; + DWord time; + } ctlRepeat; + + struct fldEnter { + Word fieldID; + void * pField; + } fldEnter; + + struct fldHeightChanged { + Word fieldID; + void * pField; + Word newHeight; + Word currentPos; + } fldHeightChanged; + + struct fldChanged { + Word fieldID; + void * pField; + } fldChanged; + + struct fldExit { + Word fieldID; + void * pField; + } fldExit; + + struct lstEnter { + Word listID; + void * pList; + Word selection; + } lstEnter; + + struct lstExit { + Word listID; + void * pList; + } lstExit; + + struct lstSelect { + Word listID; + void * pList; + Word selection; + } lstSelect; + + struct tblEnter { + Word tableID; + void * pTable; + Word row; + Word column; + } tblEnter; + + struct tblExit { + Word tableID; + void * pTable; + Word row; + Word column; + } tblExit; + + struct tblSelect { + Word tableID; + void * pTable; + Word row; + Word column; + } tblSelect; + + struct frmLoad { + Word formID; + } frmLoad; + + struct frmOpen { + Word formID; + } frmOpen; + + struct frmGoto { + Word formID; + Word recordNum; // index of record that contain a match + Word matchPos; // postion in record of the match. + Word matchLen; // length of match. + Word matchFieldNum; // field number string was found int + DWord matchCustom; // application specific info + } frmGoto; + + struct frmClose { + Word formID; + } frmClose; + + struct frmUpdate { + Word formID; + Word updateCode; // Application specific + } frmUpdate; + + struct frmTitleEnter { + Word formID; + } frmTitleEnter; + + struct frmTitleSelect { + Word formID; + } frmTitleSelect; + + struct daySelect { + void * pSelector; + Word selection; + Boolean useThisDate; + } daySelect; + + struct menu { + Word itemID; + } menu; + + struct popSelect { + Word controlID; + void * controlP; + Word listID; + void * listP; + Word selection; + Word priorSelection; + } popSelect; + + struct sclEnter { + Word scrollBarID; + void * pScrollBar; + } sclEnter; + + struct sclExit { + Word scrollBarID; + void * pScrollBar; + Short value; + Short newValue; + } sclExit; + + struct sclRepeat { + Word scrollBarID; + void * pScrollBar; + Short value; + Short newValue; + Long time; + } sclRepeat; + + + } data; + +} EventType; + +typedef EventType * EventPtr; + + +// Events are stored in the event queue with some extra fields: +typedef struct { + EventType event; + DWord id; // used to support EvtAddUniqueEvent + } EventStoreType; + + +//--------------------------------------------------------------------- +// Event Functions +//--------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +void EvtInitialize (void) + SYS_TRAP(sysTrapEvtInitialize); + +void EvtAddEventToQueue (EventPtr event) + SYS_TRAP(sysTrapEvtAddEventToQueue); + +void EvtAddUniqueEventToQueue(EventPtr eventP, DWord id, Boolean inPlace) + SYS_TRAP(sysTrapEvtAddUniqueEventToQueue); + +void EvtCopyEvent (EventPtr source, EventPtr dest) + SYS_TRAP(sysTrapEvtCopyEvent); + +void EvtGetEvent (EventPtr event, SDWord timeout) + SYS_TRAP(sysTrapEvtGetEvent); + +Boolean EvtEventAvail (void) + SYS_TRAP(sysTrapEvtEventAvail); + +void EvtGetPen(SWord *pScreenX, SWord *pScreenY, Boolean *pPenDown) + SYS_TRAP(sysTrapEvtGetPen); + +#ifdef __cplusplus +} +#endif + + +// For Compatibility.. DOLATER... source modules should use EvtGetPen instead. +#define PenGetPoint(a,b,c) EvtGetPen(a,b,c) + + +// zzz make into a routine +#define EvtSetNullEventTick(tick) \ + if (NeedNullTickCount == 0 || \ + NeedNullTickCount > tick || \ + NeedNullTickCount <= TimGetTicks ()) \ + NeedNullTickCount = tick; + + + +#endif // __EVENT_H__ + + + + + + diff --git a/sdk-2/include/Core/UI/Field.h b/sdk-2/include/Core/UI/Field.h new file mode 100644 index 0000000..d8b054b --- /dev/null +++ b/sdk-2/include/Core/UI/Field.h @@ -0,0 +1,259 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: field.h + * AUTHOR: Art Lamb: August 29, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines field structures and routines. + * + ***********************************************************************/ +#ifndef __FIELD_H__ +#define __FIELD_H__ + +#define maxFieldTextLen 0x7fff + +// Maximun number of line the a dynamicly sizing field will expand to. +#define maxFieldLines 11 + + +// kind alignment values +#define leftAlign 0 +#define centerAlign 1 +#define rightAlign 2 + + +#define undoBufferSize 100 + +typedef enum { undoNone, undoTyping, undoBackspace, undoDelete, + undoPaste, undoCut } UndoMode; + +typedef struct { + UndoMode mode; + Word start; + Word end; + Word bufferLen; + CharPtr buffer; + } FieldUndoType; + + +typedef struct { + Word usable :1; // Set if part of ui + Word visible :1; // Set if drawn, used internally + Word editable :1; // Set if editable + Word singleLine :1; // Set if only a single line is displayed + Word hasFocus :1; // Set if the field has the focus + Word dynamicSize :1; // Set if height expands as text is entered + Word insPtVisible :1; // Set if the ins pt is scolled into view + Word dirty :1; // Set if user modified + Word underlined :2; // text underlined mode + Word justification :2; // text alignment + Word autoShift :1; // Set if auto case shift + Word hasScrollBar :1; // Set if the field has a scroll bar + Word numeric :1; // Set if numeric, digits and secimal separator only +} FieldAttrType; + +typedef FieldAttrType * FieldAttrPtr; + +typedef struct { + Word start; // position in text string of first char. + Word length; // number of character in the line +} LineInfoType; + +typedef LineInfoType * LineInfoPtr; + + +typedef struct { + Word id; + RectangleType rect; + FieldAttrType attr; + CharPtr text; // pointer to the start of text string + VoidHand textHandle; // block the contains the text string + LineInfoPtr lines; + Word textLen; + Word textBlockSize; + Word maxChars; + Word selFirstPos; + Word selLastPos; + Word insPtXPos; + Word insPtYPos; + FontID fontID; +} FieldType; + + +typedef FieldType * FieldPtr; + +//--------------------------------------------------------------------- +// Field Functions +//--------------------------------------------------------------------- + +extern void FldCopy (FieldPtr fld) + SYS_TRAP(sysTrapFldCopy); + +extern void FldCut (FieldPtr fld) + SYS_TRAP(sysTrapFldCut); + +extern void FldDrawField (FieldPtr fld) + SYS_TRAP(sysTrapFldDrawField); + +extern void FldEraseField (FieldPtr fld) + SYS_TRAP(sysTrapFldEraseField); + +extern void FldFreeMemory (FieldPtr fld) + SYS_TRAP(sysTrapFldFreeMemory); + +extern void FldGetBounds (FieldPtr fld, RectanglePtr rect) + SYS_TRAP(sysTrapFldGetBounds); + +extern FontID FldGetFont (FieldPtr fld) + SYS_TRAP(sysTrapFldGetFont); + +extern void FldGetSelection (FieldPtr fld, WordPtr startPosition, + WordPtr endPosition) + SYS_TRAP(sysTrapFldGetSelection); + +extern Handle FldGetTextHandle (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextHandle); + +extern CharPtr FldGetTextPtr (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextPtr); + +extern Boolean FldHandleEvent (FieldPtr fld, EventPtr pEvent) + SYS_TRAP(sysTrapFldHandleEvent); + +extern void FldPaste (FieldPtr fld) + SYS_TRAP(sysTrapFldPaste); + +extern void FldRecalculateField (FieldPtr fld, Boolean redraw) + SYS_TRAP(sysTrapFldRecalculateField); + +extern void FldSetBounds (FieldPtr fld, RectanglePtr rect) + SYS_TRAP(sysTrapFldSetBounds); + +extern void FldSetFont (FieldPtr fld, FontID fontID) + SYS_TRAP(sysTrapFldSetFont); + +extern void FldSetText (FieldPtr fld, VoidHand textHandle, Word offset, + Word size) + SYS_TRAP(sysTrapFldSetText); + +extern void FldSetTextHandle (FieldPtr fld, Handle textHandle) + SYS_TRAP(sysTrapFldSetTextHandle); + +extern void FldSetTextPtr (FieldPtr fld, CharPtr textP) + SYS_TRAP(sysTrapFldSetTextPtr); + +extern void FldSetUsable (FieldPtr fld, Boolean usable) + SYS_TRAP(sysTrapFldSetUsable); + +extern void FldSetSelection (FieldPtr fld, Word startPosition, + Word endPosition) + SYS_TRAP(sysTrapFldSetSelection); + +extern void FldGrabFocus (FieldPtr fld) + SYS_TRAP(sysTrapFldGrabFocus); + +extern void FldReleaseFocus (FieldPtr fld) + SYS_TRAP(sysTrapFldReleaseFocus); + + +extern Word FldGetInsPtPosition (FieldPtr fld) + SYS_TRAP(sysTrapFldGetInsPtPosition); + +extern void FldSetInsPtPosition (FieldPtr fld, Word pos) + SYS_TRAP(sysTrapFldSetInsPtPosition); + +extern void FldSetInsertionPoint (FieldPtr fld, Word pos) + SYS_TRAP(sysTrapFldSetInsertionPoint); + +extern Word FldGetScrollPosition (FieldPtr fld) + SYS_TRAP(sysTrapFldGetScrollPosition); + +extern void FldSetScrollPosition (FieldPtr fld, Word pos) + SYS_TRAP(sysTrapFldSetScrollPosition); + +extern void FldGetScrollValues (FieldPtr fld, WordPtr scrollPosP, + WordPtr textHeightP, WordPtr fieldHeightP) + SYS_TRAP(sysTrapFldGetScrollValues); + + +extern Word FldGetTextLength (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextLength); + +extern void FldScrollField (FieldPtr fld, Word linesToScroll, + DirectionType direction) + SYS_TRAP(sysTrapFldScrollField); + +extern Boolean FldScrollable (FieldPtr fld, DirectionType direction) + SYS_TRAP(sysTrapFldScrollable); + +extern Word FldGetVisibleLines (FieldPtr fld) + SYS_TRAP(sysTrapFldGetVisibleLines); + +extern Word FldGetTextHeight (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextHeight); + +extern Word FldCalcFieldHeight (CharPtr chars, Word maxWidth) + SYS_TRAP(sysTrapFldCalcFieldHeight); + +Word FldWordWrap (CharPtr chars, Word maxWidth) + SYS_TRAP(sysTrapFldWordWrap); + +extern void FldCompactText (FieldPtr fld) + SYS_TRAP(sysTrapFldCompactText); + +extern Boolean FldDirty (FieldPtr fld) + SYS_TRAP(sysTrapFldDirty); + +extern void FldSetDirty (FieldPtr fld, Boolean dirty) + SYS_TRAP(sysTrapFldSetDirty); + +extern Word FldGetMaxChars (FieldPtr fld) + SYS_TRAP(sysTrapFldGetMaxChars); + +extern void FldSetMaxChars (FieldPtr fld, Word maxChars) + SYS_TRAP(sysTrapFldSetMaxChars); + +extern Boolean FldInsert (FieldPtr fld, CharPtr insertChars, Word insertLen) + SYS_TRAP(sysTrapFldInsert); + +extern void FldDelete (FieldPtr fld, Word start, Word end) + SYS_TRAP(sysTrapFldDelete); + +extern void FldUndo (FieldPtr fld) + SYS_TRAP(sysTrapFldUndo); + +extern Word FldGetTextAllocatedSize (FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextAllocatedSize); + +extern void FldSetTextAllocatedSize (FieldPtr fld, Word allocatedSize) + SYS_TRAP(sysTrapFldSetTextAllocatedSize); + +extern void FldGetAttributes (FieldPtr fld, FieldAttrPtr attrP) + SYS_TRAP(sysTrapFldGetAttributes); + +extern void FldSetAttributes (FieldPtr fld, FieldAttrPtr attrP) + SYS_TRAP(sysTrapFldSetAttributes); + +extern void FldSendChangeNotification (FieldPtr fld) + SYS_TRAP(sysTrapFldSendChangeNotification); + +extern void FldSendHeightChangeNotification (FieldPtr fld, Word pos, + Short numLines) + SYS_TRAP(sysTrapFldSendHeightChangeNotification); + +extern Boolean FldMakeFullyVisible (FieldPtr fld) + SYS_TRAP(sysTrapFldMakeFullyVisible); + +extern Word FldGetNumberOfBlankLines (FieldPtr fld) + SYS_TRAP(sysTrapFldGetNumberOfBlankLines); + + +#endif // __FIELD_H__ + + + diff --git a/sdk-2/include/Core/UI/Find.h b/sdk-2/include/Core/UI/Find.h new file mode 100644 index 0000000..d115200 --- /dev/null +++ b/sdk-2/include/Core/UI/Find.h @@ -0,0 +1,105 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: field.h + * AUTHOR: Art Lamb: August 29, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines field structures and routines. + * + ***********************************************************************/ +#ifndef __FIND_H__ +#define __FIND_H__ + +#define maxFinds 9 +#define maxFindStrLen 16 + +typedef struct { + Word appCardNo; // card number of the application + LocalID appDbID; // LocalID of the application + Boolean foundInCaller; // true if found in app that called Find + + Word dbCardNo; // card number of the database record was found in + LocalID dbID; // LocalID of the database record was found in + Word recordNum; // index of record that contain a match + Word matchPos; // postion in record of the match. + Word matchFieldNum; // field number + DWord matchCustom; // app specific data + } FindMatchType; + +typedef FindMatchType * FindMatchPtr; + +typedef struct { + + // These fields are used by the applications. + Word dbAccesMode; // read mode and maybe show secret + Word recordNum; // index of last record that contained a match + Boolean more; // true of more matches to display + Char strAsTyped [maxFindStrLen+1]; // search string as entered + Char strToFind [maxFindStrLen+1]; // search string is lower case + + + // These fields are private to the Find routine and should NOT be accessed by + // applications. + Word numMatches; // # of matches + Word lineNumber; // next line in the results tabel + Boolean continuation; // true if contining search of same app + Boolean searchedCaller; // true after we've searched app that initiated the find + + LocalID callerAppDbID; // dbID of app that initiated search + Word callerAppCardNo; // cardNo of app that initiated search + + LocalID appDbID; // dbID of app that we're currently searching + Word appCardNo; // card number of app that we're currently searching + + Boolean newSearch; // true for first search + DmSearchStateType searchState; // search state + FindMatchType match [maxFinds]; +} FindParamsType; + +typedef FindParamsType * FindParamsPtr; + + +// Param Block passsed with the sysAppLaunchCmdGoto Command +typedef struct { + Word searchStrLen; // length of search string. + Word dbCardNo; // card number of the database + LocalID dbID; // LocalID of the database + Word recordNum; // index of record that contain a match + Word matchPos; // postion in record of the match. + Word matchFieldNum; // field number string was found int + DWord matchCustom; // application specific info + } GoToParamsType; + +typedef GoToParamsType * GoToParamsPtr; + + +//---------------------------------------------------------- +// Find Functions +//---------------------------------------------------------- + +void Find (GoToParamsPtr goToP) + SYS_TRAP(sysTrapFind); + + +Boolean FindStrInStr (CharPtr strToSearch, CharPtr strToFind, + WordPtr posP) + SYS_TRAP(sysTrapFindStrInStr); + +Boolean FindSaveMatch (FindParamsPtr findParams, Word recordNum, + Word pos, Word fieldNum, DWord appCustom, Word cardNo, LocalID dbID) + SYS_TRAP(sysTrapFindSaveMatch); + +void FindGetLineBounds (FindParamsPtr findParams, RectanglePtr r) + SYS_TRAP(sysTrapFindGetLineBounds); + +Boolean FindDrawHeader (FindParamsPtr findParams, CharPtr title) + SYS_TRAP(sysTrapFindDrawHeader); + + + +#endif __FIND_H__ diff --git a/sdk-2/include/Core/UI/Font.h b/sdk-2/include/Core/UI/Font.h new file mode 100644 index 0000000..d032906 --- /dev/null +++ b/sdk-2/include/Core/UI/Font.h @@ -0,0 +1,120 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: font.h + * AUTHOR: Art Lamb: September 13, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines font structures and routines. + * + ***********************************************************************/ + +#ifndef __FONT_H__ +#define __FONT_H__ + + +typedef struct +{ + SByte offset; + SByte width; +} FontCharInfoType; + +typedef struct{ + SWord fontType; // font type + SWord firstChar; // ASCII code of first character + SWord lastChar; // ASCII code of last character + SWord maxWidth; // maximum character width + SWord kernMax; // negative of maximum character kern + SWord nDescent; // negative of descent + SWord fRectWidth; // width of font rectangle + SWord fRectHeight; // height of font rectangle + SWord owTLoc; // offset to offset/width table + SWord ascent; // ascent + SWord descent; // descent + SWord leading; // leading + SWord rowWords; // row width of bit image / 2 +} FontType; + +typedef FontType * FontPtr; + +enum fontID { stdFont, boldFont, largeFont, symbolFont, symbol11Font, + symbol7Font, ledFont }; + +#define checkboxFont symbol11Font + + +typedef enum fontID FontID; + + +//-------------------------------------------------------------------- +// +// Font Function +// +//-------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern FontID FntGetFont (void) + SYS_TRAP(sysTrapFntGetFont); + +extern FontID FntSetFont (FontID font) + SYS_TRAP(sysTrapFntSetFont); + +extern FontPtr FntGetFontPtr (void) + SYS_TRAP(sysTrapFntGetFontPtr); + +extern SWord FntBaseLine (void) + SYS_TRAP(sysTrapFntBaseLine); + +extern SWord FntCharHeight (void) + SYS_TRAP(sysTrapFntCharHeight); + +extern SWord FntLineHeight (void) + SYS_TRAP(sysTrapFntLineHeight); + +extern SWord FntAverageCharWidth (void) + SYS_TRAP(sysTrapFntAverageCharWidth); + +extern SWord FntCharWidth (Char ch) + SYS_TRAP(sysTrapFntCharWidth); + +extern SWord FntCharsWidth (Char *chars, Word len) + SYS_TRAP(sysTrapFntCharsWidth); + +extern void FntCharsInWidth(CharPtr string, SWord *stringWidthP, + SWord *stringLengthP, Boolean *fitWithinWidth) + SYS_TRAP(sysTrapFntCharsInWidth); + +extern SWord FntDescenderHeight (void) + SYS_TRAP(sysTrapFntDescenderHeight); + +extern SWord FntLineWidth (CharPtr pChars, Word length) + SYS_TRAP(sysTrapFntLineWidth); + +Word FntWordWrap (CharPtr chars, Word maxWidth) + SYS_TRAP(sysTrapFntWordWrap); + +void FntWordWrapReverseNLines (CharPtr chars, Word maxWidth, + WordPtr linesToScrollP, WordPtr scrollPosP) + SYS_TRAP(sysTrapFntWordWrapReverseNLines); + +void FntGetScrollValues (CharPtr chars, Word width, Word scrollPos, + WordPtr linesP, WordPtr topLine) + SYS_TRAP(sysTrapFntGetScrollValues); + + +#ifdef __cplusplus +} +#endif + + +#endif // __FONT_H__ + + + diff --git a/sdk-2/include/Core/UI/Form.h b/sdk-2/include/Core/UI/Form.h new file mode 100644 index 0000000..cdffa43 --- /dev/null +++ b/sdk-2/include/Core/UI/Form.h @@ -0,0 +1,377 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: Form.h + * AUTHOR: Art Lamb: September 6, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines dialog box structures and routines. + * + ***********************************************************************/ + +#ifndef __FORM_H__ +#define __FORM_H__ + +#define noFocus 0xffff + +// Update code send as part of a frmUpdate event. +#define frmRedrawUpdateCode 0x8000 + + +// Alert constants and structures +enum alertTypes { + informationAlert, + confirmationAlert, + warningAlert, + errorAlert }; +typedef enum alertTypes AlertType; + +typedef struct { + Word alertType; + Word helpRscID; + Word numButtons; + Word defaultButton; +} AlertTemplateType; + + +// Types of object in a dialog box +enum formObjects { + frmFieldObj, + frmControlObj, + frmListObj, + frmTableObj, + frmBitmapObj, + frmLineObj, + frmFrameObj, + frmRectangleObj, + frmLabelObj, + frmTitleObj, + frmPopupObj, + frmGraffitiStateObj, + frmGadgetObj, + frmScrollBarObj }; +typedef enum formObjects FormObjectKind; + + +typedef struct { + Word usable :1; // Set if part of ui +} FormObjAttrType; + + +typedef struct { + FormObjAttrType attr; + PointType pos; + Word rscID; +} FormBitmapType; + + +typedef struct { + FormObjAttrType attr; + PointType point1; + PointType point2; +} FormLineType; + + +typedef struct { + Word id; + FormObjAttrType attr; + RectangleType rect; + Word frameType; +} FormFrameType; + + +typedef struct { + FormObjAttrType attr; + RectangleType rect; +} FormRectangleType; + + +typedef struct { + Word id; + PointType pos; + FormObjAttrType attr; + FontID fontID; + Char * text; +} FormLabelType; + + +typedef struct { + RectangleType rect; + Char * text; +} FormTitleType; + + +typedef struct { + Word controlID; + Word listID; +} FormPopupType; + + +typedef struct { + PointType pos; +} FrmGraffitiStateType; + + +typedef struct { + Word id; + FormObjAttrType attr; + RectangleType rect; + VoidPtr data; +} FormGadgetType; + + +typedef union { + void * ptr; + FieldType * field; + ControlType * control; + ListType * list; + TableType * table; + FormBitmapType * bitmap; +// FormLineType * line; +// FormFrameType * frame; +// FormRectangleType * rectangle; + FormLabelType * label; + FormTitleType * title; + FormPopupType * popup; + FrmGraffitiStateType * grfState; + FormGadgetType * gadget; + ScrollBarType * scrollBar; +} FormObjectType; + +// typedef FormObjectType * FormObjectPtr; + + +typedef struct { + FormObjectKind objectType; + FormObjectType object; +} FormObjListType; + + +typedef struct { + Word usable :1; // Set if part of ui + Word enabled :1; // Set if interactable (not grayed out) + Word visible :1; // Set if drawn, used internally + Word dirty :1; // Set if dialog has been modified + Word saveBehind :1; // Set if bits behind form are save when form ids drawn + Word graffitiShift :1; // Set if graffiti shift indicator is supported + Word reserved :11; +} FormAttrType; + + +typedef Boolean FormEventHandlerType (EventPtr eventP); + +typedef FormEventHandlerType * FormEventHandlerPtr; + +typedef struct { + WindowType window; + Word formId; + FormAttrType attr; + WinHandle bitsBehindForm; + FormEventHandlerPtr handler; + Word focus; + Word defaultButton; + Word helpRscId; + Word menuRscId; + Word numObjects; + FormObjListType * objects; +} FormType; + + +typedef FormType * FormPtr; + + +//-------------------------------------------------------------------- +// +// Form Function +// +//-------------------------------------------------------------------- + +extern FormPtr FrmInitForm (Word rscID) + SYS_TRAP(sysTrapFrmInitForm); + +extern void FrmDeleteForm (FormPtr frm) + SYS_TRAP(sysTrapFrmDeleteForm); + +extern void FrmDrawForm (FormPtr frm) + SYS_TRAP(sysTrapFrmDrawForm); + +extern void FrmEraseForm (FormPtr frm) + SYS_TRAP(sysTrapFrmEraseForm); + +extern FormPtr FrmGetActiveForm (void) + SYS_TRAP(sysTrapFrmGetActiveForm); + +extern void FrmSetActiveForm (FormPtr frm) + SYS_TRAP(sysTrapFrmSetActiveForm); + +extern Word FrmGetActiveFormID (void) + SYS_TRAP(sysTrapFrmGetActiveFormID); + +extern Boolean FrmGetUserModifiedState (FormPtr frm) + SYS_TRAP(sysTrapFrmGetUserModifiedState); + +extern void FrmSetNotUserModified (FormPtr frm) + SYS_TRAP(sysTrapFrmSetNotUserModified); + +extern Word FrmGetFocus (FormPtr frm) + SYS_TRAP(sysTrapFrmGetFocus); + +extern void FrmSetFocus (FormPtr frm, Word fieldIndex) + SYS_TRAP(sysTrapFrmSetFocus); + +extern Boolean FrmHandleEvent (FormPtr frm, EventPtr eventP) + SYS_TRAP(sysTrapFrmHandleEvent); + +extern void FrmGetFormBounds (FormPtr frm, RectanglePtr r) + SYS_TRAP(sysTrapFrmGetFormBounds); + +extern WinHandle FrmGetWindowHandle (FormPtr frm) + SYS_TRAP(sysTrapFrmGetWindowHandle); + +extern Word FrmGetFormId (FormPtr frm) + SYS_TRAP(sysTrapFrmGetFormId); + +extern FormPtr FrmGetFormPtr (Word formId) + SYS_TRAP(sysTrapFrmGetFormPtr); + +extern FormPtr FrmGetFirstForm (void) + SYS_TRAP(sysTrapFrmGetFirstForm); + +extern Word FrmGetNumberOfObjects (FormPtr frm) + SYS_TRAP(sysTrapFrmGetNumberOfObjects); + +extern Word FrmGetObjectIndex (FormPtr frm, Word objID) + SYS_TRAP(sysTrapFrmGetObjectIndex); + +extern Word FrmGetObjectId (FormPtr, Word objIndex) + SYS_TRAP(sysTrapFrmGetObjectId); + +extern FormObjectKind FrmGetObjectType (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmGetObjectType); + +extern VoidPtr FrmGetObjectPtr (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmGetObjectPtr); + +extern void FrmGetObjectBounds (FormPtr frm, Word pObjIndex, RectanglePtr r) + SYS_TRAP(sysTrapFrmGetObjectBounds); + +extern void FrmHideObject (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmHideObject); + +extern void FrmShowObject (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmShowObject); + +extern void FrmGetObjectPosition (FormPtr frm, Word objIndex, + SWordPtr x, SWordPtr y) + SYS_TRAP(sysTrapFrmGetObjectPosition); + +extern void FrmSetObjectPosition (FormPtr frm, Word objIndex, + SWord x, SWord y) + SYS_TRAP(sysTrapFrmSetObjectPosition); + +extern void FrmSetObjectBounds (FormPtr frm, Word objIndex, + RectanglePtr bounds) + SYS_TRAP(sysTrapFrmSetObjectBounds); + + + +extern SWord FrmGetControlValue (FormPtr frm, Word controlID) + SYS_TRAP(sysTrapFrmGetControlValue); + +extern void FrmSetControlValue (FormPtr frm, Word controlID, SWord newValue) + SYS_TRAP(sysTrapFrmSetControlValue); + +extern Byte FrmGetControlGroupSelection (FormPtr frm, Byte groupNum) + SYS_TRAP(sysTrapFrmGetControlGroupSelection); + +extern void FrmSetControlGroupSelection (FormPtr frm, Byte groupNum, + Word controlID) + SYS_TRAP(sysTrapFrmSetControlGroupSelection); + +extern void FrmCopyLabel (FormPtr frm, Word lableID, CharPtr newLable) + SYS_TRAP(sysTrapFrmCopyLabel); + +extern CharPtr FrmGetLabel (FormPtr frm, Word lableID) + SYS_TRAP(sysTrapFrmGetLabel); + +extern void FrmSetCategoryLabel (FormPtr frm, Word objIndex, CharPtr newLabel) + SYS_TRAP(sysTrapFrmSetCategoryLabel); + +extern CharPtr FrmGetTitle (FormPtr frm) + SYS_TRAP(sysTrapFrmGetTitle); + +extern void FrmSetTitle (FormPtr frm, CharPtr newTitle) + SYS_TRAP(sysTrapFrmSetTitle); + +extern void FrmCopyTitle (FormPtr frm, CharPtr newTitle) + SYS_TRAP(sysTrapFrmCopyTitle); + +extern VoidPtr FrmGetGadgetData (FormPtr frm, Word objIndex) + SYS_TRAP(sysTrapFrmGetGadgetData); + +extern void FrmSetGadgetData (FormPtr frm, Word objIndex, VoidPtr data) + SYS_TRAP(sysTrapFrmSetGadgetData); + + + +extern Word FrmDoDialog (FormPtr frm) + SYS_TRAP(sysTrapFrmDoDialog); + +extern Word FrmAlert (Word alertId) + SYS_TRAP(sysTrapFrmAlert); + +extern Word FrmCustomAlert (Word alertId, CharPtr s1, CharPtr s2, CharPtr s3) + SYS_TRAP(sysTrapFrmCustomAlert); + +extern void FrmHelp (Word helpMsgId) + SYS_TRAP(sysTrapFrmHelp); + +extern void FrmUpdateScrollers (FormPtr frm, Word upIndex, Word downIndex, + Boolean scrollableUp, Boolean scrollabledown) + SYS_TRAP(sysTrapFrmUpdateScrollers); + +extern Boolean FrmVisible (FormPtr frm) + SYS_TRAP(sysTrapFrmVisible); + +extern void FrmSetEventHandler (FormPtr frm, FormEventHandlerPtr) + SYS_TRAP(sysTrapFrmSetEventHandler); + +extern Boolean FrmDispatchEvent (EventPtr eventP) + SYS_TRAP(sysTrapFrmDispatchEvent); + + + + +extern void FrmPopupForm (Word formId) + SYS_TRAP(sysTrapFrmPopupForm); + +extern void FrmGotoForm (Word formId) + SYS_TRAP(sysTrapFrmGotoForm); + +extern void FrmUpdateForm (Word formId, Word updateCode) + SYS_TRAP(sysTrapFrmUpdateForm); + +extern void FrmReturnToForm (Word formId) + SYS_TRAP(sysTrapFrmReturnToForm); + +extern void FrmCloseAllForms (void) + SYS_TRAP(sysTrapFrmCloseAllForms); + +extern void FrmSaveAllForms (void) + SYS_TRAP(sysTrapFrmSaveAllForms); + + + +extern Boolean FrmPointInTitle (FormPtr frm, Short x, Short y) + SYS_TRAP(sysTrapFrmPointInTitle); + +extern void FrmSetMenu (FormPtr frm, Word menuRscID) + SYS_TRAP(sysTrapFrmSetMenu); + + + +#endif __FORM_H__ diff --git a/sdk-2/include/Core/UI/GraffitiShift.h b/sdk-2/include/Core/UI/GraffitiShift.h new file mode 100644 index 0000000..b684854 --- /dev/null +++ b/sdk-2/include/Core/UI/GraffitiShift.h @@ -0,0 +1,54 @@ +/*********************************************************************** + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: GriffitifShift.h + * AUTHOR: Art Lamb: Aug 24, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines Griffiti shift state indicator routines. + * + **********************************************************************/ + +#ifndef __GRFSHIFTIND_H__ +#define __GRFSHIFTIND_H__ + + +// Graffiti lock flags +#define glfCapsLock 0x01 +#define glfNumLock 0x02 + + +typedef enum { gsiShiftNone, // no indicator + gsiNumLock, // numeric lock + gsiCapsLock, // capital lock + gsiShiftPunctuation, // punctuation shift + gsiShiftExtended, // extented punctuation shift + gsiShiftUpper, // alpha upper case shift + gsiShiftLower // alpha lower case + } GsiShiftState; + + + +extern void GsiInitialize (void) + SYS_TRAP(sysTrapGsiInitialize); + +extern void GsiSetLocation (SWord x, SWord y) + SYS_TRAP(sysTrapGsiSetLocation); + +extern void GsiEnable (Boolean enableIt) + SYS_TRAP(sysTrapGsiEnable); + +extern Boolean GsiEnabled (void) + SYS_TRAP(sysTrapGsiEnabled); + +extern void GsiSetShiftState (Word lockFlags, Word tempShift) + SYS_TRAP(sysTrapGsiSetShiftState); + + +#endif __GRFSHIFTIND_H__ + + diff --git a/sdk-2/include/Core/UI/GraffitiUI.h b/sdk-2/include/Core/UI/GraffitiUI.h new file mode 100644 index 0000000..e8e0a91 --- /dev/null +++ b/sdk-2/include/Core/UI/GraffitiUI.h @@ -0,0 +1,25 @@ +/*********************************************************************** + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Touchdown + * FILE: GraffitifUI.h + * AUTHOR: Roger Flores: Sep 15, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines Graffiti UI routines. + * + **********************************************************************/ + +#ifndef __GRFUI_H__ +#define __GRFUI_H__ + + +extern void SysGrfShortCutListDialog () + SYS_TRAP(sysTrapSysGrfShortCutListDialog); + + +#endif __GRFUI_H__ + diff --git a/sdk-2/include/Core/UI/Init.h b/sdk-2/include/Core/UI/Init.h new file mode 100644 index 0000000..618319c --- /dev/null +++ b/sdk-2/include/Core/UI/Init.h @@ -0,0 +1,35 @@ +/*********************************************************************** + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: Init.h + * AUTHOR: Art Lamb: Jan 25, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines UI initialization routines. + * + **********************************************************************/ + +#ifndef __INIT_H__ +#define __INIT_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void UIInitialize (void) + SYS_TRAP(sysTrapUIInitialize); + +extern void UIReset (void) + SYS_TRAP(sysTrapUIReset); + +#ifdef __cplusplus +} +#endif + + +#endif __INIT_H__ diff --git a/sdk-2/include/Core/UI/InsPoint.h b/sdk-2/include/Core/UI/InsPoint.h new file mode 100644 index 0000000..8204976 --- /dev/null +++ b/sdk-2/include/Core/UI/InsPoint.h @@ -0,0 +1,48 @@ +/*********************************************************************** + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: InsPoint.h + * AUTHOR: Art Lamb: Jan 25, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines insertion point routines. + * + **********************************************************************/ + +#ifndef __INSPOINT_H__ +#define __INSPOINT_H__ + +// Blink interval is half of a second +#define insPtBlinkInterval 30 +#define insPtWidth 2 + +extern void InsPtInitialize (void) + SYS_TRAP(sysTrapInsPtInitialize); + +extern void InsPtSetLocation (SWord x, SWord y) + SYS_TRAP(sysTrapInsPtSetLocation); + +extern void InsPtGetLocation (SWordPtr x, SWordPtr y) + SYS_TRAP(sysTrapInsPtGetLocation); + +extern void InsPtEnable (Boolean enableIt) + SYS_TRAP(sysTrapInsPtEnable); + +extern Boolean InsPtEnabled (void) + SYS_TRAP(sysTrapInsPtEnabled); + +extern void InsPtSetHeight (SWord height) + SYS_TRAP(sysTrapInsPtSetHeight); + +extern SWord InsPtGetHeight (void) + SYS_TRAP(sysTrapInsPtGetHeight); + +extern void InsPtCheckBlink (void) + SYS_TRAP(sysTrapInsPtCheckBlink); + + +#endif __INSPOINT_H__ diff --git a/sdk-2/include/Core/UI/List.h b/sdk-2/include/Core/UI/List.h new file mode 100644 index 0000000..20c96d1 --- /dev/null +++ b/sdk-2/include/Core/UI/List.h @@ -0,0 +1,111 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: list.h + * AUTHOR: Roger Flores: November 3, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines list structures and routines. + * + ***********************************************************************/ + +#ifndef __LIST_H__ +#define __LIST_H__ + + +#define noListSelection 0x0ffff + +//------------------------------------------------------------------- +// List structures +//------------------------------------------------------------------- + +typedef struct { + Word usable :1; // set if part of ui + Word enabled :1; // set if interactable (not grayed out) + Word visible :1; // set if drawn + Word poppedUp :1; // set if choices displayed in popup win. + Word hasScrollBar :1; // set if the list has a scroll bar + Word search :1; // set if incremental search is enabled + Word reserved :2; +} ListAttrType; + + +// Load data callback routine prototype +typedef void ListDrawDataFuncType (Word itemNum, RectanglePtr bounds, + CharPtr *itemsText); + +typedef ListDrawDataFuncType * ListDrawDataFuncPtr; + + +typedef struct { + Word id; + RectangleType bounds; + ListAttrType attr; + CharPtr *itemsText; + Word numItems; // number of choices in the list + Word currentItem; // currently display choice + Word topItem; // top item visible when poped up + FontID font; // font used to draw list + WinHandle popupWin; // used only by popup lists + ListDrawDataFuncPtr drawItemsCallback; // 0 indicates no function +} ListType; + +typedef ListType * ListPtr; + + +//------------------------------------------------------------------- +// List routines +//------------------------------------------------------------------- +extern void LstDrawList (ListPtr list) + SYS_TRAP(sysTrapLstDrawList); + +extern void LstEraseList (ListPtr list) + SYS_TRAP(sysTrapLstEraseList); + +extern Word LstGetSelection (ListPtr list) + SYS_TRAP(sysTrapLstGetSelection); + +extern CharPtr LstGetSelectionText (ListPtr list, Word itemNum) + SYS_TRAP(sysTrapLstGetSelectionText); + +extern Boolean LstHandleEvent (ListPtr list, EventPtr event) + SYS_TRAP(sysTrapLstHandleEvent); + +extern void LstSetHeight (ListPtr pList, Word visibleItems) + SYS_TRAP(sysTrapLstSetHeight); + +extern void LstSetPosition (ListPtr pList, SWord x, SWord y) + SYS_TRAP(sysTrapLstSetPosition); + +extern void LstSetSelection (ListPtr list, Word itemNum) + SYS_TRAP(sysTrapLstSetSelection); + +extern void LstSetListChoices (ListPtr list, Char ** itemsText, + Word numItems) + SYS_TRAP(sysTrapLstSetListChoices); + +extern void LstSetDrawFunction (ListPtr pList, ListDrawDataFuncPtr func) + SYS_TRAP(sysTrapLstSetDrawFunction); + +extern void LstSetTopItem (ListPtr pList, Word itemNum) + SYS_TRAP(sysTrapLstSetTopItem); + +extern void LstMakeItemVisible (ListPtr pList, Word itemNum) + SYS_TRAP(sysTrapLstMakeItemVisible); + +extern Word LstGetNumberOfItems (ListPtr pList) + SYS_TRAP(sysTrapLstGetNumberOfItems); + +extern SWord LstPopupList (ListPtr list) + SYS_TRAP(sysTrapLstPopupList); + +extern Boolean LstScrollList(ListPtr pList, enum directions direction, short itemCount) + SYS_TRAP(sysTrapLstScrollList); + +extern Int LstGetVisibleItems (ListPtr pList) + SYS_TRAP(sysTrapLstGetVisibleItems); +#endif // __LIST_H__ diff --git a/sdk-2/include/Core/UI/Menu.h b/sdk-2/include/Core/UI/Menu.h new file mode 100644 index 0000000..ee08ba0 --- /dev/null +++ b/sdk-2/include/Core/UI/Menu.h @@ -0,0 +1,99 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: menu.h + * AUTHOR: Roger Flores: November 18, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines menu structures and routines. + * + ***********************************************************************/ + +#ifndef __MENU_H__ +#define __MENU_H__ + + +#define noMenuSelection -1 +#define noMenuItemSelection -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. +#define MenuSeparatorChar '-' + + + +typedef struct { + Word id; // id of the menu item + Char command; // command key + CharPtr itemStr; // string to be displayed +} MenuItemType; + + +typedef struct { + WinHandle menuWin; // window of pull-down menu + RectangleType bounds; // bounds of the pulldown + WinHandle bitsBehind; // saving bits behind pull-down menu + RectangleType titleBounds; // bounds of the title in menu bar + CharPtr title; // menu title displayed in menu bar + Word numItems; // number of items in the menu + MenuItemType * items; // array of menu items +} MenuPullDownType; + +typedef MenuPullDownType * MenuPullDownPtr; + +typedef struct { + Word visible :1; // Set if menu bar is drawn + Word commandPending :1; // Set if next key is a command + Word insPtEnabled :1; // Set if insPt was on when menu was drawn +} MenuBarAttrType; + + +typedef struct { + WinHandle barWin; // window of menu bar + WinHandle bitsBehind; // saving bits behind menu bar + WinHandle savedActiveWin; + WinHandle bitsBehindStatus; + MenuBarAttrType attr; + SWord curMenu; // current menu or -1 if none + SWord curItem; // current item in curMenu, -1 if none + SDWord commandTick; // + SWord numMenus; // number of menus + MenuPullDownPtr menus; // array of menus +} MenuBarType; + +typedef MenuBarType * MenuBarPtr; + + + +extern MenuBarPtr MenuInit (Word resourceId) + SYS_TRAP(sysTrapMenuInit); + +extern MenuBarPtr MenuGetActiveMenu (void) + SYS_TRAP(sysTrapMenuGetActiveMenu); + +extern MenuBarPtr MenuSetActiveMenu (MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuSetActiveMenu); + +extern void MenuDispose (MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuDispose); + +extern Boolean MenuHandleEvent (MenuBarPtr pMenu, EventPtr event, + WordPtr error) + SYS_TRAP(sysTrapMenuHandleEvent); + +extern void MenuDrawMenu (MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuDrawMenu); + +extern void MenuEraseStatus (MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuEraseStatus); + +extern void MenuSetActiveMenuRscID (Word resourceId) + SYS_TRAP(sysTrapMenuSetActiveMenuRscID); + + +#endif //__MENU_H__ diff --git a/sdk-2/include/Core/UI/PhoneLookup.h b/sdk-2/include/Core/UI/PhoneLookup.h new file mode 100644 index 0000000..36bbb59 --- /dev/null +++ b/sdk-2/include/Core/UI/PhoneLookup.h @@ -0,0 +1,17 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot 2.0 + * FILE: PhoneLookup.h + * AUTHOR: Art Lamb: July 23, 1996 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines phone number lookup structures and routines. + * + ***********************************************************************/ + +extern void PhoneNumberLookup (FieldPtr fld) + SYS_TRAP(sysTrapPhoneNumberLookup); diff --git a/sdk-2/include/Core/UI/Rect.h b/sdk-2/include/Core/UI/Rect.h new file mode 100644 index 0000000..0787519 --- /dev/null +++ b/sdk-2/include/Core/UI/Rect.h @@ -0,0 +1,71 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: Rect.h + * AUTHOR: Roger Flores: November 3, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines rectangle structures and routines. + * + ***********************************************************************/ + +#ifndef __RECT_H__ +#define __RECT_H__ + +typedef struct { + SWord left; + SWord top; + SWord right; + SWord bottom; +} AbsRectType; + + +typedef struct { + SWord x; + SWord y; +} PointType; + + +typedef struct { + PointType topLeft; + PointType extent; +} RectangleType; + +typedef RectangleType * RectanglePtr; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void RctSetRectangle (RectanglePtr r, SWord left, SWord top, + SWord width, SWord height) + SYS_TRAP(sysTrapRctSetRectangle); + +extern void RctCopyRectangle (RectanglePtr srcRect, RectanglePtr dstRect) + SYS_TRAP(sysTrapRctCopyRectangle); + +extern void RctInsetRectangle (RectanglePtr r, SWord insetAmt) + SYS_TRAP(sysTrapRctInsetRectangle); + +extern void RctOffsetRectangle (RectanglePtr r, SWord deltaX, SWord deltaY) + SYS_TRAP(sysTrapRctOffsetRectangle); + +extern Boolean RctPtInRectangle (SWord x, SWord y, RectanglePtr r) + SYS_TRAP(sysTrapRctPtInRectangle); + +extern void RctGetIntersection (RectanglePtr r1, RectanglePtr r2, RectanglePtr r3) + SYS_TRAP(sysTrapRctGetIntersection); + + +#ifdef __cplusplus +} +#endif + + +#endif //__RECT_H__ diff --git a/sdk-2/include/Core/UI/ScrDriver.h b/sdk-2/include/Core/UI/ScrDriver.h new file mode 100644 index 0000000..1d6cc8a --- /dev/null +++ b/sdk-2/include/Core/UI/ScrDriver.h @@ -0,0 +1,162 @@ +/*********************************************************************** + * + * Copyright (c) 1995-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot [EMULATOR] + * + * FILE: ScrDriver.h + * + * AUTHOR: Ain McKendrick + * + * DECLARER: + * + * DESCRIPTION: Screen driver function prototypes. For use by TD applications. + * + * REVISION HISTORY: + * Name Date Description + * ---- ---- ----------- + * Ain 1/25/95 Initial creation + * Ain 2/3/95 Revised to use new WinPtr type due to name + * changes in window.h + * + **********************************************************************/ + + +#ifndef __SCRDRIVER_H__ +#define __SCRDRIVER_H__ + +#include + + +/************************************************************************** + * Internal constants + ***************************************************************************/ +#define scrMaxLineBytes 32 // Max # of bytes in a scan line + // used in compression/decompression calls + + + +/************************************************************************** + * Internal Drawing info structure used by Screen Driver + ***************************************************************************/ +//typedef enum {scrCopy, scrAND, scrANDNOT, scrXOR, scrOR, scrCopyNOT} ScrOperation; + + + + +typedef struct ScrBltInfoType { + + // Common fields. + ScrOperation op; // which bit operation to do + SWord height; // height of blit operation + + WordPtr dstBaseP; // base address of window we're blitting to + Word dstRowBytes; // rowBytes of window + + WordPtr srcBaseP; // base address of window we're blitting from + Word srcRowBytes; // rowBytes of window + + + // Info for each line + Word leftMask; // mask for leftmost byte of row + Word rightMask; // mask for rightmost byte of row + SWord midWords; // # of words between left and right mask + + SWord dstRowDelta; // delta bytes from row to row + WordPtr dstP; // byte address of first dst line + + SWord srcRowDelta; // delta bytes from row to row + WordPtr srcP; // byte address of first source line + + + + // These fields only used for drawing operations. + Word* patternP; // pointer to pattern to use + Word solidPat; // color word if no pattern + //DOLATER.. used to byte byte + Boolean simple; // true if scrCopy with solid pattern + CustomPatternType pattern; // copy of modified pattern + + } ScrBltInfoType; +typedef ScrBltInfoType* ScrBltInfoPtr; + + + + +/************************************************************************** + * Structure of Screen Driver globals + ***************************************************************************/ +typedef struct ScrGlobalsType { + Word width; // width of display in pixels + Word height; // height of display in pixels + Word rowBytes; // rowBytes of display + Ptr baseAddr; // base address of display + CustomPatternType grayPat; // Gray pattern + Boolean doDrawNotify; // call ScrDrawNotify after drawing + AbsRectType updateR; // update rect when in remote mode + SDWord lastUpdate; // Tickcount of last update + } ScrGlobalsType; +typedef ScrGlobalsType* ScrGlobalsPtr; + + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Initialization +void ScrInit(void) + SYS_TRAP(sysTrapScrInit); + + +// BitBlt Functions +Err ScrCopyRectangle(WinPtr sourceWindow, WinPtr destWindow, + SWord fromX, SWord fromY, SWord toX, SWord toY, + SWord bitCount, SWord lineCount) + SYS_TRAP(sysTrapScrCopyRectangle); + + + +// Character Functions +void ScrDrawChars(WinPtr pWindow, SWord xLoc, SWord yLoc, SWord xExtent, SWord yExtent, + SWord clipTop, SWord clipLeft, SWord clipBottom, SWord clipRight, + CharPtr chars, Word len, FontPtr fontPtr) + SYS_TRAP(sysTrapScrDrawChars); + +// Line Draw Functions +void ScrLineRoutine(WinPtr pWindow, SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapScrLineRoutine); + +void ScrRectangleRoutine(WinPtr pWindow, SWord x, SWord y, SWord extentX, + SWord extentY) + SYS_TRAP(sysTrapScrRectangleRoutine); + +// Utility Functions +void ScrScreenInfo (WinPtr pWindow) + SYS_TRAP(sysTrapScrScreenInfo); + +void ScrDrawNotify(SWord updLeft, SWord updTop, SWord updWidth, SWord updHeight) + SYS_TRAP(sysTrapScrDrawNotify); + +void ScrSendUpdateArea(Boolean force) + SYS_TRAP(sysTrapScrSendUpdateArea); + +Word ScrCompressScanLine(BytePtr lineP, BytePtr prevLineP, Word width, + BytePtr dstParamP, Boolean firstLine) + SYS_TRAP(sysTrapScrCompressScanLine); + +Word ScrDeCompressScanLine(BytePtr srcP, BytePtr dstP, Word width) + SYS_TRAP(sysTrapScrDeCompressScanLine); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __SCRDRIVER_H__ diff --git a/sdk-2/include/Core/UI/ScrollBar.h b/sdk-2/include/Core/UI/ScrollBar.h new file mode 100644 index 0000000..8729c2b --- /dev/null +++ b/sdk-2/include/Core/UI/ScrollBar.h @@ -0,0 +1,63 @@ +/*********************************************************************** + * + * Copyright (c) 1996-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: ScrollBar.h + * AUTHOR: Art Lamb: Feb 6, 1996 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines scroll bar structures and routines. + * + ***********************************************************************/ + +#ifndef __SCROLLBAR_H__ +#define __SCROLLBAR_H__ + +typedef enum { sclUpArrow, sclDownArrow, sclUpPage, sclDownPage, sclCar } + ScrollBarRegionType; + + +typedef struct { + Word usable :1; // Set if part of ui + Word visible :1; // Set if drawn, used internally + Word hilighted :1; // Set if region is hilighted + Word shown :1; // Set if drawn and maxValue > minValue + Word activeRegion :4; // ScrollBarRegionType +} ScrollBarAttrType; + + +typedef struct { + RectangleType bounds; + Word id; + ScrollBarAttrType attr; + Short value; + Short minValue; + Short maxValue; + Short pageSize; + Short penPosInCar; + Short savePos; +} ScrollBarType; + +typedef ScrollBarType * ScrollBarPtr; + + +extern void SclGetScrollBar (ScrollBarPtr bar, ShortPtr valueP, ShortPtr minP, + ShortPtr maxP, ShortPtr pageSizeP) + SYS_TRAP(sysTrapSclGetScrollBar); + +extern void SclSetScrollBar (ScrollBarPtr bar, short value, short min, + short max, short pageSize) + SYS_TRAP(sysTrapSclSetScrollBar); + +extern void SclDrawScrollBar (ScrollBarPtr bar) + SYS_TRAP(sysTrapSclDrawScrollBar); + +extern Boolean SclHandleEvent (ScrollBarPtr bar, EventPtr event) + SYS_TRAP(sysTrapSclHandleEvent); + + + +#endif __SCROLLBAR_H__ diff --git a/sdk-2/include/Core/UI/SelDay.h b/sdk-2/include/Core/UI/SelDay.h new file mode 100644 index 0000000..0c627ea --- /dev/null +++ b/sdk-2/include/Core/UI/SelDay.h @@ -0,0 +1,33 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: SelDay.h + * AUTHOR: Roger Flores: November 10, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the date picker month object's structures + * and routines. + * + ***********************************************************************/ +#ifndef __SELDAY_H__ +#define __SELDAY_H__ + +#include + +#define daySelectorMinYear firstYear +#define daySelectorMaxYear lastYear + + +extern Boolean SelectDayV10 (SWord *month, SWord *day, SWord *year, CharPtr title) + SYS_TRAP(sysTrapSelectDayV10); + +extern Boolean SelectDay (SelectDayType selectDayBy, SWord *month, + SWord *day, SWord *year, CharPtr title) + SYS_TRAP(sysTrapSelectDay); + + +#endif //__SELDAY_H__ diff --git a/sdk-2/include/Core/UI/SelTime.h b/sdk-2/include/Core/UI/SelTime.h new file mode 100644 index 0000000..d25616b --- /dev/null +++ b/sdk-2/include/Core/UI/SelTime.h @@ -0,0 +1,38 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: selTime.h + * AUTHOR: Roger Flores: December 6, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines select time structures and routines. + * + ***********************************************************************/ + +#ifndef __SELTIME_H__ +#define __SELTIME_H__ + +#define NumericSpaceChar 0x80 + +//------------------------------------------------------------------- +// structures +//------------------------------------------------------------------- + + + +typedef struct { + Byte hours; + Byte minutes; + Byte seconds; +} HMSTime; + + +extern Boolean SelectTime (TimePtr startTimeP, TimePtr EndTimeP, + Boolean untimed, CharPtr title, SWord startOfDay) + SYS_TRAP(sysTrapSelectTime); + +#endif // __SELTIME_H__ diff --git a/sdk-2/include/Core/UI/Table.h b/sdk-2/include/Core/UI/Table.h new file mode 100644 index 0000000..f934b16 --- /dev/null +++ b/sdk-2/include/Core/UI/Table.h @@ -0,0 +1,286 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: field.h + * AUTHOR: Art Lamb: September 1, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines table structures and routines. + * + ***********************************************************************/ +#ifndef __TABLE_H__ +#define __TABLE_H__ + +//------------------------------------------------------------------- +// Table structures +//------------------------------------------------------------------- + +#define tableDefaultColumnSpacing 1 +#define tableNoteIndicatorWidth 7 +#define tableNoteIndicatorHeight 11 + +// Display style of a table item +// +enum tableItemStyles { checkboxTableItem, + customTableItem, + dateTableItem, + labelTableItem, + numericTableItem, + popupTriggerTableItem, + textTableItem, + textWithNoteTableItem, + timeTableItem, + narrowTextTableItem + }; +typedef enum tableItemStyles TableItemStyleType; + + +typedef struct { + TableItemStyleType itemType; + FontID fontID; // font for drawing text + Word intValue; + CharPtr ptr; +} TableItemType; +typedef TableItemType * TableItemPtr; + + +// Draw item callback routine prototype, used only by customTableItem. +typedef void TableDrawItemFuncType + (VoidPtr table, Word row, Word column, RectanglePtr bounds); + +typedef TableDrawItemFuncType * TableDrawItemFuncPtr; + + +// Load data callback routine prototype +typedef Err TableLoadDataFuncType + (VoidPtr table, Word row, Word column, Boolean editable, + VoidHand * dataH, WordPtr dataOffset, WordPtr dataSize, FieldPtr fld); + +typedef TableLoadDataFuncType * TableLoadDataFuncPtr; + + +// Save data callback routine prototype +typedef Boolean TableSaveDataFuncType + (VoidPtr table, Word row, Word column); + +typedef TableSaveDataFuncType * TableSaveDataFuncPtr; + +typedef struct { + Word width; // width in pixels + Word unused : 6; + Word editIndicator : 1; + Word usable : 1; + Word spacing; // space after column + TableDrawItemFuncPtr drawCallback; + TableLoadDataFuncPtr loadDataCallback; + TableSaveDataFuncPtr saveDataCallback; + +} TableColumnAttrType; + + +typedef struct { + Word id; + Word height; // row height in pixels + DWord data; + + Word reserved1 : 7; + Word usable : 1; + Word reserved2 : 5; + Word invalid : 1; // true if redraw needed + Word staticHeight : 1; // Set if height does not expands as text is entered + Word selectable : 1; + + Word reserved3; + +} TableRowAttrType; + + +typedef struct { + Word visible:1; // Set if drawn, used internally + Word editable:1; // Set if editable + Word editing:1; // Set if in edit mode + Word selected:1; // Set if the current item is selected + Word hasScrollBar:1; // Set if the table has a scroll bar +} TableAttrType; + + +typedef struct { + Word id; + RectangleType bounds; + TableAttrType attr; + Word numColumns; + Word numRows; + Word currentRow; + Word currentColumn; + Word topRow; + TableColumnAttrType * columnAttrs; + TableRowAttrType * rowAttrs; + TableItemPtr items; + FieldType currentField; +} TableType; + +typedef TableType * TablePtr; + + +//------------------------------------------------------------------- +// Table routines +//------------------------------------------------------------------- + +extern void TblDrawTable (TablePtr table) + SYS_TRAP(sysTrapTblDrawTable); + +extern void TblRedrawTable (TablePtr table) + SYS_TRAP(sysTrapTblRedrawTable); + +extern void TblEraseTable (TablePtr table) + SYS_TRAP(sysTrapTblEraseTable); + +extern Boolean TblHandleEvent (TablePtr table, EventPtr event) + SYS_TRAP(sysTrapTblHandleEvent); + +extern void TblGetItemBounds (TablePtr table, Word row, Word column, + RectanglePtr r) + SYS_TRAP(sysTrapTblGetItemBounds); + +extern void TblSelectItem (TablePtr table, Word row, Word column) + SYS_TRAP(sysTrapTblSelectItem); + +extern Word TblGetItemInt (TablePtr table, Word row, Word column) + SYS_TRAP(sysTrapTblGetItemInt); + +extern void TblSetItemInt (TablePtr table, Word row, Word column, Word value) + SYS_TRAP(sysTrapTblSetItemInt); + +extern void TblSetItemPtr (TablePtr table, Word row, Word column, VoidPtr value) + SYS_TRAP(sysTrapTblSetItemPtr); + +extern void TblSetItemStyle (TablePtr table, Word row, Word column, + TableItemStyleType type) + SYS_TRAP(sysTrapTblSetItemStyle); + +extern void TblUnhighlightSelection (TablePtr table) + SYS_TRAP(sysTrapTblUnhighlightSelection); + +extern Boolean TblRowUsable (TablePtr table, Word row) + SYS_TRAP(sysTrapTblRowUsable); + +extern void TblSetRowUsable (TablePtr table, Word row, Boolean usable) + SYS_TRAP(sysTrapTblSetRowUsable); + +extern Word TblGetLastUsableRow (TablePtr table) + SYS_TRAP(sysTrapTblGetLastUsableRow); + + +extern void TblSetColumnUsable (TablePtr table, Word row, Boolean usable) + SYS_TRAP(sysTrapTblSetColumnUsable); + +extern void TblSetRowSelectable (TablePtr table, Word row, Boolean selectable) + SYS_TRAP(sysTrapTblSetRowSelectable); + +extern Boolean TblRowSelectable (TablePtr table, Word row) + SYS_TRAP(sysTrapTblRowSelectable); + +extern Word TblGetNumberOfRows (TablePtr table) + SYS_TRAP(sysTrapTblGetNumberOfRows); + +extern void TblSetCustomDrawProcedure + (TablePtr table, Word column, TableDrawItemFuncPtr drawCallback) + SYS_TRAP(sysTrapTblSetCustomDrawProcedure); + +extern void TblSetLoadDataProcedure + (TablePtr table, Word column, TableLoadDataFuncPtr loadDataCallback) + SYS_TRAP(sysTrapTblSetLoadDataProcedure); + +extern void TblSetSaveDataProcedure + (TablePtr table, Word column, TableSaveDataFuncPtr saveDataCallback) + SYS_TRAP(sysTrapTblSetSaveDataProcedure); + + +extern void TblGetBounds (TablePtr table, RectanglePtr r) + SYS_TRAP(sysTrapTblGetBounds); + +extern void TblSetBounds (TablePtr table, RectanglePtr r) + SYS_TRAP(sysTrapTblSetBounds); + +extern Word TblGetRowHeight (TablePtr table, Word row) + SYS_TRAP(sysTrapTblGetRowHeight); + +extern void TblSetRowHeight (TablePtr table, Word row, Word height) + SYS_TRAP(sysTrapTblSetRowHeight); + +extern Word TblGetColumnWidth (TablePtr table, Word column) + SYS_TRAP(sysTrapTblGetColumnWidth); + +extern void TblSetColumnWidth (TablePtr table, Word column, Word width) + SYS_TRAP(sysTrapTblSetColumnWidth); + +extern Word TblGetColumnSpacing (TablePtr table, Word column) + SYS_TRAP(sysTrapTblGetColumnSpacing); + +extern void TblSetColumnSpacing (TablePtr table, Word column, Word spacing) + SYS_TRAP(sysTrapTblSetColumnSpacing); + +extern Boolean TblFindRowID (TablePtr table, Word id, WordPtr rowP) + SYS_TRAP(sysTrapTblFindRowID); + +extern Boolean TblFindRowData (TablePtr table, DWord data, WordPtr rowP) + SYS_TRAP(sysTrapTblFindRowData); + +extern Word TblGetRowID (TablePtr table, Word row) + SYS_TRAP(sysTrapTblGetRowID); + +extern void TblSetRowID (TablePtr table, Word row, Word id) + SYS_TRAP(sysTrapTblSetRowID); + +extern DWord TblGetRowData (TablePtr table, Word row) + SYS_TRAP(sysTrapTblGetRowData); + +extern void TblSetRowData (TablePtr table, Word row, DWord data) + SYS_TRAP(sysTrapTblSetRowData); + +extern Boolean TblRowInvalid (TablePtr table, Word row) + SYS_TRAP(sysTrapTblRowInvalid); + +extern void TblMarkRowInvalid (TablePtr table, Word row) + SYS_TRAP(sysTrapTblMarkRowInvalid); + +extern void TblMarkTableInvalid (TablePtr table) + SYS_TRAP(sysTrapTblMarkTableInvalid); + +extern Boolean TblGetSelection (TablePtr table, WordPtr rowP, WordPtr columnP) + SYS_TRAP(sysTrapTblGetSelection); + +extern void TblInsertRow (TablePtr table, Word row) + SYS_TRAP(sysTrapTblInsertRow); + +extern void TblRemoveRow (TablePtr table, Word row) + SYS_TRAP(sysTrapTblRemoveRow); + +extern void TblReleaseFocus (TablePtr table) + SYS_TRAP(sysTrapTblReleaseFocus); + +extern Boolean TblEditing (TablePtr table) + SYS_TRAP(sysTrapTblEditing); + +extern FieldPtr TblGetCurrentField (TablePtr table) + SYS_TRAP(sysTrapTblGetCurrentField); + +extern void TblGrabFocus (TablePtr table, Word row, Word column) + SYS_TRAP(sysTrapTblGrabFocus); + +extern void TblSetColumnEditIndicator (TablePtr table, Word column, + Boolean editIndicator) + SYS_TRAP(sysTrapTblSetColumnEditIndicator); + +extern void TblSetRowStaticHeight (TablePtr table, Word row, + Boolean staticHeight) + SYS_TRAP(sysTrapTblSetRowStaticHeight); + +extern void TblHasScrollBar (TablePtr table, Boolean hasScrollBar) + SYS_TRAP(sysTrapTblHasScrollBar); + +#endif //__TABLE_H__ diff --git a/sdk-2/include/Core/UI/UIAll.h b/sdk-2/include/Core/UI/UIAll.h new file mode 100644 index 0000000..d6cc773 --- /dev/null +++ b/sdk-2/include/Core/UI/UIAll.h @@ -0,0 +1,33 @@ +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif + diff --git a/sdk-2/include/Core/UI/UICommon.h b/sdk-2/include/Core/UI/UICommon.h new file mode 100644 index 0000000..ade8a8d --- /dev/null +++ b/sdk-2/include/Core/UI/UICommon.h @@ -0,0 +1,297 @@ +#ifndef __UICOMMON_H__ +#define __UICOMMON_H__ + +enum justifications { leftAlign, centerAlign, rightAlign }; +typedef enum justifications JustificationType; + +//------------------------------------------------------------ +// System functions +//------------------------------------------------------------ +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define max(a, b) (((a) > (b)) ? (a) : (b)) + + + +//------------------------------------------------------------ +// Temporary resource routines +//------------------------------------------------------------ + +#define strRsc 'tSTR' +#define ainRsc 'tAIN' +#define iconType 'tAIB' +#define bitmapRsc 'Tbmp' +#define alertRscType 'Talt' +#define kbdRscType 'tkbd' +#define MenuRscType 'MBAR' +#define fontRscType 'NFNT' +#define verRsc 'tver' +#define appInfoStringsRsc 'tAIS' + + +// Application version string ID +#define appVersionID 1 +#define ainID 1000 + +// System Default app icon (for apps missing a tAIB) +#define defaultAppIconBitmap 10000 + +// System version string ID - this is hidden in +// the SystemVersion.rsrc resource, because the 'system' resources +// don't have ResEdit formats. +#define systemVersionID 10000 + +// System bitmaps +#define palmLogoBitmap 10000 +#define keyboardBackspaceBitmap 10001 +#define keyboardTabBitmap 10002 +#define keyboardReturnBitmap 10003 +#define InformationAlertBitmap 10004 +#define ConfirmationAlertBitmap 10005 +#define WarningAlertBitmap 10006 +#define ErrorAlertBitmap 10007 +#define keyboardShiftBitmap 10008 +#define keyboardCapBitmap 10009 + + +// System string resources +#define daysOfWeekStrID 10000 +#define dayFullNamesStrID 10001 +#define monthNamesStrID 10002 +#define monthFullNamesStrID 10003 +#define categoryAllStrID 10004 +#define categoryEditStrID 10005 +#define menuCommandStrID 10006 +#define launcherBatteryStrID 10007 +#define systemNameStrID 10008 +#define phoneLookupTitleStrID 10009 +#define phoneLookupAddStrID 10010 +#define phoneLookupFormatStrID 10011 + + +// System Alerts +#define SelectACategoryAlert 10000 + +// This alert broke 1.0 applications and is now disabled until later. +// It is redefined below (10015). +//#define RemoveCategoryAlert 10001 +//#define RemoveCategoryRecordsButton 0 +//#define RemoveCategoryNameButton 1 +//#define RemoveCategoryCancelButton 2 + +#define LowBatteryAlert 10002 +#define VeryLowBatteryAlert 10003 +#define UndoAlert 10004 +#define UndoCancelButton 1 + +#define MergeCategoryAlert 10005 +#define MergeCategoryYes 0 +#define MergeCategoryNo 1 + +#define privateRecordInfoAlert 10006 + +#define ClipboardLimitAlert 10007 + +#define CategoryExistsAlert 10012 + +#define DeviceFullAlert 10013 + +#define categoryAllUsedAlert 10014 + +#define RemoveCategoryAlert 10015 // See alert 10001 +#define RemoveCategoryYes 0 +#define RemoveCategoryNo 1 + +#define DemoUnitAlert 10016 + + + +// System Menu Bar and Menus +#define sysEditMenuID 10000 +#define sysEditMenuUndoCmd 10000 +#define sysEditMenuCutCmd 10001 +#define sysEditMenuCopyCmd 10002 +#define sysEditMenuPasteCmd 10003 +#define sysEditMenuSelectAllCmd 10004 +#define sysEditMenuSeparator 10005 +#define sysEditMenuKeyboardCmd 10006 +#define sysEditMenuGraffitiCmd 10007 + + +// Keyboard Menu Bar and Menus +#define sysKeyboardMenuID 10100 +#define sysKeyboardEditUndoCmd 100 +#define sysKeyboardEditCutCmd 101 +#define sysKeyboardEditCopyCmd 102 +#define sysKeyboardEditPasteCmd 103 +#define sysKeyboardEditSelectAllCmd 104 + + +// Note View Menu Bar and Menus +#define noteMenuID 10200 +#define noteUndoCmd 10000 +#define noteCutCmd 10001 +#define noteCopyCmd 10002 +#define notePasteCmd 10003 +#define noteSelectAllCmd 10004 +#define noteSeparator 10005 +#define noteKeyboardCmd 10006 +#define noteGraffitiCmd 10007 +#define noteTopOfPageCmd 10200 +#define noteBottomOfPageCmd 10201 +#define notePhoneLookupCmd 10202 + + +// System Keyboard Dialog +#define SystemKeyboardID 10000 + + +// Categories Edit Dialog +#define CategoriesEditForm 10000 +#define CategoriesEditList 10002 +#define CategoriesEditOKButton 10003 +#define CategoriesEditNewButton 10004 +#define CategoriesEditRenameButton 10005 +#define CategoriesEditDeleteButton 10006 + + +// Date Selector Dialog +#define DateSelectorForm 10100 +#define DateSelectorYearLabel 10102 +#define DateSelectorPriorYearButton 10103 +#define DateSelectorNextYearButton 10104 +#define DateSelectorTodayButton 10118 +#define DateSelectorCancelButton 10119 +#define DateSelectorDayGadget 10120 +#define DateSelectorThisWeekButton 10121 +#define DateSelectorThisMonthButton 10122 + + +// Time Selector Dialog +#define TimeSelectorForm 10200 +#define TimeSelectorStartTimeButton 10204 +#define TimeSelectorEndTimeButton 10205 +#define TimeSelectorHourList 10206 +#define TimeSelectorMinuteList 10207 +#define TimeSelectorOKButton 10208 +#define TimeSelectorCancelButton 10209 +#define TimeSelectorNoTimeButton 10210 + + +// Onscreen Keyboard +#define KeyboardForm 10300 +#define KeyboardGadget 10310 + + +// Help Dialog +#define HelpForm 10400 +#define HelpField 10402 +#define HelpDoneButton 10403 +#define HelpUpButton 10404 +#define HelpDownButton 10405 + + +// Find Dialog +#define FindDialog 10500 +#define FindStrField 10503 +#define FindOKButton 10504 + + +// Find Results Dialog +#define FindResultsDialog 10600 +#define FindResultsMsgLabel 10602 +#define FindResultsTable 10603 +#define FindResultsGoToButton 10604 +#define FindResultsCancelButton 10605 +#define FindResultsMoreButton 10606 +#define FindResultsStopButton 10607 + +#define FindResultsSearchingStr 10607 +#define FindResultsMatchesStr 10608 +#define FindResultsNoMatchesStr 10609 +#define FindResultsContinueStr 10610 + + +// Note View (used by Datebook, To Do, and Address apps) +#define NoteView 10900 +#define NoteField 10901 +#define NoteDoneButton 10902 +#define NoteSmallFontButton 10903 +#define NoteLargeFontButton 10904 +#define NoteDeleteButton 10905 +#define NoteUpButton 10906 +#define NoteDownButton 10907 +#define NoteScrollBar 10908 +#define NoteFontGroup 1 + + +// About Box - used by Datebook, Memo, Address, To Do, & others +#define aboutDialog 11000 +#define aboutNameLabel 11001 +#define aboutVersionLabel 11002 +#define aboutErrorStr 11003 + + +// Category New Name Dialog (used for new and renamed categories) +#define categoryNewNameDialog 11100 +#define categoryNewNameField 11103 +#define categoryNewNameOKButton 11104 + + +// Graffiti Reference Dialog +#define graffitiReferenceDialog 11200 +#define graffitiReferenceDoneButton 11202 +#define graffitiReferenceUpButton 11203 +#define graffitiReferenceDownButton 11204 +#define graffitiReferenceFirstBitmap 11205 + + +// Net Library Serial Net Interface dialogs. These don't really have to +// have ID's in the system range except in the Emulator. When running on +// the device, the interface's resource file is opened up just to get these +// resources so that the ID's don't have to be unique with the application's +// resource IDs. +#define netSerStringList 11300 // String list resource ID + +// Net Serial Progress Dialog +#define netSerProgressFrm 11300 // progress form ID +#define netSerProgressLabelStage 11302 // Label ID +#define netSerProgressBtnCancel 11303 // Cancel button ID +#define netSerPictPhone 11300 // resource ID of phone picture +#define netSerPictHandshake 11301 // resource ID of handshake picture +#define netSerPictBook 11302 // resource ID of book picture +#define netSerPictError 11303 // resource ID of error picture + +// Net Serial Prompt Dialog +#define netSerPromptFrm 11400 // Prompt for string form ID +#define netSerPromptAsk 11402 // Label - ask string +#define netSerPromptField 11403 // answer field +#define netSerPromptBtnOK 11404 // OK button ID +#define netSerPromptBtnCancel 11405 // Cancel button ID + + +// Launcher Dialog +#define launcherDialog 11500 +#define launcherGadget 11501 + +//------------------------------------------------------------ +// Temporary resource routines +//------------------------------------------------------------ + +VoidPtr ResLoadForm (Word rscID) + SYS_TRAP(sysTrapResLoadForm); + +VoidPtr ResLoadMenu (Word rscID) + SYS_TRAP(sysTrapResLoadMenu); + + +CharPtr ResLoadString (Word rscID); + + + +//------------------------------------------------------------ +// Temporary debugging routines +//------------------------------------------------------------ +extern Boolean HeapDump (void); + + +#endif //__UICOMMON_H__ diff --git a/sdk-2/include/Core/UI/UIGlobals.h b/sdk-2/include/Core/UI/UIGlobals.h new file mode 100644 index 0000000..ebd05fc --- /dev/null +++ b/sdk-2/include/Core/UI/UIGlobals.h @@ -0,0 +1,132 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: Global.h + * AUTHOR: Art Lamb: September 12, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines global variables used by the UI routines. + * + **********************************************************************/ + +#ifndef __GLOBAL_H__ +#define __GLOBAL_H__ + + +#define UINumFonts 7 +#define eventQueueSize 10 + + +typedef struct UIGlobalsType { + + // Global variables used by the window routines. + WinHandle activeWindow; + WinHandle displayWindow; + WinHandle drawWindow; + WinHandle firstWindow; + WinHandle exitWindowID; + WinHandle enterWindowID; + WinHandle exitedWindowID; + GraphicStateType gState; + + + // Global variables used by the event routines. + EventStoreType* eventQ; + Word eventQIndex; + Word eventQLength; + SWord lastScreenX; + SWord lastScreenY; + Boolean lastPenDown; + SDWord needNullTickCount; // We want a null Evt when ticks reaches this value + + + // Global variables used by the font routins. + FontPtr uiCurrentFontPtr; + FontPtr uiFontTable[UINumFonts]; + FontID uiCurrentFontID; + + + // Global variables used by the form routines. + FormPtr currentForm; + + + // Global variables used by the insertion point routines. + Boolean insPtIsEnabled; + Boolean insPtOn; + PointType insPtLoc; + SWord insPtHeight; + SDWord insPtLastTick; + WinHandle insPtBitsBehind; + + // Global variables used by the clipboard routines. + ClipboardItem clipboard[numClipboardForamts]; + + // Globals used by the Memory Manager + MenuBarPtr uiCurrentMenu; + Word uiCurrentMenuRscID; + + // Global variables used by the field routines. + FieldUndoType undoGlobals; + + // Global variables used by the Griffiti shift state indicator routines. + Byte gsiState; + Boolean gsiIsEnabled; + PointType gsiLocation; + + // Numeric decimal seperator, used in the field routines. + Char uiDecimalSeparator; + + } UIGlobalsType; +typedef UIGlobalsType* UIGlobalsPtr; + + +#define ActiveWindow ((UIGlobalsPtr)GUIGlobalsP)->activeWindow +#define DisplayWindow ((UIGlobalsPtr)GUIGlobalsP)->displayWindow +#define DrawWindow ((UIGlobalsPtr)GUIGlobalsP)->drawWindow +#define FirstWindow ((UIGlobalsPtr)GUIGlobalsP)->firstWindow +#define ExitWindowID ((UIGlobalsPtr)GUIGlobalsP)->exitWindowID +#define EnterWindowID ((UIGlobalsPtr)GUIGlobalsP)->enterWindowID +#define ExitedWindowID ((UIGlobalsPtr)GUIGlobalsP)->exitedWindowID +#define GState ((UIGlobalsPtr)GUIGlobalsP)->gState + +#define EventQ ((UIGlobalsPtr)GUIGlobalsP)->eventQ +#define EventQIndex ((UIGlobalsPtr)GUIGlobalsP)->eventQIndex +#define EventQLength ((UIGlobalsPtr)GUIGlobalsP)->eventQLength +#define LastScreenX ((UIGlobalsPtr)GUIGlobalsP)->lastScreenX +#define LastScreenY ((UIGlobalsPtr)GUIGlobalsP)->lastScreenY +#define LastPenDown ((UIGlobalsPtr)GUIGlobalsP)->lastPenDown +#define NeedNullTickCount ((UIGlobalsPtr)GUIGlobalsP)->needNullTickCount + +#define UICurrentFontPtr ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentFontPtr +#define UIFontTable ((UIGlobalsPtr)GUIGlobalsP)->uiFontTable +#define UICurrentFontID ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentFontID + +#define CurrentForm ((UIGlobalsPtr)GUIGlobalsP)->currentForm + +#define InsPtIsEnabled ((UIGlobalsPtr)GUIGlobalsP)->insPtIsEnabled +#define InsPtOn ((UIGlobalsPtr)GUIGlobalsP)->insPtOn +#define InsPtLoc ((UIGlobalsPtr)GUIGlobalsP)->insPtLoc +#define InsPtHeight ((UIGlobalsPtr)GUIGlobalsP)->insPtHeight +#define InsPtLastTick ((UIGlobalsPtr)GUIGlobalsP)->insPtLastTick +#define InsPtBitsBehind ((UIGlobalsPtr)GUIGlobalsP)->insPtBitsBehind + +#define Clipboard ((UIGlobalsPtr)GUIGlobalsP)->clipboard + +#define UICurrentMenu ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentMenu +#define UICurrentMenuRscID ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentMenuRscID +#define UndoGlobals ((UIGlobalsPtr)GUIGlobalsP)->undoGlobals + +#define GsiState ((UIGlobalsPtr)GUIGlobalsP)->gsiState +#define GsiIsEnabled ((UIGlobalsPtr)GUIGlobalsP)->gsiIsEnabled +#define GsiLocation ((UIGlobalsPtr)GUIGlobalsP)->gsiLocation + +#define UIDecimalSeparator ((UIGlobalsPtr)GUIGlobalsP)->uiDecimalSeparator + + +#endif //__GLOBAL_H__ + + diff --git a/sdk-2/include/Core/UI/Window.h b/sdk-2/include/Core/UI/Window.h new file mode 100644 index 0000000..ea76215 --- /dev/null +++ b/sdk-2/include/Core/UI/Window.h @@ -0,0 +1,351 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1997, Palm Computing Inc., All Rights Reserved + * + * PROJECT: Pilot + * FILE: window.h + * AUTHOR: Art Lamb: September 12, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines window structures and routines. + * + **********************************************************************/ + +#ifndef __WINDOW_H__ +#define __WINDOW_H__ + + +enum directions { up = 0, down, left, right }; +typedef enum directions DirectionType; + + +enum windowFormats { screenFormat = 0, genericFormat }; +typedef enum windowFormats WindowFormatType; + + +//enum graphicModes { drawMode = 0, eraseMode, invertMode, mergeMode}; +//typedef enum graphicModes GraphicModeType; +typedef enum {scrCopy, scrAND, scrANDNOT, scrXOR, scrOR, scrCopyNOT} ScrOperation; + + +enum patterns { blackPattern, whitePattern, grayPattern, customPattern }; +typedef enum patterns PatternType; + +#define grayHLinePattern 0xAA + +enum underlineModes { noUnderline, grayUnderline, solidUnderline }; +typedef enum underlineModes UnderlineModeType; + + + +typedef struct { + Word compressed:1; // Data format: 0=raw; 1=compressed + Word reserved :15; +} BitmapFlagsType; + + +typedef struct { + Word width; + Word height; + Word rowBytes; + BitmapFlagsType flags; + Word reserved [4]; +} BitmapType; + + + +typedef BitmapType * BitmapPtr; + +typedef Word CustomPatternType [4]; + +typedef struct { + ScrOperation grafMode; + Boolean patternMode; + PatternType pattern; + CustomPatternType customPtn; + FontID fontId; + Byte padding1; + FontPtr font; + UnderlineModeType underlineMode; +} GraphicStateType; + +typedef GraphicStateType * GraphicStatePtr; + + +typedef union { + struct { + Word cornerDiam : 8; // corner diameter, max 38 + Word reserved : 4; + Word shadowWidth : 2; // Width of shadow + Word width : 2; // Width frame + } bits; + Word word; +} FrameBitsType; + +typedef Word FrameType; + +// Standard Frame Types +#define noFrame 0 +#define simpleFrame 1 +#define rectangleFrame 1 +#define roundFrame 0x0401 // corner = 7, frame = 1 +#define boldRoundFrame 0x0702 // corner = 7, frame = 2 +#define popupFrame 0x0205 // corner = 2, frame = 1, shadow = 1 +#define dialogFrame 0x0302 // corner = 3, frame = 2 +#define menuFrame popupFrame + + +typedef struct { + Word format:1; // window format: 0=screen mode; 1=generic mode + Word offscreen:1; // offscreen flag: 0=onscreen ; 1=offscreen + Word modal:1; // modal flag: 0=modeless window; 1=modal window + Word focusable:1; // focusable flag: 0=non-focusable; 1=focusable + Word enabled:1; // enabled flag: 0=disabled; 1=enabled + Word visible:1; // visible flag: 0-invisible; 1=visible + Word dialog:1; // dialog flag: 0=non-dialog; 1=dialog + Word compressed:1; // compressed flag: 0=uncompressed; 1=compressed + Word reserved :8; +} WindowFlagsType; + + +typedef struct WinTypeStruct { + Word displayWidth; + Word displayHeight; + VoidPtr displayAddr; + WindowFlagsType windowFlags; + RectangleType windowBounds; + AbsRectType clippingBounds; + PointType viewOrigin; + FrameBitsType frameType; + GraphicStatePtr gstate; + struct WinTypeStruct * nextWindow; +} WindowType; + +typedef WindowType * WinPtr; +typedef WinPtr WinHandle; + + + + + +//----------------------------------------------- +// Macros +//----------------------------------------------- + +// For now, the window handle is a pointer to a window structure, +// this however may change, so use the following macros. + +#define WinGetWindowPointer(winHandle) ((WinPtr) winHandle) + +#define WinGetWindowHandle(winPtr) ((WinHandle) winPtr) + + +//----------------------------------------------- +// Routines relating to windows management +//----------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern WinHandle WinCreateWindow (RectanglePtr bounds, FrameType frame, + Boolean modal, Boolean focusable, WordPtr error) + SYS_TRAP(sysTrapWinCreateWindow); + +extern WinHandle WinCreateOffscreenWindow (SWord width, SWord height, + WindowFormatType format, WordPtr error) + SYS_TRAP(sysTrapWinCreateOffscreenWindow); + +extern void WinDeleteWindow (WinHandle winHandle, Boolean eraseIt) + SYS_TRAP(sysTrapWinDeleteWindow); + +extern void WinInitializeWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinInitializeWindow); + +extern void WinAddWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinAddWindow); + +extern void WinRemoveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinRemoveWindow); + +extern void WinSetActiveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetActiveWindow); + +extern WinHandle WinSetDrawWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetDrawWindow); + +extern WinHandle WinGetDrawWindow (void) + SYS_TRAP(sysTrapWinGetDrawWindow); + +extern WinHandle WinGetActiveWindow (void) + SYS_TRAP(sysTrapWinGetActiveWindow); + +extern WinHandle WinGetDisplayWindow (void) + SYS_TRAP(sysTrapWinGetDisplayWindow); + +extern WinHandle WinGetFirstWindow (void) + SYS_TRAP(sysTrapWinGetFirstWindow); + +extern void WinEnableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinEnableWindow); + +extern void WinDisableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinDisableWindow); + +extern void WinGetWindowFrameRect (WinHandle winHandle, RectanglePtr r) + SYS_TRAP(sysTrapWinGetWindowFrameRect); + +extern void WinDrawWindowFrame (void) + SYS_TRAP(sysTrapWinDrawWindowFrame); + +extern void WinEraseWindow (void) + SYS_TRAP(sysTrapWinEraseWindow); + +extern WinHandle WinSaveBits (RectanglePtr source, WordPtr error) + SYS_TRAP(sysTrapWinSaveBits); + +extern void WinRestoreBits (WinHandle winHandle, SWord destX, SWord destY) + SYS_TRAP(sysTrapWinRestoreBits); + +extern void WinCopyRectangle (WinHandle srcWin, WinHandle dstWin, + RectanglePtr srcRect, SWord destX, SWord destY, ScrOperation mode) + SYS_TRAP(sysTrapWinCopyRectangle); + +extern void WinScrollRectangle + (RectanglePtr r, enum directions direction, SWord distance, + RectanglePtr vacated) + SYS_TRAP(sysTrapWinScrollRectangle); + +extern void WinGetDisplayExtent (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinGetDisplayExtent); + +extern void WinGetWindowBounds (RectanglePtr r) + SYS_TRAP(sysTrapWinGetWindowBounds); + +extern void WinSetWindowBounds (WinHandle winHandle, RectanglePtr r) + SYS_TRAP(sysTrapWinSetWindowBounds); + +extern void WinGetWindowExtent (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinGetWindowExtent); + +extern void WinDisplayToWindowPt (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinDisplayToWindowPt); + +extern void WinWindowToDisplayPt (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinWindowToDisplayPt); + +extern void WinGetClip (RectanglePtr r) + SYS_TRAP(sysTrapWinGetClip); + +extern void WinSetClip (RectanglePtr r) + SYS_TRAP(sysTrapWinSetClip); + +extern void WinResetClip (void) + SYS_TRAP(sysTrapWinResetClip); + +extern void WinClipRectangle (RectanglePtr r) + SYS_TRAP(sysTrapWinClipRectangle); + +extern Boolean WinModal (WinHandle winHandle) + SYS_TRAP(sysTrapWinModal); + +//----------------------------------------------- +// Routines to draw shapes or frames shapes +//----------------------------------------------- + +extern void WinDrawLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinDrawLine); + +extern void WinDrawGrayLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinDrawGrayLine); + +extern void WinEraseLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinEraseLine); + +extern void WinInvertLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinInvertLine); + +extern void WinFillLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinFillLine); + +extern void WinDrawRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinDrawRectangle); + +extern void WinEraseRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinEraseRectangle); + +extern void WinInvertRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinInvertRectangle); + +extern void WinFillRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinFillRectangle); + +extern void WinDrawRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinDrawRectangleFrame); + +extern void WinDrawGrayRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinDrawGrayRectangleFrame); + +extern void WinEraseRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinEraseRectangleFrame); + +extern void WinInvertRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinInvertRectangleFrame); + +extern void WinGetFramesRectangle (FrameType frame, RectanglePtr r, + RectanglePtr obscuredRect) + SYS_TRAP(sysTrapWinGetFramesRectangle); + + + +//----------------------------------------------- +// Routines relating to characters +//----------------------------------------------- + +extern void WinDrawChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawChars); + +extern void WinDrawInvertedChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawInvertedChars); + +extern void WinEraseChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinEraseChars); + +extern void WinInvertChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinInvertChars); + +extern UnderlineModeType WinSetUnderlineMode (UnderlineModeType mode) + SYS_TRAP(sysTrapWinSetUnderlineMode); + + +//----------------------------------------------- +// Routines to control patterns +//----------------------------------------------- + +extern void WinGetPattern (CustomPatternType) + SYS_TRAP(sysTrapWinGetPattern); + +extern void WinSetPattern (CustomPatternType) + SYS_TRAP(sysTrapWinSetPattern); + +//extern void WinSetPatternXferMode (enum patternXferModes mode); + +//extern enum patternXferModes WinGetPatternXferMode (void); + + +//----------------------------------------------- +// Routines relating to bitmaps +//----------------------------------------------- +extern void WinDrawBitmap (BitmapPtr bitmapP, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawBitmap); + + +#ifdef __cplusplus +} +#endif + + +#endif // __WINDOW_H__ + diff --git a/sdk-3.1/LicenseAgreement.txt b/sdk-3.1/LicenseAgreement.txt new file mode 100644 index 0000000..e6b24d8 --- /dev/null +++ b/sdk-3.1/LicenseAgreement.txt @@ -0,0 +1,184 @@ +IMPORTANT: Read Before Using The Accompanying Software + + +3COM PALM OS SOFTWARE DEVELOPMENT KIT +SOFTWARE LICENSE AGREEMENT + + +YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND +CONDITIONS BEFORE USING THE ACCOMPANYING SOFTWARE, +THE USE OF WHICH IS LICENSED BY PALM COMPUTING, INC., A +SUBSIDIARY OF 3COM CORPORATION (COLLECTIVELY, "3COM"), +TO ITS CUSTOMERS FOR THEIR USE ONLY AS SET FORTH +BELOW. IF YOU DO NOT AGREE TO THE TERMS AND +CONDITIONS OF THIS AGREEMENT, DO NOT USE THE +SOFTWARE. USING ANY PART OF THE SOFTWARE INDICATES +THAT YOU ACCEPT THESE TERMS. + +LICENSE: 3Com grants you a nonexclusive, royalty-free license to use the +accompanying software program(s) (the "Software") subject to the terms and +restrictions set forth in this License Agreement. Except as explicitly set forth +below, (i) you are not permitted to lease or rent (except under separate mutually +agreeable terms set forth in writing and signed by both parties), distribute or +sublicense the Software or to use the Software in a time-sharing arrangement or +in any other unauthorized manner; (ii) no license is granted to you in the human +readable code of the Software (source code); and (iii) this License Agreement +does not grant you any rights to patents, copyrights, trade secrets, trademarks, or +any other rights in respect to the Software. + +The Software is licensed to be used on any personal computer and/or any Palm +Computing platform product, provided that the Software is used only in +connection with your development of products for use with Palm Computing +platform products. The Software contains certain sample source code in the +form of example applications (including several conduits) and code fragments +(both in the source code files and documentation provided hereunder), and may +include a tutorial application (collectively, "Sample Source Code"). You may +use the Sample Source Code internally to develop products for Palm Computing +platform products. You may distribute any such products built with the Sample +Source Code, provided that you include the following copyright notice within +your source code and in the location of your own copyright notice: "Portions +copyright c 1998 3Com Corporation or its subsidiaries. All rights reserved." + +Notwithstanding anything else in this License Agreement, you may not distribute +the conduit development kit header files included as part of the Software to +anyone for any reason. + +Except as described above, the Software and supporting documentation may be +copied only as essential for backup or archive purposes in support of your use of +the Software as permitted hereunder. You must reproduce and include all +copyright notices and any other proprietary rights notices appearing on the +Software on any copies that you make. + +NO ASSIGNMENT; NO REVERSE ENGINEERING: You may transfer the +Software and this License Agreement to another party if the other party agrees in +writing to accept the terms and conditions of this License Agreement. If you +transfer the Software, you must at the same time either transfer all copies of the +Software as well as the supporting documentation to the same party or destroy +any such materials not transferred. Except as set forth above, you may not +transfer or assign the Software or your rights under this License Agreement. + +Modification, reverse engineering, reverse compiling, or disassembly of the +Software is expressly prohibited. However, if you are a European Community +("EC") resident, information necessary to achieve interoperability of the +Software with other programs within the meaning of the EC Directive on the +Legal Protection of Computer Programs is available to you from 3Com upon +written request. + +EXPORT RESTRICTIONS: You agree that you will not export or re-export +the Software or accompanying documentation (or any copies thereof) or any +products utilizing the Software or such documentation in violation of any +applicable laws or regulations of the United States or the country in which you +obtained them. + +TRADE SECRETS; TITLE: You acknowledge and agree that the structure, +sequence and organization of the Software are the valuable trade secrets of +3Com and its suppliers. You agree to hold such trade secrets in confidence. +You further acknowledge and agree that ownership of, and title to, the Software +and all subsequent copies thereof regardless of the form or media are held by +3Com and its suppliers. + +UNITED STATES GOVERNMENT LEGEND: The Software is commercial +in nature and developed solely at private expense. The Software is delivered as +"Commercial Computer Software" as defined in DFARS 252.227-7014 (June +1995) or as a commercial item as defined in FAR 2.101(a) and as such is +provided with only such rights as are provided in this License Agreement, which +is 3Com's standard commercial license for the Software. Technical data is +provided with limited rights only as provided in DFAR 252.227-7015 (Nov. +1995) or FAR 52.227-14 (June 1987), whichever is applicable. + +TERM AND TERMINATION: This License Agreement is effective until +terminated. You may terminate it at any time by destroying the Software and +documentation together with all copies and merged portions in any form. It will +also terminate immediately if you fail to comply with any term or condition of +this License Agreement. Upon such termination you agree to destroy the +Software and documentation, together with all copies and merged portions in any +form. + +GOVERNING LAW: This License Agreement shall be governed by the laws +of the State of California as such laws are applied to agreements entered into and +to be performed entirely within California between California residents and by +the laws of the United States. You agree that the United Nations Convention on +Contracts for the International Sale of Goods (1980) is hereby excluded in its +entirety from application to this License Agreement. + +LIMITED WARRANTY: 3Com warrants the media containing the Software +for a period of ninety (90) days from the date of original purchase from 3Com or +its authorized retailer. Proof of date of purchase will be required. Any updates +to the Software provided by 3Com (which may be provided by 3Com at its sole +discretion) shall be governed by the terms of this License Agreement. The sole +obligation of 3Com with respect to this express warranty shall be (at the +discretion of 3Com) to refund the purchase price paid by you for the Software on +the defective media, or to replace the Software on new media. 3Com makes no +warranty or representation that its software products will meet your requirements +or will work in combination with any hardware or applications software products +provided by third parties, that the operation of the software products will be +uninterrupted or error free, or that all defects in the Software will be corrected. + +OBTAINING WARRANTY SERVICE: You must contact 3Com's Palm +Computing, Inc. Customer Service within the applicable warranty period to +obtain warranty service authorization. Dated proof of original purchase will be +required. 3Com is not responsible for your products or parts received without +warranty service authorization. + +WARRANTIES EXCLUSIVE: IF TH SOFTWARE MEDIA DOES NOT +OPERATE AS WARRANTED ABOVE, YOUR SOLE REMEDY FOR +BREACH OF THAT WARRANTY SHALL BE REPLACEMENT OF THE +SOFTWARE ON NEW MEDIA OR REFUND OF THE PURCHASE +PRICE PAID, AT THE OPTION OF 3COM AND DEPENDENT UPON +PRIOR AUTHORIZATION. TO THE FULL EXTENT ALLOWED BY +LAW, THE FOREGOING WARRANTIES AND REMEDIES ARE +EXCLUSIVE AND ARE IN LIEU OF ALL OTHER WARRANTIES, +TERMS, OR CONDITIONS, EXPRESS OR IMPLIED, EITHER IN FACT +OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, +INCLUDING WARRANTIES, TERMS, OR CONDITIONS OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +AND SATISFACTORY QUALITY. 3COM NEITHER ASSUMES NOR +AUTHORIZES ANY OTHER PERSON TO ASSUME FOR IT ANY +OTHER LIABILITY IN CONNECTION WITH THE SALE, +INSTALLATION, MAINTENANCE OR USE OF ITS PRODUCTS. + +3Com shall not be liable under this warranty if its testing and examination +disclose that the alleged defect in the product does not exist or was caused by +your or any third person's misuse, neglect, improper installation or testing, +unauthorized attempts to repair or modify, or any other cause beyond the range +of the intended use, or by accident, fire, lightning, or other hazards or acts of +God. This warranty does not apply when the malfunction results from the use of +this product in conjunction with accessories, other products, or ancillary or +peripheral equipment and 3Com determines that there is no fault with the +product itself. + +LIMITATION OF LIABILITY. TO THE FULL EXTENT ALLOWED +BY LAW 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS +ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT +(INCLUDING NEGLIGENCE), FOR INCIDENTAL, CONSEQUENTIAL, +INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF ANY KIND, OR +FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF +INFORMATION OR DATA, OR OTHER FINANCIAL LOSS ARISING +OUT OF OR IN CONNECTION WITH THE SALE, INSTALLATION, +MAINTENANCE, USE, PERFORMANCE, FAILURE, OR +INTERRUPTION OF THIS PRODUCT, EVEN IF 3COM OR ITS +AUTHORIZED RESELLER HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES, AND LIMITS ITS LIABILITY TO +REPLACEMENT OF THE SOFTWARE ON NEW MEDIA, OR REFUND +OF THE PURCHASE PRICE PAID, AT THE OPTION OF 3COM. THIS +DISCLAIMER OF LIABILITY FOR DAMAGES WILL NOT BE +AFFECTED IF ANY REMEDY PROVIDED HEREIN SHALL FAIL OF +ITS ESSENTIAL PURPOSE. +SEVERABILITY: In the event any provision of this License Agreement is +found to be invalid, illegal or unenforceable, the validity, legality and +enforceability of any of the remaining provisions shall not in any way be +affected or impaired and a valid, legal and enforceable provision of similar intent +and economic impact shall be substituted therefor. The headings used in this +Agreement are for convenience only and shall not be considered part of the +Agreement. + +ENTIRE AGREEMENT: This License Agreement sets forth the entire +understanding and agreement between you and 3Com, supersedes all prior +agreements, whether written or oral, with respect to the Software and subject +matter hereof, and may be amended only in a writing signed by both parties. + +Palm Computing, Inc., a subsidiary of 3Com Corporation +1565 Charleston Road +Mountain View, California 94043 +(650) 237-6000 + diff --git a/sdk-3.1/include/Core/AppBuildRules.h b/sdk-3.1/include/Core/AppBuildRules.h new file mode 100644 index 0000000..f3e6452 --- /dev/null +++ b/sdk-3.1/include/Core/AppBuildRules.h @@ -0,0 +1,34 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * AppBuildRules.h + * + * Description: + * This header file can be used as a template for + * application specific build options. To use, simple copy this file + * and place it into your local directory. + * + * Typically, the options specified in this file are used to build + * with different forms of error-checking, etc. and are not common to all projects. + * + * History: + * 6/6/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +// Run with error checking that forces all handles to be locked before +// they are accessed. Before alpha, all applications should be able to run with this +// option on. +//#define MEMORY_FORCE_LOCK 1 + + +// Set these according to which Shell commands you want to +// link with. +#define SHELL_COMMAND_DB 0 // Not Available +#define SHELL_COMMAND_UI 0 // Not Available +#define SHELL_COMMAND_APP 0 // Not Available +#define SHELL_COMMAND_EMULATOR 1 // Available + diff --git a/sdk-3.1/include/Core/BuildRules.h b/sdk-3.1/include/Core/BuildRules.h new file mode 100644 index 0000000..071767a --- /dev/null +++ b/sdk-3.1/include/Core/BuildRules.h @@ -0,0 +1,308 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * BuildRules.h + * + * Description: + * Build Rules for Pilot. This file is necessary for + * the CodeWarrior environment since it doesn't permit #defines + * in the "Makefile" (project settings). + * + * This file is included from within Common.h + * + * History: + * 12/13/94 RM - Created by Ron Marianetti + * 5/19/97 SL - Cleaned up CMD_LINE_BUILD and __PALMOS_TRAPS__ + * for other build environments + * 04/07/98 art - Added INTERNATIONAL_MGR build setting. + * + *******************************************************************/ + +#ifndef __BUILDRULES_H__ +#define __BUILDRULES_H__ + +/************************************************************ + * Compilation Control Options + *************************************************************/ + +// The makefile should set the define EMULATION_LEVEL to one of the following +// constants: +#define EMULATION_NONE 0 // native environment +#define EMULATION_WINDOWS 1 // emulate on Windows +#define EMULATION_DOS 2 // emulate on DOS +#define EMULATION_MAC 3 // emulate on Macintosh + + +// If emulation is not EMULATION_NONE, the following define controls +// whether we are talking to a touchdown device over the serial port, +// or if we are emulating a memory card in local RAM. +// +// The makefile should set the define MEMORY_TYPE to one of the following +// constants +#define MEMORY_LOCAL 0 // Emulate using local memory card image +#define MEMORY_REMOTE 1 // Pass calls through serial port to the device + + +// The makefile should set the define ENVIRONMENT to one of the following: +#define ENVIRONMENT_CW 0 // CodeWarrior compiler/linker (IDE or MPW) +#define ENVIRONMENT_MPW 1 // Apple's MPW compiler/linker + + +// The makefile should set the define ERROR_CHECK_LEVEL to one of the +// following constants: +#define ERROR_CHECK_NONE 0 // compile no error checking code +#define ERROR_CHECK_PARTIAL 1 // display for fatal errors only +#define ERROR_CHECK_FULL 2 // display fatal or non-fatal errors + + +// The makefile should set the define CPU_TYPE to one of the +// following constants: +#define CPU_68K 0 // Motorola 68K type +#define CPU_x86 1 // Intel x86 type + + +// The makefile should set the define HW_TARGET to one of the +// following constants: +#define HW_TARGET_NONE 0 // Emulating +#define HW_TARGET_302 1 // Motorola 302 ADS board +#define HW_TARGET_328EMU 2 // Motorola 328 Emulator ADS board +#define HW_TARGET_328 3 // Motorola 328 ADS board +#define HW_TARGET_TD1 4 // Pilot hardware +#define HW_TARGET_EZ 6 // EZ hardware (68EZ328 Processor-based) + +// The makefile should set the define MODEL to one of the +// following constants. This equate is currently only use by +// special purpose applications like Setup that need to install different +// files for each type of product. Normally, model dependent behavior +// should be run-time based off of Features using FtrGet(). +#define MODEL_GENERIC 0 // Not one of the specific models that follow +#define MODEL_ELEVEN 1 // Eleven (Palm Seven) +#define MODEL_SUMO 2 // EZ product + +// The makefile should set the define MEMORY_FORCE_LOCK to one of the +// following. +#define MEMORY_FORCE_LOCK_OFF 0 // Don't force all handles to be locked +#define MEMORY_FORCE_LOCK_ON 1 // Force all handles to be locked before usage + + +// The makefile should set the define DEBUG_LEVEL to one of the +// following. THIS DEFINE IS ONLY USED BY A COUPLE MODULES SO WE +// DON'T GIVE IT A DEFAULT VALUE BELOW... +// ANY MODULE THAT USES THIS DEFINE SHOULD VERIFY THAT IT IS DEFINED!! +#define DEBUG_LEVEL_NONE 1 // None: Does not auto-launch Console or Debugger +#define DEBUG_LEVEL_PARTIAL 2 // Partial: Auto-Launches Console but skips debugger +#define DEBUG_LEVEL_FULL 3 // Full: Waits in debugger on reset + + +// The makefile should set the define CONSOLE_SERIAL_LIB to one of +// the following. THIS DEFINE IS ONLY USED BY A COUPLE MODULES SO WE +// DON'T GIVE IT A DEFAULT VALUE BELOW... +// ANY MODULE THAT USES THIS DEFINE SHOULD VERIFY THAT IT IS DEFINED!! +#define CONSOLE_SERIAL_LIB_68328 1 // SerialMgr68328 used by Console app +#define CONSOLE_SERIAL_LIB_68681 2 // SerialMgr68681 used by Console app + + +// The makefile should set the define COUNTRY to one of the +// following constants: +#define COUNTRY_UNITED_STATES 0 +#define COUNTRY_FRANCE 1 +#define COUNTRY_GERMANY 2 +#define COUNTRY_ITALY 3 +#define COUNTRY_SPAIN 4 +#define COUNTRY_JAPAN 6 + + +// The makefile should set the define LANGUAGE to one of the +// following constants: +#define LANGUAGE_ENGLISH 0 +#define LANGUAGE_FRENCH 1 +#define LANGUAGE_GERMAN 2 +#define LANGUAGE_ITALIAN 3 +#define LANGUAGE_SPANISH 4 +#define LANGUAGE_WORKPAD 5 +#define LANGUAGE_JAPANESE 6 + + + +// The makefile should set the define USER_MODE to one of the +// following constants: +#define USER_MODE_NORMAL 0 // normal operation +#define USER_MODE_DEMO 1 // demo mode - Graffiti and pop-up keyboard disabled + + +// The makefile should set the define INTERNAL_COMMANDS to one of the +// following constants: +#define INTERNAL_COMMANDS_EXCLUDE 0 +#define INTERNAL_COMMANDS_INCLUDE 1 // Include internal shell commands + +// The makefile should set the define MEMORY_VERSION to one of the +// following constants: +#define MEMORY_VERSION_1 1 +#define MEMORY_VERSION_2 2 // >64K chunks + +// The makefile should set the define GRAPHICS_VERSION to one of the +// following constants: +#define GRAPHICS_VERSION_1 1 +#define GRAPHICS_VERSION_2 2 // color + +// The makefile should set the define INCLUDE_DES to one of the +// following constants: +#define INCLUDE_DES_OFF 0 +#define INCLUDE_DES_ON 1 // include it + +// The makefile should set the define TEXT_SERVICES to one of the +// following constants: +#define TEXT_SERVICES_OFF 0 +#define TEXT_SERVICES_ON 1 // include it + +// The makefile should set the define INTERNATIONAL_MGR to one of the +// following constants: +#define INTERNATIONAL_MGR_OFF 0 +#define INTERNATIONAL_MGR_ON 1 // include it + +/************************************************************ + * Include the following when running under the CodeWarrior + * IDE so that default build options can be overriden. The default + * version of this file is in the Incs: directory. If an app wishes + * to override the default options, it should create a copy of this + * include file in its own local directory. This include file + * is never used when building from MPW since MPW can specify compiler + * defines from the command line. + * + * Other environments can override all of these settings by simply + * pre-defining CMD_LINE_BUILD and any other desired settings. + *************************************************************/ + +#ifndef CMD_LINE_BUILD // typically pre-defined only from MPW + + #if !defined(__MWERKS__) && !defined(__PALMOS_TRAPS__) + + // assume other environments generally build only PalmOS executables + #define __PALMOS_TRAPS__ 1 + + #endif + + + #if __PALMOS_TRAPS__ // defined by CodeWarrior IDE or above + + // Settings to build a PalmOS executable + #define EMULATION_LEVEL EMULATION_NONE // building Pilot executable + #define USE_TRAPS 1 // use Pilot traps + + #endif + + + // Include default definitions - either from Incs: directory or from + // local project directory (if present, to override system defaults). + #include "AppBuildRules.h" + #include +#endif + + + +/************************************************************ + * Settings that can be overriden in the makefile (for MPW) + * OR (for CodeWarrior) in "AppBuildRules.h". If there is no + * local copy of "AppBuildRules.h" within the project directory, + * the one in the Incs directory will be used instead. + *************************************************************/ +#ifndef EMULATION_LEVEL + #define EMULATION_LEVEL EMULATION_MAC +#endif + +#if EMULATION_LEVEL == EMULATION_NONE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +#ifndef MEMORY_TYPE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +#ifndef ENVIRONMENT + #define ENVIRONMENT ENVIRONMENT_CW +#endif + +#ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL ERROR_CHECK_FULL +#endif + +#ifndef CPU_TYPE + #define CPU_TYPE CPU_68K +#endif + +#ifndef HW_TARGET + #define HW_TARGET HW_TARGET_NONE +#endif + +#ifndef MEMORY_FORCE_LOCK + #define MEMORY_FORCE_LOCK MEMORY_FORCE_LOCK_ON +#endif + +#ifndef COUNTRY + #define COUNTRY COUNTRY_UNITED_STATES +#endif + +#ifndef LANGUAGE + #define LANGUAGE LANGUAGE_ENGLISH +#endif + +#ifndef USER_MODE + #define USER_MODE USER_MODE_NORMAL +#endif + +#ifndef INTERNAL_COMMANDS + #define INTERNAL_COMMANDS INTERNAL_COMMANDS_EXCLUDE +#endif + +#ifndef MEMORY_VERSION + #define MEMORY_VERSION MEMORY_VERSION_2 +#endif + +#ifndef GRAPHICS_VERSION + #define GRAPHICS_VERSION GRAPHICS_VERSION_2 +#endif + +#ifndef INCLUDE_DES + #define INCLUDE_DES INCLUDE_DES_OFF +#endif + +#ifndef TEXT_SERVICES + #define TEXT_SERVICES TEXT_SERVICES_OFF +#endif + +#ifndef INTERNATIONAL_MGR + #define INTERNATIONAL_MGR INTERNATIONAL_MGR_OFF +#endif + +/********************************************************************** + * By putting these here (once), we don't need them in each :Src:ĹRsc.c + **********************************************************************/ +#if LANGUAGE == LANGUAGE_ENGLISH +#define RESOURCE_FILE_PREFIX "" + +// Let it be known that these paths SHOULD have been language-based +// rather than country-based... (e.g. "Localized:French:") +#elif LANGUAGE == LANGUAGE_FRENCH +#define RESOURCE_FILE_PREFIX "Localized:France:" + +#elif LANGUAGE == LANGUAGE_GERMAN +#define RESOURCE_FILE_PREFIX "Localized:Germany:" + +#elif LANGUAGE == LANGUAGE_ITALIAN +#define RESOURCE_FILE_PREFIX "Localized:Italy:" + +#elif LANGUAGE == LANGUAGE_SPANISH +#define RESOURCE_FILE_PREFIX "Localized:Spain:" + +#elif LANGUAGE == LANGUAGE_WORKPAD +#define RESOURCE_FILE_PREFIX "Localized:WPEng:" + +#elif LANGUAGE == LANGUAGE_JAPANESE +#define RESOURCE_FILE_PREFIX "Localized:Japan:" +#endif + + +#endif // __BUILDRULES_H__ diff --git a/sdk-3.1/include/Core/Common.h b/sdk-3.1/include/Core/Common.h new file mode 100644 index 0000000..2d26e3c --- /dev/null +++ b/sdk-3.1/include/Core/Common.h @@ -0,0 +1,283 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * Common.h + * + * Description: + * Common header file for all Pilot routines. + * Contains elementary data types + * + * History: + * 10/19/94 RM - Created by Ron Marianetti + * 4/24/97 SL - Changes for PalmOS 2.0 SDK + * 5/27/98 kwk - Added WChar & WCharPtr typedefs. + * 5/30/98 kwk - Added ConstCharPtr typedef. + * + *******************************************************************/ + + +#ifndef __COMMON_H__ +#define __COMMON_H__ + + +/************************************************************ + * Build Rules + *************************************************************/ +#include + + +/************************************************************ + * Metrowerks will substitute strlen and strcpy with inline + * 68K assembly code. Prevent this. + *************************************************************/ + +#ifdef __MC68K__ +#define _NO_FAST_STRING_INLINES_ 0 +#endif + + +/************************************************************ + * Define whether or not we are direct linking, or going through + * traps. + * + * When eumulating we use directy linking. + * When running under native mode, we use traps EXCEPT for the + * modules that actually install the routines into the trap table. + * These modules will set the DIRECT_LINK define to 1 + *************************************************************/ +#ifndef EMULATION_LEVEL +#error "This should not happen!" +#endif + +#ifndef USE_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_TRAPS 1 // use Pilot traps + #else + #define USE_TRAPS 0 // direct link (Simulator) + #endif +#endif + +#if USE_TRAPS == 0 + +#define ONEWORD_INLINE(trapNum) +#define TWOWORD_INLINE(w1, w2) +#define THREEWORD_INLINE(w1, w2, w3) +#define FOURWORD_INLINE(w1, w2, w3, w4) +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) + +#else + +// Define the traps differently depending on the compiler + +#ifdef __GNUC__ +#define _ALAS __attribute__ ((__callseq__ ("** Sorry; calling this function with these header files doesn't work yet. Life will be much better with 3.5 headers"))) +#define ONEWORD_INLINE(trapNum) _ALAS +#define TWOWORD_INLINE(w1, w2) _ALAS +#define ONEWORD_INLINE(trapNum) _ALAS +#define THREEWORD_INLINE(w1, w2, w3) _ALAS +#define FOURWORD_INLINE(w1, w2, w3, w4) _ALAS +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) _ALAS +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) _ALAS +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) _ALAS +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) _ALAS +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) _ALAS +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) _ALAS +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) _ALAS +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) _ALAS + +#else + +// Define the traps for Metrowerks IDE or MPW 68K compiler + +#define ONEWORD_INLINE(trapNum) \ + = trapNum +#define TWOWORD_INLINE(w1, w2) \ + = {w1,w2} +#define THREEWORD_INLINE(w1, w2, w3) \ + = {w1,w2,w3} +#define FOURWORD_INLINE(w1, w2, w3, w4) \ + = {w1,w2,w3,w4} +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) \ + = {w1,w2,w3,w4,w5} +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) \ + = {w1,w2,w3,w4,w5,w6} +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) \ + = {w1,w2,w3,w4,w5,w6,w7} +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) \ + = {w1,w2,w3,w4,w5,w6,w7,w8} +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9} +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10} +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11} +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12} + +#endif + +#endif + + +/******************************************************************** + * Elementary data types + ********************************************************************/ +// Determine if we need to define our basic types or not +#ifndef __TYPES__ // (Already defined in CW11) +#ifndef __MACTYPES__ // (Already defined in CWPro3) +#define __DEFINE_TYPES_ 1 +#endif +#endif + + +// Fixed size data types +typedef char SByte; // 8 bits +#if __DEFINE_TYPES_ +typedef unsigned char Byte; +typedef unsigned short UInt16; +typedef unsigned long UInt32; +#endif + +typedef short SWord; // 16 bits +typedef short Int16; +typedef unsigned short Word; + +typedef long SDWord; // 32 bits +typedef long Int32; +typedef unsigned long DWord; + + +// Logical data types +#if __DEFINE_TYPES_ +typedef unsigned char Boolean; +#endif + +typedef char Char; // Used for character strings +typedef unsigned char UChar; +typedef unsigned short WChar; // 'wide' int'l character type. + +typedef short Short; // >= Byte +typedef unsigned short UShort; + +typedef short Int; // >= Word (use short so MPW and CW agree) +typedef unsigned short UInt; + +typedef long Long; // >= DWord +typedef unsigned long ULong; + +typedef short Err; + +typedef DWord LocalID; // local (card relative) chunk ID + + + +/************************************************************ + * Pointer Types + *************************************************************/ +typedef void* VoidPtr; +typedef void const * ConstVoidPtr; +typedef VoidPtr* VoidHand; +typedef ConstVoidPtr* ConstVoidHand; + + +// Fixed size data types +typedef SByte* SBytePtr; +typedef SByte const * ConstSBytePtr; +#if __DEFINE_TYPES_ +typedef Byte* BytePtr; +typedef Byte const * ConstBytePtr; +#endif + +typedef SWord* SWordPtr; +typedef Word* WordPtr; +typedef unsigned short* UInt16Ptr; +typedef SWord const * ConstSWordPtr; +typedef Word const * ConstWordPtr; +typedef unsigned short const * ConstUInt16Ptr; + +typedef SDWord* SDWordPtr; +typedef DWord* DWordPtr; +typedef SDWord const * ConstSDWordPtr; +typedef DWord const * ConstDWordPtr; + + +// Logical data types +typedef Boolean* BooleanPtr; +typedef Boolean const * ConstBooleanPtr; + +typedef Char* CharPtr; +typedef UChar* UCharPtr; +typedef WChar* WCharPtr; +typedef const Char* ConstCharPtr; + +typedef Short* ShortPtr; +typedef UShort* UShortPtr; +typedef Short const * ConstShortPtr; +typedef UShort* ConstUShortPtr; + +typedef Int* IntPtr; +typedef UInt* UIntPtr; +typedef Int const * ConstIntPtr; +typedef UInt const * ConstUIntPtr; + +typedef Long* LongPtr; +typedef ULong* ULongPtr; +typedef Long const * ConstLongPtr; +typedef ULong const * ConstULongPtr; + +// Include the following typedefs if types.h wasn't read. +#if __DEFINE_TYPES_ + +// Generic Pointer types used by Memory Manager +// We have to define Ptr as char* because that's what the Mac includes do. +typedef char* Ptr; // global pointer +typedef Ptr* Handle; // global handle +typedef char const * ConstPtr; // global pointer to constant data +typedef ConstPtr* ConstHandle; // global handle to constant data + +// Function types +typedef Long (*ProcPtr)(); + +#endif /* __DEFINE_TYPES_ */ + + + +/************************************************************ + * Common constants + *************************************************************/ +#ifndef NULL +#define NULL 0 +#endif // NULL + +// Include the following typedefs if types.h wasn't read. +#if __DEFINE_TYPES_ + #ifdef __MWERKS__ + #if !__option(bool) + #ifndef true + #define true 1 + #endif + #ifndef false + #define false 0 + #endif + #endif + #else + #ifndef __cplusplus + #ifndef true + enum {false, true}; + #endif + #endif + #endif +#endif /* __TYPES__ */ + + +#endif //__COMMON_H__ diff --git a/sdk-3.1/include/Core/Es.Prefix.h b/sdk-3.1/include/Core/Es.Prefix.h new file mode 100644 index 0000000..b6d55c4 --- /dev/null +++ b/sdk-3.1/include/Core/Es.Prefix.h @@ -0,0 +1,63 @@ +/********************************************************************* +* + Copyright Š 1995 - 1998, 3Com Corporation or its subsidiaries ("3Com"). + All rights reserved. + + This software may be copied and used solely for developing products for + the Palm Computing platform and for archival and backup purposes. Except + for the foregoing, no part of this software may be reproduced or transmitted + in any form or by any means or used to make any derivative work (such as + translation, transformation or adaptation) without express written consent + from 3Com. + + 3Com reserves the right to revise this software and to make changes in content + from time to time without obligation on the part of 3Com to provide notification + of such revision or changes. + 3COM MAKES NO REPRESENTATIONS OR WARRANTIES THAT THE SOFTWARE IS FREE OF ERRORS + OR THAT THE SOFTWARE IS SUITABLE FOR YOUR USE. THE SOFTWARE IS PROVIDED ON AN + "AS IS" BASIS. 3COM MAKES NO WARRANTIES, TERMS OR CONDITIONS, EXPRESS OR IMPLIED, + EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, INCLUDING WARRANTIES, + TERMS, OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND + SATISFACTORY QUALITY. + + TO THE FULL EXTENT ALLOWED BY LAW, 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS + ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT (INCLUDING NEGLIGENCE), FOR + DIRECT, INCIDENTAL, CONSEQUENTIAL, INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF + ANY KIND, OR FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF INFORMATION + OR DATA, OR OTHER FINANCIAL LOSS ARISING OUT OF OR IN CONNECTION WITH THIS SOFTWARE, + EVEN IF 3COM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + 3Com, HotSync, Palm Computing, and Graffiti are registered trademarks, and + Palm III and Palm OS are trademarks of 3Com Corporation or its subsidiaries. + + IF THIS SOFTWARE IS PROVIDED ON A COMPACT DISK, THE OTHER SOFTWARE AND + DOCUMENTATION ON THE COMPACT DISK ARE SUBJECT TO THE LICENSE AGREEMENT + ACCOMPANYING THE COMPACT DISK. + +******************************************************************** +* Please see :Incs:BuildRules.h for more information. +* +* History: +* 12/13/94 PBS - Created by Phillip Shoemaker +* +* +*******************************************************************/ + +#ifndef __SP_PREFIX_H__ +#define __SP_PREFIX_H__ + +/* +* This file is used for CodeWarrior projects incorporating Spanish +* localized resources. +*/ + +#ifndef COUNTRY + #define COUNTRY COUNTRY_SPANISH +#endif + +#ifndef LANGUAGE + #define LANGUAGE LANGUAGE_SPANISH +#endif + +#endif // Sp.Prefix.h + diff --git a/sdk-3.1/include/Core/Fr.Prefix.h b/sdk-3.1/include/Core/Fr.Prefix.h new file mode 100644 index 0000000..b18662f --- /dev/null +++ b/sdk-3.1/include/Core/Fr.Prefix.h @@ -0,0 +1,64 @@ +/********************************************************************* +* + Copyright Š 1995 - 1998, 3Com Corporation or its subsidiaries ("3Com"). + All rights reserved. + + This software may be copied and used solely for developing products for + the Palm Computing platform and for archival and backup purposes. Except + for the foregoing, no part of this software may be reproduced or transmitted + in any form or by any means or used to make any derivative work (such as + translation, transformation or adaptation) without express written consent + from 3Com. + + 3Com reserves the right to revise this software and to make changes in content + from time to time without obligation on the part of 3Com to provide notification + of such revision or changes. + 3COM MAKES NO REPRESENTATIONS OR WARRANTIES THAT THE SOFTWARE IS FREE OF ERRORS + OR THAT THE SOFTWARE IS SUITABLE FOR YOUR USE. THE SOFTWARE IS PROVIDED ON AN + "AS IS" BASIS. 3COM MAKES NO WARRANTIES, TERMS OR CONDITIONS, EXPRESS OR IMPLIED, + EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, INCLUDING WARRANTIES, + TERMS, OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND + SATISFACTORY QUALITY. + + TO THE FULL EXTENT ALLOWED BY LAW, 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS + ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT (INCLUDING NEGLIGENCE), FOR + DIRECT, INCIDENTAL, CONSEQUENTIAL, INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF + ANY KIND, OR FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF INFORMATION + OR DATA, OR OTHER FINANCIAL LOSS ARISING OUT OF OR IN CONNECTION WITH THIS SOFTWARE, + EVEN IF 3COM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + 3Com, HotSync, Palm Computing, and Graffiti are registered trademarks, and + Palm III and Palm OS are trademarks of 3Com Corporation or its subsidiaries. + + IF THIS SOFTWARE IS PROVIDED ON A COMPACT DISK, THE OTHER SOFTWARE AND + DOCUMENTATION ON THE COMPACT DISK ARE SUBJECT TO THE LICENSE AGREEMENT + ACCOMPANYING THE COMPACT DISK. + +******************************************************************** +* Please see :Incs:BuildRules.h for more information. +* +* History: +* 12/13/94 PBS - Created by Phillip Shoemaker +* +* +*******************************************************************/ + + +#ifndef __FR_PREFIX_H__ +#define __FR_PREFIX_H__ + +/* +* This file is used for CodeWarrior projects incorporating French +* localized resources. +*/ + +#ifndef COUNTRY + #define COUNTRY COUNTRY_FRANCE +#endif + +#ifndef LANGUAGE + #define LANGUAGE LANGUAGE_FRENCH +#endif + +#endif // Fr.Prefix.h + diff --git a/sdk-3.1/include/Core/Ge.Prefix.h b/sdk-3.1/include/Core/Ge.Prefix.h new file mode 100644 index 0000000..7a09417 --- /dev/null +++ b/sdk-3.1/include/Core/Ge.Prefix.h @@ -0,0 +1,64 @@ +/********************************************************************* +* + Copyright Š 1995 - 1998, 3Com Corporation or its subsidiaries ("3Com"). + All rights reserved. + + This software may be copied and used solely for developing products for + the Palm Computing platform and for archival and backup purposes. Except + for the foregoing, no part of this software may be reproduced or transmitted + in any form or by any means or used to make any derivative work (such as + translation, transformation or adaptation) without express written consent + from 3Com. + + 3Com reserves the right to revise this software and to make changes in content + from time to time without obligation on the part of 3Com to provide notification + of such revision or changes. + 3COM MAKES NO REPRESENTATIONS OR WARRANTIES THAT THE SOFTWARE IS FREE OF ERRORS + OR THAT THE SOFTWARE IS SUITABLE FOR YOUR USE. THE SOFTWARE IS PROVIDED ON AN + "AS IS" BASIS. 3COM MAKES NO WARRANTIES, TERMS OR CONDITIONS, EXPRESS OR IMPLIED, + EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, INCLUDING WARRANTIES, + TERMS, OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND + SATISFACTORY QUALITY. + + TO THE FULL EXTENT ALLOWED BY LAW, 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS + ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT (INCLUDING NEGLIGENCE), FOR + DIRECT, INCIDENTAL, CONSEQUENTIAL, INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF + ANY KIND, OR FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF INFORMATION + OR DATA, OR OTHER FINANCIAL LOSS ARISING OUT OF OR IN CONNECTION WITH THIS SOFTWARE, + EVEN IF 3COM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + 3Com, HotSync, Palm Computing, and Graffiti are registered trademarks, and + Palm III and Palm OS are trademarks of 3Com Corporation or its subsidiaries. + + IF THIS SOFTWARE IS PROVIDED ON A COMPACT DISK, THE OTHER SOFTWARE AND + DOCUMENTATION ON THE COMPACT DISK ARE SUBJECT TO THE LICENSE AGREEMENT + ACCOMPANYING THE COMPACT DISK. + +******************************************************************** +* Please see :Incs:BuildRules.h for more information. +* +* History: +* 12/13/94 PBS - Created by Phillip Shoemaker +* +* +*******************************************************************/ + + +#ifndef __GE_PREFIX_H__ +#define __GE_PREFIX_H__ + +/* +* This file is used for CodeWarrior projects incorporating German +* localized resources. +*/ + +#ifndef COUNTRY + #define COUNTRY COUNTRY_GERMANY +#endif + +#ifndef LANGUAGE + #define LANGUAGE LANGUAGE_GERMAN +#endif + +#endif // Ge.Prefix.h + diff --git a/sdk-3.1/include/Core/Hardware/Hardware.h b/sdk-3.1/include/Core/Hardware/Hardware.h new file mode 100644 index 0000000..d1d8687 --- /dev/null +++ b/sdk-3.1/include/Core/Hardware/Hardware.h @@ -0,0 +1,466 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * Hardware.h + * + * Description: + * General Hardware Equates. This header file + * contains general hardware configuration equates that are not dependent on + * the version of the hardware we're running on. Equates specific to + * a certain component like the 68328, etc. is contained in separate + * header files. + * + * History: + * 04/27/95 RM Created by Ron Marianetti + * 02/04/98 srj Added LCD contrast trap routine prototype + * 05/05/98 art Added button layout for Instant Karma + * 08/17/98 SCL Synchronized HwrMiscFlags between Sumo/Eleven + * 09/07/98 kwk Updated TSM button sizes. + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HARDWARE_H__ +#define __HARDWARE_H__ + + + +/************************************************************************** + * General Equates + ***************************************************************************/ + +// Bits in the low memory global GHwrWakeUp +#define hwrWakeUpGeneral 0x0001 +#define hwrWakeUpPWM 0x0002 +#define hwrWakeUpFromKey 0x0004 // set if we woke from a key press +#define hwrWakeUpReturnToSleep 0x0008 // set if we woke from 24 hr. interrupt + // in which case we want to go right back to sleep + + +// Bits in the low memory global GHwrMiscFlags +#define hwrMiscFlagHasBacklight 0x0001 // set if backlight is present +#define hwrMiscFlagHasMbdIrDA 0x0002 // set if IrDA is present (on main board) +#define hwrMiscFlagHasCardIrDA 0x0004 // set if IrDA is present (on memory card) +#define hwrMiscFlagHasBurrBrown 0x0008 // set if BurrBrown A/D is present +#define hwrMiscFlagHasJerryHW 0x0010 // set if Jerry Hardware is present +#define hwrMiscFlagReserved1 0x0020 // reserved for Eleven +#define hwrMiscFlagReserved2 0x0040 // reserved for Eleven +#define hwrMiscFlagReserved3 0x0080 // reserved for Eleven +#define hwrMiscFlagHasCradleDetect 0x0100 // set if we can detect the cradle +#define hwrMiscFlagHasSWContrast 0x0200 // set if UI should support software contrast +#define hwrMiscFlagInvertLCDForBL 0x0400 // set if we need to invert LCD w/Backlight +#define hwrMiscFlagHasMiscFlagExt 0x0800 // 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... +#define hwrMiscFlagID1 0x1000 // set if ID bit keyBitHard1 was set +#define hwrMiscFlagID2 0x2000 // set if ID bit keyBitHard2 was set +#define hwrMiscFlagID3 0x4000 // set if ID bit keyBitHard3 was set +#define hwrMiscFlagID4 0x8000 // set if ID bit keyBitHard4 was set +#define hwrMiscFlagIDMask 0xF000 +#define hwrMiscFlagIDOffset 12 // Bits to shift to get a numeric ID + +#define hwrMiscFlagIDSumo (hwrMiscFlagID1 | hwrMiscFlagID2 | hwrMiscFlagID4) +#define hwrMiscFlagIDBrad (hwrMiscFlagID1 | hwrMiscFlagID3 | hwrMiscFlagID4) + + +// Bits in the low memory global GHwrMiscFlagsExt +#define hwrMiscFlagExtSubID1 0x0001 // subtype ID (for feature select in dev.) +#define hwrMiscFlagExtSubID2 0x0002 // subtype ID (for feature select in dev.) +#define hwrMiscFlagExtSubID3 0x0004 // subtype ID (for feature select in dev.) +#define hwrMiscFlagExtSubIDMask 0x0007 // sybtype ID Mask + +#define hwrMiscFlagExtHasLiIon 0x0010 // set if we have Lithium Ion battery +#define hwrMiscFlagExtHasRailIO 0x0020 // set if we have Rail I/O hardware + + +// Bits for the call HwrDockSignals +#define hwrDockInSyncButton 0x0001 // Dock button +#define hwrDockInGeneric1 0x0002 // General Purpose input #1 + +#define hwrDockOutGeneric0 0x0001 // General Purpose output #0 + +// Enum returned by hwrDockStatus() call +typedef enum { + DockStatusNotDocked = 0, + DockStatusInModem, + DockStatusInCharger, + DockStatusUnknown = 0xFF + } hwrDockStatusState, *hwrDockStatusStateP; + +// Define # of card slots +#if EMULATION_LEVEL == EMULATION_NONE +#define hwrNumCardSlots 1 // 1 card slot +#else +#define hwrNumCardSlots 2 // 2 card slots for emulation +#endif + + +// Screen Dimensions +#define hwrDisplayWidth 160 // Width of display +#define hwrDisplayHeight 160 // Height of display + +// Screen depth info +#define hwrDisplayBootDepth 1 // Boot time bits per pixel (system default) +#define hwrDisplayMaxDepth 2 // Maximum bits per pixel hardware supports +#define hwrDisplayAllDepths 0x0003 // All display depths (in bit map format) + +// Screen refresh rate +#define hwrDisplayPeriod 12 // frame period in ms. + +//---------------------------------------------------------------------------- +// Digitizer Dimensions +//---------------------------------------------------------------------------- +#define hwrSystemTop (hwrDisplayHeight+4) +#define hwrSystemHeight 56 + + +// If the device supports a Text Services Managers then the are +// addition buttons in the silk screen area, between the left-most app buttons +// and the left edge of the Graffiti alpha area. +#if TEXT_SERVICES == TEXT_SERVICES_ON + + #define hwrBtnCount 8 + #define hwrBtnWidth 20 + #define hwrGraffitiAlphaWidth 50 + #define hwrTSMBtnWidth 22 + #define hwrTSMBtnHeight 16 // Std. height...last button is 1/2 this. + #define hwrCalcChr keyboardChr + +#else + + #define hwrBtnCount 4 + #define hwrBtnWidth 27 + #define hwrGraffitiAlphaWidth 62 + #define hwrTSMBtnWidth 0 + #define hwrTSMBtnHeight 0 + #define hwrCalcChr calcChr + +#endif + +// Graffiti Area +#define hwrGraffitiTop hwrSystemTop // Top coordinate of Graffiti area +#define hwrGraffitiLeft (hwrBtnWidth + hwrTSMBtnWidth) // Left coordinate of Graffiti area +#define hwrGraffitiWidth (hwrDisplayWidth - (hwrBtnWidth *2) - hwrTSMBtnWidth) // Width of Graffiti area +#define hwrGraffitiHeight hwrSystemHeight // Height of Graffiti area +#define hwrGraffitiSplit (hwrGraffitiLeft + hwrGraffitiAlphaWidth) // Split mode dividing line + +// Launch Button +#define hwrLaunchBtnLeft 0 +#define hwrLaunchBtnTop hwrSystemTop +#define hwrLaunchBtnWidth hwrBtnWidth +#define hwrLaunchBtnHeight (hwrSystemHeight/2) + +// Menu Button +#define hwrMenuBtnLeft 0 +#define hwrMenuBtnTop (hwrSystemTop+hwrMenuBtnHeight) +#define hwrMenuBtnWidth hwrBtnWidth +#define hwrMenuBtnHeight (hwrSystemHeight/2) + +// Calculator Button +#define hwrCalcBtnLeft (hwrDisplayWidth - hwrBtnWidth) +#define hwrCalcBtnTop hwrSystemTop +#define hwrCalcBtnWidth hwrBtnWidth +#define hwrCalcBtnHeight (hwrSystemHeight/2) + +// Find Button +#define hwrFindBtnLeft (hwrDisplayWidth - hwrBtnWidth) +#define hwrFindBtnTop (hwrSystemTop+hwrCalcBtnHeight) +#define hwrFindBtnWidth hwrBtnWidth +#define hwrFindBtnHeight (hwrSystemHeight/2) + +// Keyboard Alpha Button +#define hwrKeyboardAlphaBtnLeft (hwrBtnWidth + hwrTSMBtnWidth) +#define hwrKeyboardAlphaBtnTop (hwrSystemTop+hwrSystemHeight-hwrSystemHeight/4) +#define hwrKeyboardAlphaBtnWidth 18 +#define hwrKeyboardAlphaBtnHeight (hwrSystemHeight/4) + +// Keyboard Numeric Button +#define hwrKeyboardNumericBtnLeft (hwrFindBtnLeft-hwrKeyboardNumericBtnWidth) +#define hwrKeyboardNumericBtnTop hwrKeyboardAlphaBtnTop +#define hwrKeyboardNumericBtnWidth 18 +#define hwrKeyboardNumericBtnHeight hwrKeyboardAlphaBtnHeight + +// TSM Buttons 1 +#define hwrTSMBtn1Left hwrBtnWidth +#define hwrTSMBtn1Top (hwrSystemTop + (hwrTSMBtnHeight * 0)) +#define hwrTSMBtn1Width hwrTSMBtnWidth +#define hwrTSMBtn1Height hwrTSMBtnHeight + +// TSM Buttons 2 +#define hwrTSMBtn2Left hwrBtnWidth +#define hwrTSMBtn2Top (hwrSystemTop + (hwrTSMBtnHeight * 1)) +#define hwrTSMBtn2Width hwrTSMBtnWidth +#define hwrTSMBtn2Height hwrTSMBtnHeight + +// TSM Buttons 3 +#define hwrTSMBtn3Left hwrBtnWidth +#define hwrTSMBtn3Top (hwrSystemTop + (hwrTSMBtnHeight * 2)) +#define hwrTSMBtn3Width hwrTSMBtnWidth +#define hwrTSMBtn3Height hwrTSMBtnHeight + +// TSM Buttons 4 +#define hwrTSMBtn4Left hwrBtnWidth +#define hwrTSMBtn4Top (hwrSystemTop + (hwrTSMBtnHeight * 3)) +#define hwrTSMBtn4Width hwrTSMBtnWidth +#define hwrTSMBtn4Height hwrTSMBtnHeight/2 + + +// HwrLCDGetDepth requests +#define hwrLCDGetCurrentDepth 0 // Get depth display is currently set to + +//-------------------------------------------------------------------------- +// The battery data in the ROM is stored in a structure like this. +// +// This is an array of structures in the ROM. +// +// WARNING: DO NOT CHANGE THE STRUCTURE OF THIS RECORD WITHOUT MODIFYING THE +// ASSOCIATED ROUTINES IN SystemMgr.c !!! +//---------------------------------------------------------------------------- +typedef struct { + Word sysBattDataStructVersion; // rev level of the structure (this one is 1) + Word sysBattMildWrngVoltage; // in centivolts-- this is the voltage where the warning dialog appears + Word sysBattSevereWrngVoltage; // in cVolts-- this is the voltage where the critical warning dialog appears + Word sysBattShutdownEnVoltage; // in cV-- This voltage causes us to do a software shutdown + Word sysBattShutdownDisVoltage; // in cV-- This voltage allows us to wakeup from shutdown + Word sysBattMinIRVoltage; // prevents IR from working if below this threshold + DWord sysBattMildWrngTimeout; // in ticks-- this is the number of ticks to wait between displaying warning dialogs + DWord sysBattSevereWrngTimeout; // in ticks-- this is the number of ticks to wait between displaying critical warning dialogs + Word sysBattCritWarnOffDays; // in days-- number of days between mild and severe warnings + DWord sysBattCritWarnOnTicks; // in ticks-- number of ticks between mild and severe warnings + Word sysBattStepsPerVolt; // for scaling A/D to Voltages + SWord sysBattVoltageStepOffset; // for scaling A/D to Voltages + DWord sysBattReserved1; // future use + DWord sysBattReserved2; // future use + Word sysBattVoltageCurve[11]; // in cV; this is the voltage at the specified percentage/10; i.e. if the voltage + // with 20% remaining is 2.5 volts, battVoltageCurve[2] = 250. + } SysBatteryDataStruct, *SysBatteryDataStructP; + +//-------------------------------------------------------------------- +// Layout of the A to D convertor calibration ROM token. +// This data is calculated for each unit during production, and burnt +// into the ROM. It consists of 2 precise voltages which are +// applied to the A to D convertor, as well as their respective outputs +// from the A/D convertor. Because of manufacturing tolerances in the +// convertor, its important that the conversion of the output (0-255) +// into centivolts is tailored to each device during manufacturing. +//-------------------------------------------------------------------- +typedef struct { + Word lowCentivolts; + Word lowAToDOutput; + Word highCentivolts; + Word highAToDOutput; +} SysAToDCalibrationTokenType; + + + +//---------------------------------------------------------------------------- +// The ROM token list is an array of zero or more HwrROMTokenRec records +// terminated by a record having token 0xFFFFFFFF. Each record is variable +// length (6 bytes minimum) and must begin on an even byte boundry. +// +// WARNING: DO NOT CHANGE THE STRUCTURE OF THIS RECORD WITHOUT MODIFYING THE +// ASSOCIATED ASSEMBLY ROUTINES IN ROMHardwareTD1.c !!! +// PrvGetROMToken, HwrGetROMToken, PrvExecuteROMToken1 +//---------------------------------------------------------------------------- +typedef struct { + ULong token; + UInt len; + UChar data[0]; // variable length data goes here (0 or more chars) +} HwrROMTokenRec, *HwrROMTokenRecPtr; + + +#define hwrROMTokenSnum 'snum' // MUST be the first token, should be 12 bytes long + // Snum == Memory Card Flash ID (serial number) +#define hwrROMTokenIrda 'irda' // present ONLY on memory card w/IrDA (Gordon) +#define hwrROMTokenFlex 'flex' // present ONLY on memory card w/Flex pager (Cessna) +#define hwrROMTokenBoot1 'cd01' // boot time code plug-in #1 (See RomBoot.c) +#define hwrROMTokenBoot2 'cd02' // boot time code plug-in #2 (See RomBoot.c) +#define hwrROMTokenBoot3 'cd03' // boot time code plug-in #3 (See RomBoot.c) +#define hwrROMTokenAToD 'adcc' // Data for the A to D Convertor calibration + +// The following include has to appear here, because MemoryPrvNew.h +// needs hwrNumCardSlots, which is defined above... + +#include // for CardHeaderPtr below + + +/************************************************************************** + * Prototypes of functions used only when running on the real hardware + ***************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + // These routines are only accessed from the Debugger or boot code, + // so they don't need traps. + void HwrPreRAMInit(void); + + void HwrPreDebugInit(void); + + Err HwrChecksumBigROM (CardHeaderPtr cardP); + + void HwrInit(void); + + void HwrPostDebugInit(void); + + void HwrIdentifyFeatures(void); + + void HwrResetNMI(void); + + DWord HwrGetRAMSize(UInt cardNo, DWord limit); + + void HwrDrawSplashScreen(void); + + void HwrDisableInts(void); + + void HwrShutDownPLL(void); + + void HwrLowBatteryHandler(void); + + void HwrModelSpecificInit(void); + +#ifndef __GNUC__ + asm void PrvGetROMTokenListByCardNo(void); + + asm void PrvGetROMToken(void); + + asm void PrvExecuteROMToken1(void); +#endif + + // Interrupt handlers should NOT patch the low-memory interrupt vectors. + // Instead, they should be installed using the following traps, which the + // kernel will call whenever the given interrupt triggers. + // Additionally, since the handlers are limited in what they can do (no calls + // to Memory Manager or other routines that use it, including FeatureMgr), + // a pointer to globals should be stored in the corresponding LowMem global. + // See irq1GlobalsP, irq2GlobalsP, irq3GlobalsP, & irq6GlobalsP in + void HwrIRQ1Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ1Handler); + void HwrIRQ2Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ2Handler); + void HwrIRQ3Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ3Handler); + void HwrIRQ4Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ4Handler); + void HwrIRQ5Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ5Handler); + void HwrIRQ6Handler(DWord param) + SYS_TRAP(sysTrapHwrIRQ6Handler); + + + // These routines are for "general" use. + + void HwrGetRAMMapping(Ptr /*CardInfoPtr*/ cardInfoP, UInt* numBlocksP, + DWordPtr physBlockInfoP, DWordPtr logBlockInfoP) + SYS_TRAP(sysTrapHwrGetRAMMapping); + + DWord HwrMemWritable(VoidPtr addr) + SYS_TRAP(sysTrapHwrMemWritable); + + DWord HwrMemReadable(VoidPtr addr) + SYS_TRAP(sysTrapHwrMemReadable); + + Err HwrCursor(Boolean set, Int* modeP, PointType* whereP, PointType* sizeP, + UInt* blinkP) + SYS_TRAP(sysTrapHwrCursor); + + void HwrDelay(ULong microseconds) + SYS_TRAP(sysTrapHwrDelay); + + void HwrDoze(Boolean onlyNMI) + SYS_TRAP(sysTrapHwrDoze); + + void HwrSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapHwrSleep); + + Err HwrWake(void) + SYS_TRAP(sysTrapHwrWake); + + Err HwrSetSystemClock(ULong* freqP) + SYS_TRAP(sysTrapHwrSetSystemClock); + + Err HwrSetCPUDutyCycle(UInt* dutyP) + SYS_TRAP(sysTrapHwrSetCPUDutyCycle); + + Err HwrLCDInit(UInt framePeriod, VoidPtr baseP, UInt width, + UInt height, UInt depth) + SYS_TRAP(sysTrapHwrLCDInit); + + Err HwrLCDBaseAddr(Ptr* newAddrP) + SYS_TRAP(sysTrapHwrLCDBaseAddr); + + Err HwrLCDDrawBitmap(UInt x, UInt y, Ptr bitmapP, Boolean clearFirst) + SYS_TRAP(sysTrapHwrLCDDrawBitmap); + + Err HwrLCDSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapHwrLCDSleep); + + Err HwrLCDWake(void) + SYS_TRAP(sysTrapHwrLCDWake); + + Word HwrLCDGetDepth(Word request) + SYS_TRAP(sysTrapHwrLCDGetDepth); + + Err HwrTimerInit(UInt timer) + SYS_TRAP(sysTrapHwrTimerInit); + + Err HwrTimerSleep(UInt timer) + SYS_TRAP(sysTrapHwrTimerSleep); + + Err HwrTimerWake(UInt timer) + SYS_TRAP(sysTrapHwrTimerWake); + + UInt HwrBatteryLevel(void) + SYS_TRAP(sysTrapHwrBatteryLevel); + + Boolean HwrPluggedIn(void) + SYS_TRAP(sysTrapHwrPluggedIn); + + Boolean HwrBacklight(Boolean set, Boolean newState) + SYS_TRAP(sysTrapHwrBacklight); + + Boolean HwrEnableDataWrites(void) + SYS_TRAP(sysTrapHwrEnableDataWrites); + + void HwrDisableDataWrites(void) + SYS_TRAP(sysTrapHwrDisableDataWrites); + + Err HwrDockSignals(WordPtr inputsP, Word outputSet, Word outputClr) + SYS_TRAP(sysTrapHwrDockSignals); + + Err HwrGetROMToken (Word cardNo, DWord token, BytePtr *dataP, WordPtr sizeP ) + SYS_TRAP(sysTrapHwrGetROMToken); + + Byte HwrLCDContrast(Boolean set, Byte NewContrastLevel) + SYS_TRAP(sysTrapHwrLCDContrast); + + hwrDockStatusState HwrDockStatus(void) + SYS_TRAP(sysTrapHwrDockStatus); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _HwrWake \ + ASM_SYS_TRAP(sysTrapHwrWake) + +#define _HwrDelay \ + ASM_SYS_TRAP(sysTrapHwrDelay) + + +#endif //__HARDWARE_H__ + +#endif // NON_PORTABLE diff --git a/sdk-3.1/include/Core/Hardware/M68KHwr.h b/sdk-3.1/include/Core/Hardware/M68KHwr.h new file mode 100644 index 0000000..9354b0f --- /dev/null +++ b/sdk-3.1/include/Core/Hardware/M68KHwr.h @@ -0,0 +1,115 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * M68KHwr.h + * + * Description: + * Pilot debugger remote hardware/system info + * + * History: + * 1/18/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __M68KHWR_H +#define __M68KHWR_H + +// Pilot common definitions +#include + + +/*********************************************************************** + * Breakpoint words we use + ***********************************************************************/ +#define m68kTrapInstr 0x4E40 +#define m68kTrapVectorMask 0x000F + +/*********************************************************************** + * 68000 Exception Vector table + ***********************************************************************/ +typedef struct M68KExcTableType { + DWord initStack; // initial stack pointer + DWord initPC; // initial PC + + DWord busErr; // 08 + DWord addressErr; // 0C + DWord illegalInstr; // 10 + DWord divideByZero; // 14 + DWord chk; // 18 + DWord trap; // 1C + DWord privilege; // 20 + DWord trace; // 24 + DWord aTrap; // 28 + DWord fTrap; // 2C + DWord reserved12; // 30 + DWord coproc; // 34 + DWord formatErr; // 38 + DWord unitializedInt; // 3C + + DWord reserved[8]; // 40-5C + + DWord spuriousInt; // 60 + DWord autoVec1; // 64 + DWord autoVec2; // 68 + DWord autoVec3; // 6C + DWord autoVec4; // 70 + DWord autoVec5; // 74 + DWord autoVec6; // 78 + DWord autoVec7; // 7C + + DWord trapN[16]; // 80 - BC + + DWord unassigned[16]; // C0 - FC + } M68KExcTableType; + + + +/************************************************************************************** + * 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. + * + **************************************************************************************/ +typedef struct M68KRegsType { + DWord d[8]; /* data registers */ + DWord a[7]; /* address registers */ + DWord usp; /* user stack pointer */ + DWord ssp; /* supervisor stack pointer */ + DWord pc; /* program counter */ + Word sr; /* status register */ +} M68KRegsType; + + + + +/************************************************************************************** + * bit masks for testing M68000 status register fields + **************************************************************************************/ + +/* trace mode */ +#define m68kSrTraceMask 0x08000 +#define m68kSrTraceBit 15 + +/* supervisor state */ +#define m68kSrSupervisorMask 0x02000 + +/* interrupt mask */ +#define m68kSrInterruptMask 0x00700 +#define m68kSrInterruptOffset 8 /* offset for right-shifting interrupt mask */ + +/* condition codes */ +#define m68kSrExtendMask 0x00010 +#define m68kSrNegativeMask 0x00008 +#define m68kSrZeroMask 0x00004 +#define m68kSrOverflowMask 0x00002 +#define m68kSrCarryMask 0x00001 + + + +#endif //__M68KHWR_H + diff --git a/sdk-3.1/include/Core/International/CharLatin.h b/sdk-3.1/include/Core/International/CharLatin.h new file mode 100644 index 0000000..451813e --- /dev/null +++ b/sdk-3.1/include/Core/International/CharLatin.h @@ -0,0 +1,348 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * Project International + * File CharLatin.h + * Author Ken Krugler + * Purpose Header file for Microsoft code page 1252 character encoding + * (Microsoft extension to ISO 8859-1 character encoding). + * + * Agenda + * kwk - Sync fonts (add Euro, upper/lower-case Z caron). + * kwk - Fill in full set of Unicode alias names. + * + * History + * 05 Mar 98 kwk New today. + * 15 Apr 98 kwk Moved 1252-specific #defines here from Chars.h. + * kwk Only include these #defines if NON_INTERNATIONAL + * is defined. + * 27 May 98 kwk Minor cleanup from Art's mods to my earlier file. + * kwk Deleted playing card chars, commandStrokeChr, and + * shortcutStrokeChr. + * 29 May 98 kwk Changed the name of numericSpaceChr to numericSpace1252Chr, + * and horizEllipsisChr to horizEllipsis1252Chr, to + * avoid name collision with new versions of these chars + * located at 0x18 & 0x19 (defined in Chars.h). + * 11 Jun 98 kwk Changed chrCircumplexAccent to chrModifierCircumflexAccent, + * to match Unicode name and prevent name collision with + * the chrCircumflexAccent char at 0x5E. + * kwk Changed chrHorizontalEllipsis to chrHorizontalEllipsis1252, + * to avoid collision with chrHorizontalEllipsis located + * in control range. + * 30 Jun 98 kwk Changed name from CharCP1252.h to CharLatin.h. + * 20 Oct 98 kwk Filled out everything but alias Unicode names. + * 21 Oct 98 kwk Commented out upper & lower-case Z caron defines, since + * these two chars aren't in the fonts yet. + * + ***********************************************************************/ + +#ifdef NON_INTERNATIONAL + +#ifndef __CHARLATIN_H__ +#define __CHARLATIN_H__ + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Character codes that are part of code page 1252, but not guaranteed +// to exist in every possible PalmOS encoding. These names are based on +// the Unicode 2.0 standard. + +#define chrReverseSolidus 0x005C // Is yen char in Japanese fonts. + +// Undefined 0x0080 // Was numeric space (valid thru 3.2) + // Will become Euro char in future. +// Undefined 0x0081 +#define chrSingleLow9QuotationMark 0x0082 +#define chrSmall_F_Hook 0x0083 +#define chrDoubleLow9QuotationMark 0x0084 +#define chrHorizontalEllipsis 0x0085 // Also at 0x18 in 3.1 and later roms. +#define chrDagger 0x0086 +#define chrDoubleDagger 0x0087 +#define chrModifierCircumflexAccent 0x0088 +#define chrPerMilleSign 0x0089 +#define chrCapital_S_Caron 0x008A +#define chrSingleLeftPointingAngleQuotationMark 0x008B +#define chrCapital_OE 0x008C +// Undefined 0x008D // Was diamondChr (valid thru 3.0) +// Undefined 0x008E // Was clubChr (valid thru 3.0) + // Will become chrCapital_Z_Caron +// Undefined 0x008F // Was heartChr +// Undefined 0x0090 // Was spadeChr +#define chrLeftSingleQuotationMark 0x0091 +#define chrRightSingleQuotationMark 0x0092 +#define chrLeftDoubleQuotationMark 0x0093 +#define chrRightDoubleQuotationMark 0x0094 +#define chrBullet 0x0095 +#define chrEnDash 0x0096 +#define chrEmDash 0x0097 +#define chrSmallTilde 0x0098 +#define chrTradeMarkSign 0x0099 +#define chrSmall_S_Caron 0x009A +#define chrSingleRightPointingAngleQuotationMark 0x009B +#define chrSmall_OE 0x009C +// Undefined 0x009D // Was command stroke (valid thru 3.0) +// Undefined 0x009E // Was shortcut stroke (valid thru 3.0) + // Will become chrSmall_Z_Caron +#define chrCapital_Y_Diaeresis 0x009F +#define chrNoBreakSpace 0x00A0 +#define chrInvertedExclamationMark 0x00A1 +#define chrCentSign 0x00A2 +#define chrPoundSign 0x00A3 +#define chrCurrencySign 0x00A4 +#define chrYenSign 0x00A5 +#define chrBrokenBar 0x00A6 +#define chrSectionSign 0x00A7 +#define chrDiaeresis 0x00A8 +#define chrCopyrightSign 0x00A9 +#define chrFeminineOrdinalIndicator 0x00AA +#define chrLeftPointingDoubleAngleQuotationMark 0x00AB +#define chrNotSign 0x00AC +#define chrSoftHyphen 0x00AD +#define chrRegisteredSign 0x00AE +#define chrMacron 0x00AF +#define chrDegreeSign 0x00B0 +#define chrPlusMinusSign 0x00B1 +#define chrSuperscriptTwo 0x00B2 +#define chrSuperscriptThree 0x00B3 +#define chrAcuteAccent 0x00B4 +#define chrMicroSign 0x00B5 +#define chrPilcrowSign 0x00B6 +#define chrMiddleDot 0x00B7 +#define chrCedilla 0x00B8 +#define chrSuperscriptOne 0x00B9 +#define chrMasculineOrdinalIndicator 0x00BA +#define chrRightPointingDoubleAngleQuotationMark 0x00BB +#define chrVulgarFractionOneQuarter 0x00BC +#define chrVulgarFractionOneHalf 0x00BD +#define chrVulgarFractionThreeQuarters 0x00BE +#define chrInvertedQuestionMark 0x00BF +#define chrCapital_A_Grave 0x00C0 +#define chrCapital_A_Acute 0x00C1 +#define chrCapital_A_Circumflex 0x00C2 +#define chrCapital_A_Tilde 0x00C3 +#define chrCapital_A_Diaeresis 0x00C4 +#define chrCapital_A_RingAbove 0x00C5 +#define chrCapital_AE 0x00C6 +#define chrCapital_C_Cedilla 0x00C7 +#define chrCapital_E_Grave 0x00C8 +#define chrCapital_E_Acute 0x00C9 +#define chrCapital_E_Circumflex 0x00CA +#define chrCapital_E_Diaeresis 0x00CB +#define chrCapital_I_Grave 0x00CC +#define chrCapital_I_Acute 0x00CD +#define chrCapital_I_Circumflex 0x00CE +#define chrCapital_I_Diaeresis 0x00CF +#define chrCapital_Eth 0x00D0 +#define chrCapital_N_Tilde 0x00D1 +#define chrCapital_O_Grave 0x00D2 +#define chrCapital_O_Acute 0x00D3 +#define chrCapital_O_Circumflex 0x00D4 +#define chrCapital_O_Tilde 0x00D5 +#define chrCapital_O_Diaeresis 0x00D6 +#define chrMultiplicationSign 0x00D7 +#define chrCapital_O_Stroke 0x00D8 +#define chrCapital_U_Grave 0x00D9 +#define chrCapital_U_Acute 0x00DA +#define chrCapital_U_Circumflex 0x00DB +#define chrCapital_U_Diaeresis 0x00DC +#define chrCapital_Y_Acute 0x00DD +#define chrCapital_Thorn 0x00DE +#define chrSmall_SharpS 0x00DF +#define chrSmall_A_Grave 0x00E0 +#define chrSmall_A_Acute 0x00E1 +#define chrSmall_A_Circumflex 0x00E2 +#define chrSmall_A_Tilde 0x00E3 +#define chrSmall_A_Diaeresis 0x00E4 +#define chrSmall_A_RingAbove 0x00E5 +#define chrSmall_AE 0x00E6 +#define chrSmall_C_Cedilla 0x00E7 +#define chrSmall_E_Grave 0x00E8 +#define chrSmall_E_Acute 0x00E9 +#define chrSmall_E_Circumflex 0x00EA +#define chrSmall_E_Diaeresis 0x00EB +#define chrSmall_I_Grave 0x00EC +#define chrSmall_I_Acute 0x00ED +#define chrSmall_I_Circumflex 0x00EE +#define chrSmall_I_Diaeresis 0x00EF +#define chrSmall_Eth 0x00F0 +#define chrSmall_N_Tilde 0x00F1 +#define chrSmall_O_Grave 0x00F2 +#define chrSmall_O_Acute 0x00F3 +#define chrSmall_O_Circumflex 0x00F4 +#define chrSmall_O_Tilde 0x00F5 +#define chrSmall_O_Diaeresis 0x00F6 +#define chrDivisionSign 0x00F7 +#define chrSmall_O_Stroke 0x00F8 +#define chrSmall_U_Grave 0x00F9 +#define chrSmall_U_Acute 0x00FA +#define chrSmall_U_Circumflex 0x00FB +#define chrSmall_U_Diaeresis 0x00FC +#define chrSmall_Y_Acute 0x00FD +#define chrSmall_Thorn 0x00FE +#define chrSmall_Y_Diaeresis 0x00FF + +// Alternative names for some characters. + +#define chrBackslash chrReverseSolidus; +#define chrNonBreakingSpace chrNoBreakSpace; + +// Old character names. + +#define lowSingleCommaQuoteChr chrSingleLow9QuotationMark // 0x0082 +#define scriptFChr chrSmall_F_Hook // 0x0083 +#define lowDblCommaQuoteChr chrDoubleLow9QuotationMark // 0x0084 +#define daggerChr chrDagger // 0x0086 +#define dblDaggerChr chrDoubleDagger // 0x0087 +#define circumflexChr chrModifierCircumflexAccent // 0x0088 +#define perMilleChr chrPerMilleSign // 0x0089 +#define upSHacekChr chrCapital_S_Caron // 0x008A +#define leftSingleGuillemetChr chrSingleLeftPointingAngleQuotationMark // 0x008B +#define upOEChr chrCapital_OE // 0x008C +#define singleOpenCommaQuoteChr chrLeftSingleQuotationMark // 0x0091 +#define singleCloseCommaQuoteChr chrRightSingleQuotationMark // 0x0092 +#define dblOpenCommaQuoteChr chrLeftDoubleQuotationMark // 0x0093 +#define dblCloseCommaQuoteChr chrRightDoubleQuotationMark // 0x0094 +#define bulletChr chrBullet // 0x0095 +#define enDashChr chrEnDash // 0x0096 +#define emDashChr chrEmDash // 0x0097 +#define spacingTildeChr chrSmallTilde // 0x0098 +#define trademarkChr chrTradeMarkSign // 0x0099 +#define lowSHacekChr chrSmall_S_Caron // 0x009A +#define rightSingleGuillemetChr chrSingleRightPointingAngleQuotationMark // 0x009B +#define lowOEChr chrSmall_OE // 0x009C +#define upYDiaeresisChr chrCapital_Y_Diaeresis // 0x009F +#define nonBreakSpaceChr chrNoBreakSpace // 0x00A0 +#define invertedExclamationChr chrInvertedExclamationMark // 0x00A1 +#define centChr chrCentSign // 0x00A2 +#define poundChr chrPoundSign // 0x00A3 +#define currencyChr chrCurrencySign // 0x00A4 +#define yenChr chrYenSign // 0x00A5 +#define brokenVertBarChr chrBrokenBar // 0x00A6 +#define sectionChr chrSectionSign // 0x00A7 +#define spacingDiaeresisChr chrDiaeresis // 0x00A8 +#define copyrightChr chrCopyrightSign // 0x00A9 +#define feminineOrdinalChr chrFeminineOrdinalIndicator // 0x00AA +#define leftGuillemetChr chrLeftPointingDoubleAngleQuotationMark // 0x00AB +#define notChr chrNotSign // 0x00AC +#define softHyphenChr chrSoftHyphen // 0x00AD +#define registeredChr chrRegisteredSign // 0x00AE +#define spacingMacronChr chrMacron // 0x00AF +#define degreeChr chrDegreeSign // 0x00B0 +#define plusMinusChr chrPlusMinusSign // 0x00B1 +#define superscript2Chr chrSuperscriptTwo // 0x00B2 +#define superscript3Chr chrSuperscriptThree // 0x00B3 +#define spacingAcuteChr chrAcuteAccent // 0x00B4 +#define microChr chrMicroSign // 0x00B5 +#define paragraphChr chrPilcrowSign // 0x00B6 +#define middleDotChr chrMiddleDot // 0x00B7 +#define spacingCedillaChr chrCedilla // 0x00B8 +#define superscript1Chr chrSuperscriptOne // 0x00B9 +#define masculineOrdinalChr chrMasculineOrdinalIndicator // 0x00BA +#define rightGuillemetChr chrRightPointingDoubleAngleQuotationMark // 0x00BB +#define fractOneQuarterChr chrVulgarFractionOneQuarter // 0x00BC +#define fractOneHalfChr chrVulgarFractionOneHalf // 0x00BD +#define fractThreeQuartersChr chrVulgarFractionThreeQuarters // 0x00BE +#define invertedQuestionChr chrInvertedQuestionMark // 0x00BF +#define upAGraveChr chrCapital_A_Grave // 0x00C0 +#define upAAcuteChr chrCapital_A_Acute // 0x00C1 +#define upACircumflexChr chrCapital_A_Circumflex // 0x00C2 +#define upATildeChr chrCapital_A_Tilde // 0x00C3 +#define upADiaeresisChr chrCapital_A_Diaeresis // 0x00C4 +#define upARingChr chrCapital_A_RingAbove // 0x00C5 +#define upAEChr chrCapital_AE // 0x00C6 +#define upCCedillaChr chrCapital_C_Cedilla // 0x00C7 +#define upEGraveChr chrCapital_E_Grave // 0x00C8 +#define upEAcuteChr chrCapital_E_Acute // 0x00C9 +#define upECircumflexChr chrCapital_E_Circumflex // 0x00CA +#define upEDiaeresisChr chrCapital_E_Diaeresis // 0x00CB +#define upIGraveChr chrCapital_I_Grave // 0x00CC +#define upIAcuteChr chrCapital_I_Acute // 0x00CD +#define upICircumflexChr chrCapital_I_Circumflex // 0x00CE +#define upIDiaeresisChr chrCapital_I_Diaeresis // 0x00CF +#define upEthChr chrCapital_Eth // 0x00D0 +#define upNTildeChr chrCapital_N_Tilde // 0x00D1 +#define upOGraveChr chrCapital_O_Grave // 0x00D2 +#define upOAcuteChr chrCapital_O_Acute // 0x00D3 +#define upOCircumflexChr chrCapital_O_Circumflex // 0x00D4 +#define upOTildeChr chrCapital_O_Tilde // 0x00D5 +#define upODiaeresisChr chrCapital_O_Diaeresis // 0x00D6 +#define multiplyChr chrMultiplicationSign // 0x00D7 +#define upOSlashChr chrCapital_O_Stroke // 0x00D8 +#define upUGraveChr chrCapital_U_Grave // 0x00D9 +#define upUAcuteChr chrCapital_U_Acute // 0x00DA +#define upUCircumflexChr chrCapital_U_Circumflex // 0x00DB +#define upUDiaeresisChr chrCapital_U_Diaeresis // 0x00DC +#define upYAcuteChr chrCapital_Y_Acute // 0x00DD +#define upThorn chrCapital_Thorn // 0x00DE +#define lowSharpSChr chrSmall_SharpS // 0x00DF +#define lowAGraveChr chrSmall_A_Grave // 0x00E0 +#define lowAAcuteChr chrSmall_A_Acute // 0x00E1 +#define lowACircumflexChr chrSmall_A_Circumflex // 0x00E2 +#define lowATildeChr chrSmall_A_Tilde // 0x00E3 +#define lowADiaeresisChr chrSmall_A_Diaeresis // 0x00E4 +#define lowARingChr chrSmall_A_RingAbove // 0x00E5 +#define lowAEChr chrSmall_AE // 0x00E6 +#define lowCCedillaChr chrSmall_C_Cedilla // 0x00E7 +#define lowEGraveChr chrSmall_E_Grave // 0x00E8 +#define lowEAcuteChr chrSmall_E_Acute // 0x00E9 +#define lowECircumflexChr chrSmall_E_Circumflex // 0x00EA +#define lowEDiaeresisChr chrSmall_E_Diaeresis // 0x00EB +#define lowIGraveChr chrSmall_I_Grave // 0x00EC +#define lowIAcuteChr chrSmall_I_Acute // 0x00ED +#define lowICircumflexChr chrSmall_I_Circumflex // 0x00EE +#define lowIDiaeresisChr chrSmall_I_Diaeresis // 0x00EF +#define lowEthChr chrSmall_Eth // 0x00F0 +#define lowNTildeChr chrSmall_N_Tilde // 0x00F1 +#define lowOGraveChr chrSmall_O_Grave // 0x00F2 +#define lowOAcuteChr chrSmall_O_Acute // 0x00F3 +#define lowOCircumflexChr chrSmall_O_Circumflex // 0x00F4 +#define lowOTildeChr chrSmall_O_Tilde // 0x00F5 +#define lowODiaeresisChr chrSmall_O_Diaeresis // 0x00F6 +#define divideChr chrDivisionSign // 0x00F7 +#define lowOSlashChr chrSmall_O_Stroke // 0x00F8 +#define lowUGraveChr chrSmall_U_Grave // 0x00F9 +#define lowUAcuteChr chrSmall_U_Acute // 0x00FA +#define lowUCircumflexChr chrSmall_U_Circumflex // 0x00FB +#define lowUDiaeresisChr chrSmall_U_Diaeresis // 0x00FC +#define lowYAcuteChr chrSmall_Y_Acute // 0x00FD +#define lowThorn chrSmall_Thorn // 0x00FE +#define lowYDiaeresisChr chrSmall_Y_Diaeresis // 0x00FF + +// The horizEllipsisChr (0x85) still exists in the font, but (in 3.1 and later roms) +// has been duplicated at location 0x18, so that it will be available with all future +// character encodings. If you are running on pre-3.1 roms, then you should use the +// chrHorizontalEllipsis character constant name (0x85), otherwise use chrEllipsis (0x18). + +// The following characters were moved in the four standard fonts with the +// 3.1 release of PalmOS; they still exist in their old positions in the +// font, but eventually will be removed: +// +// Old character name Old position New character name New position +// +// numericSpaceChr 0x80 chrNumericSpace 0x19 +// commandStrokeChr 0x9D chrCommandStroke 0x16 +// shortcutStrokeChr 0x9E chrShortcutStroke 0x17 + +#define numericSpaceChrV30 0x80 // ** COPIED TO 0x19; will be removed ** +#define commandStrokeChrV30 0x9D // ** COPIED TO 0x16; will be removed ** +#define shortcutStrokeChr 0x9E // ** COPIED TO 0x17; will be removed ** + +// The following characters were removed from the four standard fonts and +// placed in the 9pt symbol font (see Chars.h). +// +// diamondChr 0x8D +// clubChr 0x8E +// heartChr 0x8F +// spadeChr 0x90 + +#define diamondChrV30 0x8D // As of PalmOS v3.2, these characters are +#define clubChrV30 0x8E // now available in the Symbol-9 font. They +#define heartChrV30 0x8F // still appear in the regular fonts for now, +#define spadeChrV30 0x90 // but they WILL be removed in a future release. + +#endif // __CHARLATIN_H__ +#endif // NON_INTERNATIONAL diff --git a/sdk-3.1/include/Core/International/CharShiftJIS.h b/sdk-3.1/include/Core/International/CharShiftJIS.h new file mode 100644 index 0000000..0a12d40 --- /dev/null +++ b/sdk-3.1/include/Core/International/CharShiftJIS.h @@ -0,0 +1,843 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * Project Instant Karma + * File CharShiftJIS.h + * Author Ken Krugler + * Purpose Header file for Shift-JIS (code page 932) Japanese character + * encoding. These are based on Windows-J implementation of the + * Shift-JIS standard. + * + * Agenda + * + * History + * 12 Mar 98 kwk New today. + * 06 Apr 98 kwk Reverted back to #define instead of const values. + * 07 Apr 98 kwk Added TxtCharIsHiragana & TxtCharIsKatakana macros. + * 09 Apr 98 kwk Made this entire file conditional on NON_INTERNATIONAL. + * 15 Apr 98 kwk Filled out full set of character names (from Unicode + * 2.0 standard). + * 17 Apr 98 kwk Resolved duplicated names (thanks Microsoft). + * 28 May 98 kwk Put in horizEllipsisChr & numericSpaceChr. + * 29 Jun 98 kwk Changed name from CharCP932.h to CharShiftJIS.h. + * 15 Aug 98 CSS Reworked the extended character attribute #defines so + * we've now got a MicroSoft bit and a bunch of field + * values specifying kana, romaji, kanji, greek, etc. + * that don't overlap with the standard attributes. + * CSS Recoded the TxtCharIsHiragana/Katakana macros to + * AND with class mask and compare with class. + * 23 Aug 98 kwk Added charXClassKanaSound. + * + ***********************************************************************/ + +#ifdef NON_INTERNATIONAL + +#ifndef __CHARSHIFTJIS_H__ +#define __CHARSHIFTJIS_H__ + +/*********************************************************************** + * Public macros + ***********************************************************************/ + +#define TxtCharIsHiragana(ch) ( (TxtCharXAttr(ch) & charXClassMask) \ + == charXClassHiragana) +#define TxtCharIsKatakana(ch) ( (TxtCharXAttr(ch) & charXClassMask) \ + == charXClassKatakana) + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Transliteration operations that are not universal, but can be applied +// to Japanese text. + +#define translitOpFullToHalfKatakana (translitOpCustomBase+0) +#define translitOpHalfToFullKatakana (translitOpCustomBase+1) +#define translitOpFullToHalfRomaji (translitOpCustomBase+2) +#define translitOpHalfToFullRomaji (translitOpCustomBase+3) +#define translitOpKatakanaToHiragana (translitOpCustomBase+4) +#define translitOpHiraganaToKatakana (translitOpCustomBase+5) +#define translitOpCombineSoundMark (translitOpCustomBase+6) +#define translitOpDivideSoundMark (translitOpCustomBase+7) +#define translitOpRomajiToHiragana (translitOpCustomBase+8) +#define translitOpHiraganaToRomaji (translitOpCustomBase+9) + +// Extended character attributes for the Shift-JIS (CP932) code page. +// kwk - is this on an encoding basis, or a language/encoding basis? +// kwk - fill out rest of interesting attributes (youon?) from Bowne +// data. + +#define charXAttrMask 0x00ff +#define charXAttrFollowing 0x0001 +#define charXAttrLeading 0x0002 +#define charXAttrBreak 0x0004 +#define charXAttrMicroSoft 0x0008 + +#define charXClassMask 0x0f00 +#define charXClassRomaji 0x0100 +#define charXClassHiragana 0x0200 +#define charXClassKatakana 0x0300 +#define charXClassKanaSound 0x0400 +#define charXClassGreek 0x0500 +#define charXClassCyrillic 0x0600 +#define charXClassKanjiL1 0x0700 +#define charXClassKanjiL2 0x0800 +#define charXClassKanjiOther 0x0900 +#define charXClassOther 0x0a00 +#define charXClassUndefined 0x0b00 + +// Some ShiftJIS-specific combinations. Every byte in a stream of +// ShiftJIS data must be either a single byte, a single/low byte, +// or a high/low byte. + +#define byteAttrSingleLow (byteAttrSingle | byteAttrLast) +#define byteAttrHighLow (byteAttrFirst | byteAttrLast) + +#define kFirstHighByte 0x81 +#define kFirstLowByte 0x40 + +// Character codes that are specific to Shift JIS. These names +// are generated from the Unicode 2.0 data files. kwk - check on +// these values. + +#define chrYenSign 0x005c + +#define chrFirstSJISDoubleByte 0x8140 + +#define chrHalfwidthIdeographicFullStop 0x00A1 +#define chrHalfwidthLeftCornerBracket 0x00A2 +#define chrHalfwidthRightCornerBracket 0x00A3 +#define chrHalfwidthIdeographicComma 0x00A4 +#define chrHalfwidthKatakanaMiddleDot 0x00A5 +#define chrHalfwidthKatakana_WO 0x00A6 +#define chrHalfwidthKatakanaSmall_A 0x00A7 +#define chrHalfwidthKatakanaSmall_I 0x00A8 +#define chrHalfwidthKatakanaSmall_U 0x00A9 +#define chrHalfwidthKatakanaSmall_E 0x00AA +#define chrHalfwidthKatakanaSmall_O 0x00AB +#define chrHalfwidthKatakanaSmall_YA 0x00AC +#define chrHalfwidthKatakanaSmall_YU 0x00AD +#define chrHalfwidthKatakanaSmall_YO 0x00AE +#define chrHalfwidthKatakanaSmall_TU 0x00AF +#define chrHalfwidthKatakanaHiraganaProlongedSoundMark 0x00B0 +#define chrHalfwidthKatakana_A 0x00B1 +#define chrHalfwidthKatakana_I 0x00B2 +#define chrHalfwidthKatakana_U 0x00B3 +#define chrHalfwidthKatakana_E 0x00B4 +#define chrHalfwidthKatakana_O 0x00B5 +#define chrHalfwidthKatakana_KA 0x00B6 +#define chrHalfwidthKatakana_KI 0x00B7 +#define chrHalfwidthKatakana_KU 0x00B8 +#define chrHalfwidthKatakana_KE 0x00B9 +#define chrHalfwidthKatakana_KO 0x00BA +#define chrHalfwidthKatakana_SA 0x00BB +#define chrHalfwidthKatakana_SI 0x00BC +#define chrHalfwidthKatakana_SU 0x00BD +#define chrHalfwidthKatakana_SE 0x00BE +#define chrHalfwidthKatakana_SO 0x00BF +#define chrHalfwidthKatakana_TA 0x00C0 +#define chrHalfwidthKatakana_TI 0x00C1 +#define chrHalfwidthKatakana_TU 0x00C2 +#define chrHalfwidthKatakana_TE 0x00C3 +#define chrHalfwidthKatakana_TO 0x00C4 +#define chrHalfwidthKatakana_NA 0x00C5 +#define chrHalfwidthKatakana_NI 0x00C6 +#define chrHalfwidthKatakana_NU 0x00C7 +#define chrHalfwidthKatakana_NE 0x00C8 +#define chrHalfwidthKatakana_NO 0x00C9 +#define chrHalfwidthKatakana_HA 0x00CA +#define chrHalfwidthKatakana_HI 0x00CB +#define chrHalfwidthKatakana_HU 0x00CC +#define chrHalfwidthKatakana_HE 0x00CD +#define chrHalfwidthKatakana_HO 0x00CE +#define chrHalfwidthKatakana_MA 0x00CF +#define chrHalfwidthKatakana_MI 0x00D0 +#define chrHalfwidthKatakana_MU 0x00D1 +#define chrHalfwidthKatakana_ME 0x00D2 +#define chrHalfwidthKatakana_MO 0x00D3 +#define chrHalfwidthKatakana_YA 0x00D4 +#define chrHalfwidthKatakana_YU 0x00D5 +#define chrHalfwidthKatakana_YO 0x00D6 +#define chrHalfwidthKatakana_RA 0x00D7 +#define chrHalfwidthKatakana_RI 0x00D8 +#define chrHalfwidthKatakana_RU 0x00D9 +#define chrHalfwidthKatakana_RE 0x00DA +#define chrHalfwidthKatakana_RO 0x00DB +#define chrHalfwidthKatakana_WA 0x00DC +#define chrHalfwidthKatakana_N 0x00DD +#define chrHalfwidthKatakanaVoicedSoundMark 0x00DE +#define chrHalfwidthKatakanaSemiVoicedSoundMark 0x00DF + +#define chrIdeographicSpace 0x8140 +#define chrIdeographicComma 0x8141 +#define chrIdeographicFullStop 0x8142 +#define chrFullwidthComma 0x8143 +#define chrFullwidthFullStop 0x8144 +#define chrKatakanaMiddleDot 0x8145 +#define chrFullwidthColon 0x8146 +#define chrFullwidthSemicolon 0x8147 +#define chrFullwidthQuestionMark 0x8148 +#define chrFullwidthExclamationMark 0x8149 +#define chrKatakanaHiraganaVoicedSoundMark 0x814A +#define chrKatakanaHiraganaSemiVoicedSoundMark 0x814B +#define chrAcuteAccent 0x814C +#define chrFullwidthGraveAccent 0x814D +#define chrDiaeresis 0x814E +#define chrFullwidthCircumflexAccent 0x814F +#define chrFullwidthMacron 0x8150 +#define chrFullwidthLowLine 0x8151 +#define chrKatakanaIterationMark 0x8152 +#define chrKatakanaVoicedIterationMark 0x8153 +#define chrHiraganaIterationMark 0x8154 +#define chrHiraganaVoicedIterationMark 0x8155 +#define chrDittoMark 0x8156 +#define chrIdeographicIterationMark 0x8158 +#define chrIdeographicClosingMark 0x8159 +#define chrIdeographicNumberZero 0x815A +#define chrKatakanaHiraganaProlongedSoundMark 0x815B +#define chrHorizontalBar 0x815C +#define chrHyphen 0x815D +#define chrFullwidthSolidus 0x815E +#define chrFullwidthReverseSolidus 0x815F +#define chrFullwidthTilde 0x8160 +#define chrParallelTo 0x8161 +#define chrFullwidthVerticalLine 0x8162 +#define chrFullwidthHorizontalEllipsis 0x8163 +#define chrTwoDotLeader 0x8164 +#define chrLeftSingleQuotationMark 0x8165 +#define chrRightSingleQuotationMark 0x8166 +#define chrLeftDoubleQuotationMark 0x8167 +#define chrRightDoubleQuotationMark 0x8168 +#define chrFullwidthLeftParenthesis 0x8169 +#define chrFullwidthRightParenthesis 0x816A +#define chrLeftTortoiseShellBracket 0x816B +#define chrRightTortoiseShellBracket 0x816C +#define chrFullwidthLeftSquareBracket 0x816D +#define chrFullwidthRightSquareBracket 0x816E +#define chrFullwidthLeftCurlyBracket 0x816F +#define chrFullwidthRightCurlyBracket 0x8170 +#define chrLeftAngleBracket 0x8171 +#define chrRightAngleBracket 0x8172 +#define chrLeftDoubleAngleBracket 0x8173 +#define chrRightDoubleAngleBracket 0x8174 +#define chrLeftCornerBracket 0x8175 +#define chrRightCornerBracket 0x8176 +#define chrLeftWhiteCornerBracket 0x8177 +#define chrRightWhiteCornerBracket 0x8178 +#define chrLeftBlackLenticularBracket 0x8179 +#define chrRightBlackLenticularBracket 0x817A +#define chrFullwidthPlusSign 0x817B +#define chrFullwidthHyphenMinus 0x817C +#define chrPlusMinusSign 0x817D +#define chrMultiplicationSign 0x817E +#define chrDivisionSign 0x8180 +#define chrFullwidthEqualsSign 0x8181 +#define chrNotEqualTo 0x8182 +#define chrFullwidthLessThanSign 0x8183 +#define chrFullwidthGreaterThanSign 0x8184 +#define chrLessThanOverEqualTo 0x8185 +#define chrGreaterThanOverEqualTo 0x8186 +#define chrInfinity 0x8187 +#define chrTherefore 0x8188 +#define chrMaleSign 0x8189 +#define chrFemaleSign 0x818A +#define chrDegreeSign 0x818B +#define chrPrime 0x818C +#define chrDoublePrime 0x818D +#define chrDegreeCelsius 0x818E +#define chrFullwidthYenSign 0x818F +#define chrFullwidthDollarSign 0x8190 +#define chrFullwidthCentSign 0x8191 +#define chrFullwidthPoundSign 0x8192 +#define chrFullwidthPercentSign 0x8193 +#define chrFullwidthNumberSign 0x8194 +#define chrFullwidthAmpersand 0x8195 +#define chrFullwidthAsterisk 0x8196 +#define chrFullwidthCommercialAt 0x8197 +#define chrSectionSign 0x8198 +#define chrWhiteStar 0x8199 +#define chrBlackStar 0x819A +#define chrWhiteCircle 0x819B +#define chrBlackCircle 0x819C +#define chrBullseye 0x819D +#define chrWhiteDiamond 0x819E +#define chrBlackDiamond 0x819F +#define chrWhiteSquare 0x81A0 +#define chrBlackSquare 0x81A1 +#define chrWhiteUpPointingTriangle 0x81A2 +#define chrBlackUpPointingTriangle 0x81A3 +#define chrWhiteDownPointingTriangle 0x81A4 +#define chrBlackDownPointingTriangle 0x81A5 +#define chrReferenceMark 0x81A6 +#define chrPostalMark 0x81A7 +#define chrRightwardsArrow 0x81A8 +#define chrLeftwardsArrow 0x81A9 +#define chrUpwardsArrow 0x81AA +#define chrDownwardsArrow 0x81AB +#define chrGetaMark 0x81AC +#define chrElementOf 0x81B8 +#define chrContainsAsMember 0x81B9 +#define chrSubsetOfOrEqualTo 0x81BA +#define chrSupersetOfOrEqualTo 0x81BB +#define chrSubsetOf 0x81BC +#define chrSupersetOf 0x81BD +#define chrUnion 0x81BE +#define chrIntersection 0x81BF +#define chrLogicalAnd 0x81C8 +#define chrLogicalOr 0x81C9 +#define chrFullwidthNotSign 0x81CA +#define chrRightwardsDoubleArrow 0x81CB +#define chrLeftRightDoubleArrow 0x81CC +#define chrForAll 0x81CD +#define chrThereExists 0x81CE +#define chrAngle 0x81DA +#define chrUpTack 0x81DB +#define chrArc 0x81DC +#define chrPartialDifferential 0x81DD +#define chrNabla 0x81DE +#define chrIdenticalTo 0x81DF +#define chrApproximatelyEqualToOrTheImageOf 0x81E0 +#define chrMuchLessThan 0x81E1 +#define chrMuchGreaterThan 0x81E2 +#define chrSquareRoot 0x81E3 +#define chrReversedTilde 0x81E4 +#define chrProportionalTo 0x81E5 +#define chrBecause 0x81E6 +#define chrIntegral 0x81E7 +#define chrDoubleIntegral 0x81E8 +#define chrAngstromSign 0x81F0 +#define chrPerMilleSign 0x81F1 +#define chrMusicSharpSign 0x81F2 +#define chrMusicFlatSign 0x81F3 +#define chrEighthNote 0x81F4 +#define chrDagger 0x81F5 +#define chrDoubleDagger 0x81F6 +#define chrPilcrowSign 0x81F7 +#define chrLargeCircle 0x81FC + +#define chrFullwidthDigitZero 0x824F +#define chrFullwidthDigitOne 0x8250 +#define chrFullwidthDigitTwo 0x8251 +#define chrFullwidthDigitThree 0x8252 +#define chrFullwidthDigitFour 0x8253 +#define chrFullwidthDigitFive 0x8254 +#define chrFullwidthDigitSix 0x8255 +#define chrFullwidthDigitSeven 0x8256 +#define chrFullwidthDigitEight 0x8257 +#define chrFullwidthDigitNine 0x8258 +#define chrFullwidthCapital_A 0x8260 +#define chrFullwidthCapital_B 0x8261 +#define chrFullwidthCapital_C 0x8262 +#define chrFullwidthCapital_D 0x8263 +#define chrFullwidthCapital_E 0x8264 +#define chrFullwidthCapital_F 0x8265 +#define chrFullwidthCapital_G 0x8266 +#define chrFullwidthCapital_H 0x8267 +#define chrFullwidthCapital_I 0x8268 +#define chrFullwidthCapital_J 0x8269 +#define chrFullwidthCapital_K 0x826A +#define chrFullwidthCapital_L 0x826B +#define chrFullwidthCapital_M 0x826C +#define chrFullwidthCapital_N 0x826D +#define chrFullwidthCapital_O 0x826E +#define chrFullwidthCapital_P 0x826F +#define chrFullwidthCapital_Q 0x8270 +#define chrFullwidthCapital_R 0x8271 +#define chrFullwidthCapital_S 0x8272 +#define chrFullwidthCapital_T 0x8273 +#define chrFullwidthCapital_U 0x8274 +#define chrFullwidthCapital_V 0x8275 +#define chrFullwidthCapital_W 0x8276 +#define chrFullwidthCapital_X 0x8277 +#define chrFullwidthCapital_Y 0x8278 +#define chrFullwidthCapital_Z 0x8279 +#define chrFullwidthSmall_A 0x8281 +#define chrFullwidthSmall_B 0x8282 +#define chrFullwidthSmall_C 0x8283 +#define chrFullwidthSmall_D 0x8284 +#define chrFullwidthSmall_E 0x8285 +#define chrFullwidthSmall_F 0x8286 +#define chrFullwidthSmall_G 0x8287 +#define chrFullwidthSmall_H 0x8288 +#define chrFullwidthSmall_I 0x8289 +#define chrFullwidthSmall_J 0x828A +#define chrFullwidthSmall_K 0x828B +#define chrFullwidthSmall_L 0x828C +#define chrFullwidthSmall_M 0x828D +#define chrFullwidthSmall_N 0x828E +#define chrFullwidthSmall_O 0x828F +#define chrFullwidthSmall_P 0x8290 +#define chrFullwidthSmall_Q 0x8291 +#define chrFullwidthSmall_R 0x8292 +#define chrFullwidthSmall_S 0x8293 +#define chrFullwidthSmall_T 0x8294 +#define chrFullwidthSmall_U 0x8295 +#define chrFullwidthSmall_V 0x8296 +#define chrFullwidthSmall_W 0x8297 +#define chrFullwidthSmall_X 0x8298 +#define chrFullwidthSmall_Y 0x8299 +#define chrFullwidthSmall_Z 0x829A + +#define chrHiraganaSmall_A 0x829F +#define chrHiragana_A 0x82A0 +#define chrHiraganaSmall_I 0x82A1 +#define chrHiragana_I 0x82A2 +#define chrHiraganaSmall_U 0x82A3 +#define chrHiragana_U 0x82A4 +#define chrHiraganaSmall_E 0x82A5 +#define chrHiragana_E 0x82A6 +#define chrHiraganaSmall_O 0x82A7 +#define chrHiragana_O 0x82A8 +#define chrHiragana_KA 0x82A9 +#define chrHiragana_GA 0x82AA +#define chrHiragana_KI 0x82AB +#define chrHiragana_GI 0x82AC +#define chrHiragana_KU 0x82AD +#define chrHiragana_GU 0x82AE +#define chrHiragana_KE 0x82AF +#define chrHiragana_GE 0x82B0 +#define chrHiragana_KO 0x82B1 +#define chrHiragana_GO 0x82B2 +#define chrHiragana_SA 0x82B3 +#define chrHiragana_ZA 0x82B4 +#define chrHiragana_SI 0x82B5 +#define chrHiragana_ZI 0x82B6 +#define chrHiragana_SU 0x82B7 +#define chrHiragana_ZU 0x82B8 +#define chrHiragana_SE 0x82B9 +#define chrHiragana_ZE 0x82BA +#define chrHiragana_SO 0x82BB +#define chrHiragana_ZO 0x82BC +#define chrHiragana_TA 0x82BD +#define chrHiragana_DA 0x82BE +#define chrHiragana_TI 0x82BF +#define chrHiragana_DI 0x82C0 +#define chrHiraganaSmall_TU 0x82C1 +#define chrHiragana_TU 0x82C2 +#define chrHiragana_DU 0x82C3 +#define chrHiragana_TE 0x82C4 +#define chrHiragana_DE 0x82C5 +#define chrHiragana_TO 0x82C6 +#define chrHiragana_DO 0x82C7 +#define chrHiragana_NA 0x82C8 +#define chrHiragana_NI 0x82C9 +#define chrHiragana_NU 0x82CA +#define chrHiragana_NE 0x82CB +#define chrHiragana_NO 0x82CC +#define chrHiragana_HA 0x82CD +#define chrHiragana_BA 0x82CE +#define chrHiragana_PA 0x82CF +#define chrHiragana_HI 0x82D0 +#define chrHiragana_BI 0x82D1 +#define chrHiragana_PI 0x82D2 +#define chrHiragana_HU 0x82D3 +#define chrHiragana_BU 0x82D4 +#define chrHiragana_PU 0x82D5 +#define chrHiragana_HE 0x82D6 +#define chrHiragana_BE 0x82D7 +#define chrHiragana_PE 0x82D8 +#define chrHiragana_HO 0x82D9 +#define chrHiragana_BO 0x82DA +#define chrHiragana_PO 0x82DB +#define chrHiragana_MA 0x82DC +#define chrHiragana_MI 0x82DD +#define chrHiragana_MU 0x82DE +#define chrHiragana_ME 0x82DF +#define chrHiragana_MO 0x82E0 +#define chrHiraganaSmall_YA 0x82E1 +#define chrHiragana_YA 0x82E2 +#define chrHiraganaSmall_YU 0x82E3 +#define chrHiragana_YU 0x82E4 +#define chrHiraganaSmall_YO 0x82E5 +#define chrHiragana_YO 0x82E6 +#define chrHiragana_RA 0x82E7 +#define chrHiragana_RI 0x82E8 +#define chrHiragana_RU 0x82E9 +#define chrHiragana_RE 0x82EA +#define chrHiragana_RO 0x82EB +#define chrHiraganaSmall_WA 0x82EC +#define chrHiragana_WA 0x82ED +#define chrHiragana_WI 0x82EE +#define chrHiragana_WE 0x82EF +#define chrHiragana_WO 0x82F0 +#define chrHiragana_N 0x82F1 + +#define chrKatakanaSmall_A 0x8340 +#define chrKatakana_A 0x8341 +#define chrKatakanaSmall_I 0x8342 +#define chrKatakana_I 0x8343 +#define chrKatakanaSmall_U 0x8344 +#define chrKatakana_U 0x8345 +#define chrKatakanaSmall_E 0x8346 +#define chrKatakana_E 0x8347 +#define chrKatakanaSmall_O 0x8348 +#define chrKatakana_O 0x8349 +#define chrKatakana_KA 0x834A +#define chrKatakana_GA 0x834B +#define chrKatakana_KI 0x834C +#define chrKatakana_GI 0x834D +#define chrKatakana_KU 0x834E +#define chrKatakana_GU 0x834F +#define chrKatakana_KE 0x8350 +#define chrKatakana_GE 0x8351 +#define chrKatakana_KO 0x8352 +#define chrKatakana_GO 0x8353 +#define chrKatakana_SA 0x8354 +#define chrKatakana_ZA 0x8355 +#define chrKatakana_SI 0x8356 +#define chrKatakana_ZI 0x8357 +#define chrKatakana_SU 0x8358 +#define chrKatakana_ZU 0x8359 +#define chrKatakana_SE 0x835A +#define chrKatakana_ZE 0x835B +#define chrKatakana_SO 0x835C +#define chrKatakana_ZO 0x835D +#define chrKatakana_TA 0x835E +#define chrKatakana_DA 0x835F +#define chrKatakana_TI 0x8360 +#define chrKatakana_DI 0x8361 +#define chrKatakanaSmall_TU 0x8362 +#define chrKatakana_TU 0x8363 +#define chrKatakana_DU 0x8364 +#define chrKatakana_TE 0x8365 +#define chrKatakana_DE 0x8366 +#define chrKatakana_TO 0x8367 +#define chrKatakana_DO 0x8368 +#define chrKatakana_NA 0x8369 +#define chrKatakana_NI 0x836A +#define chrKatakana_NU 0x836B +#define chrKatakana_NE 0x836C +#define chrKatakana_NO 0x836D +#define chrKatakana_HA 0x836E +#define chrKatakana_BA 0x836F +#define chrKatakana_PA 0x8370 +#define chrKatakana_HI 0x8371 +#define chrKatakana_BI 0x8372 +#define chrKatakana_PI 0x8373 +#define chrKatakana_HU 0x8374 +#define chrKatakana_BU 0x8375 +#define chrKatakana_PU 0x8376 +#define chrKatakana_HE 0x8377 +#define chrKatakana_BE 0x8378 +#define chrKatakana_PE 0x8379 +#define chrKatakana_HO 0x837A +#define chrKatakana_BO 0x837B +#define chrKatakana_PO 0x837C +#define chrKatakana_MA 0x837D +#define chrKatakana_MI 0x837E +#define chrKatakana_MU 0x8380 +#define chrKatakana_ME 0x8381 +#define chrKatakana_MO 0x8382 +#define chrKatakanaSmall_YA 0x8383 +#define chrKatakana_YA 0x8384 +#define chrKatakanaSmall_YU 0x8385 +#define chrKatakana_YU 0x8386 +#define chrKatakanaSmall_YO 0x8387 +#define chrKatakana_YO 0x8388 +#define chrKatakana_RA 0x8389 +#define chrKatakana_RI 0x838A +#define chrKatakana_RU 0x838B +#define chrKatakana_RE 0x838C +#define chrKatakana_RO 0x838D +#define chrKatakanaSmall_WA 0x838E +#define chrKatakana_WA 0x838F +#define chrKatakana_WI 0x8390 +#define chrKatakana_WE 0x8391 +#define chrKatakana_WO 0x8392 +#define chrKatakana_N 0x8393 +#define chrKatakana_VU 0x8394 +#define chrKatakanaSmall_KA 0x8395 +#define chrKatakanaSmall_KE 0x8396 + +#define chrGreekCapitalAlpha 0x839F +#define chrGreekCapitalBeta 0x83A0 +#define chrGreekCapitalGamma 0x83A1 +#define chrGreekCapitalDelta 0x83A2 +#define chrGreekCapitalEpsilon 0x83A3 +#define chrGreekCapitalZeta 0x83A4 +#define chrGreekCapitalEta 0x83A5 +#define chrGreekCapitalTheta 0x83A6 +#define chrGreekCapitalIota 0x83A7 +#define chrGreekCapitalKappa 0x83A8 +#define chrGreekCapitalLamda 0x83A9 +#define chrGreekCapitalMu 0x83AA +#define chrGreekCapitalNu 0x83AB +#define chrGreekCapitalXi 0x83AC +#define chrGreekCapitalOmicron 0x83AD +#define chrGreekCapitalPi 0x83AE +#define chrGreekCapitalRho 0x83AF +#define chrGreekCapitalSigma 0x83B0 +#define chrGreekCapitalTau 0x83B1 +#define chrGreekCapitalUpsilon 0x83B2 +#define chrGreekCapitalPhi 0x83B3 +#define chrGreekCapitalChi 0x83B4 +#define chrGreekCapitalPsi 0x83B5 +#define chrGreekCapitalOmega 0x83B6 +#define chrGreekSmallAlpha 0x83BF +#define chrGreekSmallBeta 0x83C0 +#define chrGreekSmallGamma 0x83C1 +#define chrGreekSmallDelta 0x83C2 +#define chrGreekSmallEpsilon 0x83C3 +#define chrGreekSmallZeta 0x83C4 +#define chrGreekSmallEta 0x83C5 +#define chrGreekSmallTheta 0x83C6 +#define chrGreekSmallIota 0x83C7 +#define chrGreekSmallKappa 0x83C8 +#define chrGreekSmallLamda 0x83C9 +#define chrGreekSmallMu 0x83CA +#define chrGreekSmallNu 0x83CB +#define chrGreekSmallXi 0x83CC +#define chrGreekSmallOmicron 0x83CD +#define chrGreekSmallPi 0x83CE +#define chrGreekSmallRho 0x83CF +#define chrGreekSmallSigma 0x83D0 +#define chrGreekSmallTau 0x83D1 +#define chrGreekSmallUpsilon 0x83D2 +#define chrGreekSmallPhi 0x83D3 +#define chrGreekSmallChi 0x83D4 +#define chrGreekSmallPsi 0x83D5 +#define chrGreekSmallOmega 0x83D6 + +#define chrCyrillicCapital_A 0x8440 +#define chrCyrillicCapital_BE 0x8441 +#define chrCyrillicCapital_VE 0x8442 +#define chrCyrillicCapital_GHE 0x8443 +#define chrCyrillicCapital_DE 0x8444 +#define chrCyrillicCapital_IE 0x8445 +#define chrCyrillicCapital_IO 0x8446 +#define chrCyrillicCapital_ZHE 0x8447 +#define chrCyrillicCapital_ZE 0x8448 +#define chrCyrillicCapital_I 0x8449 +#define chrCyrillicCapitalShort_I 0x844A +#define chrCyrillicCapital_KA 0x844B +#define chrCyrillicCapital_EL 0x844C +#define chrCyrillicCapital_EM 0x844D +#define chrCyrillicCapital_EN 0x844E +#define chrCyrillicCapital_O 0x844F +#define chrCyrillicCapital_PE 0x8450 +#define chrCyrillicCapital_ER 0x8451 +#define chrCyrillicCapital_ES 0x8452 +#define chrCyrillicCapital_TE 0x8453 +#define chrCyrillicCapital_U 0x8454 +#define chrCyrillicCapital_EF 0x8455 +#define chrCyrillicCapital_HA 0x8456 +#define chrCyrillicCapital_TSE 0x8457 +#define chrCyrillicCapital_CHE 0x8458 +#define chrCyrillicCapital_SHA 0x8459 +#define chrCyrillicCapital_SHCHA 0x845A +#define chrCyrillicCapitalHardSign 0x845B +#define chrCyrillicCapital_YERU 0x845C +#define chrCyrillicCapitalSoftSign 0x845D +#define chrCyrillicCapital_E 0x845E +#define chrCyrillicCapital_YU 0x845F +#define chrCyrillicCapital_YA 0x8460 +#define chrCyrillicSmall_A 0x8470 +#define chrCyrillicSmall_BE 0x8471 +#define chrCyrillicSmall_VE 0x8472 +#define chrCyrillicSmall_GHE 0x8473 +#define chrCyrillicSmall_DE 0x8474 +#define chrCyrillicSmall_IE 0x8475 +#define chrCyrillicSmall_IO 0x8476 +#define chrCyrillicSmall_ZHE 0x8477 +#define chrCyrillicSmall_ZE 0x8478 +#define chrCyrillicSmall_I 0x8479 +#define chrCyrillicSmallShort_I 0x847A +#define chrCyrillicSmall_KA 0x847B +#define chrCyrillicSmall_EL 0x847C +#define chrCyrillicSmall_EM 0x847D +#define chrCyrillicSmall_EN 0x847E +#define chrCyrillicSmall_O 0x8480 +#define chrCyrillicSmall_PE 0x8481 +#define chrCyrillicSmall_ER 0x8482 +#define chrCyrillicSmall_ES 0x8483 +#define chrCyrillicSmall_TE 0x8484 +#define chrCyrillicSmall_U 0x8485 +#define chrCyrillicSmall_EF 0x8486 +#define chrCyrillicSmall_HA 0x8487 +#define chrCyrillicSmall_TSE 0x8488 +#define chrCyrillicSmall_CHE 0x8489 +#define chrCyrillicSmall_SHA 0x848A +#define chrCyrillicSmall_SHCHA 0x848B +#define chrCyrillicSmallHardSign 0x848C +#define chrCyrillicSmall_YERU 0x848D +#define chrCyrillicSmallSoftSign 0x848E +#define chrCyrillicSmall_E 0x848F +#define chrCyrillicSmall_YU 0x8490 +#define chrCyrillicSmall_YA 0x8491 + +#define chrBoxDrawingsLightHorizontal 0x849F +#define chrBoxDrawingsLightVertical 0x84A0 +#define chrBoxDrawingsLightDownAndRight 0x84A1 +#define chrBoxDrawingsLightDownAndLeft 0x84A2 +#define chrBoxDrawingsLightUpAndLeft 0x84A3 +#define chrBoxDrawingsLightUpAndRight 0x84A4 +#define chrBoxDrawingsLightVerticalAndRight 0x84A5 +#define chrBoxDrawingsLightDownAndHorizontal 0x84A6 +#define chrBoxDrawingsLightVerticalAndLeft 0x84A7 +#define chrBoxDrawingsLightUpAndHorizontal 0x84A8 +#define chrBoxDrawingsLightVerticalAndHorizontal 0x84A9 +#define chrBoxDrawingsHeavyHorizontal 0x84AA +#define chrBoxDrawingsHeavyVertical 0x84AB +#define chrBoxDrawingsHeavyDownAndRight 0x84AC +#define chrBoxDrawingsHeavyDownAndLeft 0x84AD +#define chrBoxDrawingsHeavyUpAndLeft 0x84AE +#define chrBoxDrawingsHeavyUpAndRight 0x84AF +#define chrBoxDrawingsHeavyVerticalAndRight 0x84B0 +#define chrBoxDrawingsHeavyDownAndHorizontal 0x84B1 +#define chrBoxDrawingsHeavyVerticalAndLeft 0x84B2 +#define chrBoxDrawingsHeavyUpAndHorizontal 0x84B3 +#define chrBoxDrawingsHeavyVerticalAndHorizontal 0x84B4 +#define chrBoxDrawingsVerticalHeavyAndRightLight 0x84B5 +#define chrBoxDrawingsDownLightAndHorizontalHeavy 0x84B6 +#define chrBoxDrawingsVerticalHeavyAndLeftLight 0x84B7 +#define chrBoxDrawingsUpLightAndHorizontalHeavy 0x84B8 +#define chrBoxDrawingsVerticalLightAndHorizontalHeavy 0x84B9 +#define chrBoxDrawingsVerticalLightAndRightHeavy 0x84BA +#define chrBoxDrawingsDownHeavyAndHorizontalLight 0x84BB +#define chrBoxDrawingsVerticalLightAndLeftHeavy 0x84BC +#define chrBoxDrawingsUpHeavyAndHorizontalLight 0x84BD +#define chrBoxDrawingsVerticalHeavyAndHorizontalLight 0x84BE + +#define chrCircledDigitOne 0x8740 +#define chrCircledDigitTwo 0x8741 +#define chrCircledDigitThree 0x8742 +#define chrCircledDigitFour 0x8743 +#define chrCircledDigitFive 0x8744 +#define chrCircledDigitSix 0x8745 +#define chrCircledDigitSeven 0x8746 +#define chrCircledDigitEight 0x8747 +#define chrCircledDigitNine 0x8748 +#define chrCircledNumberTen 0x8749 +#define chrCircledNumberEleven 0x874A +#define chrCircledNumberTwelve 0x874B +#define chrCircledNumberThirteen 0x874C +#define chrCircledNumberFourteen 0x874D +#define chrCircledNumberFifteen 0x874E +#define chrCircledNumberSixteen 0x874F +#define chrCircledNumberSeventeen 0x8750 +#define chrCircledNumberEighteen 0x8751 +#define chrCircledNumberNineteen 0x8752 +#define chrCircledNumberTwenty 0x8753 +#define chrRomanNumeralOne 0x8754 +#define chrRomanNumeralTwo 0x8755 +#define chrRomanNumeralThree 0x8756 +#define chrRomanNumeralFour 0x8757 +#define chrRomanNumeralFive 0x8758 +#define chrRomanNumeralSix 0x8759 +#define chrRomanNumeralSeven 0x875A +#define chrRomanNumeralEight 0x875B +#define chrRomanNumeralNine 0x875C +#define chrRomanNumeralTen 0x875D +#define chrSquareMiri 0x875F +#define chrSquareKiro 0x8760 +#define chrSquareSenti 0x8761 +#define chrSquareMeetoru 0x8762 +#define chrSquareGuramu 0x8763 +#define chrSquareTon 0x8764 +#define chrSquareAaru 0x8765 +#define chrSquareHekutaaru 0x8766 +#define chrSquareRittoru 0x8767 +#define chrSquareWatto 0x8768 +#define chrSquareKarorii 0x8769 +#define chrSquareDoru 0x876A +#define chrSquareSento 0x876B +#define chrSquarePaasento 0x876C +#define chrSquareMiribaaru 0x876D +#define chrSquarePeezi 0x876E +#define chrSquareMm 0x876F +#define chrSquareCm 0x8770 +#define chrSquareKm 0x8771 +#define chrSquareMg 0x8772 +#define chrSquareKg 0x8773 +#define chrSquareCc 0x8774 +#define chrSquareMSquared 0x8775 +#define chrSquareEraNameHeisei 0x877E +#define chrReversedDoublePrimeQuotationMark 0x8780 +#define chrLowDoublePrimeQuotationMark 0x8781 +#define chrNumeroSign 0x8782 +#define chrSquareKk 0x8783 +#define chrTelephoneSign 0x8784 +#define chrCircledIdeographHigh 0x8785 +#define chrCircledIdeographCentre 0x8786 +#define chrCircledIdeographLow 0x8787 +#define chrCircledIdeographLeft 0x8788 +#define chrCircledIdeographRight 0x8789 +#define chrParenthesizedIdeographStock 0x878A +#define chrParenthesizedIdeographHave 0x878B +#define chrParenthesizedIdeographRepresent 0x878C +#define chrSquareEraNameMeizi 0x878D +#define chrSquareEraNameTaisyou 0x878E +#define chrSquareEraNameSyouwa 0x878F +#define chrApproximatelyEqualToOrTheImageOfDup 0x8790 // Same as 0x81E0 +#define chrIdenticalToDup 0x8791 // Same as 0x81DF +#define chrIntegralDup 0x8792 // Same as 0x81E7 +#define chrContourIntegral 0x8793 +#define chrNArySummation 0x8794 +#define chrSquareRootDup 0x8795 // Same as 0x81E3 +#define chrUpTackDup 0x8796 // Same as 0x81DB +#define chrAngleDup 0x8797 // Same as 0x81DA +#define chrRightAngle 0x8798 +#define chrRightTriangle 0x8799 +#define chrBecauseDup 0x879A // Same as 0x81E6 +#define chrIntersectionDup 0x879B // Same as 0x81BF +#define chrUnionDup 0x879C // Same as 0x81BE + +#define chrSmallRomanNumeralOne 0xEEEF +#define chrSmallRomanNumeralTwo 0xEEF0 +#define chrSmallRomanNumeralThree 0xEEF1 +#define chrSmallRomanNumeralFour 0xEEF2 +#define chrSmallRomanNumeralFive 0xEEF3 +#define chrSmallRomanNumeralSix 0xEEF4 +#define chrSmallRomanNumeralSeven 0xEEF5 +#define chrSmallRomanNumeralEight 0xEEF6 +#define chrSmallRomanNumeralNine 0xEEF7 +#define chrSmallRomanNumeralTen 0xEEF8 +#define chrFullwidthNotSignDup 0xEEF9 // Same as 0x81CA +#define chrFullwidthBrokenBar 0xEEFA +#define chrFullwidthApostrophe 0xEEFB +#define chrFullwidthQuotationMark 0xEEFC + +#define chrSmallRomanNumeralOneDup 0xFA40 // Same as 0xEEEF +#define chrSmallRomanNumeralTwoDup 0xFA41 // Same as 0xEEF0 +#define chrSmallRomanNumeralThreeDup 0xFA42 // Same as 0xEEF1 +#define chrSmallRomanNumeralFourDup 0xFA43 // Same as 0xEEF2 +#define chrSmallRomanNumeralFiveDup 0xFA44 // Same as 0xEEF3 +#define chrSmallRomanNumeralSixDup 0xFA45 // Same as 0xEEF4 +#define chrSmallRomanNumeralSevenDup 0xFA46 // Same as 0xEEF5 +#define chrSmallRomanNumeralEightDup 0xFA47 // Same as 0xEEF6 +#define chrSmallRomanNumeralNineDup 0xFA48 // Same as 0xEEF7 +#define chrSmallRomanNumeralTenDup 0xFA49 // Same as 0xEEF8 +#define chrRomanNumeralOneDup 0xFA4A // Same as 0x8754 +#define chrRomanNumeralTwoDup 0xFA4B // Same as 0x8755 +#define chrRomanNumeralThreeDup 0xFA4C // Same as 0x8756 +#define chrRomanNumeralFourDup 0xFA4D // Same as 0x8757 +#define chrRomanNumeralFiveDup 0xFA4E // Same as 0x8758 +#define chrRomanNumeralSixDup 0xFA4F // Same as 0x8759 +#define chrRomanNumeralSevenDup 0xFA50 // Same as 0x875A +#define chrRomanNumeralEightDup 0xFA51 // Same as 0x875B +#define chrRomanNumeralNineDup 0xFA52 // Same as 0x875C +#define chrRomanNumeralTenDup 0xFA53 // Same as 0x875D +#define chrFullwidthNotSignDup2 0xFA54 // Same as 0xEEF9 & 0x81CA +#define chrFullwidthBrokenBarDup 0xFA55 // Same as 0xEEFA +#define chrFullwidthApostropheDup 0xFA56 // Same as 0xEEFB +#define chrFullwidthQuotationMarkDup 0xFA57 // Same as 0xEEFC +#define chrParenthesizedIdeographStockDup 0xFA58 // Same as 0x878A +#define chrNumeroSignDup 0xFA59 // Same as 0x8782 +#define chrTelephoneSignDup 0xFA5A // Same as 0x8784 +#define chrBecauseDup2 0xFA5B // Same as 0x81E6 & 0x879A + +#define chrLastSJISDoubleByte 0xFCFC + +// Alternative character names. kwk - figure out what Bowne wants to see here. + +#define chrChouon chrKatakanaHiraganaProlongedSoundMark + +// Old character names. + +#define yenChr chrYenSign + +#endif // __CHARSHIFTJIS_H__ + +#endif // NON_INTERNATIONAL diff --git a/sdk-3.1/include/Core/International/IntlMgr.h b/sdk-3.1/include/Core/International/IntlMgr.h new file mode 100644 index 0000000..a480d3d --- /dev/null +++ b/sdk-3.1/include/Core/International/IntlMgr.h @@ -0,0 +1,149 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * Project International + * File IntlMgr.h + * Author Ken Krugler + * Purpose Header file for the international manager. + * + * Agenda + * + * History + * 21 Mar 98 kwk New today. + * 24 Mar 98 kwk Filled out full set of routine selectors. + * 05 Apr 98 kwk Added static keyword to const in effort to get this + * to work w/standard C compilers. + * 08 Apr 98 kwk Deleted intlTxtCompareString and intlTxtCompareText + * routine selectors. + * kwk Added intlTxtWordBounds routine selector. + * 17 Apr 98 kwk Added intlTxtReplaceStr & intlTxtTruncateStr selectors. + * 27 May 98 kwk Removed intlTxtToLower and intlTxtTruncateStr selectors + * (unused routines). + * kwk Added intlIntlInit selector. + * kwk Added intlTxtCharEncoding & intlTxtStrEncoding selectors. + * kwk Added intlTxtEncodingName selector. + * 01 Jun 98 kwk Added intlTxtMaxEncoding selector. + * 10 Jun 98 kwk Added intlTxtTransliterate selector. + * 16 Jun 98 kwk Added intlTxtIsValidChar selector. + * 18 Jun 98 kwk Added intlTxtCompare & intlTxtCaselessCompare selectors. + * 30 Jun 98 kwk Moved IntlDispatch declaration here from IntlPrv.h. + * 28 Jul 98 kwk Changed TxtGetPrevChar to TxtGetPreviousChar. + * kwk Deleted intlTxtPrevCharSize & intlTxtNextCharSize + * selectors. + * kwk Added intlTxtGetChar selector. + * 26 Aug 98 kwk Added intlTxtCharWidth selector. + * 10 Sep 98 kwk Added intlTxtTruncate selector. + * 15 Sep 98 kwk Removed unused IntlQuit() routine declaration. + * 14 Oct 98 kwk Added intlIntlGetRoutineAddress selector and + * IntlGetRoutineAddress routine declaration. + * 16 Feb 99 kwk Changed TxtTruncate to TxtGetTruncationOffset. + * + ***********************************************************************/ + +#ifndef __INTLMGR_H__ +#define __INTLMGR_H__ + +// If nobody has explicitly specified that we should or should not +// use our international trap dispatcher, set it based on the emulation +// level. + +#ifndef USE_INTL_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_INTL_TRAPS 1 + #else + #define USE_INTL_TRAPS 0 + #endif +#endif + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Bits set for the Intl Mgr feature. + +#define kIntlMgrExists 0x00000001 + +// International Manager trap macros. + +#define m68kMoveQd2Instr 0x7400 + +#if USE_INTL_TRAPS + #define INTL_TRAP(intlSelectorNum) \ + THREEWORD_INLINE(m68kMoveQd2Instr + intlSelectorNum, \ + m68kTrapInstr+sysDispatchTrapNum, sysTrapIntlDispatch) +#else + #define INTL_TRAP(intlSelectorNum) +#endif + +// Selectors for routines found in the international manager. The order +// of these selectors MUST match the jump table in IntlDispatch.cp. + +typedef enum { + intlIntlInit = 0, + intlTxtByteAttr, + intlTxtCharAttr, + intlTxtCharXAttr, + intlTxtCharSize, + intlTxtGetPreviousChar, + intlTxtGetNextChar, + intlTxtGetChar, + intlTxtSetNextChar, + intlTxtCharBounds, + intlTxtPrepFindString, + intlTxtFindString, + intlTxtReplaceStr, + intlTxtWordBounds, + intlTxtCharEncoding, + intlTxtStrEncoding, + intlTxtEncodingName, + intlTxtMaxEncoding, + intlTxtTransliterate, + intlTxtIsValidChar, + intlTxtCompare, + intlTxtCaselessCompare, + intlTxtCharWidth, + intlTxtGetTruncationOffset, + intlIntlGetRoutineAddress, + + intlMaxSelector = intlIntlGetRoutineAddress, + intlBigSelector = 0x7FFF // Force IntlSelector to be 16 bits. +} IntlSelector; + +/*********************************************************************** + * Public routines + ***********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +// Return back the address of the routine indicated by . If +// isn't a valid routine selector, return back NULL. + +VoidPtr IntlGetRoutineAddress(IntlSelector inSelector) + INTL_TRAP(intlIntlGetRoutineAddress); + +// kwk - Move this, and other routine declarations, into IntlPrv.h which is +// new file in International folder. Rename existing IntlPrv.h in IntlMgr +// extension folder to be something like IntlExtShiftJIS.h + +// Dispatcher that uses contents of register D2 to dispatch to the +// appropriate int'l routine. This routine declaration is only used +// when setting up the trap dispatch table; all callers of routines +// accessed via the dispatcher should use the explicit routine declarations +// (e.g. IntlInit below), which set up D2 before calling IntlDispatch. + +void IntlDispatch(void); + +// Initialization routine, called at system reset time by PalmOS.. + +void IntlInit(void) + INTL_TRAP(intlIntlInit); + +#ifdef __cplusplus + } +#endif + +#endif // __INTLMGR_H__ diff --git a/sdk-3.1/include/Core/International/JapaneseFEP.h b/sdk-3.1/include/Core/International/JapaneseFEP.h new file mode 100644 index 0000000..8f4064b --- /dev/null +++ b/sdk-3.1/include/Core/International/JapaneseFEP.h @@ -0,0 +1,52 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * Project Instant Karma + * File JapaneseFEP.h + * Author Art LAmb + * Purpose Header file for Text Services Manager User Dictionary support. + * + ***********************************************************************/ + +// This file only contains support for the UserDictRegister macro. + + +#define sysFileCUserDict 'udic' /* creator of UserDict panel */ + +/* call user dictionary panel */ +enum +{ + userDictLaunchCmdRegister = sysAppLaunchCmdCustomBase +}; + +/* parameter block passed with the userDictLaunchCmdRegister command. */ +typedef struct +{ + /* current focused field or NULL */ + void *field; /* FieldPtr */ +} UserDictRegisterParamsType; +typedef UserDictRegisterParamsType *UserDictRegisterParamsPtr; + +#define UserDictRegister(fld) \ +do \ +{ \ + DmSearchStateType searchState; \ + LocalID dbID; \ + UInt cardNo; \ + UserDictRegisterParamsType params; \ +\ + params.field = (fld); \ +\ + /* Get the card number and database id of the UserDict panel. */ \ + if (DmGetNextDatabaseByTypeCreator (true, &searchState, \ + sysFileTPanel, sysFileCUserDict, \ + true, &cardNo, &dbID) == 0) \ + { \ + DWord result; \ + SysAppLaunch (cardNo, dbID, 0, \ + userDictLaunchCmdRegister, (Ptr) ¶ms, &result); \ + } \ +} while (0) + diff --git a/sdk-3.1/include/Core/International/TextMgr.h b/sdk-3.1/include/Core/International/TextMgr.h new file mode 100644 index 0000000..bfb099c --- /dev/null +++ b/sdk-3.1/include/Core/International/TextMgr.h @@ -0,0 +1,308 @@ +/*********************************************************************** + * Project International + * File TextMgr.h + * Author Ken Krugler + * Purpose Header file for Text Manager. + * + * Written by TransPac Software, Inc. + * Copyright Š 1998-1999 Palm Computing, Inc. + * All Rights Reserved. + * + * Agenda + * + * History + * 03/05/98 kwk New today. + * 02/16/99 kwk Added charEncodingPalmLatin & charEncodingPalmSJIS, + * since we've extended the CP1252 & CP932 encodings. + * kwk Added TxtUpperStr & TxtLowerStr macros. + * kwk Changed TxtTruncate to TxtGetTruncationOffset. + * + ***********************************************************************/ + +#ifndef __TEXTMGR_H__ +#define __TEXTMGR_H__ + + +#include + + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// 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 encodids (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). + +typedef enum { + charEncodingUnknown = 0, // Unknown to this version of PalmOS. + + charEncodingAscii, // ISO 646-1991 + charEncodingISO8859_1, // ISO 8859 Part 1 + charEncodingPalmLatin, // PalmOS version of CP1252 + charEncodingShiftJIS, // Encoding for 0208-1990 + 1-byte katakana + charEncodingPalmSJIS, // PalmOS version of CP932 + charEncodingUTF8, // Encoding for Unicode + charEncodingCP1252, // Windows variant of 8859-1 + charEncodingCP932 // Windows variant of ShiftJIS +} CharEncodingType; + +// Transliteration operations for the TxtTransliterate call. We don't use +// an enum, since each character encoding contains its own set of special +// transliteration operations (which begin at translitOpCustomBase). + +typedef Word TranslitOpType; + +#define translitOpUpperCase 0 +#define translitOpLowerCase 1 + +#define translitOpCustomBase 1000 // Beginning of char-encoding specific ops. + +#define translitOpPreprocess 0x8000 // Mask for pre-process option, where + // no transliteration actually is done. + +// Names of the known encodings. + +#define encodingNameAscii "us-ascii" +#define encodingNameISO8859_1 "ISO-8859-1" +#define encodingNameCP1252 "ISO-8859-1-Windows-3.1-Latin-1" +#define encodingNameShiftJIS "Shift_JIS" +#define encodingNameCP932 "Windows-31J" +#define encodingNameUTF8 "UTF-8" + +// Maximum length of any encoding name. + +#define kMaxEncodingName 40 + +// Various byte attribute flags. Note that multiple flags can be +// set, thus a byte could be both a single-byte character, or the first +// byte of a multi-byte character. + +#define byteAttrFirst 0x80 // First byte of multi-byte char. +#define byteAttrLast 0x40 // Last byte of multi-byte char. +#define byteAttrMiddle 0x20 // Middle byte of muli-byte char. +#define byteAttrSingle 0x01 // Single byte. + +// Various sets of character attribute flags. + +#define charAttrPrint (_DI|_LO|_PU|_SP|_UP|_XA) +#define charAttrSpace (_CN|_SP|_XS) +#define charAttrAlNum (_DI|_LO|_UP|_XA) +#define charAttrAlpha (_LO|_UP|_XA) +#define charAttrCntrl (_BB|_CN) +#define charAttrGraph (_DI|_LO|_PU|_UP|_XA) +#define charAttrDelim (_SP|_PU) + +// Maximum size a single WChar character will occupy in a text string. + +#define kMaxCharSize 3 + +// Text manager error codes. + +#define txtErrUknownTranslitOp (txtErrorClass | 1) +#define txtErrTranslitOverrun (txtErrorClass | 2) +#define txtErrTranslitOverflow (txtErrorClass | 3) + +/*********************************************************************** + * Public macros + ***********************************************************************/ + +#define TxtCharIsSpace(ch) ((TxtCharAttr(ch) & charAttrSpace) != 0) +#define TxtCharIsPrint(ch) ((TxtCharAttr(ch) & charAttrPrint) != 0) +#define TxtCharIsDigit(ch) ((TxtCharAttr(ch) & _DI) != 0) +#define TxtCharIsAlNum(ch) ((TxtCharAttr(ch) & charAttrAlNum) != 0) +#define TxtCharIsAlpha(ch) ((TxtCharAttr(ch) & charAttrAlpha) != 0) +#define TxtCharIsCntrl(ch) ((TxtCharAttr(ch) & charAttrCntrl) != 0) +#define TxtCharIsGraph(ch) ((TxtCharAttr(ch) & charAttrGraph) != 0) +#define TxtCharIsLower(ch) ((TxtCharAttr(ch) & _LO) != 0) +#define TxtCharIsPunct(ch) ((TxtCharAttr(ch) & _PU) != 0) +#define TxtCharIsUpper(ch) ((TxtCharAttr(ch) & _UP) != 0) +#define TxtCharIsHex(ch) ((TxtCharAttr(ch) & _XD) != 0) +#define TxtCharIsDelim(ch) ((TxtCharAttr(ch) & charAttrDelim) != 0) + +// is a hard key if the event modifier has the command bit set +// and is either in the proper range or is the calculator character. +#define TxtCharIsHardKey(m, c) ((((m) & commandKeyMask) != 0) && \ + ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr))) + +#define TxtPreviousCharSize(inText, inOffset) TxtGetPreviousChar((inText), (inOffset), NULL) +#define TxtNextCharSize(inText, inOffset) TxtGetNextChar((inText), (inOffset), NULL) + + +/*********************************************************************** + * Public routines + ***********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +// Return back byte attribute (first, last, single, middle) for . + +Byte TxtByteAttr(Byte inByte) + INTL_TRAP(intlTxtByteAttr); + +// Return back the standard attribute bits for . + +Word TxtCharAttr(WChar inChar) + INTL_TRAP(intlTxtCharAttr); + +// Return back the extended attribute bits for . + +Word TxtCharXAttr(WChar inChar) + INTL_TRAP(intlTxtCharXAttr); + +// Return the size (in bytes) of the character . This represents +// how many bytes would be required to store the character in a string. + +Word TxtCharSize(WChar inChar) + INTL_TRAP(intlTxtCharSize); + +// Return the width (in pixels) of the character . + +SWord TxtCharWidth(WChar inChar) + INTL_TRAP(intlTxtCharWidth); + +// Load the character before offset in the text. Return +// back the size of the character. + +Word TxtGetPreviousChar(ConstCharPtr inText, ULong inOffset, WCharPtr outChar) + INTL_TRAP(intlTxtGetPreviousChar); + +// Load the character at offset in the text. Return +// back the size of the character. + +Word TxtGetNextChar(ConstCharPtr inText, ULong inOffset, WCharPtr outChar) + INTL_TRAP(intlTxtGetNextChar); + +// Return the character at offset in the text. + +WChar TxtGetChar(ConstCharPtr inText, ULong inOffset) + INTL_TRAP(intlTxtGetChar); + +// Set the character at offset in the text, and +// return back the size of the character. + +Word TxtSetNextChar(CharPtr ioText, ULong inOffset, WChar inChar) + INTL_TRAP(intlTxtSetNextChar); + +// Replace the substring "^X" (where X is 0..9, as specified by ) +// with the string . If is nil then don't modify . +// Make sure the resulting string doesn't contain more than bytes, +// excluding the terminating null. Return back the number of occurances of +// the substring found in . + +Word TxtReplaceStr(CharPtr ioStr, Word inMaxLen, ConstCharPtr inParamStr, Word inParamNum) + INTL_TRAP(intlTxtReplaceStr); + +// Return the bounds of the character at in the +// text, via the & offsets, and also return the +// actual value of character at or following . + +WChar TxtCharBounds(ConstCharPtr inText, ULong inOffset, ULongPtr outStart, ULongPtr outEnd) + INTL_TRAP(intlTxtCharBounds); + +// Return the appropriate byte position for truncating such that it is +// at most bytes long. + +ULong TxtGetTruncationOffset(ConstCharPtr inText, ULong inOffset) + INTL_TRAP(intlTxtGetTruncationOffset); + +// Convert the characters in into an appropriate form for searching, +// and copy up to bytes of converted characters into . The +// resulting string will be null-terminated. We assume that includes +// the space required for the null. + +void TxtPrepFindString(ConstCharPtr inSource, CharPtr outDest, Word inDstSize) + INTL_TRAP(intlTxtPrepFindString); + +// Search for in . If found return true and pass back +// the found position (byte offset) in , and the length of the matched +// text in . + +Boolean TxtFindString(ConstCharPtr inSourceStr, ConstCharPtr inTargetStr, + ULongPtr outPos, WordPtr outLength) + INTL_TRAP(intlTxtFindString); + +// Find the bounds of the word that contains the character at . +// Return the offsets in <*outStart> and <*outEnd>. Return true if the +// word we found was not empty & not a delimiter (attribute of first char +// in word not equal to space or punct). + +Boolean TxtWordBounds(ConstCharPtr inText, ULong inLength, ULong inOffset, + ULongPtr outStart, ULongPtr outEnd) + INTL_TRAP(intlTxtWordBounds); + +// Return the minimum (lowest) encoding required for . If we +// don't know about the character, return encoding_Unknown. + +CharEncodingType TxtCharEncoding(WChar inChar) + INTL_TRAP(intlTxtCharEncoding); + +// Return the minimum (lowest) encoding required to represent . +// This is the maximum encoding of any character in the string, where +// highest is unknown, and lowest is ascii. + +CharEncodingType TxtStrEncoding(ConstCharPtr inStr) + INTL_TRAP(intlTxtStrEncoding); + +// Return the higher (max) encoding of and . + +CharEncodingType TxtMaxEncoding(CharEncodingType a, CharEncodingType b) + INTL_TRAP(intlTxtMaxEncoding); + +// Return a const pointer to the 'standard' name for . If the +// encoding is unknown, return a pointer to an empty string. + +ConstCharPtr TxtEncodingName(CharEncodingType inEncoding) + INTL_TRAP(intlTxtEncodingName); + +// Transliterate bytes of text found in , based +// on the requested operation. Place the results in , +// and set the resulting length in . On entry +// must contain the maximum size of the buffer. If the +// buffer isn't large enough, return an error (note that outDestText +// might have been modified during the operation). Note that if +// has the preprocess bit set, then is not modified, and +// will contain the total space required in the destination +// buffer in order to perform the operation. + +Err TxtTransliterate(ConstCharPtr inSrcText, Word inSrcLength, CharPtr outDstText, + WordPtr ioDstLength, TranslitOpType inOp) + INTL_TRAP(intlTxtTransliterate); + +// Return true if is a valid (drawable) character. Note that we'll +// return false if it is a virtual character code. + +Boolean TxtIsValidChar(WChar inChar) + INTL_TRAP(intlTxtIsValidChar); + +// Compare the first bytes of with the first bytes +// of . Return the results of the comparison: < 0 if sorts before +// , > 0 if sorts after , and 0 if they are equal. Also return +// the number of bytes that matched in and +// (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. + +Int TxtCaselessCompare(ConstCharPtr s1, Word s1Len, WordPtr s1MatchLen, + ConstCharPtr s2, Word s2Len, WordPtr s2MatchLen) + INTL_TRAP(intlTxtCaselessCompare); + +// Compare the first bytes of with the first bytes +// of . Return the results of the comparison: < 0 if sorts before +// , > 0 if sorts after , and 0 if they are equal. Also return +// the number of bytes that matched in and +// (either one of which can be NULL if the match length is not needed). + +Int TxtCompare(ConstCharPtr s1, Word s1Len, WordPtr s1MatchLen, + ConstCharPtr s2, Word s2Len, WordPtr s2MatchLen) + INTL_TRAP(intlTxtCompare); + +#ifdef __cplusplus + } +#endif + +#endif // __TEXTMGR_H__ diff --git a/sdk-3.1/include/Core/International/TextServices.h b/sdk-3.1/include/Core/International/TextServices.h new file mode 100644 index 0000000..fe4db56 --- /dev/null +++ b/sdk-3.1/include/Core/International/TextServices.h @@ -0,0 +1,20 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * Project International + * File TextServices.h + * Author Ken Krugler + * Purpose Header file for Text Services Manager. + * + ***********************************************************************/ + +#ifndef __TEXTSERVICES_H__ +#define __TEXTSERVICES_H__ + +// This file intentionally left blank; the Text Services manager's API is +// going to be changing in the future so the current version isn't being +// documented. + +#endif // __TEXTSERVICES_H__ diff --git a/sdk-3.1/include/Core/Jp.Prefix.h b/sdk-3.1/include/Core/Jp.Prefix.h new file mode 100644 index 0000000..9eb7b73 --- /dev/null +++ b/sdk-3.1/include/Core/Jp.Prefix.h @@ -0,0 +1,72 @@ +/********************************************************************* +* + Copyright Š 1995 - 1998, 3Com Corporation or its subsidiaries ("3Com"). + All rights reserved. + + This software may be copied and used solely for developing products for + the Palm Computing platform and for archival and backup purposes. Except + for the foregoing, no part of this software may be reproduced or transmitted + in any form or by any means or used to make any derivative work (such as + translation, transformation or adaptation) without express written consent + from 3Com. + + 3Com reserves the right to revise this software and to make changes in content + from time to time without obligation on the part of 3Com to provide notification + of such revision or changes. + 3COM MAKES NO REPRESENTATIONS OR WARRANTIES THAT THE SOFTWARE IS FREE OF ERRORS + OR THAT THE SOFTWARE IS SUITABLE FOR YOUR USE. THE SOFTWARE IS PROVIDED ON AN + "AS IS" BASIS. 3COM MAKES NO WARRANTIES, TERMS OR CONDITIONS, EXPRESS OR IMPLIED, + EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, INCLUDING WARRANTIES, + TERMS, OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND + SATISFACTORY QUALITY. + + TO THE FULL EXTENT ALLOWED BY LAW, 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS + ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT (INCLUDING NEGLIGENCE), FOR + DIRECT, INCIDENTAL, CONSEQUENTIAL, INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF + ANY KIND, OR FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF INFORMATION + OR DATA, OR OTHER FINANCIAL LOSS ARISING OUT OF OR IN CONNECTION WITH THIS SOFTWARE, + EVEN IF 3COM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + 3Com, HotSync, Palm Computing, and Graffiti are registered trademarks, and + Palm III and Palm OS are trademarks of 3Com Corporation or its subsidiaries. + + IF THIS SOFTWARE IS PROVIDED ON A COMPACT DISK, THE OTHER SOFTWARE AND + DOCUMENTATION ON THE COMPACT DISK ARE SUBJECT TO THE LICENSE AGREEMENT + ACCOMPANYING THE COMPACT DISK. + +******************************************************************** +* Please see :Incs:BuildRules.h for more information. +* +* History: +* 12/13/94 PBS - Created by Phillip Shoemaker +* +* +*******************************************************************/ + +#ifndef __JP_PREFIX_H__ +#define __JP_PREFIX_H__ + +/* +* This file is used for CodeWarrior projects incorporating United States +* localized resources. +*/ + +#ifndef COUNTRY + #define COUNTRY COUNTRY_JAPAN +#endif + +#ifndef LANGUAGE + #define LANGUAGE LANGUAGE_JAPANESE +#endif + +#ifndef TEXT_SERVICES + #define TEXT_SERVICES TEXT_SERVICES_ON +#endif + +#ifndef INTERNATIONAL_MGR + #define INTERNATIONAL_MGR INTERNATIONAL_MGR_ON +#endif + + +#endif // Jp.Prefix.h + diff --git a/sdk-3.1/include/Core/Pilot.h b/sdk-3.1/include/Core/Pilot.h new file mode 100644 index 0000000..7bdb3ad --- /dev/null +++ b/sdk-3.1/include/Core/Pilot.h @@ -0,0 +1,82 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * Pilot.h + * + * Description: + * Include file used by UI library source code modules + * + * History: + * 6/ 6/95 RM - Created by Ron Marianetti + * 2/24/97 RF - Changed to handle c++ versions. + * 4/24/97 SL - Changes for PalmOS 2.0 SDK + * 5/19/97 SL - Now includes only in MWERKS environments + * + *******************************************************************/ + + +// This tells "SysAll.h" not to use it's own pre-compiled header +#define __PILOT_H__ + +// Include the pre-compiled header, if not overriden. This pre-compiled header +// can be automatically re-generated by CodeWarrior by including the +// source file "Pilot.pch" in your project. +#ifndef PILOT_PRECOMPILED_HEADERS_OFF + + // Use Metrowerk's precompiled headers option + #if defined(__MWERKS__) + #if !__option(precompile) + #if __PALMOS_TRAPS__ + #ifdef __cplusplus + #include "Pilot.h++.mch" + #else + #include "Pilot.h.mch" + #endif + #else + #ifdef CMD_LINE_BUILD + #ifdef __cplusplus + #include "Pilot.h++.mpw.mch" + #else + #include "Pilot.h.mpw.mch" + #endif + #else + #ifdef __cplusplus + #include "Pilot.h++.sim.mch" + #else + #include "Pilot.h.sim.mch" + #endif + #endif + #endif + #define __INCLUDED_PILOT_H_OBJ__ + #endif + #endif + +#endif + + +// Fastest compilation speed is obtained by not including these +// headers when the pre-compiled header is used. +#ifndef __INCLUDED_PILOT_H_OBJ__ + +// The following Mac include file must be included before the Pilot +// headers for the emulator modules that have both Mac and Pilot +// code in them. This is only relevant for development environments +// that can compile both Mac and PalmOS code. +#if defined(__MWERKS__) + #if !defined(CMD_LINE_BUILD) && !defined(__PALMOS_TRAPS__) + #include // Include Mac types.h file + #endif +#endif + + +#include +#include + +#define NON_PORTABLE +#include +#include + +#endif diff --git a/sdk-3.1/include/Core/SysBuildRules.h b/sdk-3.1/include/Core/SysBuildRules.h new file mode 100644 index 0000000..04f649d --- /dev/null +++ b/sdk-3.1/include/Core/SysBuildRules.h @@ -0,0 +1,54 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SysBuildRules.h + * + * Description: + * This header file can beused as a template for + * common build options across all applications. To use, simply break + * the pencil and edit. + * + * + * Typically, the options specified in this file are used to + * set the language and country for the emulator + * + * History: + * 6/6/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +//#define LANGUAGE LANGUAGE_FRENCH +//#define COUNTRY COUNTRY_FRANCE + +// These can be overridden by AppBuildRules.h so we must check to +// see if they've been defined already or not. + + +// 1-16-98, Replaced DYN_MEM_SIZE with DYN_MEM_SIZE_MIN & +// DYN_MEM_SIZE_MAX +// WAS: +// #ifndef DYN_MEM_SIZE +// #define DYN_MEM_SIZE 0x010000 // 64K +// #endif +#ifdef DYN_MEM_SIZE + #error Error! Obsolete define DYN_MEM_SIZE used +#endif + +#ifndef DYN_MEM_SIZE_MIN + #define DYN_MEM_SIZE_MIN 0x010000 // 64K +#endif +#ifndef DYN_MEM_SIZE_MAX + #define DYN_MEM_SIZE_MAX 0x010000 // 64K +#endif +#ifndef DYN_MEM_SIZE_EXTRA + #define DYN_MEM_SIZE_EXTRA 0x000000 // 0K +#endif + + + +#ifndef DEFAULT_LIB_ENTRIES + #define DEFAULT_LIB_ENTRIES 5 // 5 libraries +#endif diff --git a/sdk-3.1/include/Core/System/AlarmMgr.h b/sdk-3.1/include/Core/System/AlarmMgr.h new file mode 100644 index 0000000..3ca5f2b --- /dev/null +++ b/sdk-3.1/include/Core/System/AlarmMgr.h @@ -0,0 +1,208 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * AlarmMgr.h + * + * Description: + * Include file for Alarm Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __ALARM_MGR_H__ +#define __ALARM_MGR_H__ + + +// Include elementary types +#include +#include + + + + +/************************************************************ + * Alarm Manager result codes + * (almErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define almErrMemory (almErrorClass | 1) // ran out of memory +#define almErrFull (almErrorClass | 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. +typedef struct SysAlarmTriggeredParamType { + DWord ref; // --> alarm reference value passed by caller; + ULong alarmSeconds; // --> alarm date/time in seconds since 1/1/1904; + + Boolean purgeAlarm; // <-- 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 + } SysAlarmTriggeredParamType; + +// 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. +typedef struct SysDisplayAlarmParamType { + DWord ref; // alarm reference value passed by caller; + ULong alarmSeconds; // alarm date/time in seconds since 1/1/1904; + Boolean soundAlarm; // non-zero if alarm needs to be sounded; + } SysDisplayAlarmParamType; + + + +/******************************************************************** + * Alarm Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// 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. +// +Err AlmInit(void) + SYS_TRAP(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. +// +Err AlmSetAlarm(UInt cardNo, LocalID dbID, DWord ref, + ULong alarmSeconds, Boolean quiet) + SYS_TRAP(sysTrapAlmSetAlarm); + + +// AlmGetAlarm() +// +// Gets the alarm seconds for a given app. +// Zero is returned if there is no alarm setting for the app. +ULong AlmGetAlarm(UInt cardNo, LocalID dbID, DWordPtr refP) + SYS_TRAP(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. +// +void AlmEnableNotification(Boolean enable) + SYS_TRAP(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. +// +void AlmDisplayAlarm(Boolean okToDisplay) + SYS_TRAP(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. +// +void AlmCancelAll(void) + SYS_TRAP(sysTrapAlmCancelAll); + + + +// AlmAlarmCallback() +// +// This function is called at interrupt time by the Time Manager when +// an alarm goes off. +// +void AlmAlarmCallback(void) + SYS_TRAP(sysTrapAlmAlarmCallback); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __ALARM_MGR_H__ + diff --git a/sdk-3.1/include/Core/System/AppLaunchCmd.h b/sdk-3.1/include/Core/System/AppLaunchCmd.h new file mode 100644 index 0000000..913c513 --- /dev/null +++ b/sdk-3.1/include/Core/System/AppLaunchCmd.h @@ -0,0 +1,249 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * AppLaunchCmd.h + * + * 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. + * + *******************************************************************/ + + #ifndef __APPLNCMD_H__ + #define __APPLNCMD_H__ + +// Include elementary types +#include + + +#define LaunchWithCommand(type, creator, command, commandParams) \ +{ \ + UInt 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) \ +{ \ + UInt cardNo; \ + LocalID dbID; \ + DmSearchStateType searchState; \ + DWord 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, (Ptr) 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. +typedef enum { + addrLookupName, + addrLookupFirstName, + addrLookupCompany, + addrLookupAddress, + addrLookupCity, + addrLookupState, + addrLookupZipCode, + addrLookupCountry, + addrLookupTitle, + addrLookupCustom1, + addrLookupCustom2, + addrLookupCustom3, + addrLookupCustom4, + addrLookupNote, // This field is assumed to be < 4K + addrLookupWork, + addrLookupHome, + addrLookupFax, + addrLookupOther, + addrLookupEmail, + addrLookupMain, + addrLookupPager, + addrLookupMobile, + addrLookupSortField, + addrLookupListPhone, + addrLookupNoField = 0xff +} AddressLookupFields; + + +#define addrLookupStringLength 12 + +typedef struct + { + CharPtr title; + // Title to appear in the title bar. If NULL the default is used. + + CharPtr pasteButtonText; + // Text to appear in paste button. If NULL "paste" is used. + + Char lookupString[addrLookupStringLength]; + // 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. + + AddressLookupFields field1; + // 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). + + AddressLookupFields field2; + // 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. + + Boolean field2Optional; + // 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. + + Boolean userShouldInteract; + // 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; + + CharPtr formatStringP; + // 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. + + Handle resultStringH; + // If there is a format string a result string is allocated on + // the dynamic heap and it's handle is returned here. + + DWord uniqueID; + // The unique ID of the found record or 0 if none was found. + + } AddrLookupParamsType; + +typedef AddrLookupParamsType * AddrLookupParamsPtr; + + + + +/************************************************************ + * Param Block passsed with the sysAppLaunchCmdSetActivePanel Command + *************************************************************/ + +#define prefAppLaunchCmdSetActivePanel (sysAppLaunchCmdCustomBase + 1) + // Record this panel so switching to the Prefs app + // causes this panel to execute. + +typedef struct + { + DWord activePanel; + // 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. + + } PrefActivePanelParamsType; + +typedef PrefActivePanelParamsType * PrefActivePanelParamsPtr; + + + +/************************************************************ + * Param Block passsed with the sysAppLaunchCmdAddRecord Command + *************************************************************/ + +//------------------------------------------------------------------- +// sysAppLaunchCmdAddRecord parameter block for the Mail application +//------------------------------------------------------------------- +// Param Block passsed with the sysAppLaunchCmdAddRecord Command + +typedef enum { mailPriorityHigh, mailPriorityNormal, mailPriorityLow } MailMsgPriorityType; + +typedef struct { + Boolean secret; + // True means that the message should be marked secret + + Boolean signature; + // True means that signature from the Mail application's preferences + // should be attached to the message. + + Boolean confirmRead; + // True means that a comfirmation should be sent when the message + // is read. + + Boolean confirmDelivery; + // True means that a comfirmation should be sent when the message + // is deliveried + + MailMsgPriorityType priority; + // high, normial, or low. + + CharPtr subject; + // Message's subject, a null-terminated string (optional). + + CharPtr from; + // Message's send, a null-terminated string (not currently used). + + CharPtr to; + // Address the the recipient, a null-terminated string (required). + + CharPtr cc; + // Copy Addresses, a null-terminated string (required). + + CharPtr bcc; + // Blind copy Addresses, a null-terminated string (required). + + CharPtr replyTo; + // Reply to address, a null-terminated string (required). + + CharPtr body; + // The text of the message, a null-terminated string (required). + +} MailAddRecordParamsType; + +typedef MailAddRecordParamsType * MailAddRecordParamsPtr; + + + + +#endif //__APPLNCMD_H__ diff --git a/sdk-3.1/include/Core/System/CMClient.h b/sdk-3.1/include/Core/System/CMClient.h new file mode 100644 index 0000000..54d2224 --- /dev/null +++ b/sdk-3.1/include/Core/System/CMClient.h @@ -0,0 +1,117 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * CMClient.h + * + * Description: + * Connection Management Protocol client definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * + *******************************************************************/ + + +#ifndef __CMCLIENT_H__ +#define __CMCLIENT_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Touchdown common definitions + #include "Common.h" + #include "SerLink.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Touchdown common definitions + #include + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + +/************************************************************ + * Connection Manager result codes + * (cmpErrorClass is defined in SystemMgr.h) + *************************************************************/ + +#define cmErrParam (cmpErrorClass | 1) // bad parameter +#define cmErrTimeOut (cmpErrorClass | 2) // connection listenning/initialization timed out +#define cmErrComm (cmpErrorClass | 3) // communication(send/receive) error +#define cmErrCommVersion (cmpErrorClass | 4) // incompatible comm version +#define cmErrMemory (cmpErrorClass | 5) // insufficient memory error +#define cmErrCommBusy (cmpErrorClass | 6) // PAD server is already in use +#define cmErrUserCan (cmpErrorClass | 7) // attempt cancelled by user + + + +/******************************************************************** + * Connection Manager Constants + ********************************************************************/ + +#define cmWakeupTransactionID 0xFF + +/******************************************************************** + * Connection Manager Structures + ********************************************************************/ +typedef Int (*CmAbortProc)(DWord userRef); + +typedef struct CmParamType { + UInt localSocket; // -> user's socket + UInt remoteSocket; // -> remote socket + ULong maxBaud; // -> maximum baud rate which can be used + Boolean viaModem; // -> set to true if connecting via modem + CmAbortProc abortProc; // -> ptr to abort procedure + DWord userRef; // -> reference value for abort procedure + } CmParamType; + +typedef CmParamType* CmParamPtr; + + +typedef struct CmSessionType { + // Parameters passed by user + CmParamType param; // user parameters + + UInt serRefNum; // serial library reference number + } CmSessionType; + +typedef CmSessionType* CmSessionPtr; + + + + +/******************************************************************** + * Connection Manager API Routines + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Listens for a "wakeup" message from the broadcaster +// and completes the connection handshake by sending the "init" +// or "abort" message(called by client). +Err CmListen(CmParamPtr paramP); + + +#ifdef __cplusplus +} +#endif + + + +/******************************************************************** + * Connection Manager Macros + ********************************************************************/ + + + +#endif // __CMCLIENT_H__ diff --git a/sdk-3.1/include/Core/System/CMCommon.h b/sdk-3.1/include/Core/System/CMCommon.h new file mode 100644 index 0000000..745df25 --- /dev/null +++ b/sdk-3.1/include/Core/System/CMCommon.h @@ -0,0 +1,359 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * CMCommon.h + * + * Description: + * Connection Management Protocol common definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * 11/19/96 vmk Added CM v1.1 receive timeout override extensions + * + *******************************************************************/ + + +#ifndef __CM_COMMON_H__ +#define __CM_COMMON_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Pilot common definitions + #include "Common.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Pilot common definitions + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + +/******************************************************************** + * CMP 1.0 Command Format + ********************************************************************/ + +// IT IS ANTICIPATED THAT the 1.0 PACKET FORMAT WILL BE USED TO INITIATE +// HOT SYNC "WAKE-UP" MESSAGE INDEFINITELY. BASED ON THE COMMUNICATIONS +// VERSION NUMBER PROVIDED IN THIS BASIC COMMAND STRUCTURE, FUTURE VERSIONS +// OF DESKTOP AND PILOT SOFTWARE MAY SUPPORT ADDITIONAL CONNECTION MANAGEMENT +// COMMANDS/FEATURES AS THE NEED ARISES. FOR EXAMPLE, TCP-ENABLED HOTSYNCS +// MAY PROVIDE ADDITIONAL INFORMATION, SUCH AS THE INTERNET ADDRESS OF THE +// PREFERRED HOTSYNC PC. THIS DESIGN PROVIDES FOR BACKWARD COMPATIBILITY +// WITH OLDER VERSIONS OF THE SOFTWARE. FUTURE COMMANDS WILL BE ADDED +// FOLLOWING THIS BASIC COMMAND SET. + +// The CMP packets are used for transmitting data for the Pilot CMP protocol layer. +// The structure of the CMP packet is built into the data part of the SLP packet and is, +// therefore, constrained by the SLP packet data size limitations. + + +// Packet type values used in the CMP packet body "type" field: +// +typedef enum CmpType { + cmpWakeup = 1, // CMP Wakeup packet sent from server to client + cmpInit, // CMP Init packet sent from client to server + cmpAbort, // CMP Abort packet sent from client to server + cmpExtended // For future command extensions + } CmpType; + + +// cmpInit and cmpWakeup packet body structure: +// +typedef struct CmpBodyType { + Byte type; // CMP packet type + + Byte flags; // in cmpInit packets: indicates which values were adjusted by + // the client(defined below); in cmpWakeup pakcets: null; + // in cmpAbort packets: reason for abort. + + Byte verMajor; // Major PAD version number + Byte verMinor; // Minor PAD version number + Word wReserved; // RESERVED -- set to NULL!!! + //DWord commVersion; // in cmpWakeup: server comm software version number; + // in cmpInit: client comm version + + DWord baudRate; // in cmpWakeup: max server baud rate; + // in cmpInit packets: the prescribed baud rate + } CmpBodyType; + +typedef CmpBodyType* CmpBodyPtr; + +// Flags used in the packet body "flags" field of cmpInit +// packets. These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpInitFlagChangeBaudRate 0x80 // signals that the baud rate was adjusted by the client + +// CM v1.1 extensions +#define cmpInitFlagRcvTOut1Min 0x40 // instructs the Pilot to set its receive timeout to 1 minute +#define cmpInitFlagRcvTOut2Min 0x20 // instructs the Pilot to set its receive timeout to 1 minute + + +// Flags used in the packet body "flags" field of cmpAbort packets. +// These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpAbortFlagVersionError 0x80 // signals incompatible comm versions + + + +/******************************************************************** + * CMP Protocol Parameters + ********************************************************************/ + +// This transaction id is used by cmpWakeup packets. cmpInit and cmpAbort +// packets MUST use a different transaction id. +// +#define cmpWakeupTransactionID 0xFF + +// This is the baud rate at which CMP connections are initiated +// +#define cmpInitialBaudRate 9600L + +// This is the time limit for trying to initiate a connection +// +#define cmpMaxInitiateSec 20 + + +/******************************************************************** + * CMP v2.0 Extensible Command Format + ********************************************************************/ + +// THE v2.0 COMMANDS USE A MORE FLEXIBLE STRUCTURE TO ANTICIPATE DYNAMIC +// ADDITION OF NEW ARGUMENTS. THE COMMAND HEADER AND ARGUMENT IDENTIFIERS +// AND THEIR STRUCTURES WILL BE SPECIFIED IN THIS INCLUDE FILE. THE PACKAGING +// OF THE ARGUMENTS WILL BE SPECIFIED IN THE TRANSPORT IMPLEMENTATION +// WHICH PROVIDES THE UTILITY ROUTINES TO PACKAGE DYNAMIC ARGUMENTS. + +typedef struct CmpCommandHeaderType { + Byte hdrType; // set to cmpExtended + Byte cmd; // extended command/response id + Word errorCode; // used in replies; set to null in commands! + Byte argCount; // number of arguments + Byte reserved1; // RESERVED - SET TO NULL! + DWord reserved2; // RESERVED - SET TO NULL! + } CmpCommandHeaderType; + + +// Generic command type for +typedef union CmpGenericCommandType { + Byte hdrType; // command header type(CmpType) + CmpBodyType body10; // v1.0 command/response body + CmpCommandHeaderType exHdr; // v2.0 extended command/response header + } CmpGenericCommandType; + +typedef CmpGenericCommandType* CmpGenericCommandPtr; + + +// cmpRespBit is used to form a response ID from a +// command ID by or'ing it with the function ID. +#define cmpRespBit 0x80 + +// cmpCmdIDMask is used to mask out the command/response ID value +#define cmpCmdIDMask 0x7f + +// Command/Response argument id's begin at this value +#define cmpFirstArgID 0x20 + + +//------------------------------------------------------------------------- +// Connection Management error codes returned in the response errorCode +// field. +//------------------------------------------------------------------------- +typedef enum CmpRespErrEnum { + cmpRespErrNone = 0, // reserve 0 for no error + cmpRespErrSystem, // general Pilot system error + cmpRespErrUnknownCmd, // unknown command ID + cmpRespErrMemory, // insufficient memory + cmpRespErrParam, // invalid parameter + + cmpRespErrLast // *KEEP THIS ENTRY LAST* + } CmpRespErrEnum; + + +//------------------------------------------------------------------------- +// Connection Management Extended Command ID's +//------------------------------------------------------------------------- +typedef enum CmpCmdEnum { + + cmpCmdReserved = 0x0F, // range reserved for internal use + + //---------------------------- + // v2.0 COMMANDS + //---------------------------- + cmpCmdXCommPrefs, // exchange communications protocol preferences + cmpCmdHShakeComplete, // hand-shake completion command + + cmpCmdLast // *KEEP THIS ENTRY LAST* + } CmpCmdEnum; + + + +//------------------------------------------------------------------------- +// v2.0 Connection Management Command/Response Structures +//------------------------------------------------------------------------- + +// CmpCommPrefsType: common data structure shared by cmpCmdXCommPrefs and +// cmpCmdHShakeComplete. In cmpCmdXCommPrefs, the data structure is used +// to exchange capabilities. In cmpCmdHShakeComplete, the structure is +// used to instruct the Pilot on which settings/features to use. Some +// fields apply to direct PAD-based connections only and should be ignored +// by other transports such as TCP. More on this later(DOLATER...) +// +typedef struct CmpCommPrefsType { + // OFFSET + DWord maxPktDataSize;// 0; maximum supported packet data size + DWord maxDataBlkSize;// 4; maximum supported data block size + DWord maxBaudRate; // 8; maximum supported baud rate/baud rate to use + DWord hwHShakeAbove; // 12; requires hardware handshake above this baud rate + DWord flags; // 16; flags + DWord version; // 20; transport version (comm version) + DWord reserved2; // 24; RESERVED - SET TO NULL! + DWord reserved3; // 28; RESERVED - SET TO NULL! + // TOTAL: 32 bytes; + } CmpCommPrefsType; + + +//-------------------------------------- +// Packet-level CRC preferences +//-------------------------------------- + +// cmpCommPrefsFlagSupportPktCRC16: if set, the transport layer is capable of +// CRC-16 protection of every data packet(v2.0 extension). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportPktCRC16 0x80000000L + +// cmpCommPrefsFlagUsePktCRC16: if set, instructs the transport layer to use +// the CRC-16 protection of every data packet(v2.0 extension). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUsePktCRC16 0x00008000L + +//-------------------------------------- +// Data offset size preferences +//-------------------------------------- + +// NOTE: +// If specifying short offsets, short argument wrappers will be used. +// If specifying long offsets, long argument wrappers will be used. + +// cmpCommPrefsFlagSupportShortOffsets: if set, indicates that the transport layer +// supports short(single-word) offsets/sizes in its data packets. The smaller +// field does not permit bigger blocks to be transmitted(v1.0-compatible). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportShortOffsets 0x40000000L + +// cmpCommPrefsFlagUseShortOffsets: if set, instructs the transport layer to use +// short(single-word) offsets/sizes in its data packets(v1.0-compatible). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUseShortOffsets 0x00004000L + +// cmpCommPrefsFlagSupportLongOffsets: if set, indicates that the transport layer +// supports long(double-word) offsets/sizes in its data packets. The larger +// field permits bigger blocks to be transmitted(v2.0 extension). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportLongOffsets 0x20000000L + +// cmpCommPrefsFlagUseLongOffsets: if set, instructs the transport layer to use +// long(double-word) offsets/sizes in its data packets(v2.0 extension). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUseLongOffsets 0x00002000L + + + +////////////////////////////////////////////////////////////////////////// +// cmpCmdXCommPrefs +////////////////////////////////////////////////////////////////////////// +// +// Description: +// Exchange communications preferences. +// +// Possible error codes +// cmpRespErrSystem, +// cmpRespErrMemory, +// cmpRespErrParam, + +//--------------------- +// Command arguments: +//--------------------- +enum { + cmpXCommPrefsReqArgID = cmpFirstArgID + }; + + +// cmpXCommPrefsReqArgID argument structure: +// +typedef struct CmpXCommPrefsReqType { + // OFFSET + CmpCommPrefsType prefs; // 0; CMP comm preferences + // TOTAL: 32 bytes; + } CmpXCommPrefsReqType; + + +//--------------------- +// Response arguments: +//--------------------- +enum { + cmpXCommPrefsPrefsRespArgID = cmpFirstArgID, // preferences argument + cmpXCommPrefsIPAddrRespArgID // preferred PC IP Address/host name + }; + + +// cmpXCommPrefsPrefsRespArgID argument structure: +// +typedef struct CmpXCommPrefsPrefsRespType { + // OFFSET + CmpCommPrefsType prefs; // 0; CMP comm preferences + // TOTAL: 32 bytes; + } CmpXCommPrefsPrefsRespType; + + +// cmpXCommPrefsIPAddrRespArgID argument structure: +// +typedef struct CmpXCommPrefsIPAddrRespType { + // OFFSET + Byte ipAddr[1]; // 0; IP address/host name string, zero-terminated + // TOTAL: variable size; + } CmpXCommPrefsIPAddrRespType; + + + +////////////////////////////////////////////////////////////////////////// +// cmpCmdHShakeComplete +////////////////////////////////////////////////////////////////////////// +// +// Description: +// Completes the Extended Connection Management hand-shake. Instructs +// the Pilot on which settings/features to use. +// +// Possible error codes +// cmpRespErrSystem, +// cmpRespErrMemory, +// cmpRespErrParam + +//--------------------- +// Command arguments: +//--------------------- +enum { + cmpHShakeCompleteReqArgID = cmpFirstArgID + }; + + +// cmpHShakeCompleteReqArgID argument structure: +// +typedef struct CmpHShakeCompleteReqType { + // OFFSET + CmpCommPrefsType final; // 0; final settings/features to use + // TOTAL: 32 bytes; + } CmpHShakeCompleteReqType; + + +//--------------------- +// Response arguments: +//--------------------- + +// No response arguments; the response consists of the command header only + + + +#endif // __CM_COMMON_H__ diff --git a/sdk-3.1/include/Core/System/ConsoleMgr.h b/sdk-3.1/include/Core/System/ConsoleMgr.h new file mode 100644 index 0000000..1357d78 --- /dev/null +++ b/sdk-3.1/include/Core/System/ConsoleMgr.h @@ -0,0 +1,50 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * ConsoleMgr.h + * + * 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 + * + *******************************************************************/ + +#ifndef __CONSOLEMGR_H__ +#define __CONSOLEMGR_H__ + + + + +/******************************************************************** + * Console Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err ConPutS(CharPtr message) + SYS_TRAP(sysTrapConPutS); + +Err ConGetS(CharPtr message, Long timeout) + SYS_TRAP(sysTrapConGetS); + + +#ifdef __cplusplus +} +#endif + + + + +#endif // __CONSOLEMGR_H__ + + + + diff --git a/sdk-3.1/include/Core/System/Crc.h b/sdk-3.1/include/Core/System/Crc.h new file mode 100644 index 0000000..a6d129e --- /dev/null +++ b/sdk-3.1/include/Core/System/Crc.h @@ -0,0 +1,67 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Crc.h + * AUTHOR: Vitaly Kruglikov: May 10, 1995 + * + * + * DESCRIPTION: + * This is the header file for the CRC calculation routines for Pilot. + * + * + * REVISION HISTORY: + * 5/10/95 vmk Initial version. + * + **********************************************************************/ + + +#ifndef __CRC_H__ +#define __CRC_H__ + + +// Include elementary types +#include +#include + + + + +/******************************************************************** + * CRC Calculation Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + + +// Crc16CalcBlock() +// +// Calculate the 16-bit CRC of a data block using the table lookup method. +// +Word Crc16CalcBlock(VoidPtr bufP, UInt count, Word crc) + SYS_TRAP(sysTrapCrc16CalcBlock); + +Word Crc16CalcBigBlock(VoidPtr bufP, DWord count, Word crc); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __CRC_H__ + diff --git a/sdk-3.1/include/Core/System/DLCommon.h b/sdk-3.1/include/Core/System/DLCommon.h new file mode 100644 index 0000000..bd61b6e --- /dev/null +++ b/sdk-3.1/include/Core/System/DLCommon.h @@ -0,0 +1,2436 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * DLCommon.h + * + * Description: + * Desktop Link Protocol(DLP) function id's, parameters, and frame + * structures. + * + * History: + * 6/7/95 vmk Created by Vitaly Marty Kruglikov + * 6/15/95 vmk Changed dlp/Read/Write/UserID to dlp/Read/Write/UserInfo and + * added the last sync PC id field to their arguments at Laura's request. + * 6/15/95 vmk Added option to dlpDeleteRecord to delete all records in DB. + * + *******************************************************************/ + + +#ifndef __DLCOMMON_H__ +#define __DLCOMMON_H__ + + +/************************************************************ + * DesktopLink function codes + *************************************************************/ + +// DlpFuncID -- function id's used in request blocks sent to +// the DesktopLink application on Pilot. The width of the function +// id base is 7 bits. The high order bit(the 8th bit) is used to +// distinguish requests from their responses -- it is cleared in request +// blocks and is set in response blocks (i.e., the response to a particular +// command will have the same function code base as the command and the +// high order bit set). See dlpFuncRespFlag defined below. +// +typedef enum DlpFuncID { + + dlpReservedFunc = 0x0F, // range reserved for internal use + + // DLP 1.0 FUNCTIONS START HERE (PalmOS v1.0) + dlpReadUserInfo, + + dlpWriteUserInfo, + + dlpReadSysInfo, + + dlpGetSysDateTime, + + dlpSetSysDateTime, + + dlpReadStorageInfo, + + dlpReadDBList, + + dlpOpenDB, + + dlpCreateDB, + + dlpCloseDB, + + dlpDeleteDB, + + dlpReadAppBlock, + + dlpWriteAppBlock, + + dlpReadSortBlock, + + dlpWriteSortBlock, + + dlpReadNextModifiedRec, + + dlpReadRecord, + + dlpWriteRecord, + + dlpDeleteRecord, + + dlpReadResource, + + dlpWriteResource, + + dlpDeleteResource, + + dlpCleanUpDatabase, + + dlpResetSyncFlags, + + dlpCallApplication, + + dlpResetSystem, + + dlpAddSyncLogEntry, + + dlpReadOpenDBInfo, + + dlpMoveCategory, + + dlpProcessRPC, // remote procedure calls interface + + dlpOpenConduit, // this command is sent before each conduit is opened + + dlpEndOfSync, // ends the sync session + + dlpResetRecordIndex, // resets "modified record" index + + dlpReadRecordIDList, // LAST 1.0 FUNCTION + + + // DLP 1.1 FUNCTIONS ADDED HERE (PalmOS v2.0 Personal, and Professional) + dlpReadNextRecInCategory, // iterate through all records in category + + dlpReadNextModifiedRecInCategory, // iterate through modified records in category + + dlpReadAppPreference, // read application preference + + dlpWriteAppPreference, // write application preference + + dlpReadNetSyncInfo, // read Network HotSync settings + + dlpWriteNetSyncInfo, // write Network HotSync settings + + dlpReadFeature, // read a feature from Feature Manager + + + // DLP 1.2 FUNCTIONS ADDED HERE (PalmOS v3.0) + dlpFindDB, // find a database given creator and type, or name, or + // get info on currently-open db + dlpSetDBInfo, // change database information (name, attributes, version, + // creation, modification, backup dates, type and creator + + + + + dlpLastFunc // ***ALWAYS KEEP LAST*** + + } DlpFuncID; + +#define dlpLastPilotV10FuncID dlpReadRecordIDList + + +// Desktop Link function error codes returned in the response errorCode +// field. +typedef enum DlpRespErrorCode { + dlpRespErrNone = 0, // reserve 0 for no error + dlpRespErrSystem, // general Pilot system error + dlpRespErrIllegalReq, // unknown function ID + dlpRespErrMemory, // insufficient dynamic heap memory + dlpRespErrParam, // invalid parameter + dlpRespErrNotFound, // database, record, or resource not found + dlpRespErrNoneOpen, // there are no open databases + dlpRespErrDatabaseOpen, // database is open by someone else + dlpRespErrTooManyOpenDatabases, // there are too many open databases + dlpRespErrAlreadyExists, // DB already exists + dlpRespErrCantOpen, // couldn't open DB + dlpRespErrRecordDeleted, // record is deleted + dlpRespErrRecordBusy, // record is in use by someone else + dlpRespErrNotSupported, // the requested operation is not supported + // on the given database type(record or resource) + dlpRespErrUnused1, // was dlpRespErrROMBased + dlpRespErrReadOnly, // caller does not have write access(or DB is in ROM) + dlpRespErrNotEnoughSpace, // not enough space in data store for record/resource/etc. + dlpRespErrLimitExceeded, // size limit exceeded + dlpRespErrCancelSync, // cancel the sync + + dlpRespErrBadWrapper, // bad arg wrapper(for debugging) + dlpRespErrArgMissing, // required arg not found(for debugging) + dlpRespErrArgSize, // invalid argument size + + dlpRespErrLastReserved = 127 // last error code reserved for Palm + // *KEEP THIS ENTRY LAST* + } DlpRespErrorCode; + + +// Database flags +// NOTE: THESE *MUST* MATCH THE TOUCHDOWN DB ATTRIBUTES(AT LEAST IN THE FIRST VERSION). +// ANY CHANGES MUST BE REFLECTED IN "READ DB LIST" AND +#define dlpDBFlagResDB 0x0001 // resource DB if set; record DB if cleared + +#define dlpDBFlagReadOnly 0x0002 // DB is read only if set; read/write if cleared + +#define dlpDBFlagAppInfoDirty 0x0004 // Set if Application Info block is dirty + // Optionally supported by an App's conduit + +#define dlpDBFlagBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. + +#define dlpDBFlagOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK + // for it to install a newer version of this database + // with a different name if the current database is + // open. This mechanism is used to update the + // Graffiti Shortcuts database, for example. + +#define dlpDBFlagResetAfterInstall 0x0020 // Device requires a reset after this database is + // installed. + +#define dlpDBFlagCopyPrevention 0x0040 // This database should not be copied to + // another deviced. + +#define dlpDBFlagOpen 0x8000 // DB is open + + + + +// Database record attributes +#define dlpRecAttrDeleted 0x80 // delete this record next sync +#define dlpRecAttrDirty 0x40 // archive this record next sync +#define dlpRecAttrBusy 0x20 // record currently in use +#define dlpRecAttrSecret 0x10 // "secret" record - password protected +#define dlpRecAttrArchived 0x08 // archived record + + +// Date/time will be described in the following format +// yr(2 bytes), mo(1 byte, 1-12), dy(1 byte, 1-31), +// hr(1 byte, 0-23), min(1 byte, 0-59), sec(1 byte, 0-59), +// unused(1 byte). + +typedef struct DlpDateTimeType { // OFFSET + Word year; // 0; year (high, low) + Byte month; // 2; month: 1-12 + Byte day; // 3; day: 1-31 + Byte hour; // 4; hour: 0-23 + Byte minute; // 5; minute: 0-59 + Byte second; // 6; second: 0-59 + Byte unused; // 7; unused -- set to null! + } DlpDateTimeType; // TOTAL: 8 bytes + + +// Version structure +typedef struct DlpVersionType { + // OFFSET + Word wMajor; // 0; major version number (0 = ignore) + Word wMinor; // 2; minor version number + // TOTAL: 4 bytes + } DlpVersionType; + + +/************************************************************ + * Request and Response headers. + * + * Each DLP request and response data block begins with the + * corresponding header structure which identifies the function + * id, argument count, and error code(responses only). + *************************************************************/ + +// Request header: +// +typedef struct DlpReqHeaderType { + // OFFSET + Byte id; // 0; request function ID + Byte argc; // 2; count of args that follow this header + // TOTAL: 2 bytes + } DlpReqHeaderType; + +typedef DlpReqHeaderType* DlpReqHeaderPtr; + +typedef struct DlpReqType { + // OFFSET + DlpReqHeaderType header; // 0; request header + // FIXED SIZE: 2 bytes + Byte args[1]; // 2; request arguments -- var size + } DlpReqType; + +typedef DlpReqType* DlpReqPtr; + +// Response header: +// +typedef struct DlpRespHeaderType { + // OFFSET + Byte id; // 0; response function ID + Byte argc; // 1; count of arguments that follow this header + Word errorCode; // 2; error code + // TOTAL: 4 bytes + } DlpRespHeaderType; + +typedef DlpRespHeaderType* DlpRespHeaderPtr; + +typedef struct DlpRespType { + // OFFSET + DlpRespHeaderType header; // 0; response header + // FIXED SIZE: 4 bytes + Byte args[1]; // 4; response arguments -- var size + } DlpRespType; + +typedef DlpRespType* DlpRespPtr; + + +// Generic request/response body type(for utility routines) +// +typedef union DlpGenericBodyType { + Byte id; // request/response id + DlpReqType req; // request body + DlpRespType resp; // response body + } DlpGenericBodyType; + +typedef DlpGenericBodyType* DlpGenericBodyPtr; + + +// dlpFuncRespFlag is used to form a function response ID from a +// function ID by or'ing it with the function ID. For example: if +// dlpFuncDeleteResource is the request ID, the correct response ID +// must be (dlpFuncDeleteResource | dlpFuncRespFlag). +// +#define dlpFuncRespFlag 0x80 + +// dlpFuncIDMask is used to mask out the function ID value +#define dlpFuncIDMask 0x7f + +// dlpFirstArgID is the value of the first argument ID to be defined for +// functions. Values below it are reserved. +// +#define dlpFirstArgID 0x20 + + +/************************************************************ + * + * Argument headers used to "wrap" request and response arguments + * + * IMPORTANT: ARGUMENT WRAPPERS IN REQUESTS AND RESPONSES MUST + * ALWAYS START ON AN EVEN-BYTE BOUNDARY. The server + * implementation expects this to be the case. + * + *************************************************************/ + +// dlpSmallArgFlag is used to identify "small" argument wrappers by +// or'ing it with the argument id in argument header. +// +#define dlpSmallArgFlag 0x080 + +// dlpShortArgIDMask is used to mask out the argument id value +// +#define dlpShortArgIDMask 0x7F + + +// dlpLongArgFlag is used to identify "long" argument wrappers by +// or'ing it with the argument id in argument header. +// +#define dlpLongArgFlag 0xC000 + +// dlpLongArgIDMask is used to mask out the argument id value +// +#define dlpLongArgIDMask 0x3FFF + + +//------------------------------------------------------------------------- +// Short argument wrappers (v1.0-compatible) +//------------------------------------------------------------------------- + +// Maximum short argument size which can be "wrapped" +#define dlpMaxTinyArgSize 0x000000FFL +#define dlpMaxSmallArgSize 0x0000FFFFL +#define dlpMaxShortArgSize dlpMaxSmallArgSize + + + +// Tiny argument header for data sizes up to 255 bytes(optimization) +// +typedef struct DlpTinyArgWrapperType { + // OFFSET + Byte bID; // 0; argument ID + Byte bSize; // 1; argument size (does NOT include this arg header) + // TOTAL: 2 bytes + } DlpTinyArgWrapperType; + +typedef struct DlpTinyArgType { + DlpTinyArgWrapperType wrapper; // 0; argument header + Byte data[1]; // 2; argument data -- var size + } DlpTinyArgType; + + +// Small argument header for data sizes above 255 bytes(*may also be used for +// smaller arguments when convenient*) +// +typedef struct DlpSmallArgWrapperType { + // OFFSET + Byte bID; // 0; argument ID + Byte unused; // 1; unused(for alignment) -- set to null! + Word wSize; // 2; argument size (does NOT include this arg header) + // TOTAL: 4 bytes + } DlpSmallArgWrapperType; + +typedef struct DlpSmallArgType { + DlpSmallArgWrapperType wrapper; // 0; argument header + Byte data[1]; // 4; argument data -- var size + } DlpSmallArgType; + +// Unions of short argument types +typedef union DlpShortArgWrapperType { + Byte bID; // arg id + DlpTinyArgWrapperType tiny; // "tiny" arg wrapper + DlpSmallArgWrapperType small;// "tiny" arg wrapper + } DlpShortArgWrapperType; +typedef DlpShortArgWrapperType* DlpShortArgWrapperPtr; + +typedef union DlpShortArgType { + Byte bID; // arg id + DlpTinyArgType tiny; // "tiny" arg + DlpSmallArgType small; // "small" arg + } DlpShortArgType; + +typedef DlpShortArgType* DlpShortArgPtr; + + + +//------------------------------------------------------------------------- +// Long argument wrapper (v2.0 extension) +//------------------------------------------------------------------------- +// NOTE: Pilot v2.0 will implement the capability to parse long arguments +// but will not originate them. This will assure backwards compatibility with +// the 1.0 desktop as well as compatibility with the future version of the +// desktop software which may originate the "long" argument wrappers. +// +// Long argument wrappers are identified by the dlpLongArgFlag bits set +// in the argument id field. + +// Maximum long argument size which can be "wrapped" +#define dlpMaxLongArgSize 0xFFFFFFFFL + +typedef struct DlpLongArgWrapperType { + // OFFSET + Word wID; // 0; argument ID + DWord dwSize; // 2; argument size (does NOT include this arg header) + // TOTAL: 6 bytes + } DlpLongArgWrapperType; +typedef DlpLongArgWrapperType* DlpLongArgWrapperPtr; + +typedef struct DlpLongArgType { + // OFFSET + DlpLongArgWrapperType wrapper; // 0; argument header + Byte data[1]; // 6; argument data -- var size + } DlpLongArgType; +typedef DlpLongArgType* DlpLongArgPtr; + + +//------------------------------------------------------------------------- +// Unions of all argument and wrapper types +//------------------------------------------------------------------------- + +// Union of all argument wrapper types +typedef union DlpGenericArgWrapperType { + DlpShortArgWrapperType shortWrap; // "short" arg wrapper(tiny and small) + DlpLongArgWrapperType longWrap; // "long" arg wrapper + } DlpGenericArgWrapperType; +typedef DlpGenericArgWrapperType* DlpGenericArgWrapperPtr; + + +// Union of all argument types +typedef union DlpGenericArgType { + DlpShortArgType shortArg; // "short" arg(tiny and small) + DlpLongArgType longArg; // "long" arg + } DlpGenericArgType; +typedef DlpGenericArgType* DlpGenericArgPtr; + + +/******************************************************************** + * Desktop Link Protocol Parameters + ********************************************************************/ + +// dlpCmdTimeoutSec -- this is the number of seconds to wait for a command +// to begin coming in before timing out +// +#define dlpCmdTimeoutSec 30 + + + +/************************************************************ + * DLP function argument structures + *************************************************************/ + + +////////////////////////////////////////////////////////////////////////// +// dlpReadUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: none +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadUserInfoRespArgID dlpFirstArgID + +typedef struct DlpReadUserInfoRespHdrType { + // OFFSET + DWord userID; // 0; user ID number (0 if none) + DWord viewerID; // 4; id assigned to viewer by the desktop + DWord lastSyncPC; // 8; last sync PC id (0 if none) + DlpDateTimeType succSyncDate; // 12; last successful sync (year = 0 if none) + DlpDateTimeType lastSyncDate; // 20; last sync date(year = 0 if none) + Byte userNameLen; // 28; length of user name field, + // including null (0 = no user name) + Byte passwordLen; // 29; length of encrypted password + // (0 = no password set) + // TOTAL: 30 bytes + } DlpReadUserInfoRespHdrType; + +typedef struct DlpReadUserInfoRespType { + // OFFSET + DlpReadUserInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 30 bytes + Byte nameAndPassword[1]; // 30; user name -- var size + // User name begins at the nameAndPassword field and is null-terminated. + // The encrypted password follows the user name and is NOT null-terminated. + // The encrypted password may contain any byte values(0-255). + } DlpReadUserInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// user id (4 bytes) +// last sync PC id(4 bytes) +// user name +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpWriteUserInfoReqArgID dlpFirstArgID + +#define dlpMaxUserNameSize 41 // max user name size, including null byte + +typedef struct DlpWriteUserInfoReqHdrType { + // OFFSET + DWord userID; // 0; user ID number + DWord viewerID; // 4; id assigned to viewer by the desktop + DWord lastSyncPC; // 8; last sync PC id + DlpDateTimeType lastSyncDate; // 12; last sync date(year = 0 if none) + Byte modFlags; // 20; flags indicating which values are being + // modified; see the dlpUserInfoMod... + // flags defined below + Byte userNameLen; // 21; user name length, including null + // TOTAL: 22 bytes + } DlpWriteUserInfoReqHdrType; + +// Flags indicating which values are being changed by the dlpWriteUserInfo +// request. These flags are used in the modFlags field of DlpWriteUserInfoReqHdrType. +// These flags are additive. +// +#define dlpUserInfoModUserID 0x80 // changing the user id +#define dlpUserInfoModSyncPC 0x40 // changing the last sync PC id +#define dlpUserInfoModSyncDate 0x20 // changing sync date +#define dlpUserInfoModName 0x10 // changing user name +#define dlpUserInfoModViewerID 0x08 // changing the viewer id + +typedef struct DlpWriteUserInfoReqType { + // OFFSET + DlpWriteUserInfoReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 22 bytes + Byte userName[1]; // 22; user name -- var size + // User name begins at the userName field and is null-terminated. + } DlpWriteUserInfoReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSysInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem +// + +// Request argument structure: +// +// none. DLP v1.0 and v1.1 + +enum { + // NEW FOR DLP v1.2: + dlpReadSysInfoReqArgID = dlpFirstArgID + }; + + +// dlpReadSysInfoReqArgID request arg structure +// +typedef struct DlpReadSysInfoReqType { + // OFFSET + DlpVersionType dlpVer; // 0; DLP version of the caller + // TOTAL: 4 bytes + } DlpReadSysInfoReqType; + + +// Response argument structure: +// +// Both response arguments are returned in one reply +enum { + dlpReadSysInfoRespArgID = dlpFirstArgID, + + // NEW FOR DLP v1.2: + dlpReadSysInfoVerRespArgID + }; + +// dlpReadSysInfoRespArgID response arg structure: +// +typedef struct DlpReadSysInfoRespType { + // OFFSET + DWord romSWVersion; // 0; ROM-based sys software version + DWord localizationID;// 4; localization ID + Byte unused; // 8; unused(for alignment) -- set to null! + Byte prodIDSize; // 9; size of productID/model field + DWord prodID; // 10; product id (was variable size) + // TOTAL: 14 bytes + } DlpReadSysInfoRespType; + + +// dlpReadSysInfoVerRespArgID response arg structure: +// +typedef struct DlpReadSysInfoVerRespType { + // OFFSET + DlpVersionType dlpVer; // 0; DLP version of the device + DlpVersionType compVer; // 4; product compatibility version of the device + DWord dwMaxRecSize; // 8; maximum record/resource size that may be allocated on + // the device given that sufficient free memory exists + // (0xFFFFFFFF = up to available memory) + // TOTAL: 12 bytes + } DlpReadSysInfoVerRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpGetSysDateTime +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes: none + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpGetSysDateTimeRespArgID dlpFirstArgID + +typedef struct DlpGetSysDateTimeRespType { + // OFFSET + DlpDateTimeType dateTime; // 0; system date/time + // TOTAL: 8 bytes + } DlpGetSysDateTimeRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpSetSysDateTime +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// new system date/time +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrParam + +// Request argument structure: +// +#define dlpSetSysDateTimeReqArgID dlpFirstArgID + +typedef struct DlpSetSysDateTimeReqType { + // OFFSET + DlpDateTimeType dateTime; // 0; new system date/time + // TOTAL: 8 bytes + } DlpSetSysDateTimeReqType; + +typedef DlpSetSysDateTimeReqType* DlpSetSysDateTimeReqPtr; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadStorageInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +enum { + dlpReadStorageInfoReqArgID = dlpFirstArgID + }; + +typedef struct DlpReadStorInfoReqType { + // OFFSET + Byte startCardNo; // 0; card number to start at + // (0 = first) + Byte unused; // 1; unused -- set to null! + // TOTAL: 2 bytes + } DlpReadStorInfoReqType; + + +// Response argument structure: +// +enum { + dlpReadStorageInfoRespArgID = dlpFirstArgID, + dlpReadStorageInfoExRespArgID // v1.1 extension + }; + +// +// dlpReadStorageInfoRespArgID: +// + +// Card info structure of variable size +typedef struct DlpCardInfoHdrType { + // OFFSET + Byte totalSize; // 0; total size of this card info + // *ROUNDED UP TO EVEN SIZE* + Byte cardNo; // 1; card number + Word cardVersion; // 2; card version + DlpDateTimeType crDate; // 4; creation date/time + DWord romSize; // 12; ROM size + DWord ramSize; // 16; RAM size + DWord freeRam; // 20; total free data store RAM - Fixed in DLP v1.2 to exclude + // dynamic heap RAM + Byte cardNameSize; // 24; size of card name string + Byte manufNameSize; // 25; size of manuf. name string + // TOTAL: 26 bytes; + } DlpCardInfoHdrType; + +typedef struct DlpCardInfoType { + // OFFSET + DlpCardInfoHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 26 bytes; + Byte cardNameAndManuf[1]; + // 26; card name and manuf. text -- var size + // Card name is the cardNameSize bytes of text at cardNameAndManuf, + // followed immediately by manufNameSize bytes of manufacturer name. + } DlpCardInfoType; + + +typedef struct DlpReadStorInfoRespHdrType { + // OFFSET + Byte lastCardNo; // 0; card number of last card retrieved + Byte more; // 1; non-zero if there are more cards + Byte unused; // 2; unused -- set to null! + Byte actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadStorInfoRespHdrType; + +typedef struct DlpReadStorInfoRespType { + // OFFSET + DlpReadStorInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpCardInfoType cardInfo[1]; // 4; actCount of card info structures -- var size + } DlpReadStorInfoRespType; + + +// +// EXTENDED ARGUMENTS(DL v1.1): dlpReadStorageInfoExRespArgID +// +typedef struct DlpReadStorInfoExRespType { + // OFFSET + Word romDBCount; // 0; ROM database count + Word ramDBCount; // 2; RAM database count + DWord dwReserved1; // 4; RESERVED -- SET TO NULL! + DWord dwReserved2; // 8; RESERVED -- SET TO NULL! + DWord dwReserved3; // 12; RESERVED -- SET TO NULL! + DWord dwReserved4; // 16; RESERVED -- SET TO NULL! + // TOTAL: 20 bytes + } DlpReadStorInfoExRespType; + + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadDBList +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +#define dlpReadDBListReqArgID dlpFirstArgID + +typedef struct DlpReadDBListReqType { + // OFFSET + Byte srchFlags; // 0; search flags + Byte cardNo; // 1; card number -- 0-based + Word startIndex; // 2; DB index to start at + // (0 = from beginning) + // TOTAL: 4 bytes + } DlpReadDBListReqType; + +#define dlpReadDBListFlagRAM 0x80 // Search for RAM-based +#define dlpReadDBListFlagROM 0x40 // Search for ROM-based +#define dlpReadDBListFlagMultiple 0x20 // OK to return multiple entries (DEFINED FOR DLP v1.2) + + +// Response argument structure: +// +#define dlpReadDBListRespArgID dlpFirstArgID + +// Database info structure of variable size +typedef struct DlpDBInfoHdrType { + // OFFSET + Byte totalSize; // 0; total size of the DB info (DlpDBInfoHdrType + name) + // *ROUNDED UP TO EVEN SIZE* + Byte miscFlags; // 1; dlpDbInfoMiscFlag... flags(v1.1) -- set all unused bits to null! + Word dbFlags; // 2; DB flags: dlpDBFlagReadOnly, + // dlpDBFlagResDB, dlpDBFlagAppInfoDirty, dlpDBFlagOpen, + // dlpDBFlagBackup, etc; + DWord type; // 4; database type + DWord creator; // 8; database creator + Word version; // 12; database version + DWord modNum; // 14; modification number + DlpDateTimeType crDate; // 18; creation date + DlpDateTimeType modDate; // 26; latest modification date + DlpDateTimeType backupDate; // 34; latest backup date + Word dbIndex; // 42; DB index (or dlpDbInfoUnknownDbIndex for dlpFindDB) + // TOTAL: 44 bytes; + } DlpDBInfoHdrType; + +// Flags for the miscFlags field of DlpDBInfoHdrType +#define dlpDbInfoMiscFlagExcludeFromSync 0x80 // DEFINED FOR DLP v1.1 +#define dlpDbInfoMiscFlagRamBased 0x40 // DEFINED FOR DLP v1.2 + +// Unknown index value for the dbIndex field of DlpDBInfoHdrType +#define dlpDbInfoUnknownDbIndex 0xFFFF + + +typedef struct DlpDBInfoType { + // OFFSET + DlpDBInfoHdrType header; // 0; fixed-size header + // FIXED SIZE: 44 bytes; + Byte name[1]; // 44; databse name text -- var size and + // null-terminated + } DlpDBInfoType; + + +typedef struct DlpReadDBListRespHdrType { + // OFFSET + Word lastIndex; // 0; DB index of last entry retrieved + Byte flags; // 2; flags: dlpReadDBListRespFlagMore + Byte actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadDBListRespHdrType; + +// dlpReadDBListRespFlagMore flag: if set, indicates that there are more +// databases to list -- this enables the server to send the listing +// incrementally, reducing server memory requirements if necessary +#define dlpReadDBListRespFlagMore 0x80 + +typedef struct DlpReadDBListRespType { + // OFFSET + DlpReadDBListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpDBInfoType dbInfo[1]; // 4; actCount of DB info structures -- var size + } DlpReadDBListRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrTooManyOpenDatabases +// dlpRespErrCantOpen + +// Request argument structure: +// +#define dlpOpenDBReqArgID dlpFirstArgID + +typedef struct DlpOpenDBReqHdrType { + // OFFSET + Byte cardNo; // 0; memory module number + Byte mode; // 1; open mode + // TOTAL: 2 bytes; + } DlpOpenDBReqHdrType; + +#define dlpOpenDBModeRead 0x80 +#define dlpOpenDBModeWrite 0x40 +#define dlpOpenDBModeExclusive 0x20 +#define dlpOpenDBModeShowSecret 0x10 + + +typedef struct DlpOpenDBReqType { + // OFFSET + DlpOpenDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + Byte name[1]; // 2; databse name text -- var size + // zero-terminated + } DlpOpenDBReqType; + +typedef DlpOpenDBReqType* DlpOpenDBReqPtr; + + +// Response argument structure: +// +#define dlpOpenDBRespArgID dlpFirstArgID +// +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCreateDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrAlreadyExists, +// dlpRespErrCantOpen, +// dlpRespErrNotEnoughSpace, +// dlpRespErrTooManyOpenDatabases + +// Request argument structure: +// +#define dlpCreateDBReqArgID dlpFirstArgID + +typedef struct DlpCreateDBReqHdrType { + // OFFSET + DWord creator; // 0; DB creator + DWord type; // 4; DB type + Byte cardNo; // 8; memory module number + Byte unused; // 9; unused -- set to null + Word dbFlags; // 10; allowed flags: dlpDBFlagResDB, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall + Word version; // 12; DB version # + // TOTAL: 14 bytes; + } DlpCreateDBReqHdrType; + +typedef struct DlpCreateDBReqType { + // OFFSET + DlpCreateDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + Byte name[1]; // 14; DB name text -- var size + // zero-terminated + } DlpCreateDBReqType; + +typedef DlpCreateDBReqType* DlpCreateDBReqPtr; + + +// Response argument structure: +// +#define dlpCreateDBRespArgID dlpFirstArgID + +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCloseDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrParam, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNoneOpen + +// Request argument structure: +// +typedef enum { + dlpCloseDBReqArgID = dlpFirstArgID, // close a specific database + dlpCloseDBAllReqArgID, // close all databases + dlpCloseDBExReqArgID // close a specific db and update backup + // and/or modification dates (PalmOS v3.0) + } DlpCloseDBReqArgID; + +// Argument structure to close a specific database(dlpCloseDBDBIDReqArgID): +// +// The request argument is the 1-byte database ID returned in open/create +// DB responses. +typedef Byte DlpCloseDBReqType; + +// Argument structure to close all databases(dlpCloseDBReqAllArgID): +// +// This request argument contains no data + + +// Request type for dlpCloseDBExReqArgID (PalmOS v3.0): +typedef struct DlpCloseDBExReqType { + // OFFSET + Byte dbID; // 0; database id to close + Byte bOptFlags; // 1; bitfield of dlpCloseDBExOptFlag... flags + // TOTAL: 2 bytes + } DlpCloseDBExReqType; + +// Option flags +#define dlpCloseDBExOptFlagUpdateBackupDate 0x80 // Update the backup date after closing +#define dlpCloseDBExOptFlagUpdateModDate 0x40 // Update the modification date after closing + + +#define dlpCloseDBExOptAllFlags (dlpCloseDBExOptFlagUpdateBackupDate | dlpCloseDBExOptFlagUpdateModDate) + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrCantOpen, +// dlpRespErrDatabaseOpen + +// Request argument structure: +// +#define dlpDeleteDBReqArgID dlpFirstArgID + +typedef struct DlpDeleteDBReqHdrType { + // OFFSET + Byte cardNo; // 0; memory module number + Byte unused; // 1; unused -- set to null! + // TOTAL: 2 bytes; + } DlpDeleteDBReqHdrType; + + +typedef struct DlpDeleteDBReqType { + // OFFSET + DlpDeleteDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + Byte name[1]; // 2; databse name text -- var size + // zero-terminated + } DlpDeleteDBReqType; + +typedef DlpDeleteDBReqType* DlpDeleteDBReqPtr; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadOpenDBInfo +////////////////////////////////////////////////////////////////////////// +// Get information on an open database +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadOpenDBInfoArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +#define dlpReadOpenDBInfoRespArgID dlpFirstArgID + + +typedef struct DlpReadOpenDBInfoRespType { + // OFFSET + Word numRec; // 0; number of records or resources + // TOTAL: 2 bytes + } DlpReadOpenDBInfoRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpMoveCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam +// dlpRespErrNotSupported +// dlpRespErrReadOnly + +// Request argument structure: +// +#define dlpMoveCategoryReqArgID dlpFirstArgID + +typedef struct DlpMoveCategoryReqType { + // OFFSET + Byte dbID; // 0; database id + Byte fromCategory; // 1; id of the "from" category + Byte toCategory; // 2; id of the "to" category + Byte unused; // 3; unused -- set to null! + // TOTAL: 4 bytes; + } DlpMoveCategoryReqType; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadBlockReqArgID dlpFirstArgID + +typedef struct DlpReadBlockReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word offset; // 2; offset into the block + Word numBytes; // 4; number of bytes to read starting + // at offset(-1 = to the end) + // TOTAL: 6 bytes; + } DlpReadBlockReqType; + + +// Response argument structure: +// +#define dlpReadBlockRespArgID dlpFirstArgID + +typedef struct DlpReadBlockRespHdrType { + // OFFSET + Word blockSize; // 0; actual block size -- may be greater + // than the amount of data returned + // TOTAL: 2 bytes + } DlpReadBlockRespHdrType; + +typedef struct DlpReadBlockRespType { + // OFFSET + DlpReadBlockRespHdrType // + header; // 0; fixed size header + // FIXED SIZE: 2 bytes + Byte data[1]; // 2; block data -- var size + } DlpReadBlockRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly +// dlpRespErrNotEnoughSpace +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteBlockReqArgID dlpFirstArgID + +typedef struct DlpWriteBlockReqHdrType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word blockSize; // 2; total block size(0 = free existing block) + // TOTAL: 4 bytes; + } DlpWriteBlockReqHdrType; + + +typedef struct DlpWriteBlockReqType { + // OFFSET + DlpWriteBlockReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes; + Byte data[1]; // 4; block data -- var size + } DlpWriteBlockReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpReadAppBlock + + +// Response argument structure: +// +// see dlpReadAppBlock + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpWriteAppBlock + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextModifiedRec +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadRecord +// + +// Request argument structure: +// +#define dlpReadNextModRecReqArgID dlpFirstArgID +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// Response argument id = dlpReadRecordRespArgID + +// Response argument structure = DlpReadRecordRespType + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetRecordIndex +////////////////////////////////////////////////////////////////////////// +// Resets the "next modified record" index to the beginning +// +// Possible error codes +// dlpRespErrParam +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetRecordIndexReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrRecordBusy, +// dlpRespErrNoneOpen + +typedef enum { + dlpReadRecordIdArgID = dlpFirstArgID, + dlpReadRecordIndexArgID + } DlpReadRecordReqArgID; + +// dlpReadRecordIdArgID request argument structure: +// +typedef struct DlpReadRecordByIDReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + DWord recordID; // 2; unique record id + Word offset; // 6; offset into the record + Word numBytes; // 8; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 10 bytes; + } DlpReadRecordByIDReqType; + +// dlpReadRecordIndexArgID request argument structure: +// +typedef struct DlpReadRecordByIndexReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word index; // 2; record index + Word offset; // 4; offset into the record + Word numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadRecordByIndexReqType; + + +// Response argument structure: +// +#define dlpReadRecordRespArgID dlpFirstArgID + +typedef struct DlpReadRecordRespHdrType { + // OFFSET + DWord recordID; // 0; unique record id + Word index; // 4; record index + Word recSize; // 6; total record size in bytes + Byte attributes; // 8; record attributes + Byte category; // 9; record category index + // TOTAL: 10 bytes; + } DlpReadRecordRespHdrType; + +typedef struct DlpReadRecordRespType { + // OFFSET + DlpReadRecordRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + Byte data[1]; // 8; record data -- var size + } DlpReadRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecordIDList +////////////////////////////////////////////////////////////////////////// +// Returns a list of unique record id's. May need to call more than once +// to get the entire list. dlpRespErrNotFound is returned when "start" +// is out of bounds +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrNoneOpen + +#define dlpReadRecordIDListReqArgID dlpFirstArgID + +// dlpReadRecordIDListReqArgID request argument structure: +// +typedef struct DlpReadRecordIDListReqType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; request flags + Word start; // 2; starting record index (0-based) + Word maxEntries; // 4; maximum number of entries, or + // 0xFFFF to return as many as possible + // TOTAL: 6 bytes; + } DlpReadRecordIDListReqType; + +// dlpReadRecordIDListFlagSortDB: if set, DL Server will call the creator +// application to resort the database before returning the list. +#define dlpReadRecordIDListFlagSortDB 0x80 + + +// Response argument structure: +// +#define dlpReadRecordIDListRespArgID dlpFirstArgID + +typedef struct DlpReadRecordIDListRespHdrType { + // OFFSET + Word numEntries; // 0; number of entries returned + // TOTAL: 2 bytes; + } DlpReadRecordIDListRespHdrType; + +typedef struct DlpReadRecordIDListRespType { + // OFFSET + DlpReadRecordIDListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + DWord recID[1]; // 8; list of record id's -- var size + } DlpReadRecordIDListRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotEnoughSpace +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteRecordReqArgID dlpFirstArgID + +// dlpWriteRecordReqArgID -- required +typedef struct DlpWriteRecordReqHdrType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; set unused bits to null! + DWord recordID; // 2; unique record id or null + Byte attributes; // 6; record attributes -- only + // dlpRecAttrSecret is allowed here + // v1.1 extension: + // dlpRecAttrDeleted, dlpRecAttrArchived and + // dlpRecAttrDirty are also allowed. + Byte category; // 7; record category + // TOTAL: 8 bytes; + } DlpWriteRecordReqHdrType; + +#define dlpWriteRecordReqFlagDataIncluded 0x80 // original implementer of destop software always + // set this bit. Define it here for compatibility + +typedef struct DlpWriteRecordReqType { + // OFFSET + DlpWriteRecordReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + Byte data[1]; // 8; record data -- var size + } DlpWriteRecordReqType; + + +// Response argument structure: +// +#define dlpWriteRecordRespArgID dlpFirstArgID + +typedef struct DlpWriteRecordRespType { + // OFFSET + DWord recordID; // 0; record ID + // TOTAL: 4 bytes + } DlpWriteRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen +// + +// Request argument structure: +// +#define dlpDeleteRecordReqArgID dlpFirstArgID + +// Argument structure to delete by record ID(dlpDeleteRecordReqIDArgID): +typedef struct DlpDeleteRecordReqType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; flags (dlpDeleteRecFlagDeleteAll) + DWord recordID; // 2; unique record id (see flags) + // TOTAL: 6 bytes; + } DlpDeleteRecordReqType; + +// dlpDeleteRecFlagDeleteAll: if this flag is set, the reocordID field +// is ignored and all database records will be deleted +#define dlpDeleteRecFlagDeleteAll 0x80 + +// dlpDeleteRecFlagByCategory: if this flag is set, the least significant byte +// of the reocordID field contains the category id of records to be deleted +#define dlpDeleteRecFlagByCategory 0x40 + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +typedef enum { + dlpReadResourceIndexArgID = dlpFirstArgID, + dlpReadResourceTypeArgID + } DlpReadResourceReqArgID; + +// dlpReadResourceIndexArgID request argument structure: +// +typedef struct DlpReadResourceByIndexReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + Word index; // 2; resource index + Word offset; // 4; offset into the resource + Word numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadResourceByIndexReqType; + +// dlpReadResourceTypeArgID request argument structure: +// +typedef struct DlpReadResourceByTypeReqType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; unused -- set to null! + DWord type; // 2; resource type + Word id; // 6; resource id + Word offset; // 8; offset into the resource + Word numBytes; // 10; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 12 bytes; + } DlpReadResourceByTypeReqType; + + +// Response argument structure: +// +#define dlpReadResourceRespArgID dlpFirstArgID + +typedef struct DlpReadResourceRespHdrType { + // OFFSET + DWord type; // 0; resource type + Word id; // 4; resource id + Word index; // 6; resource index + Word resSize; // 8; total resource size in bytes + // TOTAL: 10 bytes; + } DlpReadResourceRespHdrType; + +typedef struct DlpReadResourceRespType { + // OFFSET + DlpReadResourceRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes; + Byte resData[1]; // 6; resource data -- var size + } DlpReadResourceRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteResourceReqArgID dlpFirstArgID + +typedef struct DlpWriteResourceReqHdrType { + // OFFSET + Byte dbID; // 0; database id + Byte unused; // 1; inused -- set to null! + DWord type; // 2; resource type + Word id; // 6; resource id + Word resSize; // 8; total resource size + // TOTAL: 10 bytes; + } DlpWriteResourceReqHdrType; + +typedef struct DlpWriteResourceReqType { + // OFFSET + DlpWriteResourceReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 10 bytes; + Byte data[1]; // 10; resource data -- var size + } DlpWriteResourceReqType; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpDeleteResourceReqArgID dlpFirstArgID + +typedef struct DlpDeleteResourceReqType { + // OFFSET + Byte dbID; // 0; database id + Byte flags; // 1; flags (dlpDeleteResFlagDeleteAll) + DWord type; // 2; resource type + Word id; // 6; resource id + // TOTAL: 8 bytes; + } DlpDeleteResourceReqType; + +// dlpDeleteResFlagDeleteAll: if set, all resources in the db will be deleted +#define dlpDeleteResFlagDeleteAll 0x80 + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCleanUpDatabase +////////////////////////////////////////////////////////////////////////// +// Deletes all records which are marked as archived or deleted in the +// record database +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly, +// dlpRespErrNotSupported +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpCleanUpDatabaseReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSyncFlags +////////////////////////////////////////////////////////////////////////// +// For record databases, reset all dirty flags. +// For both record and resource databases, set the last sync time to NOW +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam +// dlpRespErrReadOnly, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetSyncFlagsReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCallApplication +////////////////////////////////////////////////////////////////////////// +// Call an application entry point via an action code +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound + +// Request argument structure: +// +enum { + dlpCallApplicationReqArgIDV10 = dlpFirstArgID, // req id for Pilot v1.0 + dlpCallAppReqArgID // req id for Pilot v2.0 and later + }; + +// dlpCallApplicationReqArgIDV10: +typedef struct DlpCallApplicationReqHdrTypeV10 { + // OFFSET + DWord creator; // 0; app DB creator id + Word action; // 4; action code + Word paramSize; // 6; custom param size + // TOTAL: 8 bytes + } DlpCallApplicationReqHdrTypeV10; + +typedef struct DlpCallApplicationReqTypeV10 { + // OFFSET + DlpCallApplicationReqHdrTypeV10 // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes + Byte paramData[1]; // 8; custom param data -- var size + } DlpCallApplicationReqTypeV10; + + +// dlpCallAppReqArgID (Pilot v2.0): +typedef struct DlpCallAppReqHdrType { + // OFFSET + DWord creator; // 0; DB creator id of target executable + DWord type; // 4; DB type id of target executable + Word action; // 8; action code + DWord dwParamSize; // 10; custom param size in number of bytes + DWord dwReserved1; // 14; RESERVED -- set to NULL!!! + DWord dwReserved2; // 18; RESERVED -- set to NULL!!! + // TOTAL: 22 bytes + } DlpCallAppReqHdrType; + +typedef struct DlpCallAppReqType { + // OFFSET + DlpCallAppReqHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 22 bytes + Byte paramData[1]; // 22; custom param data -- var size + } DlpCallAppReqType; + + + +// Response argument structure: +// +enum { + dlpCallApplicationRespArgIDV10 = dlpFirstArgID, // resp id for Pilot v1.0 + dlpCallAppRespArgID // resp id for Pilot v2.0 and later + }; + +// dlpCallApplicationRespArgIDV10: +typedef struct DlpCallApplicationRespHdrTypeV10 { + // OFFSET + Word action; // 0; action code which was called + Word resultCode; // 2; result error code returned by action + Word resultSize; // 4; custom result data size + // TOTAL: 6 bytes + } DlpCallApplicationRespHdrTypeV10; + +typedef struct DlpCallApplicationRespTypeV10 { + // OFFSET + DlpCallApplicationRespHdrTypeV10 // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes + Byte resultData[1]; // 6; custom result data -- var size + } DlpCallApplicationRespTypeV10; + +// dlpCallAppRespArgID: +typedef struct DlpCallAppRespHdrType { + // OFFSET + DWord dwResultCode; // 0; result error code returned by handler + DWord dwResultSize; // 4; custom result data size + DWord dwReserved1; // 8; RESERVED -- SET TO NULL!!! + DWord dwReserved2; // 12; RESERVED -- SET TO NULL!!! + // TOTAL: 16 bytes + } DlpCallAppRespHdrType; + +typedef struct DlpCallAppRespType { + // OFFSET + DlpCallAppRespHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 16 bytes + Byte resultData[1]; // 16; custom result data -- var size + } DlpCallAppRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSystem +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpAddSyncLogEntry +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrLimitExceeded, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpAddSyncLogEntryReqArgID dlpFirstArgID + +typedef struct DlpAddSyncLogEntryReqType { + // OFFSET + Byte text[1]; // 0; entry text -- var size and + // null-terminated + } DlpAddSyncLogEntryReqType; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpProcessRPC +////////////////////////////////////////////////////////////////////////// +// Remote Procedure Call interface +// +// Request arguments: +// RPC command block +// +// Response arguments: +// RPC reply block +// +// Possible error codes +// 0 on success; otherwise error code from the TouchDown +// RPC executor +// +// NOTE: this is a low-level system command which does not use arg wrappers. + +// Request argument structure: +// +// Block of RPC command data (no arg wrapper) + +// Response argument structure: +// +// Block of RPC reply data of same length as command block(no arg wrapper) + + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenConduit +////////////////////////////////////////////////////////////////////////// +// This command is sent before each conduit is opened by the desktop. +// If the viewer has a cancel pending, it will return dlpRespErrCancelSync +// in the response header's errorCode field. +// +// Request arguments: none. +// +// Response arguments: none. +// +// Possible error codes +// dlpRespErrCancelSync + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpEndOfSync +////////////////////////////////////////////////////////////////////////// +// This command is sent by the desktop to end the sync. +// +// Request arguments: termination code: 0 = normal termination; +// otherwise the client is aborting the sync +// +// Possible error codes +// 0 + +// Request argument structure: +// +#define dlpEndOfSyncReqArgID dlpFirstArgID + +typedef enum DlpSyncTermCode { + dlpTermCodeNormal = 0, // normal termination + dlpTermCodeOutOfMemory, // termination due to low memory on TD + dlpTermCodeUserCan, // user cancelled from desktop + dlpTermCodeOther, // catch-all abnormal termination code + dlpTermCodeIncompatibleProducts // incompatibility between desktop and handheld hotsync products + } DlpSyncTermCode; + + +typedef struct DlpEndOfSyncReqType { + // OFFSET + Word termCode; // 0; termination code + // TOTAL: 2 bytes + } DlpEndOfSyncReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextRecInCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadRecord + +#define dlpReadNextRecInCategoryReqArgID dlpFirstArgID + +// dlpReadNextRecInCategoryReqArgID request argument structure: +// +typedef struct DlpReadNextRecInCategoryReqType { + // OFFSET + Byte dbID; // 0; database id + Byte category; // 1; category id + // TOTAL: 2 bytes; + } DlpReadNextRecInCategoryReqType; + + +// Response argument structure: +// +// Response argument id = dlpReadRecordRespArgID + +// Response argument structure = DlpReadRecordRespType + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextModifiedRecInCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadNextRecInCategory + +// Request argument structure: +// +// same as dlpReadNextRecInCategory + +// Response argument structure: +// +// same as dlpReadNextRecInCategory + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadAppPreference +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound, + +#define dlpReadAppPreferenceReqArgID dlpFirstArgID + +// dlpReadAppPreferenceReqArgID request argument structure: +// +typedef struct DlpReadAppPreferenceReqType { + // OFFSET + DWord creator; // 0; application creator type + Word id; // 4; preference id + Word reqBytes; // 6; max. number of preference bytes requested; + // pass 0xFFFF for actual size + Byte flags; // 8; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db + Byte unused; // 9; reserved/padding -- set to NUL! + // TOTAL: 10 bytes; + } DlpReadAppPreferenceReqType; + +#define dlpReadAppPrefActualSize 0xFFFF +#define dlpAppPrefReqFlagBackedUp 0x80 + +// Response argument structure: +// +#define dlpReadAppPreferenceRespArgID dlpFirstArgID + +typedef struct DlpReadAppPreferenceRespHdrType { + // OFFSET + Word version; // 0; version number of the application + Word actualSize; // 2; actual preference data size + Word retBytes; // 4; number of preference bytes returned + // TOTAL: 6 bytes + } DlpReadAppPreferenceRespHdrType; + +typedef struct DlpReadAppPreferenceRespType { + // OFFSET + DlpReadAppPreferenceRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes + Byte data[1]; // 6; custom result data -- var size + } DlpReadAppPreferenceRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteAppPreference +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotEnoughSpace + +// Request argument structure: +// +#define dlpWriteAppPreferenceReqArgID dlpFirstArgID + +typedef struct DlpWriteAppPreferenceReqHdrType { + // OFFSET + DWord creator; // 0; application creator type + Word id; // 4; preference id + Word version; // 6; version number of the application + Word prefSize; // 8; preference size(in number of bytes) + Byte flags; // 10; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db + Byte unused; // 11; reserved/padding -- set to NUL! + // TOTAL: 12 bytes; + } DlpWriteAppPreferenceReqHdrType; + +typedef struct DlpWriteAppPreferenceReqType { + // OFFSET + DlpWriteAppPreferenceReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + Byte data[1]; // 12; record data -- var size + } DlpWriteAppPreferenceReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNetSyncInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: none +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadNetSyncInfoRespArgID dlpFirstArgID + +typedef struct DlpReadNetSyncInfoRespHdrType { + // OFFSET + Byte lanSyncOn; // 0; non-zero if Lan Sync is enabled + Byte bReserved1; // 1; reserved -- SET TO NULL! + DWord dwReserved1; // 2; reserved -- SET TO NULL! + DWord dwReserved2; // 6; reserved -- SET TO NULL! + DWord dwReserved3; // 10; reserved -- SET TO NULL! + DWord dwReserved4; // 14; reserved -- SET TO NULL! + Word syncPCNameSize;// 18; length of sync PC host name, + // including null (0 = no host name) + Word syncPCAddrSize;// 20; length of sync PC address, + // including null (0 = no address) + Word syncPCMaskSize;// 22; length of sync PC subnet mask, + // including null (0 = no mask) + // TOTAL: 24 bytes + } DlpReadNetSyncInfoRespHdrType; + +typedef struct DlpReadNetSyncInfoRespType { + // OFFSET + DlpReadNetSyncInfoRespHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 24 bytes + Byte syncAddr[1]; // 24; sync IP address/host name -- var size, + // null-terminated + } DlpReadNetSyncInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteNetSyncInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpWriteNetSyncInfoReqArgID dlpFirstArgID + +#define dlpMaxHostAddrLength 255 // maximum PC host name length, not including NULL + +typedef struct DlpWriteNetSyncInfoReqHdrType { + // OFFSET + Byte modFlags; // 0; flags indicating which values are being + // modified; see the dlpNetSyncInfoMod... + // flags defined below + Byte lanSyncOn; // 1; non-zero if Lan Sync is enabled + DWord dwReserved1; // 2; reserved -- SET TO NULL! + DWord dwReserved2; // 6; reserved -- SET TO NULL! + DWord dwReserved3; // 10; reserved -- SET TO NULL! + DWord dwReserved4; // 14; reserved -- SET TO NULL! + Word syncPCNameSize;// 18; length of sync PC host name, + // including null (0 = no address/host name) + Word syncPCAddrSize;// 20; length of sync PC address, + // including null (0 = no address) + Word syncPCMaskSize;// 22; length of sync PC subnet mask, + // including null (0 = no mask) + // TOTAL: 24 bytes + } DlpWriteNetSyncInfoReqHdrType; + +// Flags indicating which values are being changed by the dlpWriteNetSyncInfo +// request. These flags are used in the modFlags field of DlpWriteNetSyncInfoReqHdrType. +// These flags are additive. +// +#define dlpNetSyncInfoModLanSyncOn 0x80 // changing the "lan sync on" setting +#define dlpNetSyncInfoModSyncPCName 0x40 // changing the sync PC host name +#define dlpNetSyncInfoModSyncPCAddr 0x20 // changing the sync PC address +#define dlpNetSyncInfoModSyncPCMask 0x10 // changing the sync PC subnet mask + +typedef struct DlpWriteNetSyncInfoReqType { + // OFFSET + DlpWriteNetSyncInfoReqHdrType + hdr; // 0; fixed-size header + // FIXED SIZE: 24 bytes + Byte syncAddr[1]; // 24; sync IP address/host name -- var size, + // null-terminated + } DlpWriteNetSyncInfoReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadFeature +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotFound, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadFeatureReqArgID dlpFirstArgID + +typedef struct DlpReadFeatureReqType { + // OFFSET + DWord dwFtrCreator; // 0; feature creator + Word wFtrNum; // 4; feature number + // TOTAL: 6 bytes + } DlpReadFeatureReqType; + + +// Response argument structure: +// +#define dlpReadFeatureRespArgID dlpFirstArgID + +typedef struct DlpReadFeatureRespType { + // OFFSET + DWord dwFeature; // 0; feature value + // TOTAL: 4 bytes + } DlpReadFeatureRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpFindDB +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotFound, +// dlpRespErrParam + +// Request argument structure: +// + +// dlpFindDBByNameReqArgID, dlpFindDBByTypeCreatorReqArgID and dlpFindDBByOpenHandleReqArgID +// are mutually exclusive +enum { + dlpFindDBByNameReqArgID = dlpFirstArgID, // req id for card + name based search + dlpFindDBByOpenHandleReqArgID, // req id for search given an open db handle + dlpFindDBByTypeCreatorReqArgID // req id for type + creator based iterative search + }; + +// Option flags +#define dlpFindDBOptFlagGetAttributes 0x80 // get database attributes -- this is + // an option to allow find operations to skip + // returning this data as a performance optimization + +#define dlpFindDBOptFlagGetSize 0x40 // get record count and data size also -- this is + // an option because the operation can take a long + // time, which we would rather avoid if it is not needed + +#define dlpFindDBOptFlagGetMaxRecSize 0x20 // get max rec/resource size -- this is + // an option because the operation can take a long + // time, which we would rather avoid if it is not needed + // (dlpFindDBOptFlagGetMaxRecSize is only supported for + // dlpFindDBByOpenHandleReqArgID) + +// Request type for dlpdlpFindDBByNameReqArgID: +typedef struct DlpFindDBByNameReqHdrType { + // OFFSET + Byte bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags + Byte bCardNo; // 2; card number to search + // TOTAL: 4 bytes + } DlpFindDBByNameReqHdrType; + +typedef struct DlpFindDBByNameReqType { + // OFFSET + DlpFindDBByNameReqHdrType // + header; // 0; fixed size header + // FIXED SIZE: 4 bytes + Byte name[1]; // variable size -- zero-terminated database name string + } DlpFindDBByNameReqType; + + +// Request type for dlpFindDBByOpenHandleReqArgID: +typedef struct DlpFindDBByOpenHandleReqType { + // OFFSET + Byte bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags + Byte bDbID; // 1; database id returned by dlpOpenDB or dlpCreateDB + // TOTAL: 2 bytes + } DlpFindDBByOpenHandleReqType; + + +// Request type for dlpFindDBByTypeCreatorReqArgID: +typedef struct DlpFindDBByTypeCreatorReqType { + // OFFSET + Byte bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags + Byte bSrchFlags; // 1; bitfield of dlpFindDBSrchFlag... flags + DWord dwType; // 2; db type id (zero = wildcard) + DWord dwCreator; // 6; db creator id (zero = wildcard) + // TOTAL: 10 bytes + } DlpFindDBByTypeCreatorReqType; + +#define dlpFindDBSrchFlagNewSearch 0x80 // set to beging a new search +#define dlpFindDBSrchFlagOnlyLatest 0x40 // set to search for the latest version + + + +// Response argument structures for dlpFindDBByNameReqArgID, dlpFindDBByOpenHandleReqArgID and +// dlpFindDBByTypeCreatorReqArgID (if found): +// +enum { + dlpFindDBBasicRespArgID = dlpFirstArgID, // resp arg id for basic info + // (if dlpFindDBOptFlagGetAttributes is set) + dlpFindDBSizeRespArgID // resp arg id for size info + // (if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize + // are set) + }; + + +// dlpFindDBBasicRespArgID (returned only if dlpFindDBOptFlagGetAttributes is set): + +typedef struct DlpFindDBBasicRespHdrType { + // OFFSET + Byte bCardNo; // 0; card number of database + Byte bReserved; // 1; RESERVED -- SET TO NULL + DWord dwLocalID; // 2; local id of the database (for internal use) + DWord dwOpenRef; // 6; db open ref of the database if it is currently opened + // by the caller; zero otherwise (for internal use) can + // change after read record list + DlpDBInfoHdrType info; //10; database info (creator, type, flags, etc.) MUST BE LAST FIELD + // TOTAL: 54 bytes + } DlpFindDBBasicRespHdrType; + +typedef struct DlpFindDBBasicRespType { + // OFFSET + DlpFindDBBasicRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 54 bytes + Byte name[1]; // variable size -- zero-terminated database name string + } DlpFindDBBasicRespType; + + + +// dlpFindDBSizeRespArgID (returned only if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize is set): + +typedef struct DlpFindDBSizeRespType { + // OFFSET + + // Returned if dlpFindDBOptFlagGetSize is set for all queries: + // (otherwise, fields are set to zero) + DWord dwNumRecords; // 0; record/resource count + DWord dwTotalBytes; // 4; total bytes used by db + DWord dwDataBytes; // 8; bytes used for data + + // Returned if dlpFindDBOptFlagGetSize is set for dlpFindDBByOpenHandleReqArgID only: + // (otherwise, fields are set to zero) + DWord dwAppBlkSize; //12; size of app info block size (for + // dlpFindDBByOpenHandleReqArgID only) + DWord dwSortBlkSize; //16; size of sort info block size(for + // dlpFindDBByOpenHandleReqArgID only) + // + // Returned if dlpFindDBOptFlagGetMaxRecSize is set for dlpFindDBByOpenHandleReqArgID only: + // (otherwise, field is set to zero) + DWord dwMaxRecSize; //20; size of largest record or resource in the database (for + // dlpFindDBByOpenHandleReqArgID + dlpFindDBOptFlagGetMaxRecSize only) + // TOTAL: 24 bytes + } DlpFindDBSizeRespType; + + + + +////////////////////////////////////////////////////////////////////////// +// dlpSetDBInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotEnoughSpace +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// + +enum { + dlpSetDBInfoReqArgID = dlpFirstArgID + }; + + +typedef struct DlpSetDBInfoReqHdrType { + // OFFSET + Byte dbID; // 0; database id returned by dlpOpenDB or dlpCreateDB + Byte bReserved; // 1; RESERVED -- SET TO NULL + Word wClrDbFlags; // 2; flags to clear; allowed DB flags: dlpDBFlagAppInfoDirty, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention; + // 0 = don't change + Word wSetDbFlags; // 4; flags to set; allowed DB flags: dlpDBFlagAppInfoDirty, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention; + // 0 = don't change + Word wDbVersion; // 6; database version; dlpSetDBInfoNoVerChange = don't change + DlpDateTimeType crDate; // 8; creation date; zero year = don't change + DlpDateTimeType modDate; //16; modification date; zero year = don't change + DlpDateTimeType bckUpDate; //24; backup date; zero year = don't change + DWord dwType; //32; database type id; zero = don't change + DWord dwCreator; //36; database creator id; zero = don't change + // TOTAL: 40 bytes + } DlpSetDBInfoReqHdrType; + +#define dlpSetDBInfoNoVerChange 0xFFFF + +typedef struct DlpSetDBInfoReqType { + // OFFSET + DlpSetDBInfoReqHdrType // + header; // 0; fixed size header + // FIXED SIZE: 40 bytes + Byte name[1]; // variable size -- zero-terminated database name string + } DlpSetDBInfoReqType; + + +// Response argument structure: +// +// none. + + + +/************************************************************ + * Macros + *************************************************************/ + + +#endif // __DLCOMMON_H__ + + diff --git a/sdk-3.1/include/Core/System/DLServer.h b/sdk-3.1/include/Core/System/DLServer.h new file mode 100644 index 0000000..4ef20e4 --- /dev/null +++ b/sdk-3.1/include/Core/System/DLServer.h @@ -0,0 +1,405 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * DLServer.h + * + * Description: + * Desktop Link Protocol(DLP) Server implementation definitions. + * + * History: + * vmk 7/12/95 Created by Vitaly Marty Kruglikov + * vmk 7/12/96 Converted to HTAL architecture + * + *******************************************************************/ + + +#ifndef __DL_SERVER_H__ +#define __DL_SERVER_H__ + +// Pilot common definitions +#include +#include // for DmOpenRef + + + +/************************************************************ + * DLK result codes + * (dlkErrorClass is defined in SystemMgr.h) + *************************************************************/ +#pragma mark *Error Codes* + +#define dlkErrParam (dlkErrorClass | 1) // invalid parameter +#define dlkErrMemory (dlkErrorClass | 2) // memory allocation error +#define dlkErrNoSession (dlkErrorClass | 3) // could not establish a session + +#define dlkErrSizeErr (dlkErrorClass | 4) // reply length was too big + +#define dlkErrLostConnection (dlkErrorClass | 5) // lost connection +#define dlkErrInterrupted (dlkErrorClass | 6) // sync was interrupted (see sync state) +#define dlkErrUserCan (dlkErrorClass | 7) // cancelled by user + + + +/******************************************************************** + * Desktop Link system preferences resource for user info + * id = sysResIDDlkUserInfo, defined in SystemMgr.rh + ********************************************************************/ +#pragma mark *User Info Preference* + +#define dlkMaxUserNameLength 40 +#define dlkUserNameBufSize (dlkMaxUserNameLength + 1) + +#define dlkMaxLogSize (2 * 1024) + +typedef enum DlkSyncStateType { + dlkSyncStateNeverSynced = 0, // never synced + dlkSyncStateInProgress, // sync is in progress + dlkSyncStateLostConnection, // connection lost during sync + dlkSyncStateLocalCan, // cancelled by local user on handheld + dlkSyncStateRemoteCan, // cancelled by user from desktop + dlkSyncStateLowMemoryOnTD, // sync ended due to low memory on handheld + dlkSyncStateAborted, // sync was aborted for some other reason + dlkSyncStateCompleted, // sync completed normally + + // Added in PalmOS v3.0: + dlkSyncStateIncompatibleProducts // sync ended because desktop HotSync product + // is incompatible with this version + // of the handheld HotSync + } DlkSyncStateType; + +#define dlkUserInfoPrefVersion 0x0102 // current user info pref version: 1.2 + +typedef struct DlkUserInfoHdrType { + Word version; // pref version number + DWord userID; // user id + DWord viewerID; // id assigned to viewer by the desktop + DWord lastSyncPC; // last sync PC id + ULong succSyncDate; // last successful sync date + ULong lastSyncDate; // last sync date + DlkSyncStateType lastSyncState; // last sync status + UInt lanSyncEnabled;// if non-zero, LAN Sync is enabled + DWord hsTcpPortNum; // TCP/IP port number of Desktop HotSync + DWord dwReserved1; // RESERVED -- set to NULL! + DWord dwReserved2; // RESERVED -- set to NULL! + Byte userNameLen; // length of name field(including null) + UInt syncLogLen; // length of sync log(including null) + } DlkUserInfoHdrType; + +typedef struct DlkUserInfoType { + DlkUserInfoHdrType header; // fixed size header + Char nameAndLog[2]; // user name, followed by sync log; + // both null-terminated(for debugging) + } DlkUserInfoType; + +typedef DlkUserInfoType* DlkUserInfoPtr; // user info pointer + + +/******************************************************************** + * Desktop Link system preferences resource for the Conduit Filter Table + * id = sysResIDDlkCondFilterTab, defined in SystemMgr.rh + ********************************************************************/ +#pragma mark *Conduit Filter Preference* + +// +// Table for specifying conduits to "filter out" during HotSync +// + +// This table consists of DlkCondFilterTableHdrType header followed by a +// variable number of DlkCondFilterEntryType entries + +typedef struct DlkCondFilterTableHdrType { + Word entryCount; + } DlkCondFilterTableHdrType; +typedef DlkCondFilterTableHdrType* DlkCondFilterTableHdrPtr; + +typedef struct DlkCondFilterEntryType { + DWord creator; + DWord type; + } DlkCondFilterEntryType; +typedef DlkCondFilterEntryType* DlkCondFilterEntryPtr; + +typedef struct DlkCondFilterTableType { + DlkCondFilterTableHdrType + hdr; // table header + DlkCondFilterEntryType + entry[1]; // variable number of entries + } DlkCondFilterTableType; +typedef DlkCondFilterTableType* DlkCondFilterTablePtr; + + + +/******************************************************************** + * DLK Session Structures + ********************************************************************/ +#pragma mark *Session Structures* + + +// DesktopLink event notification callback. If non-zero is returned, +// sync will be cancelled as soon as a safe point is reached. +typedef enum { + dlkEventOpeningConduit = 1, // conduit is being opened -- paramP + // is null; + + dlkEventDatabaseOpened, // client has opened a database -- paramP + // points to DlkEventDatabaseOpenedType; + + dlkEventCleaningUp, // last stage of sync -- cleaning up (notifying apps, etc) -- + // paramP is null + + dlkEventSystemResetRequested // system reset was requested by the desktop client + // (the normal action is to delay the reset until + // end of sync) -- paramP is null + } DlkEventType; + +// Prototype for the event notification callback +typedef Int (*DlkEventProcPtr)(DWord eventRef, DlkEventType dlkEvent, + VoidPtr paramP); + +// Parameter structure for dlkEventDatabaseOpened +// Added new fields for Pilot v2.0 vmk 12/24/96 +typedef struct DlkEventDatabaseOpenedType { + DmOpenRef dbR; // open database ref (v2.0) + CharPtr dbNameP; // database name + ULong dbType; // databse type (v2.0) + ULong dbCreator; // database creator + } DlkEventDatabaseOpenedType; + + +// Prototype for the "user cancel" check callback function +typedef Int (*DlkUserCanProcPtr)(DWord canRef); + + +// +// List of modified database creators maintained by DLP Server +// +typedef struct DlkDBCreatorList { + UInt count; // number of entries in the list + Handle listH; // chunk handle of the creators list + } DlkDBCreatorList; + + +// +// Desktop Link Server state flags +// +#define dlkStateFlagVerExchanged 0x8000 +#define dlkStateFlagSyncDateSet 0x4000 + +// +// DLP Server session information +// +typedef struct DlkServerSessionType { + UInt htalLibRefNum; // HTAL library reference number - the library has a live connection + ULong maxHtalXferSize; // Maximum transfer block size + + // Information supplied by user + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + DWord eventRef; // user reference value for event proc + DlkUserCanProcPtr canProcP; // ptr to user-cancel function + DWord canRef; // parameter for canProcP() + Handle condFilterH; // handle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none + + // Current database information + Byte dlkDBID; // Desktop Link database handle of the open database + DmOpenRef dbR; // TouchDown database access pointer -- if null, no current db + UInt cardNo; // memory module number + ULong dbCreator; // creator id + Char dbName[dmDBNameLength]; // DB name + UInt dbOpenMode; // database open mode + Boolean created; // true if the current db was created + Boolean isResDB; // set to true if resource database + Boolean ramBased; // true if the db is in RAM storage + Boolean readOnly; // true if the db is read-only + LocalID dbLocalID; // TouchDown LocalID of the database + ULong initialModNum; // initial DB modification number + ULong curRecIndex; // current record index for enumeration functions + // (0=beginning) + + // List of modified database creators maintained by DLP Server + DlkDBCreatorList creatorList; + + // Session status information + DlkSyncStateType syncState; // current sync state; + + Boolean complete; // set to true when completion request + // has been received + + Boolean conduitOpened; // set to true after the first coduit + // is opened by remote + + Boolean logCleared; // set to true after sync log has been + // cleared during the current session; + // The log will be cleared before any new entries are added or at + // the end of sync in case no new entries were added. + // (we do not clear the log at the beginning of sync in case the + // user cancels during the "identifying user" phase; in this + // event, the spec calls for preserving the original log) + + Boolean resetPending; // set to true if system reset is pending; + // the reset will be carried out at end + // of sync + + // Current request information + Boolean gotCommand; // set to true when got a request + Byte cmdTID; // current transaction ID + Word cmdLen; // size of data in request buffer + VoidPtr cmdP; // pointer to command + VoidHand cmdH; // handle of command buffer + + // Fields added in PalmOS v3.0 + Word wStateFlags; // bitfield of dlkStateFlag... bits + DmSearchStateType dbSearchState; // database search state for iterative + // searches using DmGetNextDatabaseByTypeCreator + } DlkServerSessionType; + +typedef DlkServerSessionType* DlkServerSessionPtr; + + +/******************************************************************** + * DLK Function Parameter Structures + ********************************************************************/ +#pragma mark *Function Parameter Structures* + +// +// Parameter passed to DlkControl() +// +typedef enum DlkCtlEnum { + dlkCtlFirst = 0, // reserve 0 + + // + // Pilot v2.0 control codes: + // + dlkCtlGetPCHostName, // param1P = ptr to text buffer; (can be null if *(UIntPtr)param2P is 0) + // param2P = ptr to buffer size(UInt); + // returns actual length, including null, in *(UIntPtr)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostName, // param1P = ptr to host name(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt), including NULL (if length is 0, the current name is deleted) + + dlkCtlGetCondFilterTable, // param1P = ptr to destination buffer for filter table, or NULL if *param2 is 0 + // param2P = on entry, ptr to size of buffer(UInt) (the size may be 0) + // on return, size, in bytes, of the actual filter table + + dlkCtlSetCondFilterTable, // param1P = ptr to to conduit filter table, or NULL if *param2 is 0 + // param2P = ptr to size of filter table(UInt) (if size is 0, the current table will be deleted) + + dlkCtlGetLANSync, // param1P = ptr to store for the LANSync setting(UInt): 0 = off, otherwise on + // param2P = not used, set to NULL + + dlkCtlSetLANSync, // param1P = ptr to the LANSync setting(UInt): 0 = off, otherwise on + // param2P = not used, set to NULL + + dlkCtlGetHSTCPPort, // param1P = ptr to store for the Desktop HotSync TCP/IP port number(DWord) -- zero if not set + // param2P = not used, set to NULL + + dlkCtlSetHSTCPPort, // param1P = ptr to the Desktop HotSync TCP/IP port number(DWord) + // param2P = not used, set to NULL + + dlkCtlSendCallAppReply, // param1P = ptr to DlkCallAppReplyParamType structure + // param2P = not used, set to NULL + // + // RETURNS: send error code; use this error code + // as return value from the action code handler + + + dlkCtlGetPCHostAddr, // param1P = ptr to text buffer; (can be null if *(UIntPtr)param2P is 0) + // param2P = ptr to buffer size(UInt); + // returns actual length, including null, in *(UIntPtr)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostAddr, // param1P = ptr to host address string(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt), including NULL (if length is 0, the current name is deleted) + + + dlkCtlGetPCHostMask, // param1P = ptr to text buffer; (can be null if *(UIntPtr)param2P is 0) + // param2P = ptr to buffer size(UInt); + // returns actual length, including null, in *(UIntPtr)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostMask, // param1P = ptr to subnet mask string(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt), including NULL (if length is 0, the current name is deleted) + + + dlkCtlLAST // *KEEP THIS ENTRY LAST* + +} DlkCtlEnum; + + +// +// Parameter passed to DlkStartServer() +// +typedef struct DlkServerParamType { + UInt htalLibRefNum; // HTAL library reference number - the library has a live connection + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + DWord eventRef; // user reference value for event proc + DWord reserved1; // reserved - set to NULL + DWord reserved2; // reserved - set to NULL + Handle condFilterH; // handle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none + } DlkServerParamType; + +typedef DlkServerParamType* DlkServerParamPtr; + + + +// +// Parameter passed with DlkControl()'s dlkCtlSendCallAppReply code +// +typedef struct DlkCallAppReplyParamType { + Word pbSize; // size of this parameter block (set to sizeof(DlkCallAppReplyParamType)) + DWord dwResultCode; // result code to be returned to remote caller + VoidPtr resultP; // ptr to result data + DWord dwResultSize; // size of reply data in number of bytes + VoidPtr dlRefP; // DesktopLink reference pointer from + // SysAppLaunchCmdHandleSyncCallAppType + DWord dwReserved1; // RESERVED -- set to null!!! + } DlkCallAppReplyParamType; + + +/******************************************************************** + * DesktopLink Server Routines + ********************************************************************/ +#pragma mark *Function Prototypes* + +#ifdef __cplusplus +extern "C" { +#endif + +// +// SERVER API +// + +// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam, +// * dlkErrNoSession, dlkErrLostConnection, dlkErrMemory, +// * dlkErrUserCan +extern Err DlkStartServer(DlkServerParamPtr paramP) + SYS_TRAP(sysTrapDlkStartServer); + +extern Err DlkGetSyncInfo(ULongPtr succSyncDateP, ULongPtr lastSyncDateP, + DlkSyncStateType* syncStateP, CharPtr nameBufP, + CharPtr logBufP, ULongPtr logLenP) + SYS_TRAP(sysTrapDlkGetSyncInfo); + +// DOLATER... this is a temporary function for debugging modem manager. +// remove it when done. +extern void DlkSetLogEntry(CharPtr textP, Int textLen, Boolean append) + SYS_TRAP(sysTrapDlkSetLogEntry); + +// Dispatch a DesktopLink request (exposed for patching) +extern Err DlkDispatchRequest(DlkServerSessionPtr sessP) + SYS_TRAP(sysTrapDlkDispatchRequest); + +extern Err DlkControl(DlkCtlEnum op, VoidPtr param1P, VoidPtr param2P) + SYS_TRAP(sysTrapDlkControl); + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * DLK Macros + ********************************************************************/ + + + +#endif // __DL_SERVER_H__ diff --git a/sdk-3.1/include/Core/System/DataMgr.h b/sdk-3.1/include/Core/System/DataMgr.h new file mode 100644 index 0000000..daad037 --- /dev/null +++ b/sdk-3.1/include/Core/System/DataMgr.h @@ -0,0 +1,522 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * DataMgr.h + * + * Description: + * Header for the Data Manager + * + * History: + * 11/14/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __DATAMGR_H__ +#define __DATAMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + +// Other headers we depend on +#include + + +/************************************************************ + * Category equates + *************************************************************/ +#define dmRecAttrCategoryMask 0x0F // mask for category # +#define dmRecNumCategories 16 // number of categories +#define dmCategoryLength 16 // 15 chars + 1 null terminator + +#define dmAllCategories 0xff +#define dmUnfiledCategory 0 + +#define dmMaxRecordIndex 0xffff + + + +// Record Attributes +// +// *** IMPORTANT: +// *** +// *** Any changes to record attributes must be reflected in dmAllRecAttrs and dmSysOnlyRecAttrs *** +// *** +// *** Only one nibble is available for record attributes +// +// *** ANY CHANGES MADE TO THESE ATTRIBUTES MUST BE REFLECTED IN DESKTOP LINK +// *** SERVER CODE (DLCommon.h, DLServer.c) +#define dmRecAttrDelete 0x80 // delete this record next sync +#define dmRecAttrDirty 0x40 // archive this record next sync +#define dmRecAttrBusy 0x20 // record currently in use +#define dmRecAttrSecret 0x10 // "secret" record - password protected + + +// All record atributes (for error-checking) +#define dmAllRecAttrs ( dmRecAttrDelete | \ + dmRecAttrDirty | \ + dmRecAttrBusy | \ + dmRecAttrSecret ) + +// Record attributes which only the system is allowed to change (for error-checking) +#define dmSysOnlyRecAttrs ( dmRecAttrBusy ) + + +/************************************************************ + * Database Header equates + *************************************************************/ +#define dmDBNameLength 32 // 31 chars + 1 null terminator + +// Attributes of a Database +// +// *** IMPORTANT: +// *** +// *** Any changes to database attributes must be reflected in dmAllHdrAttrs and dmSysOnlyHdrAttrs *** +// *** +#define dmHdrAttrResDB 0x0001 // Resource database +#define dmHdrAttrReadOnly 0x0002 // Read Only database +#define dmHdrAttrAppInfoDirty 0x0004 // Set if Application Info block is dirty + // Optionally supported by an App's conduit +#define dmHdrAttrBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. +#define dmHdrAttrOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK + // for it to install a newer version of this database + // with a different name if the current database is + // open. This mechanism is used to update the + // Graffiti Shortcuts database, for example. +#define dmHdrAttrResetAfterInstall 0x0020 // Device requires a reset after this database is + // installed. +#define dmHdrAttrCopyPrevention 0x0040 // This database should not be copied to + +#define dmHdrAttrStream 0x0080 // This database is used for file stream implementation. + +#define dmHdrAttrOpen 0x8000 // Database not closed properly + + +// All database atributes (for error-checking) +#define dmAllHdrAttrs ( dmHdrAttrResDB | \ + dmHdrAttrReadOnly | \ + dmHdrAttrAppInfoDirty | \ + dmHdrAttrBackup | \ + dmHdrAttrOKToInstallNewer | \ + dmHdrAttrResetAfterInstall | \ + dmHdrAttrCopyPrevention | \ + dmHdrAttrStream | \ + dmHdrAttrOpen ) + +// Database attributes which only the system is allowed to change (for error-checking) +#define dmSysOnlyHdrAttrs ( dmHdrAttrResDB | \ + dmHdrAttrOpen ) + + +/************************************************************ + * Unique ID equates + *************************************************************/ +#define dmRecordIDReservedRange 1 // The range of upper bits in the database's + // uniqueIDSeed from 0 to this number are + // reserved and not randomly picked when a + // database is created. +#define dmDefaultRecordsID 0 // Records in a default database are copied + // with their uniqueIDSeeds set in this range. +#define dmUnusedRecordID 0 // Record ID not allowed on the device + + +/************************************************************ + * Mode flags passed to DmOpenDatabase + *************************************************************/ +#define dmModeReadOnly 0x0001 // read access +#define dmModeWrite 0x0002 // write access +#define dmModeReadWrite 0x0003 // read & write access +#define dmModeLeaveOpen 0x0004 // leave open when app quits +#define dmModeExclusive 0x0008 // don't let anyone else open it +#define dmModeShowSecret 0x0010 // force show of secret records + +// Generic type used to represent an open Database +typedef VoidPtr DmOpenRef; + + +/************************************************************ + * Structure passed to DmGetNextDatabaseByTypeCreator and used + * to cache search information between multiple searches. + *************************************************************/ +typedef struct { + DWord info[8]; + } DmSearchStateType; +typedef DmSearchStateType* DmSearchStatePtr; + + + +/************************************************************ + * Structures used by the sorting routines + *************************************************************/ +typedef struct { + Byte attributes; // record attributes; + Byte uniqueID[3]; // unique ID of record + } SortRecordInfoType; + +typedef SortRecordInfoType * SortRecordInfoPtr; + +typedef Int DmComparF (void *, void *, Int other, SortRecordInfoPtr, + SortRecordInfoPtr, VoidHand appInfoH); + + + +/************************************************************ + * Database manager error codes + * the constant dmErrorClass is defined in SystemMgr.h + *************************************************************/ +#define dmErrMemError (dmErrorClass | 1) +#define dmErrIndexOutOfRange (dmErrorClass | 2) +#define dmErrInvalidParam (dmErrorClass | 3) +#define dmErrReadOnly (dmErrorClass | 4) +#define dmErrDatabaseOpen (dmErrorClass | 5) +#define dmErrCantOpen (dmErrorClass | 6) +#define dmErrCantFind (dmErrorClass | 7) +#define dmErrRecordInWrongCard (dmErrorClass | 8) +#define dmErrCorruptDatabase (dmErrorClass | 9) +#define dmErrRecordDeleted (dmErrorClass | 10) +#define dmErrRecordArchived (dmErrorClass | 11) +#define dmErrNotRecordDB (dmErrorClass | 12) +#define dmErrNotResourceDB (dmErrorClass | 13) +#define dmErrROMBased (dmErrorClass | 14) +#define dmErrRecordBusy (dmErrorClass | 15) +#define dmErrResourceNotFound (dmErrorClass | 16) +#define dmErrNoOpenDatabase (dmErrorClass | 17) +#define dmErrInvalidCategory (dmErrorClass | 18) +#define dmErrNotValidRecord (dmErrorClass | 19) +#define dmErrWriteOutOfBounds (dmErrorClass | 20) +#define dmErrSeekFailed (dmErrorClass | 21) +#define dmErrAlreadyOpenForWrites (dmErrorClass | 22) +#define dmErrOpenedByAnotherTask (dmErrorClass | 23) +#define dmErrUniqueIDNotFound (dmErrorClass | 24) +#define dmErrAlreadyExists (dmErrorClass | 25) +#define dmErrInvalidDatabaseName (dmErrorClass | 26) +#define dmErrDatabaseProtected (dmErrorClass | 27) + + +/************************************************************ + * Values for the direction parameter of DmSeekRecordInCategory + *************************************************************/ +#define dmSeekForward 1 +#define dmSeekBackward -1 + + +/************************************************************ + * Data Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initialization +Err DmInit(void) + SYS_TRAP(sysTrapDmInit); + + +// Directory Lists +Err DmCreateDatabase(UInt cardNo, const Char * const nameP, + ULong creator, ULong type, Boolean resDB) + SYS_TRAP(sysTrapDmCreateDatabase); + +Err DmCreateDatabaseFromImage(Ptr bufferP) + SYS_TRAP(sysTrapDmCreateDatabaseFromImage); + + +Err DmDeleteDatabase(UInt cardNo, LocalID dbID) + SYS_TRAP(sysTrapDmDeleteDatabase); + +UInt DmNumDatabases(UInt cardNo) + SYS_TRAP(sysTrapDmNumDatabases); + +LocalID DmGetDatabase(UInt cardNo, UInt index) + SYS_TRAP(sysTrapDmGetDatabase); + +LocalID DmFindDatabase(UInt cardNo, const CharPtr nameP) + SYS_TRAP(sysTrapDmFindDatabase); + +Err DmGetNextDatabaseByTypeCreator(Boolean newSearch, DmSearchStatePtr stateInfoP, + ULong type, ULong creator, Boolean onlyLatestVers, + UIntPtr cardNoP, LocalID* dbIDP) + SYS_TRAP(sysTrapDmGetNextDatabaseByTypeCreator); + + +// Database info +Err DmDatabaseInfo(UInt cardNo, LocalID dbID, const CharPtr nameP, + UIntPtr attributesP, UIntPtr versionP, ULongPtr crDateP, + ULongPtr modDateP, ULongPtr bckUpDateP, + ULongPtr modNumP, LocalID* appInfoIDP, + LocalID* sortInfoIDP, ULongPtr typeP, + ULongPtr creatorP) + SYS_TRAP(sysTrapDmDatabaseInfo); + +Err DmSetDatabaseInfo(UInt cardNo, LocalID dbID, const CharPtr nameP, + UIntPtr attributesP, UIntPtr versionP, ULongPtr crDateP, + ULongPtr modDateP, ULongPtr bckUpDateP, + ULongPtr modNumP, LocalID* appInfoIDP, + LocalID* sortInfoIDP, ULongPtr typeP, + ULongPtr creatorP) + SYS_TRAP(sysTrapDmSetDatabaseInfo); + +Err DmDatabaseSize(UInt cardNo, LocalID dbID, ULongPtr numRecordsP, + ULongPtr totalBytesP, ULongPtr dataBytesP) + SYS_TRAP(sysTrapDmDatabaseSize); + + +// This routine can be used to prevent a database from being deleted (by passing +// true for 'protect'). It will increment the protect count if 'protect' is true +// and decrement it if 'protect' is false. This is used by code that wants to +// keep a particular record or resource in a database locked down but doesn't +// want to keep the database open. This information is keep in the dynamic heap so +// all databases are "unprotected" at system reset. +Err DmDatabaseProtect(UInt cardNo, LocalID dbID, Boolean protect) + SYS_TRAP(sysTrapDmDatabaseProtect); + + +// Open Databases info +DmOpenRef DmOpenDatabase(UInt cardNo, LocalID dbID, UInt mode) + SYS_TRAP(sysTrapDmOpenDatabase); + +DmOpenRef DmOpenDatabaseByTypeCreator(ULong type, ULong creator, UInt mode) + SYS_TRAP(sysTrapDmOpenDatabaseByTypeCreator); + +Err DmCloseDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmCloseDatabase); + + +DmOpenRef DmNextOpenDatabase(DmOpenRef currentP) + SYS_TRAP(sysTrapDmNextOpenDatabase); + +Err DmOpenDatabaseInfo(DmOpenRef dbP, LocalID* dbIDP, + UIntPtr openCountP, UIntPtr modeP, UIntPtr cardNoP, + BooleanPtr resDBP) + SYS_TRAP(sysTrapDmOpenDatabaseInfo); + +LocalID DmGetAppInfoID (DmOpenRef dbP) + SYS_TRAP(sysTrapDmGetAppInfoID); + + +// Utility to unlock all records and clear busy bits +Err DmResetRecordStates(DmOpenRef dbP) + SYS_TRAP(sysTrapDmResetRecordStates); + + +// Error Query +Err DmGetLastErr(void) + SYS_TRAP(sysTrapDmGetLastErr); + + +//------------------------------------------------------------ +// Record based access routines +//------------------------------------------------------------ + +// Record Info +UInt DmNumRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumRecords); + +UInt DmNumRecordsInCategory(DmOpenRef dbP, UInt category) + SYS_TRAP(sysTrapDmNumRecordsInCategory); + +Err DmRecordInfo(DmOpenRef dbP, UInt index, + UIntPtr attrP, ULongPtr uniqueIDP, LocalID* chunkIDP) + SYS_TRAP(sysTrapDmRecordInfo); + +Err DmSetRecordInfo(DmOpenRef dbP, UInt index, + UIntPtr attrP, ULongPtr uniqueIDP) + SYS_TRAP(sysTrapDmSetRecordInfo); + + + +// Record attaching and detaching +Err DmAttachRecord(DmOpenRef dbP, UIntPtr atP, + Handle newH, Handle* oldHP) + SYS_TRAP(sysTrapDmAttachRecord); + +Err DmDetachRecord(DmOpenRef dbP, UInt index, + Handle* oldHP) + SYS_TRAP(sysTrapDmDetachRecord); + +Err DmMoveRecord(DmOpenRef dbP, UInt from, UInt to) + SYS_TRAP(sysTrapDmMoveRecord); + + + +// Record creation and deletion +VoidHand DmNewRecord(DmOpenRef dbP, UIntPtr atP, + ULong size) + SYS_TRAP(sysTrapDmNewRecord); + +Err DmRemoveRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmRemoveRecord); + +Err DmDeleteRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmDeleteRecord); + +Err DmArchiveRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmArchiveRecord); + +VoidHand DmNewHandle(DmOpenRef dbP, ULong size) + SYS_TRAP(sysTrapDmNewHandle); + +Err DmRemoveSecretRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmRemoveSecretRecords); + + +// Record viewing manipulation +Err DmFindRecordByID(DmOpenRef dbP, ULong uniqueID, UIntPtr indexP) + SYS_TRAP(sysTrapDmFindRecordByID); + +VoidHand DmQueryRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmQueryRecord); + +VoidHand DmGetRecord(DmOpenRef dbP, UInt index) + SYS_TRAP(sysTrapDmGetRecord); + +VoidHand DmQueryNextInCategory(DmOpenRef dbP, UIntPtr indexP, UInt category) + SYS_TRAP(sysTrapDmQueryNextInCategory); + +UInt DmPositionInCategory (DmOpenRef dbP, UInt index, UInt category) + SYS_TRAP(sysTrapDmPositionInCategory); + +Err DmSeekRecordInCategory (DmOpenRef dbP, UIntPtr indexP, Int offset, + Int direction, UInt category) + SYS_TRAP(sysTrapDmSeekRecordInCategory); + + +VoidHand DmResizeRecord(DmOpenRef dbP, UInt index, ULong newSize) + SYS_TRAP(sysTrapDmResizeRecord); + +Err DmReleaseRecord(DmOpenRef dbP, UInt index, Boolean dirty) + SYS_TRAP(sysTrapDmReleaseRecord); + +Int DmSearchRecord(VoidHand recH, DmOpenRef* dbPP) + SYS_TRAP(sysTrapDmSearchRecord); + + +// Category manipulation +Err DmMoveCategory (DmOpenRef dbP, UInt toCategory, UInt fromCategory, Boolean dirty) + SYS_TRAP(sysTrapDmMoveCategory); + +Err DmDeleteCategory (DmOpenRef dbR, UInt categoryNum) + SYS_TRAP(sysTrapDmDeleteCategory); + + +// Validation for writing +Err DmWriteCheck(VoidPtr recordP, ULong offset, ULong bytes) + SYS_TRAP(sysTrapDmWriteCheck); + +// Writing +Err DmWrite(VoidPtr recordP, ULong offset, const void * const srcP, ULong bytes) + SYS_TRAP(sysTrapDmWrite); + +Err DmStrCopy(VoidPtr recordP, ULong offset, const Char * const srcP) + SYS_TRAP(sysTrapDmStrCopy); + +Err DmSet(VoidPtr recordP, ULong offset, ULong bytes, Byte value) + SYS_TRAP(sysTrapDmSet); + + + + +//------------------------------------------------------------ +// Resource based access routines +//------------------------------------------------------------ + +// High level access routines +VoidHand DmGetResource(ULong type, Int id) + SYS_TRAP(sysTrapDmGetResource); + +VoidHand DmGet1Resource(ULong type, Int id) + SYS_TRAP(sysTrapDmGet1Resource); + +Err DmReleaseResource(VoidHand resourceH) + SYS_TRAP(sysTrapDmReleaseResource); + +VoidHand DmResizeResource(VoidHand resourceH, ULong newSize) + SYS_TRAP(sysTrapDmResizeResource); + + +// Searching resource databases +DmOpenRef DmNextOpenResDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNextOpenResDatabase); + +Int DmFindResourceType(DmOpenRef dbP, ULong resType, Int typeIndex) + SYS_TRAP(sysTrapDmFindResourceType); + +Int DmFindResource(DmOpenRef dbP, ULong resType, Int resID, + VoidHand resH) + SYS_TRAP(sysTrapDmFindResource); + +Int DmSearchResource(ULong resType, Int resID, + VoidHand resH, DmOpenRef* dbPP) + SYS_TRAP(sysTrapDmSearchResource); + + +// Resource Info +UInt DmNumResources(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumResources); + +Err DmResourceInfo(DmOpenRef dbP, Int index, + ULongPtr resTypeP, IntPtr resIDP, + LocalID* chunkLocalIDP) + SYS_TRAP(sysTrapDmResourceInfo); + +Err DmSetResourceInfo(DmOpenRef dbP, Int index, + ULongPtr resTypeP, IntPtr resIDP) + SYS_TRAP(sysTrapDmSetResourceInfo); + + + +// Resource attaching and detaching +Err DmAttachResource(DmOpenRef dbP, VoidHand newH, + ULong resType, Int resID) + SYS_TRAP(sysTrapDmAttachResource); + +Err DmDetachResource(DmOpenRef dbP, Int index, + VoidHand* oldHP) + SYS_TRAP(sysTrapDmDetachResource); + + + +// Resource creation and deletion +VoidHand DmNewResource(DmOpenRef dbP, ULong resType, Int resID, + ULong size) + SYS_TRAP(sysTrapDmNewResource); + +Err DmRemoveResource(DmOpenRef dbP, Int index) + SYS_TRAP(sysTrapDmRemoveResource); + + + +// Resource manipulation +VoidHand DmGetResourceIndex(DmOpenRef dbP, Int index) + SYS_TRAP(sysTrapDmGetResourceIndex); + + + +// Record sorting +Err DmQuickSort(const DmOpenRef dbP, DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmQuickSort); + +Err DmInsertionSort (const DmOpenRef dbR, DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmInsertionSort); + +UInt DmFindSortPosition(DmOpenRef dbP, VoidPtr newRecord, + SortRecordInfoPtr newRecordInfo, DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmFindSortPosition); + +UInt DmFindSortPositionV10(DmOpenRef dbP, VoidPtr newRecord, + DmComparF *compar, Int other) + SYS_TRAP(sysTrapDmFindSortPositionV10); + +#ifdef __cplusplus +} +#endif + +#endif // __DATAMGR_H__ + diff --git a/sdk-3.1/include/Core/System/DataPrv.h b/sdk-3.1/include/Core/System/DataPrv.h new file mode 100644 index 0000000..c6d5615 --- /dev/null +++ b/sdk-3.1/include/Core/System/DataPrv.h @@ -0,0 +1,236 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * DataPrv.h + * + * Description: + * Private Header for the Data Manager + * + * History: + * 8/10/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __DATAPRV_H__ +#define __DATAPRV_H__ + + + +/************************************************************ + * Structure of a Record entry + *************************************************************/ +typedef struct { + LocalID localChunkID; // local chunkID of a record + Byte attributes; // record attributes; + Byte uniqueID[3]; // unique ID of record; should + // not be 0 for a legal record. + } RecordEntryType; +typedef RecordEntryType* RecordEntryPtr; + + + +/************************************************************ + * Structure of a Resource entry + *************************************************************/ +typedef struct { + DWord type; // resource type + Word id; // resource id + LocalID localChunkID; // resource data chunk ID + } RsrcEntryType; +typedef RsrcEntryType* RsrcEntryPtr; + +// Attributes field +#define dmRsrcAttrUnused 0x0000 // to be defined... + + + +/************************************************************ + * Structure of a record list extension. This is used if all + * the database record/resource entries of a database can't fit into + * the database header. + *************************************************************/ +typedef struct { + LocalID nextRecordListID; // local chunkID of next list + Word numRecords; // number of records in this list + Word firstEntry; // array of Record/Rsrc entries + // starts here + } RecordListType; +typedef RecordListType* RecordListPtr; + + + + +/************************************************************ + * Structure of a Database Header + *************************************************************/ +typedef struct { + Byte name[dmDBNameLength]; // name of database + Word attributes; // database attributes + Word version; // version of database + + DWord creationDate; // creation date of database + DWord modificationDate; // latest modification date + DWord lastBackupDate; // latest backup date + DWord modificationNumber; // modification number of database + + LocalID appInfoID; // application specific info + LocalID sortInfoID; // app specific sorting info + + DWord type; // database type + DWord creator; // database creator + + DWord uniqueIDSeed; // used to generate unique IDs. + // Note that only the low order + // 3 bytes of this is used (in + // RecordEntryType.uniqueID). + // We are keeping 4 bytes for + // alignment purposes. + + RecordListType recordList; // first record list + } DatabaseHdrType; + +typedef DatabaseHdrType* DatabaseHdrPtr; +typedef DatabaseHdrPtr* DatabaseHdrHand; + + + + + +/************************************************************ + * Directory of all available databases - maintained by the + * Database Manager. This directory also includes resource + * databases. There is one of these directories for each store + * (either RAM or ROM store) in a memory card. + *************************************************************/ +typedef struct { + LocalID nextDatabaseListID; // continuation list, if any + Word numDatabases; // # of database ID's in this list + LocalID databaseID[1]; // ChunkID of each Database + } DatabaseDirType; + +typedef DatabaseDirType* DatabaseDirPtr; + + + + +/************************************************************ + * This structure is used to hold information on an open database + * It gets allocated as a non-movable chunk in the dynamic heap + * when a database is opened and caches database information that + * helps speed up performance. + *************************************************************/ +typedef struct { + VoidPtr next; // ptr to next access structure + UInt openCount; // incremented every time it's opened + ULong ownerTaskID; // taskID of owner + UInt exclusive : 1; // true if opened with exclusive access + UInt writeAccess : 1; // true if opened with write access + UInt resDB : 1; // true if resource database + LocalID hdrID; // local ID of database header + DatabaseHdrHand hdrH; // Database header handle + DatabaseHdrPtr hdrP; // Database header ptr for faster access + UInt cardNo; // card number of database + UInt numRecords; // cached here for better performance + Ptr hdrMasterP; // master ptr to header if ROM based + Ptr* handleTableP; // pointer to block of ROM handles + } DmOpenInfoType; + +typedef DmOpenInfoType* DmOpenInfoPtr; + + + +/************************************************************ + * This structure is used to hold client specific information for + * an open database. There is one of these allocated every time + * a database is opened, even if it's already open. This structure + * holds the open mode of the client and a pointer to the DmOpenInfoType + * of the database which contains the common database info for all + * clients. The SysAppInfoPtr, referenced off of the current A5, + * has a pointer to the first DmAccessType in the linked list. + *************************************************************/ +typedef struct DmAccessType { + struct DmAccessType* next; // ptr to next access structure + UInt mode; // mode it was opened in + DmOpenInfoPtr openP; // ptr to DmOpenInfoType for database + + // NEW FOR PalmOS v3.0 + DWord savedModNum; // saved modification number of database + // at the time of opening + } DmAccessType; + +typedef DmAccessType* DmAccessPtr; + + + +/************************************************************ + * This structure is used to hold the results of a search + * in DmGetNextDatabaseByTypeCreator. It is the "real" structure + * of the generic type DmSearchStateType used by applications. + *************************************************************/ +#if EMULATION_LEVEL == EMULATION_NONE +#define MAX_CARDS 1 +#else +#define MAX_CARDS 2 +#endif +#define MAX_STORES_PER_CARD 2 +#define MAX_STORES (MAX_CARDS * MAX_STORES_PER_CARD) + +typedef struct { + Word indexes[MAX_STORES]; + UInt cardNos[MAX_STORES]; // cardNo for each store + DWord latestVersionCandidateType; // saved type of latest version candidate + DWord latestVersionCandidateCreator; // saved creator of latest version candidate + Int latestVersionCandidateStore; // saved store for latest versions + } DmPrvSearchStateType; +typedef DmPrvSearchStateType* DmPrvSearchStatePtr; + + +/************************************************************ + * This structure is used to keep track of protected databases. These + * are databases which have been protected through the DmDatabaseProtect() + * call. A handle to an array of these structures is stored in the + * low memory global GDmProtectListH. The number of entries in the array + * must be calculated by taking the size of the handle and dividing + * by sizeof (DmProtectEntryType) + *************************************************************/ +typedef struct { + Byte protectCount; + Byte cardNo; + LocalID dbID; + } DmProtectEntryType, *DmProtectEntryPtr; + + + +/************************************************************ + * The owner ID of chunks allocated by the Database Manager + *************************************************************/ +#define dmDynOwnerID 0x00 // Dynamic heap chunks +#define dmMgrOwnerID 0x01 // Management chunks +#define dmRecOwnerID 0x02 // Record chunks +#define dmOrphanOwnerID 0x03 // Orphaned record chunks + + +/************************************************************ + * Private Data Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err DmMoveOpenDBContext(DmAccessPtr* listHeadP, DmAccessPtr dbP) + SYS_TRAP(sysTrapDmMoveOpenDBContext); + + + +#ifdef __cplusplus +} +#endif + + +#endif // __DATAPRV_H__ +#endif //NON_PORTABLE + diff --git a/sdk-3.1/include/Core/System/DateTime.h b/sdk-3.1/include/Core/System/DateTime.h new file mode 100644 index 0000000..8749bc9 --- /dev/null +++ b/sdk-3.1/include/Core/System/DateTime.h @@ -0,0 +1,208 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * DateTime.h + * + * Description: + * Date and Time calculations + * + * History: + * 1/19/95 rsf - Created by Roger Flores + * + * + *******************************************************************/ + +#ifndef __DATETIME_H__ +#define __DATETIME_H__ + + +typedef DWord time_t; + +typedef struct { + SWord second; + SWord minute; + SWord hour; + SWord day; + SWord month; + SWord year; + SWord weekDay; // Days since Sunday (0 to 6) + } DateTimeType; + +typedef DateTimeType * DateTimePtr; + + +// This is the time format. Times are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + Byte hours; + Byte minutes; +} TimeType; + +typedef TimeType * TimePtr; + +#define noTime -1 // The entire TimeType is -1 if there isn't a time. + + +// This is the date format. Dates are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + Word year :7; // years since 1904 (MAC format) + Word month :4; + Word day :5; +} DateType; + +typedef DateType * DatePtr; + + +/************************************************************ + * Date Time Constants + *************************************************************/ + +// Maximum lengths of strings return by the date and time formating +// routine DateToAscii and TimeToAscii. +#define timeStringLength 9 +#define dateStringLength 9 +#define longDateStrLength 15 + + +#define firstYear 1904 +#define numberOfYears 128 +#define lastYear (firstYear + numberOfYears - 1) + + + +// Constants for time calculations +// Could change these from xIny to yPerX +#define minutesInSeconds 60 +#define hoursInMinutes 60 +#define hoursInSeconds (hoursInMinutes * minutesInSeconds) +#define hoursPerDay 24 +//#define daysInSeconds ((long)(hoursPerDay) * ((long)hoursInSeconds)) +#define daysInSeconds (0x15180) // cc bug + +#define daysInWeek 7 +#define daysInYear 365 +#define daysInLeapYear 366 +#define daysInFourYears (daysInLeapYear + 3 * daysInYear) + +#define monthsInYear 12 + +#define maxDays ((ULong) numberOfYears / 4 * daysInFourYears - 1) +#define maxSeconds ((ULong) maxDays * daysInSeconds) +#define maxTime 0x + +// Values returned by DayOfWeek routine. +#define sunday 0 +#define monday 1 +#define tuesday 2 +#define wednesday 3 +#define thursday 4 +#define friday 5 +#define saturday 6 + +// Months of the year +#define january 1 +#define february 2 +#define march 3 +#define april 4 +#define may 5 +#define june 6 +#define july 7 +#define august 8 +#define september 9 +#define october 10 +#define november 11 +#define december 12 + + +// Values returned by DoyOfMonth routine. +typedef enum { + dom1stSun, dom1stMon, dom1stTue, dom1stWen, dom1stThu, dom1stFri, dom1stSat, + dom2ndSun, dom2ndMon, dom2ndTue, dom2ndWen, dom2ndThu, dom2ndFri, dom2ndSat, + dom3rdSun, dom3rdMon, dom3rdTue, dom3rdWen, dom3rdThu, dom3rdFri, dom3rdSat, + dom4thSun, dom4thMon, dom4thTue, dom4thWen, dom4thThu, dom4thFri, dom4thSat, + domLastSun, domLastMon, domLastTue, domLastWen, domLastThu, domLastFri, + domLastSat + } DayOfWeekType; + + +//************************************************************ +//* Date and Time macros +//*********************************************************** + +// Convert a date in a DateType structure to an unsigned int. + #define DateToInt(date) (*(UInt *) &date) + + +// Convert a date in a DateType structure to an unsigned int. + #define TimeToInt(time) (*(Int *) &time) + + + +//************************************************************ +//* Date Time procedures +//************************************************************ +#ifdef __cplusplus +extern "C" { +#endif + + +void TimSecondsToDateTime(ULong seconds, DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimSecondsToDateTime); + +ULong TimDateTimeToSeconds(DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimDateTimeToSeconds); + +void TimAdjust(DateTimePtr dateTimeP, Long adjustment) + SYS_TRAP(sysTrapTimAdjust); + +void TimeToAscii(Byte hours, Byte minutes, TimeFormatType timeFormat, + CharPtr pString) + SYS_TRAP(sysTrapTimeToAscii); + + + +UInt DaysInMonth(UInt month, UInt year) + SYS_TRAP(sysTrapDaysInMonth); + +UInt DayOfWeek (UInt month, UInt day, UInt year) + SYS_TRAP(sysTrapDayOfWeek); + +UInt DayOfMonth (UInt month, UInt day, UInt year) + SYS_TRAP(sysTrapDayOfMonth); + + + +// Date routines. +void DateSecondsToDate (ULong seconds, DatePtr date) + SYS_TRAP(sysTrapDateSecondsToDate); + +void DateDaysToDate (ULong days, DatePtr date) + SYS_TRAP(sysTrapDateDaysToDate); + +ULong DateToDays (DateType date) + SYS_TRAP(sysTrapDateToDays); + +void DateAdjust (DatePtr dateP, Long adjustment) + SYS_TRAP(sysTrapDateAdjust); + +void DateToAscii(Byte months, Byte days, Word years, + DateFormatType dateFormat, CharPtr pString) + SYS_TRAP(sysTrapDateToAscii); + +void DateToDOWDMFormat(Byte months, Byte days, Word years, + DateFormatType dateFormat, CharPtr pString) + SYS_TRAP(sysTrapDateToDOWDMFormat); + + +#ifdef __cplusplus +} +#endif + + +#endif //__DATETIME_H__ diff --git a/sdk-3.1/include/Core/System/DebugMgr.h b/sdk-3.1/include/Core/System/DebugMgr.h new file mode 100644 index 0000000..19df2bd --- /dev/null +++ b/sdk-3.1/include/Core/System/DebugMgr.h @@ -0,0 +1,177 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * DebugMgr.h + * + * Description: + * Debugging functions + * + * History: + * 11/03/94 RM - Created by Ron Marianetti + * + * 2/1/98 vmk - Defined DbgControl + * + * + *******************************************************************/ + + +#ifndef __DEBUGMGR_H__ +#define __DEBUGMGR_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +// +// Constants and structures used in conjunction with DbgControl +// +#define dbgCtlNotHandled false // debug control operation was not handled +#define dbgCtlHandled true // debug control operation was handled + +#define dbgCtlAllHandlersID 0 // indiacates that the operation is to be handled + // by all handlers + +#define dbgCtlHandlerNameLen 31 // maximum handler name length, not including null +#define dbgCtlHandlerVerLen 15 // maximum handler version string length, not including null + +#define dbgCtlFirstCustomOp 0x8000 // debug handlers begin numbering their op[erations] + // with this number; the system reserves all operation + // number values below this one +// Typed of the DbgControl function +typedef Boolean DbgControlFuncType(DWord handlerID, Word op, VoidPtr paramP, DWordPtr dwParamP); + +typedef struct DbgCtlHandlerInfoType { + DbgControlFuncType* handlerFuncP; // ptr to handler's DbgControl function + DWord version; // numeric version number (hander-defined) + Boolean enabled; // true if handler is enabled; false if not + Char name[dbgCtlHandlerNameLen+1]; // null-terminated handler name + Char ver[dbgCtlHandlerVerLen+1]; // null-terminated handler version string + DWord dwReserved; // RESERVED -- CALLER MUST INITIALIZE TO ZERO! + } DbgCtlHandlerInfoType; + +typedef void DbgCtlEnumCallbackFunc(VoidPtr callbackDataP, DWord handlerID, DbgControlFuncType* handlerFuncP); + +typedef struct DbgCtlEnumInfoType { + DbgCtlEnumCallbackFunc* enumFuncP; + VoidPtr callbackDataP; + } DbgCtlEnumInfoType; + +// System-defined debug control operations +enum { + + dbgCtlOpEnumHandlers = 1, // handlerID = dbgCtlAllHandlersID (applies to all handlers) + // paramP = ptr to DbgCtlEnumInfoType + // returns dbgCtlHandled if handled + + dbgCtlOpGetHandlerInfo, // handlerID = desired handler creator + // paramP = ptr to DbgCtlHandlerInfoType + // returns dbgCtlHandled if handled + + dbgCtlOpEnableHandler, // handlerID = desired handler creator or dbgCtlAllHandlersID + // returns dbgCtlHandled if handled + + dbgCtlOpDisableHandler, // handlerID = desired handler creator or dbgCtlAllHandlersID + // returns dbgCtlHandled if handled + + dbgCtlOpGetEnabledStatus, // handlerID = desired handler creator + // dwParamP = ptr to DWord type variable to be filled in with + // enabled status: non-zero = enabled, zero = disabled + // returns dbgCtlHandled if handled + + dbgCtlOpGetVersion, // handlerID = desired handler creator + // dwParamP = ptr to DWord type variable to be filled in with + // handler-specific version number + // returns dbgCtlHandled if handled + + + dbgCtlOpLAST + }; + +#ifdef __GNUC__ +#define _DEBUGGER_TRAP __attribute__ ((__callseq__ ("trap #8"))) +#elif defined (__MWERKS__) /* The equivalent in CodeWarrior syntax */ +#define _DEBUGGER_TRAP = 0x4E40 + 8 +#endif + + +/************************************************************ + * Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Long DbgInit(Ptr spaceP, Ptr dispatchTableP[], Boolean openComm); + +void DbgSrcBreak(void) +#if USE_TRAPS + _DEBUGGER_TRAP +#endif +; + +void DbgSrcMessage(CharPtr debugStr) + SYS_TRAP(sysTrapDbgSrcMessage); + + +// Debug control function for implementing debug tracing, etc. via debug handlers. +// The default implementation does nothing, leaving the real work up to "debug handlers". +// Debug handlers will be implemented as system extensions. As they are loaded, extensions +// will override this function call (DbgControl) and chain to those handlers loaded before +// them. When a debug control call is made by the client, a handler id of the handler that +// implements the functionality will be passed in as the first parameter. The handler id is +// the unique creator id of the handler. When a handler is called, it will first examine +// the handler ID -- if it matches its own, the handler will execute the command and return; +// if the handler id does not match, the handler must pass the call down the chain and return +// the value from that call. The operation to be performed is indicated by the parameter "op". +// op is specific to each handler this means that the same op values may be used by different +// handlers, since handler id's are unique. op values defined by handlers must begin at +// dbgCtlFirstCustomOp. Handler ID of dbgCtlAllHandlersID applies to all handlers. When the +// handler id of zero is passed, each handler is responsible for executing the requested action +// and passing the call down the chain. The last two parameters are defined by each handler +// for its own operations. +//typedef Boolean DbgControlFuncType(DWord handlerID, Word op, VoidPtr paramP, DWordPtr dwParamP); +extern DbgControlFuncType DbgControl + SYS_TRAP(sysTrapDbgControl); + + + +// NOTE!!! DbgBreak can NOT be written using the ONEWORD_INLINE macro +// because it must always resolve to a trap instruction even when +// USE_TRAPS is set to 0. In particular the SmallROM compiles with +// USE_TRAPS set to 0 and needs the DbgBreak to resolve as a trap +// instruction. +#if EMULATION_LEVEL == EMULATION_NONE + void DbgBreak(void) _DEBUGGER_TRAP; +#else + void DbgBreak(void); +#endif + +void DbgMessage(CharPtr aStr) + SYS_TRAP(sysTrapDbgMessage); + +CharPtr DbgGetMessage(BytePtr bufferP, Long timeout) + SYS_TRAP(sysTrapDbgGetMessage); + +Err DbgCommSettings(ULongPtr baudP, ULongPtr flagsP) + SYS_TRAP(sysTrapDbgCommSettings); + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _DbgBreak \ + DC.W m68kTrapInstr+sysDbgTrapNum //lint !e773 + + + +#endif // __DEBUGMGR_H__ + + diff --git a/sdk-3.1/include/Core/System/DebugPrv.h b/sdk-3.1/include/Core/System/DebugPrv.h new file mode 100644 index 0000000..0e28381 --- /dev/null +++ b/sdk-3.1/include/Core/System/DebugPrv.h @@ -0,0 +1,436 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * DebugPrv.h + * + * Description: + * PrivatŤDebugging functions + * + * History: + * 8/10/95 RM - Created by Ron Marianetti + * + * + *******************************************************************/ + +#ifdef NON_PORTABLE +#ifndef __DEBUGPRV_H__ +#define __DEBUGPRV_H__ + + +/*********************************************************************** + * Debugger Constants + ***********************************************************************/ +#define dbgLoopsPerTick 0x0800 +#define dbgStackSize 0x0300 // DOLATER -- resize??? + +#define dbgNormalBreakpoints 5 +#define dbgTempBPIndex dbgNormalBreakpoints +#define dbgTotalBreakpoints (dbgTempBPIndex+1) + +#define dbgFlashCodeSpace sysInitStack // where we copy flash code +#define dbgFlashCodeSize 0x200 // size of flash code + +#define dbgTotalTrapBreaks 5 // up to this many trap breaks at a time + + + + +/*********************************************************************** + * Structure of Debugger Breakpoints + ***********************************************************************/ +typedef struct BreakpointType { + Ptr addr; // address of breakpoint + Boolean enabled; // true if enabled + Boolean installed; // for alignment + } BreakpointType; + + + + + +/*********************************************************************** + * Structure of Debugger Specific System Packet Type Bodies. + ***********************************************************************/ + +#define sysPktMaxNameLen 32 // Max length of a routine name + +//-------------------------------------------------------------- +// sysPktStateCmd +// - get processor state +//------------------------------------------------------------------ +// number of remote code words to send in the 'state response' packet +#define sysPktStateRspInstWords 15 + + +typedef struct SysPktStateCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktStateCmdCmdType; +typedef SysPktStateCmdCmdType* SysPktStateCmdCmdPtr; + + +// Packet Body structure for the state command response packet +typedef struct SysPktStateRspType { + _sysPktBodyCommon; // Common Body header + Boolean resetted; // true if target has just reset + Word exceptionId; // exception which caused the + // debugger to be entered. + M68KRegsType reg; // current remote registers. + Word inst[sysPktStateRspInstWords]; + // instruction buffer for + // code beginning at PC. + BreakpointType bp[dbgTotalBreakpoints]; // current breakpoints + + void* startAddr; // start address of routine + void* endAddr; // end address of routine + char name[sysPktMaxNameLen]; + // routine name (0 or more chars, + // no null), immediately + // follows the address range. + Byte trapTableRev; // rev of trap table. Used to determine + // when host's trap table cache is invalid + } SysPktStateRspType; +typedef SysPktStateRspType* SysPktStateRspPtr; + +//-------------------------------------------------------------------- +// sysPktGetRtnNameCmd +// - get routine name +//-------------------------------------------------------------------- +// The response packet body will contain start address(4 bytes), +// end address(4 bytes), followed by 0 or more bytes of the routine +// name (no null byte). +typedef struct SysPktRtnNameCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // -> address to query on + } SysPktRtnNameCmdType; +typedef SysPktRtnNameCmdType* SysPktRtnNameCmdPtr; + +typedef struct SysPktRtnNameRspType { + _sysPktBodyCommon; // Common Body header + void* address; // -> address to query on + void* startAddr; // <- start address of routine + void* endAddr; // <- end address of routine + char name[sysPktMaxNameLen]; // <- routine name, if any immediately + // follows the address range. + // The balance need not be sent. + } SysPktRtnNameRspType; +typedef SysPktRtnNameRspType* SysPktRtnNameRspPtr; + + +//-------------------------------------------------------------------- +// sysPktReadRegsCmd +// - read registers +//-------------------------------------------------------------------- +// Packet Body structure for the read regs command response packet +typedef struct SysPktReadRegsCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktReadRegsCmdType; +typedef SysPktReadRegsCmdType* SysPktReadRegsCmdPtr; + +typedef struct SysPktReadRegsRspType { + _sysPktBodyCommon; // Common Body header + //M68KRegsType reg; // <- return registers + } SysPktReadRegsRspType; +typedef SysPktReadRegsRspType* SysPktReadRegsRspPtr; + + + +//-------------------------------------------------------------------- +// sysPktWriteRegsCmd +// - write registers +//-------------------------------------------------------------------- +// Packet Body structure for the write regs command packet +typedef struct SysPktWriteRegsCmdType { + _sysPktBodyCommon; // Common Body header + M68KRegsType reg; // -> registers to write + } SysPktWriteRegsCmdType; +typedef SysPktWriteRegsCmdType* SysPktWriteRegsCmdPtr; + + +// Packet Body structure for the write regs command packet +typedef struct SysPktWriteRegsRspType { + _sysPktBodyCommon; // Common Body header + } SysPktWriteRegsRspType; +typedef SysPktWriteRegsRspType* SysPktWriteRegsRspPtr; + + +//-------------------------------------------------------------------- +// sysPktContinueCmd +// - continue +//-------------------------------------------------------------------- +// Packet Body structure for the continue command packet +typedef struct SysPktContinueCmdType { + _sysPktBodyCommon; // Common Body header + M68KRegsType regs; // registers + Boolean stepSpy; // set true to do step spy + DWord ssAddr; // step spy address + DWord ssCount; // # of bytes + DWord ssCheckSum; // checksum + } SysPktContinueCmdType; + +typedef SysPktContinueCmdType* SysPktContinueCmdPtr; + + +//-------------------------------------------------------------------- +// sysPktGetBreakPointsCmd +// +// - Get breakpoints +//-------------------------------------------------------------------- +typedef struct SysPktGetBreakpointsCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktGetBreakpointsCmdType; +typedef SysPktGetBreakpointsCmdType* SysPktGetBreakpointsCmdPtr; + +typedef struct SysPktGetBreakpointsRspType { + _sysPktBodyCommon; // Common Body header + //BreakpointType bp[dbgTotalBreakpoints]; + } SysPktGetBreakpointsRspType; +typedef SysPktGetBreakpointsRspType* SysPktGetBreakpointsRspPtr; + + +//-------------------------------------------------------------------- +// sysPktSetBreakPointsCmd +// +// - Set breakpoints +//-------------------------------------------------------------------- +typedef struct SysPktSetBreakpointsCmdType { + _sysPktBodyCommon; // Common Body header + //BreakpointType bp[dbgTotalBreakpoints]; + } SysPktSetBreakpointsCmdType; +typedef SysPktSetBreakpointsCmdType* SysPktSetBreakpointsCmdPtr; + +typedef struct SysPktSetBreakpointsRspType { + _sysPktBodyCommon; // Common Body header + } SysPktSetBreakpointsRspType; +typedef SysPktSetBreakpointsRspType* SysPktSetBreakpointsRspPtr; + + + + +//-------------------------------------------------------------------- +// sysPktDbgBreakToggleCmd +// - Enable/Disable DbgBreak's command +//-------------------------------------------------------------------- +typedef struct SysPktDbgBreakToggleCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktDbgBreakToggleCmdType; +typedef SysPktDbgBreakToggleCmdType* SysPktDbgBreakToggleCmdPtr; + +typedef struct SysPktDbgBreakToggleRspType { + _sysPktBodyCommon; // Common Body header + Boolean newState; + } SysPktDbgBreakToggleRspType; +typedef SysPktDbgBreakToggleRspType* SysPktDbgBreakToggleRspPtr; + + +//-------------------------------------------------------------------- +// sysPktFlashCmd - OBSOLETE AS OF 3.0! SEE sysPktExecFlashCmd BELOW! +// Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns info on the flash in: +// manuf - manufacturer code +// device - device code +// width - width of FLASH +// ramSpaceP - buffer in RAM for flash sector +//-------------------------------------------------------------------- +typedef struct SysPktFlashWriteType { + _sysPktBodyCommon; // Common Body header + Word numBytes; // -> # of bytes in sector + DWord flashBase; // -> base address of FLASH, or 0 for default + DWord srcAddr; // -> source address of new data + DWord dstAddr; // -> dest address in flash memory + Byte manuf; // <- manufacturer + Byte device; // <- device + Byte width; // <- Flash memory width + Byte filler; + DWord ramSpaceP; // <- available space in RAM for sector + } SysPktFlashWriteType; +typedef SysPktFlashWriteType* SysPktFlashWritePtr; + + +//-------------------------------------------------------------------- +// sysPktExecFlashCmd +// NEW Program Flash command - executes flash ident/write code +// If codeAddr is 0, this routine returns address to write flash code. +// Replaces 1.0 and 2.0 sysPktFlashCmd call above in the 3.0 ROM +//-------------------------------------------------------------------- +typedef struct sysPktExecFlashType { + _sysPktBodyCommon; // Common Body header + Word numBytes; // -> # of bytes in sector + DWord flashBase; // -> base address of FLASH + DWord srcAddr; // -> source address of new data + DWord dstAddr; // -> dest address in flash memory + DWord codeAddr; // <-> address of flash code + Word flashResID; // <- resource ID of flash write code + Byte manuf; // <- manufacturer + Byte device; // <- device + Byte devInfo; // <- device info + Byte remoteCmd; // -> remote command (e.g.: flash/erase/both) + Byte response; // <- response from flash/ident code + Byte spareByte; // <-> filler (byte for word alignment) + DWord spareDWord; // <-> spare + } sysPktExecFlashType; +typedef sysPktExecFlashType* sysPktExecFlashPtr; + +// remoteCmd values sent to flash code: +#define remoteCmdErase 0x01 // tells flash code to erase block(s) +#define remoteCmdFlash 0x02 // tells flash code to flash block(s) +#define remoteCmdROMSig 0x04 // tells flash code to write ROM signature +#define remoteCmdUnlocked 0x08 // tells flash code to check block lock status + +// response values returned by flash write/identify code: +#define respNoErr 0 // no error +#define respNoFlashBase 1 // flashBase not specified +#define respIdentFailed 2 // can't identify flash part +#define respNoBytes 3 // numBytes not specified +#define respPartialBlock 4 // numBytes not multiple of flash sub-block size +#define respTooManyBytes 5 // numBytes too high +#define respEraseFailed 6 // erase command failed +#define respNotErased 7 // erase verification failed +#define respFlashFailed 8 // flash command failed +#define respInvalidFlashDeviceID 9 // unrecognized device code +#define respBlockLocked 10 // block is locked +#define respBadCommand 11 // remoteCmd not supported + +//-------------------------------------------------------------------- +// sysPktGetTrapBreaksCmd +// +// - Get Trap Breaks +//-------------------------------------------------------------------- +typedef struct SysPktGetTrapBreaksCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktGetTrapBreaksCmdType; +typedef SysPktGetTrapBreaksCmdType* SysPktGetTrapBreaksCmdPtr; + +typedef struct SysPktGetTrapBreaksRspType { + _sysPktBodyCommon; // Common Body header + //Word trapBP[dbgTotalTrapBreaks]; + } SysPktGetTrapBreaksRspType; +typedef SysPktGetTrapBreaksRspType* SysPktGetTrapBreaksRspPtr; + + +//-------------------------------------------------------------------- +// sysPktSetTrapBreaksCmd +// +// - Set Trap Breaks +//-------------------------------------------------------------------- +typedef struct SysPktSetTrapBreaksCmdType { + _sysPktBodyCommon; // Common Body header + //Word trapBP[dbgTotalTrapBreaks]; + } SysPktSetTrapBreaksCmdType; +typedef SysPktSetTrapBreaksCmdType* SysPktSetTrapBreaksCmdPtr; + +typedef struct SysPktSetTrapBreaksRspType { + _sysPktBodyCommon; // Common Body header + } SysPktSetTrapBreaksRspType; +typedef SysPktSetTrapBreaksRspType* SysPktSetTrapBreaksRspPtr; + + + +//-------------------------------------------------------------------- +// sysPktGetTrapConditionsCmd +// +// Get Trap Conditionals. These are used to tell the debugger +// to conditionally break on a trap depending on the value of the +// first word on the stack. They are used when setting a-traps on +// library calls. This is a 3.0 feature. +//-------------------------------------------------------------------- +typedef struct SysPktGetTrapConditionsCmdType { + _sysPktBodyCommon; // Common Body header + } SysPktGetTrapConditionsCmdType; +typedef SysPktGetTrapConditionsCmdType* SysPktGetTrapConditionsCmdPtr; + +typedef struct SysPktGetTrapConditionsRspType { + _sysPktBodyCommon; // Common Body header + //Word trapParam[dbgTotalTrapBreaks]; + } SysPktGetTrapConditionsRspType; +typedef SysPktGetTrapConditionsRspType* SysPktGetTrapConditionsRspPtr; + + +//-------------------------------------------------------------------- +// sysPktSetTrapConditionsCmd +// +// Set Trap Conditionals. These are used to tell the debugger +// to conditionally break on a trap depending on the value of the +// first word on the stack. They are used when setting a-traps on +// library calls. This is a 3.0 feature. +//-------------------------------------------------------------------- +typedef struct SysPktSetTrapConditionsCmdType { + _sysPktBodyCommon; // Common Body header + //Word trapParam[dbgTotalTrapBreaks]; + } SysPktSetTrapConditionsCmdType; +typedef SysPktSetTrapConditionsCmdType* SysPktSetTrapConditionsCmdPtr; + +typedef struct SysPktSetTrapConditionsRspType { + _sysPktBodyCommon; // Common Body header + } SysPktSetTrapConditionsRspType; +typedef SysPktSetTrapConditionsRspType* SysPktSetTrapConditionsRspPtr; + + + + + +// The following indicates how much space in debugger globals we've reserved for +// the SerialLibrary globals for the Debugger. Reserve 8 extra bytes for +// patching. +#define dbgSerRsvGlobalsSize 32 + + + + +/*********************************************************************** + * Stucture of Debugger Globals + ***********************************************************************/ +struct DbgGlobalsType { + // Saved registers + M68KRegsType reg; + + // Breakpoints and saved opcodes behind each one + Boolean romBP; + Boolean stepOverBP; // true if single-stepping over a BP + BreakpointType bp[dbgTotalBreakpoints]; + Word bpOpcode[dbgTotalBreakpoints]; + + // Current trap breaks + Word trapBreak[dbgTotalTrapBreaks]; + Word trapParam[dbgTotalTrapBreaks]; + DWord oldDispatcher; // saved trap dispatcher + Boolean breakingOnATrap; // set by debugger trap dispatcher + + // Mode settings + Boolean ignoreDbgBreaks; // if true, ignore DbgBreak's + Boolean commOpened; // if true, comm library and socket have been + // opened. + + // Step spy support + Boolean stepSpy; // true if step spying. + DWord ssAddr; // address to step spy on + DWord ssValue; // saved value + + // Exception type + Word excType; // why we entered debugger + Byte reEntered; // true if we re-entered + Byte firstEntrance; // true first time we enter debugger + + // Debugger Serial Library globals + Byte serGlobals[dbgSerRsvGlobalsSize]; // Debugger Serial globals + + // Saved bus error exception info + DWord busErrStack[2]; // first 2 long words of bus error stack frame + + // Debugger Stack + Byte stack[dbgStackSize]; // Debugger stack + Word stackEnd; // End of stack + + }; + +typedef struct DbgGlobalsType DbgGlobalsType; + +typedef DbgGlobalsType* DbgGlobalsPtr; + + + +#endif // __DEBUGMGR_H__ +#endif // NON_PORTABLE + diff --git a/sdk-3.1/include/Core/System/Encrypt.h b/sdk-3.1/include/Core/System/Encrypt.h new file mode 100644 index 0000000..cf9bb3d --- /dev/null +++ b/sdk-3.1/include/Core/System/Encrypt.h @@ -0,0 +1,57 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * Encrypt.h + * + * Description: + * Equates for encryption/digestion routines in pilot + * + * History: + * 7/31/96 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __ENCRYPT_H__ +#define __ENCRYPT_H__ + + + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Perform reversible encryption or decryption of 8 byte string in +// srcP using 8 byte key keyP. Place 8 byte result in dstP. +Err EncDES(BytePtr srcP, BytePtr keyP, BytePtr dstP, Boolean encrypt) + SYS_TRAP(sysTrapEncDES); + + +// Digest a string of bytes and produce a 128 bit result using +// the MD4 algorithm. +Err EncDigestMD4(BytePtr strP, Word strLen, Byte digestP[16]) + SYS_TRAP(sysTrapEncDigestMD4); + + +// Digest a string of bytes and produce a 128 bit result using +// the MD5 algorithm. +Err EncDigestMD5(BytePtr strP, Word strLen, Byte digestP[16]) + SYS_TRAP(sysTrapEncDigestMD5); + + + +#ifdef __cplusplus +} +#endif + + + +#endif //__ENCRYPT_H__ + diff --git a/sdk-3.1/include/Core/System/ErrorMgr.h b/sdk-3.1/include/Core/System/ErrorMgr.h new file mode 100644 index 0000000..22ffc3d --- /dev/null +++ b/sdk-3.1/include/Core/System/ErrorMgr.h @@ -0,0 +1,283 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * ErrorMgr.h + * + * Description: + * Include file for Error Management + * + * History: + * 10/25/94 RM - Created by Ron Marianetti + * + *----------------------------------------------------------------------- + * Exception Handling + * + * This unit implements an exception handling mechanism that is similar + * to "real" C++ Exceptions. Our Exceptions are untyped, and there + * must be one and only one Catch block for each Try block. + * + * Try/Catch Syntax: + * + * ErrTry { + * // Do something which may fail. + * // Call ErrThrow() to signal failure and force jump + * // to the following Catch block. + * } + * + * ErrCatch(inErr) { + * // Recover or cleanup after a failure in the above Try block. + * // "inErr" is an ExceptionCode identifying the reason + * // for the failure. + * + * // You may call Throw() if you want to jump out to + * // the next Catch block. + * + * // The code in this Catch block does not execute if + * // the above Try block completes without a Throw. + * + * } ErrEndCatch + * + * You must structure your code exactly as above. You can't have a + * ErrTry { } without a ErrCatch { } ErrEndCatch, or vice versa. + * + * + * ErrThrow + * + * To signal failure, call ErrThrow() from within a Try block. The + * Throw can occur anywhere in the Try block, even within functions + * called from the Try block. A ErrThrow() will jump execution to the + * start of the nearest Catch block, even across function calls. + * Destructors for stack-based objects which go out of scope as + * a result of the ErrThrow() are called. + * + * You can call ErrThrow() from within a Catch block to "rethrow" + * the exception to the next nearest Catch block. + * + * + * Exception Codes + * + * An ExceptionCode is a 32-bit number. You will normally use + * Pilot error codes, which are 16-bit numbers. This allows + * plently of room for defining codes for your own kinds of errors. + * + * + * Limitations + * + * Try/Catch and Throw are based on setjmp/longjmp. At the + * beginning of a Try block, setjmp saves the machine registers. + * Throw calls longjmp, which restores the registers and jumps + * to the beginning of the Catch block. Therefore, any changes + * in the Try block to variables stored in registers will not + * be retained when entering the Catch block. + * + * The solution is to declare variables that you want to use + * in both the Try and Catch blocks as "volatile". For example: + * + * volatile long x = 1; // Declare volatile local variable + * ErrTry { + * x = 100; // Set local variable in Try + * ErrThrow(-1); + * } + * + * ErrCatch(inErr) { + * if (x > 1) { // Use local variable in Catch + * SysBeep(1); + * } + * } ErrEndCatch + * + * + *******************************************************************/ + +#ifndef __ERRORMGR_H__ +#define __ERRORMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +#if EMULATION_LEVEL != EMULATION_NONE +#include +#endif + +/************************************************************ + * Macros for Showing Errors + * + ********************************************************************/ + + +//------------------------------------------------------------ +// Full Error Checking +//------------------------------------------------------------ +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + +#define ErrFatalDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + +#define ErrFatalDisplayIf(condition, msg) \ + {if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg);} + +#define ErrNonFatalDisplayIf(condition, msg) \ + {if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg);} + +#define ErrNonFatalDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + + + + +//------------------------------------------------------------ +// Fatal Error Checking Only +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_PARTIAL + +#define ErrFatalDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + +#define ErrFatalDisplayIf(condition, msg) \ + {if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg);} + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplay(msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, __LINE__, msg) + + + +//------------------------------------------------------------ +// No Error Checking +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_NONE + +#define ErrFatalDisplay(msg) + +#define ErrFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplay(msg) + +#define ErrDisplay(msg) + + +//------------------------------------------------------------ +// Not Defined... +//------------------------------------------------------------ +#else +#error ERROR: the compiler define 'ERROR_CHECK_LEVEL' must be defined! + +#endif // ERROR_CHECK_LEVEL + + + + +/******************************************************************** + * Try / Catch / Throw support + * + * --------------------------------------------------------------------- + * Exception Handler structure + * + * An ErrExceptionType object is created for each ErrTry & ErrCatch block. + * At any point in the program, there is a linked list of + * ErrExceptionType objects. GErrFirstException points to the + * most recently entered block. A ErrExceptionType blocks stores + * information about the state of the machine (register values) + * at the start of the Try block + ********************************************************************/ + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrJumpBuf jmp_buf +#else + typedef long* ErrJumpBuf[12]; // D3-D7,PC,A2-A7 +#endif + +// Structure used to store Try state. +typedef struct ErrExceptionType { + struct ErrExceptionType* nextP; // next exception type + ErrJumpBuf state; // setjmp/longjmp storage + Long err; // Error code + } ErrExceptionType; +typedef ErrExceptionType* ErrExceptionPtr; + + +// Try & Catch macros +#define ErrTry \ + { \ + ErrExceptionType _TryObject; \ + _TryObject.err = 0; \ + _TryObject.nextP = (ErrExceptionPtr)*ErrExceptionList(); \ + *ErrExceptionList() = (Ptr)&_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 Word 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() = (Ptr)_TryObject.nextP; \ + } \ + else { \ + Long theErr = _TryObject.err; \ + *ErrExceptionList() = (Ptr)_TryObject.nextP; + + +#define ErrEndCatch \ + } \ + } + + + +/******************************************************************** + * Error Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrSetJump(buf) setjmp(buf) + #define ErrLongJump(buf,res) longjmp(buf,res) + +#else + Int ErrSetJump(ErrJumpBuf buf) + SYS_TRAP(sysTrapErrSetJump); + + void ErrLongJump(ErrJumpBuf buf, Int result) + SYS_TRAP(sysTrapErrLongJump); +#endif + +Ptr* ErrExceptionList(void) + SYS_TRAP(sysTrapErrExceptionList); + +void ErrThrow(Long err) + SYS_TRAP(sysTrapErrThrow); + +void ErrDisplayFileLineMsg(const Char * const filename, UInt lineNo, + const Char * const msg) + SYS_TRAP(sysTrapErrDisplayFileLineMsg); + +#ifdef __cplusplus +} +#endif + + + + +#endif // __ERRORMGR_H__ + + + + diff --git a/sdk-3.1/include/Core/System/ExgLib.h b/sdk-3.1/include/Core/System/ExgLib.h new file mode 100644 index 0000000..a390665 --- /dev/null +++ b/sdk-3.1/include/Core/System/ExgLib.h @@ -0,0 +1,124 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * ExgLib.h + * + * 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 + * + *******************************************************************/ + +#ifndef __EXG_LIB_H +#define __EXG_LIB_H + +#include +#include +#include + +// special exchange mgr event key +#define exgIntDataChr 0x01ff + +//----------------------------------------------------------------------------- +// 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!!! +//----------------------------------------------------------------------------- +#pragma mark Traps +typedef enum { + exgLibTrapHandleEvent = sysLibTrapCustom, + exgLibTrapConnect, + exgLibTrapAccept, + exgLibTrapDisconnect, + exgLibTrapPut, + exgLibTrapGet, + exgLibTrapSend, + exgLibTrapReceive, + exgLibTrapControl, + exgLibReserved1, + exgLibTrapLast + } ExgLibTrapNumberEnum; + + +/************************************************************ + * Net Library procedures. + *************************************************************/ +#pragma mark Functions +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +// Open the library - enable server for receiving data. +Err ExgLibOpen (Word libRefnum) + SYS_TRAP(sysLibTrapOpen); + +Err ExgLibClose (Word libRefnum) + SYS_TRAP(sysLibTrapClose); + +Err ExgLibSleep (Word libRefnum) + SYS_TRAP(sysLibTrapSleep); + +Err ExgLibWake (Word libRefnum) + SYS_TRAP(sysLibTrapWake); + +// Handle events that this library needs. This will be called by +// sysHandle event when certain low level events are triggered. +Err ExgLibHandleEvent(Word libRefnum,VoidPtr eventP) + SYS_TRAP(exgLibTrapHandleEvent); + +// Establish a new connection +Err ExgLibConnect(UInt libRefNum,ExgSocketPtr exgSocketP) + SYS_TRAP(exgLibTrapConnect); + +// Accept a connection request from remote end +Err ExgLibAccept(Word libRefnum,ExgSocketPtr exgSocketP) + SYS_TRAP(exgLibTrapAccept); + +// Disconnect +Err ExgLibDisconnect(Word libRefnum,ExgSocketPtr exgSocketP,Err error) + SYS_TRAP(exgLibTrapDisconnect); + +// Initiate a Put command. This passes the name and other information about +// an object to be sent +Err ExgLibPut(Word libRefnum,ExgSocketPtr exgSocketP) + SYS_TRAP(exgLibTrapPut); + +// Initiate a Get command. This requests an object from the remote end. +Err ExgLibGet(UInt libRefNum,ExgSocketPtr exgSocketP) + SYS_TRAP(exgLibTrapGet); + +// Send data to remote end - called after a Put command +ULong ExgLibSend(UInt libRefNum, ExgSocketPtr exgSocketP, const void * const bufP, const ULong bufLen, Err *errP) + SYS_TRAP(exgLibTrapSend); + +// Receive data from remote end -- called after Accept +ULong ExgLibReceive(UInt libRefNum, ExgSocketPtr exgSocketP, VoidPtr bufP, const ULong bufSize, Err *errP) + SYS_TRAP(exgLibTrapReceive); + +// Send various option commands to the Exg library +Err ExgLibControl(UInt libRefNum, Word op, VoidPtr valueP, WordPtr valueLenP) + SYS_TRAP(exgLibTrapControl); + + +#ifdef __cplusplus +} +#endif + +#endif // EXG_LIB_H diff --git a/sdk-3.1/include/Core/System/ExgMgr.h b/sdk-3.1/include/Core/System/ExgMgr.h new file mode 100644 index 0000000..33f1d2b --- /dev/null +++ b/sdk-3.1/include/Core/System/ExgMgr.h @@ -0,0 +1,161 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * ExgMgr.h + * + * Description: + * Include file for Exg system functions + * + * History: + * 5/23/97 Created by Gavin Peacock + * + *******************************************************************/ + +#ifndef __EXGMGR_H +#define __EXGMGR_H + +#ifndef __COMMON_H__ +#include +#endif + +#include + +#define exgMemError (exgErrorClass | 1) +#define exgErrStackInit (exgErrorClass | 2) // stack could not initialize +#define exgErrUserCancel (exgErrorClass | 3) +#define exgErrNoReceiver (exgErrorClass | 4) // receiver device not found +#define exgErrNoKnownTarget (exgErrorClass | 5) // can't find a target app +#define exgErrTargetMissing (exgErrorClass | 6) // target app is known but missing +#define exgErrNotAllowed (exgErrorClass | 7) // operation not allowed +#define exgErrBadData (exgErrorClass | 8) // internal data was not valid +#define exgErrAppError (exgErrorClass | 9) // generic application error +#define exgErrUnknown (exgErrorClass | 10) // unknown general error +#define exgErrDeviceFull (exgErrorClass | 11) // device is full +#define exgErrDisconnected (exgErrorClass | 12) // link disconnected +#define exgErrNotFound (exgErrorClass | 13) // requested object not found +#define exgErrBadParam (exgErrorClass | 14) // bad parameter to call +#define exgErrNotSupported (exgErrorClass | 15) // operation not supported by this library +#define exgErrDeviceBusy (exgErrorClass | 16) // device is busy +#define exgErrBadLibrary (exgErrorClass | 17) // bad or missing ExgLibrary + + +typedef struct { + Word dbCardNo; // card number of the database + LocalID dbID; // LocalID of the database + Word recordNum; // index of record that contain a match + DWord uniqueID; // postion in record of the match. + DWord matchCustom; // application specific info +} ExgGoToType; + +typedef ExgGoToType * ExgGoToPtr; + + +typedef struct ExgSocketType { + Word libraryRef; // identifies the Exg library in use + ULong socketRef; // used by Exg library to identify this connection + ULong target; // Creator ID of application this is sent to + ULong count; // # of objects in this connection (usually 1) + ULong length; // # total byte count for all objects being sent (optional) + ULong time; // last modified time of object (optional) + DWord appData; // application specific info + ULong goToCreator; // creator ID of app to launch with goto after receive + ExgGoToType goToParams; // If launchCreator then this contains goto find info + Word localMode:1; // Exchange with local machine only mode + Word packetMode:1; // Use connectionless packet mode (Ultra) + Word reserved:14; // reserved system flags + CharPtr description;// text description of object (for user) + CharPtr type; // Mime type of object (optional) + CharPtr name; // name of object, generally a file name (optional) +} ExgSocketType; +typedef ExgSocketType* ExgSocketPtr; + + +// structures used for sysAppLaunchCmdExgAskUser launch code parameter +// default is exgAskDialog (ask user with dialog... +typedef enum { exgAskDialog,exgAskOk,exgAskCancel } ExgAskResultType; + +typedef struct { + ExgSocketPtr socketP; + ExgAskResultType result; // what to do with dialog +} ExgAskParamType; +typedef ExgAskParamType * ExgAskParamPtr; + +#define exgSeparatorChar '\t' // char used to separate multiple registry entries + +#define exgRegLibraryID 0xfffc // library register thier presence +#define exgRegExtensionID 0xfffd // filename extenstion registry +#define exgRegTypeID 0xfffe // MIME type registry + +#define exgDataPrefVersion 0 +#define exgMaxTitleLen 20 // max size for title from exgLibCtlGetTitle + +#define exgLibCtlGetTitle 1 // get title for Exg dialogs +#define exgLibCtlSpecificOp 0x8000 // start of range for library specific control codes + + +typedef Err (*ExgDBReadProcPtr) + (void* dataP, ULong* sizeP, void* userDataP); + +typedef Boolean (*ExgDBDeleteProcPtr) + (const char* nameP, Word version, Int cardNo, + LocalID dbID, void* userDataP); + +typedef Err (*ExgDBWriteProcPtr) + (const void* dataP, ULong* sizeP, void* userDataP); + + +Err ExgInit(void) + SYS_TRAP(sysTrapExgInit); + +Err ExgConnect(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgConnect); + +Err ExgPut(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgPut); + +Err ExgGet(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgGet); + +Err ExgAccept(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgAccept); + +Err ExgDisconnect(ExgSocketPtr socketP,Err error) + SYS_TRAP(sysTrapExgDisconnect); + +ULong ExgSend(ExgSocketPtr socketP, const void * const bufP, const ULong bufLen,Err* err) + SYS_TRAP(sysTrapExgSend); + +ULong ExgReceive(ExgSocketPtr socketP, VoidPtr bufP, const ULong bufLen, Err* err) + SYS_TRAP(sysTrapExgReceive); + +Err ExgRegisterData(const DWord creatorID, const Word id,const Char * const dataTypesP) + SYS_TRAP(sysTrapExgRegisterData); + +Err ExgNotifyReceive(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgNotifyReceive); + + +Err ExgDBRead( + ExgDBReadProcPtr readProcP, + ExgDBDeleteProcPtr deleteProcP, + void* userDataP, + LocalID* dbIDP, + Int cardNo, + Boolean* needResetP, + Boolean keepDates) + SYS_TRAP(sysTrapExgDBRead); + +Err ExgDBWrite( + ExgDBWriteProcPtr writeProcP, + void* userDataP, + const char* nameP, + LocalID dbID, + Int cardNo) + SYS_TRAP(sysTrapExgDBWrite); + + + +#endif // __EXGMGR_H diff --git a/sdk-3.1/include/Core/System/FatalAlert.h b/sdk-3.1/include/Core/System/FatalAlert.h new file mode 100644 index 0000000..f67ecdb --- /dev/null +++ b/sdk-3.1/include/Core/System/FatalAlert.h @@ -0,0 +1,28 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: window.h + * AUTHOR: Art Lamb: September 12, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines window structures and routines. + * + **********************************************************************/ +#ifndef __FATAL_ALERT_H__ +#define __FATAL_ALERT_H__ + +// Value retunred by FatalAlert +#define fatalReset 0 +#define fatalEnterDebugger 1 +#define fatalDoNothing 0xFFFFU + +UInt SysFatalAlert (CharPtr msg) + SYS_TRAP(sysTrapSysFatalAlert); + +#endif + diff --git a/sdk-3.1/include/Core/System/FeatureMgr.h b/sdk-3.1/include/Core/System/FeatureMgr.h new file mode 100644 index 0000000..008122d --- /dev/null +++ b/sdk-3.1/include/Core/System/FeatureMgr.h @@ -0,0 +1,87 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * FeatureMgr.h + * + * Description: + * Header for the Feature Manager + * + * History: + * 11/14/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __FEATUREMGR_H__ +#define __FEATUREMGR_H__ + + +#include + + + +/************************************************************ + * Feature manager error codes + * the constant ftrErrorClass is defined in SystemMgr.h + *************************************************************/ +#define ftrErrInvalidParam (ftrErrorClass | 1) +#define ftrErrNoSuchFeature (ftrErrorClass | 2) +#define ftrErrAlreadyExists (ftrErrorClass | 3) +#define ftrErrROMBased (ftrErrorClass | 4) +#define ftrErrInternalErr (ftrErrorClass | 5) + + +/************************************************************ + * Feature Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Init the feature Manager +Err FtrInit(void) + SYS_TRAP(sysTrapFtrInit); + + +// Get a feature +Err FtrGet(DWord creator, UInt featureNum, DWordPtr valueP) + SYS_TRAP(sysTrapFtrGet); + +// Set/Create a feature. +Err FtrSet(DWord creator, UInt featureNum, DWord newValue) + SYS_TRAP(sysTrapFtrSet); + +// Unregister a feature +Err FtrUnregister(DWord creator, UInt featureNum) + SYS_TRAP(sysTrapFtrUnregister); + +// Get a feature by index +Err FtrGetByIndex(UInt index, Boolean romTable, + DWordPtr creatorP, UIntPtr numP, DWordPtr valueP) + SYS_TRAP(sysTrapFtrGetByIndex); + +// Get temporary space from storage heap +Err FtrPtrNew(DWord creator, UInt featureNum, ULong size, + VoidPtr *newPtrP) + SYS_TRAP(sysTrapFtrPtrNew); + +// Release temporary space to storage heap +Err FtrPtrFree(DWord creator, UInt featureNum) + SYS_TRAP(sysTrapFtrPtrFree); + + +// Resize block of temporary storage +Err FtrPtrResize(DWord creator, UInt featureNum, ULong newSize, + VoidPtr *newPtrP) + SYS_TRAP(sysTrapFtrPtrResize); + + +#ifdef __cplusplus +} +#endif + +#endif // __FEATUREMGR_H__ + diff --git a/sdk-3.1/include/Core/System/FileStream.h b/sdk-3.1/include/Core/System/FileStream.h new file mode 100644 index 0000000..0c29e91 --- /dev/null +++ b/sdk-3.1/include/Core/System/FileStream.h @@ -0,0 +1,337 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * FileStream.h + * + * 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 + * + *******************************************************************/ + +#ifndef __FILESTREAM_H__ +#define __FILESTREAM_H__ + +/************************************************************ + * File Stream error codes + * the constant dmErrorClass is defined in SystemMgr.h + *************************************************************/ + +#define fileErrMemError (fileErrorClass | 1) // out of memory error +#define fileErrInvalidParam (fileErrorClass | 2) // invalid parameter value passed +#define fileErrCorruptFile (fileErrorClass | 3) // the file is corrupted/invalid/not a stream file +#define fileErrNotFound (fileErrorClass | 4) // couldn't find the file +#define fileErrTypeCreatorMismatch (fileErrorClass | 5) // file's type and creator didn't match those expected +#define fileErrReplaceError (fileErrorClass | 6) // couldn't replace an existing file +#define fileErrCreateError (fileErrorClass | 7) // couldn't create a new file +#define fileErrOpenError (fileErrorClass | 8) // generic open error +#define fileErrInUse (fileErrorClass | 9) // file couldn't be opened or deleted because it is in use +#define fileErrReadOnly (fileErrorClass | 10)// couldn't open in write mode because db is read-only +#define fileErrInvalidDescriptor (fileErrorClass | 11)// invalid file descriptor (FileHandle) +#define fileErrCloseError (fileErrorClass | 12)// error closing the database +#define fileErrOutOfBounds (fileErrorClass | 13)// attempted operation went out of bounds of the file +#define fileErrPermissionDenied (fileErrorClass | 14)// couldn't write to a file open for read-only access +#define fileErrIOError (fileErrorClass | 15)// general I/O error +#define fileErrEOF (fileErrorClass | 16)// end-of-file error +#define fileErrNotStream (fileErrorClass | 17)// attempted to open a file that is not a stream + + + +/************************************************************ + * File Stream handle type + *************************************************************/ +typedef VoidHand FileHand; + +#define fileNullHandle ((FileHand)0) + + +/************************************************************ + * Mode flags passed to FileOpen + *************************************************************/ + +// fileModeReadOnly, fileModeReadWrite, fileModeUpdate, and fileModeAppend are mutually exclusive - only +// pass one of them to FileOpen! +#define fileModeReadOnly (0x80000000UL) // open for read access +#define fileModeReadWrite (0x40000000UL) // create for read/write access, discarding previous if any */ +#define fileModeUpdate (0x20000000UL) // open/create for read/write, preserving previous if any +#define fileModeAppend (0x10000000UL) // open/create for read/write, always writing at the end + +#define fileModeLeaveOpen (0x08000000UL) // leave open when app quits +#define fileModeExclusive (0x04000000UL) // don't let anyone else open it +#define fileModeAnyTypeCreator (0x02000000UL) // if set, skip type/creator validation when + // opening or replacing an existing file + +#define fileModeTemporary (0x01000000UL) // 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 SystemMgr.rh 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) + +#define fileModeDontOverwrite (0x00800000UL) // if set, will prevent fileModeReadWrite from discarding an existing file + // with the same name; may only be specified together with fileModeReadWrite + +// For debugging/validation +#define fileModeAllFlags ( fileModeReadOnly | \ + fileModeReadWrite | \ + fileModeUpdate | \ + fileModeAppend | \ + fileModeLeaveOpen | \ + fileModeExclusive | \ + fileModeAnyTypeCreator | \ + fileModeTemporary | \ + fileModeDontOverwrite ) + +/************************************************************ + * Origin passed to FileSetPos + *************************************************************/ +typedef enum FileOriginEnum { + + fileOriginBeginning = 1, // from the beginning (first data byte of file) + fileOriginCurrent, // from the current position + fileOriginEnd // from the end of file (one position beyond last data byte) + + } FileOriginEnum; + + + +/************************************************************ + * Operation passed to FileControl + *************************************************************/ +typedef enum FileOpEnum { + fileOpNone = 0, // no-op + + fileOpDestructiveReadMode, // 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, // 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, // 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, // 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, // 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, // 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 Long 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, // 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 Long 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, // flush any cached data to storage + // ARGUMENTS: + // stream = open stream handle + // valueP = NULL + // valueLenP = NULL + // RETURNS: + // zero on success; fileErr... on error; + + + + + fileOpLAST // ***ADD NEW OPERATIONS BEFORE THIS ENTRY*** + // *** AND ALWAYS AFTER EXISTING ENTRIES *** + // *** FOR BACKWARD COMPATIBILITY *** + } FileOpEnum; + + +/************************************************************ + * File Stream procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Open/create a file stream (name must all be valid -- non-null, non-empty) +// (errP is optional - set to NULL to ignore) +extern FileHand FileOpen(UInt cardNo, CharPtr nameP, ULong type, ULong creator, + DWord openMode, Err* errP) + SYS_TRAP(sysTrapFileOpen); + +// Close the file stream +extern Err FileClose(FileHand stream) + SYS_TRAP(sysTrapFileClose); + +// Delete a file +extern Err FileDelete(UInt cardNo, CharPtr nameP) + SYS_TRAP(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: Long FileRead(FileHand stream, VoidPtr bufP, Long objSize, Long 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 + * + ***********************************************************************/ +#define FileRead(stream, bufP, objSize, numObj, errP) \ + FileReadLow((stream), (bufP), 0/*offset*/, false/*dataStoreBased*/, \ + (objSize), (numObj), (errP)) + + +/*********************************************************************** + * + * MACRO: FileDmRead + * + * DESCRIPTION: Read data from a file into a data storage heap-based chunk, record + * or resource. + * + * PROTOTYPE: Long FileDmRead(FileHand stream, VoidPtr startOfDmChunkP, Long destOffset, + * Long objSize, Long 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 + * + ***********************************************************************/ +#define FileDmRead(stream, startOfDmChunkP, destOffset, objSize, numObj, errP) \ + FileReadLow((stream), (startOfDmChunkP), (destOffset), true/*dataStoreBased*/, \ + (objSize), (numObj), (errP)) + + +// 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) +extern Long FileReadLow(FileHand stream, VoidPtr baseP, Long offset, Boolean dataStoreBased, Long objSize, + Long numObj, Err* errP) + SYS_TRAP(sysTrapFileReadLow); + +// Write data to a file stream +// (errP is optional - set to NULL to ignore) +extern Long FileWrite(FileHand stream, VoidPtr dataP, Long objSize, + Long numObj, Err* errP) + SYS_TRAP(sysTrapFileWrite); + +// Set position within a file stream +extern Err FileSeek(FileHand stream, Long offset, FileOriginEnum origin) + SYS_TRAP(sysTrapFileSeek); + +#define FileRewind(__stream__) \ + (FileClearerr((__stream__)), FileSeek((__stream__), 0, fileOriginBeginning)) + +// Get current position and filesize +// (fileSizeP and errP are optional - set to NULL to ignore) +extern Long FileTell(FileHand stream, LongPtr fileSizeP, Err* errP) + SYS_TRAP(sysTrapFileTell); + +// Truncate a file +extern Err FileTruncate(FileHand stream, Long newSize) + SYS_TRAP(sysTrapFileTruncate); + +// Returns the error code from the last operation on this file stream; +// if resetLastError is non-zero, resets the error status +extern Err FileControl(FileOpEnum op, FileHand stream, VoidPtr valueP, LongPtr valueLenP) + SYS_TRAP(sysTrapFileControl); + +#define FileEOF(__stream__) \ + (FileControl(fileOpGetEOFStatus, (__stream__), NULL, NULL) == fileErrEOF) + +#define FileError(__stream__) \ + FileControl(fileOpGetIOErrorStatus, (__stream__), NULL, NULL) + +#define FileClearerr(__stream__) \ + FileControl(fileOpClearError, (__stream__), NULL, NULL) + +#define FileGetLastError(__stream__) \ + FileControl(fileOpGetLastError, (__stream__), NULL, NULL) + + +#define FileFlush(__stream__) \ + FileControl(fileOpFlush, (__stream__), NULL, NULL) + + + +#ifdef __cplusplus +} +#endif + + +#endif // #ifndef __FILESTREAM_H__ diff --git a/sdk-3.1/include/Core/System/FloatMgr.h b/sdk-3.1/include/Core/System/FloatMgr.h new file mode 100644 index 0000000..a5fba51 --- /dev/null +++ b/sdk-3.1/include/Core/System/FloatMgr.h @@ -0,0 +1,103 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * FloatMgr.h + * + * Description: + * Floating point routines + * + * History: + * 3/9/95 - Created by Ron Marianetti + * + *******************************************************************/ + + +#ifndef __FLOATMGR_H__ +#define __FLOATMGR_H__ + +#include + +/************************************************************************ + * Constants + ***********************************************************************/ +#define fMaxLong ((Long)0x7FFFFFFF) +#define fMinLong ((Long)0x80000000) + + +/************************************************************************ + * Floating point type + * An exponent of kExpInf represents infinity + ***********************************************************************/ +typedef struct { + DWord man; // unsigned 32 bit + SWord exp; // signed 16 bit + SByte sign; // +/- 1 + } FloatType; +#define kExpInf 16000 + + + +/******************************************************************* + * Floating pointer Library Errors + * The constant fplErrorClass is defined in SystemMgr.h + *******************************************************************/ +#define fplErrOutOfRange (fplErrorClass | 1) + + +/************************************************************ + * Floating point manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err FplInit(void) + SYS_TRAP(sysTrapFplInit); + +void FplFree(void) + SYS_TRAP(sysTrapFplFree); + +Err FplFToA(FloatType a, char* s) + SYS_TRAP(sysTrapFplFToA); + +FloatType FplAToF(char* s) + SYS_TRAP(sysTrapFplAToF); + +Err FplBase10Info(FloatType a, ULong* mantissaP, Int* exponentP, + Int* signP) + SYS_TRAP(sysTrapFplBase10Info); + +FloatType FplLongToFloat(Long x) + SYS_TRAP(sysTrapFplLongToFloat); + +Long FplFloatToLong(FloatType f) + SYS_TRAP(sysTrapFplFloatToLong); + +ULong FplFloatToULong(FloatType f) + SYS_TRAP(sysTrapFplFloatToULong); + + +FloatType FplMul(FloatType a, FloatType b) + SYS_TRAP(sysTrapFplMul); + +FloatType FplAdd(FloatType a, FloatType b) + SYS_TRAP(sysTrapFplAdd); + +FloatType FplSub(FloatType a, FloatType b) + SYS_TRAP(sysTrapFplSub); + +FloatType FplDiv(FloatType dividend, FloatType divisor) + SYS_TRAP(sysTrapFplDiv); + + +#ifdef __cplusplus +} +#endif + + +#endif //__FLOATMGR_H__ + + diff --git a/sdk-3.1/include/Core/System/Globals.h b/sdk-3.1/include/Core/System/Globals.h new file mode 100644 index 0000000..f7614b4 --- /dev/null +++ b/sdk-3.1/include/Core/System/Globals.h @@ -0,0 +1,454 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * Globals.h + * + * Description: + * Structure definition of Pilot globals + * + * History: + * 10/26/94 RM Created by Ron Marianetti + * 4/13/95 VMK Added Sound Manager globals + * 8/15/97 vmk Reused padGlobalsP for sndOffTicks + * 1/18/98 SCL Removed lastActionCodeAppInfoP, added irq globals. + * 3/13/98 srj Added new battery subsystem + * 6/22/98 srj Added new global for software shutdown + * 8/17/98 SCL Synchronized globals between Sumo/Eleven + * 8/26/98 kwk Deleted unused FEP globals pointer. + * 8/28/98 SCL Synchronized globals between Sumo/Eleven + * 10/28/98 SCL Synchronized globals between Sumo/Eleven + * + *******************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __GLOBALS_H__ +#define __GLOBALS_H__ + +#include + +// The following indicates how much space in low memory we've reserved for +// the UI globals. The UI initialization code makes sure that we don't +// overrun this space by comparing the size of the structure UIGlobalsType +// with this constant. + +// Changing this will cause globals after uiGlobals to move including flpSoftFPSCR. +// See note below regarding flpSoftFPSCR and __SoftFPSCR__ in mc68ksfpe.s. +#define sysUIRsvGlobalsSize 0xB0 + + + +/************************************************************ + * Structure of Fixed System Globals + *************************************************************/ +typedef struct FixedGlobalsType { + + // Memory Manager Globals + Byte memCardSlots; // number of memory card slots + Byte dbgWasEntered; // set true the first time debugger is entered + Ptr memCardInfoP; // pointer to array of CardInfoTypes stored + DWord memSemaphoreID; // Memory Manager semaphore + Word memDebugMode; // Current debug mode of Memory Manager + + // Data Manager Globals + Ptr dmOpenList; // Linked list of open databases (DmOpenInfoPtr) + + // Debugger/System Shared globals + Byte dbgInDebugger; // true if in debugger + Byte dbgTracing; // tracing in debugger + Ptr dbgGlobalsP; // pointer to dbgGlobals + Ptr dbgSerGlobalsP; // pointer to Debugger Serial globals + + + // System Manager Globals + Ptr sysAppInfoP; // pointer to SysAppInfoType for system + Ptr sysKernelDataP; // pointer to Kernel data + Ptr* sysDispatchTableP; // pointer to dispatch table + DWord sysOwnerIDsInUse; // 1 bit for each owner ID in use + Ptr sysAMXAppInfoP; // SysAppInfoType for AMX app. + DWord sysClockFreq; // processor clock frequency + DWordPtr sysHardKeyCreators; // ptr to array of App Creator types + + SWord sysBatteryCheckTimer; // # of ticks left before we check battery again + Byte sysBatteryMinThreshold; // System will shut down if battery falls below this + Byte hwrBatteryLevel; // current battery level + SWord sysNextBatteryAlertTimer; // # of ticks till next battery warning (OBSOLETE, See Below) + Byte sysBatteryWarnThreshold; // If battery below this level, post low battery keyboard event + + Byte sysDispatchTableRev; // incremented every time a trap is patched. Used + // by host debugger to invalidate it's cache. + Word sysDispatchTableSize; // # of entries in dispatch table + Ptr sysLibTableP; // (SysLibTblEntryPtr) pointer to Library entries + Word sysLibTableEntries; // size of library table + Ptr sysConsoleStackChunkP; // pointer to console task stack chunk + Ptr sysUIShellAppInfoP; // AppInfoPtr for UIAppShell + + DWord sysTimerID; // TimerID of timer used for periodic system stuff + ULong sysAutoOffEvtTicks; // Ticks of last event - used to support auto-off + Word sysAutoOffSeconds; // Auto-sleep timeout in seconds. + + Long sysRandomSeed; // Random # seed + + + + // Other Manager's globals + Ptr slkGlobalsP; // pointer to serial link globals + Ptr serGlobalsP; // pointer to serial manager globals + Ptr scrGlobalsP; // pointer to screen driver globals + Ptr fplGlobalsP; // pointer to Floating Point Library globals + Ptr penGlobalsP; // Pen manager globals ptr + Ptr sysEvtMgrGlobalsP; // System Event Manager Globals + Ptr sndGlobalsP; // Sound Manager globals + Ptr timGlobalsP; // Time Manager globals + Ptr almGlobalsP; // Alarm Manager globals + Ptr ftrGlobalsP; // pointer to feature manager globals + Ptr grfGlobalsP; // pointer to Graffiti globals + Ptr keyGlobalsP; // Key manager globals + + // UI Globals + Byte uiGlobals[sysUIRsvGlobalsSize]; // Basic UI Globals + Ptr uiExtensionsP; // for future use... + + + // Globals used by UIAppShell in order to manage the launching of UI Apps. +#if EMULATION_LEVEL != EMULATION_NONE + Ptr curUIAppInfoP; // SysAppInfoPtr of current UI App or + // last action code +#else + Ptr unusedPtr; +#endif + + DWord nextUIAppDBID; // Database LocalID of next UI App to launch + Word nextUIAppCmd; // Cmd for next UI App + Ptr nextUIAppCmdPBP; // Cmd ParamBlock Ptr for next UI App + Byte nextUIAppCardNo; // Card number of next UI App to launch + + + // Hardware Manager Globals + SByte hwrDataWELevel; // if > 0, Data area is write enabled + Word hwrWakeUp; // Bit mask of which peripherals need to be + // enabled when system wakes + Byte hwrCPUDutyCycle; // Desired Duty cycle of CPU in 31ths. + Byte hwrPenDown; // last state of pen-down (zero = up + // non-zero = down, number of ticks 'till next sample) + DWord hwrCurTicks; // Current hardware tickCount - + // maintained separately from AMX ticks for performance reasons. + DWord hwrTotalRAMSize; // total RAM Size, used by HwrMemWritable + DWord hwrDozeSubTicks; // # of subTicks we've dozed for since reset + // a sub-tick is 1/4096 seconds. + + // Sound Manager "sound off" ticks + // WAS: Pad server globals pointer + // WAS: Ptr padGlobalsP; // PAD Server globals + DWord sndOffTicks; // # of ticks til disabling the PWM (0 = do nothing) + + // New System globals + Byte sysResetFlags; // Reset flags sysResetFlagXXXX + Byte sysBatteryKind; // SysBatteryKind enumerated type + + // New Memory Manager global for recording minimum heap free - used for debugging only + DWord memMinDynHeapFree; // Minimum free space in dynamic heap + + + // System Preferences flags + Word sysPrefFlags; // System Pref flags: sysPrefFlagXXXX + + + // This is a pointer to the System Manager variable size globals + Ptr sysGlobalsP; // pointer to System Globals + + // Miscellaneous System flags + Word sysMiscFlags; // System Misc flags: sysMiscFlagXXX + + + //----------------------------------------------------------------------- + // New Globals added for the 2.0 release... + //----------------------------------------------------------------------- + Word sysLibNet; // refnum of TCP/IP library + VoidPtr netPktFreeQ; // global needed by Net Library + + + // EventGroupID used by the System Event Manager for blocking on user input + // and by the Net Library for implementing NetLibSelect() + DWord sysEvGroupID; // AMX EventGroup ID. + + + Ptr irq3GlobalsP; // IRQ3 handler globals + + // Tick count last time we displayed a low battery warning. This is used by + // the system timer procedure in AMXHardwareTD1.c to insure that it doesn't + // display low battery warnings more than once/minute. + DWord sysLastBatteryWarning; // tickcount of last warning. + + // Checksum of exception vector area of low memory. Used when ROM built for full + // error checking to make sure no apps overwrite low memory by using null pointers. + DWord sysLowMemChecksum; // checksum of low memory. + + // Hardware rev. This is determined during bootup time. The first shipping rev + // is 1. + Word hwrHardwareRev; // hardware rev. + + + // Handle to list of protected databases + Handle dmProtectListH; // handle to array of protected + // databases (DmProtectEntryType) + // Miscellaneous hardware flags + Word hwrMiscFlags; // Hardware Misc Flags: hwrMiscFlagXXX + + // Support for profiling + DWord sysProfileRefcon; // Refcon value for profiler function + Ptr sysProfileProcP; // Profiler procedure, called if non-zero + // during tick interrupt (100/sec). + + // NewFloatMgr's MWSFPE (MetroWerks Software Floating Point Emulator) + // needs a global to keep track of its status and control. + // This global (__SoftFPSCR__) is referenced by the 68K code located at + // :Libraries:NewFloatMgr:mc68ksfpe.s + DWord flpSoftFPSCR; + + + //----------------------------------------------------------------------- + // New Globals added for the 3.0 release... + //----------------------------------------------------------------------- + Ptr irLibGlobalsP; // Ir Library globals pointer + Word exgActiveLib; // active Exchange library + + Word uiBusyCount; // UI busy counter + + Ptr irq1GlobalsP; // IRQ1 handler globals + Ptr irq2GlobalsP; // IRQ2 handler globals + Ptr irq6GlobalsP; // IRQ6 handler globals + + + //----------------------------------------------------------------------- + // New Globals added for the 3.1 release... + //----------------------------------------------------------------------- + + // Globals for Language support. + Ptr intlMgrGlobalsP; // Int'l Manager globals + + // Globals for Field inline Text Services + Word inlineStart; // Starting position of the inline text + Word inlineEnd; // Ending position of the inline text + Boolean inlineActive; // True if inline text support is active. + Byte inlineReservedFillerByte1; // (for alignment) + VoidPtr inlineStatus; // Ptr to FEP status record. + Word inlineLibRef; // Text Services Library Reference number + Word inlineHighlightLen; // Length of highlighted inline text + + // Added for the battery subsystem + Ptr sysBatteryDataP; // pointer to current battery data + Ptr sysBatteryValidKindsP; // pointer to list of valid batteries + + // Added for the battery subsystem + Boolean sysInShutdown; // True: We are in lockout (Sumo) + Byte sysMinWakeupThreshold; // System can wake up once we're over this voltage + + // More miscellaneous hardware flags + DWord hwrMiscFlagsExt; // Hardware Misc Flags: hwrMiscFlagExtXXX + + // Added to provide critical warning timer + Boolean sysUseCritWarnTimer; + Boolean sysCritWarnTimerRunning; + SWord sysCritWarnRTCDayStarted; + SDWord sysCritWarnTickTimer; + DWord sysCritWarnLastTick; + Boolean sysCharging; + Boolean sysUpdateVoltageLevel; + + // Notification Manager globals: + Handle notifyGlobalsH; // handle to NotifyMgr globals + + // Some globals reserved for future use (only available in 3.1 or later): + DWord sysReserved31DWord1; + DWord sysReserved31DWord2; + DWord sysReserved31DWord3; + DWord sysReserved31DWord4; + + //----------------------------------------------------------------------- + // Put New globals here... + //----------------------------------------------------------------------- + // type newGlobal; + + } FixedGlobalsType; + + +/************************************************************ + * This structure defines the start of the Low Memory Area. + * The complete structure of LowMemory is defined in SystemPrv.h + * and includes this low memory header followed by some variable + * size globals that may change from rev to rev of the System Software. + * + * When emulating under Windows, this structure ends up at some random + * place in memory and the global variable GlobalsP points to it. + * + * When running in the native environment, this structure starts at + * address sysGlobalsOffset. + * + * In order to simplify the source code, macros are defined for + * accessing commonly used globals in the optimim manner for + * each environment. + *************************************************************/ +typedef struct LowMemHdrType { + //--------------------------------------------------------------------------- + // Processor exception table + //--------------------------------------------------------------------------- + M68KExcTableType vectors; // Exception vectors, + // or Card header for RAM only cards + + //--------------------------------------------------------------------------- + // System Globals + //--------------------------------------------------------------------------- + FixedGlobalsType globals; // System Globals + + } LowMemHdrType; + + + +#if EMULATION_LEVEL == EMULATION_NONE + #define PilotGlobalsP 0 +#else + extern Ptr PilotGlobalsP; // pointer to start of Memory card 0 +#endif + + + + + +/************************************************************ + * Macros for accessing globals. + * When emulating, the globals are allocated in a memory chunk and our + * global variable Card0P points to this chunk. + * In native mode, Card0P is defined to be 0 at all times. + *************************************************************/ +#define GMemCardSlots (((LowMemHdrType*)PilotGlobalsP)->globals.memCardSlots) +#define GMemCardInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP) +#define GMemSemaphoreID (((LowMemHdrType*)PilotGlobalsP)->globals.memSemaphoreID) +#define GMemDebugMode (((LowMemHdrType*)PilotGlobalsP)->globals.memDebugMode) +#define GMemMinDynHeapFree (((LowMemHdrType*)PilotGlobalsP)->globals.memMinDynHeapFree) + +#define GDmOpenList (((LowMemHdrType*)PilotGlobalsP)->globals.dmOpenList) +#define GDmProtectListH (((LowMemHdrType*)PilotGlobalsP)->globals.dmProtectListH) + +#define GDbgWasEntered (((LowMemHdrType*)PilotGlobalsP)->globals.dbgWasEntered) +#define GDbgInDebugger (((LowMemHdrType*)PilotGlobalsP)->globals.dbgInDebugger) +#define GDbgTracing (((LowMemHdrType*)PilotGlobalsP)->globals.dbgTracing) +#define GDbgGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.dbgGlobalsP) + +#define GSysAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysAppInfoP) +#define GSysKernelDataP (((LowMemHdrType*)PilotGlobalsP)->globals.sysKernelDataP) +#define GSysDispatchTableP (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableP) +#define GSysDispatchTableSize (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableSize) +#define GSysDispatchTableRev (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableRev) +#define GSysOwnerIDsInUse (((LowMemHdrType*)PilotGlobalsP)->globals.sysOwnerIDsInUse) +#define GSysAMXAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysAMXAppInfoP) +#define GSysClockFreq (((LowMemHdrType*)PilotGlobalsP)->globals.sysClockFreq) +#define GSysHardKeyCreators (((LowMemHdrType*)PilotGlobalsP)->globals.sysHardKeyCreators) +#define GSysNextBatteryAlertTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysNextBatteryAlertTimer) +#define GSysBatteryCheckTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryCheckTimer) +#define GSysBatteryWarnThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryWarnThreshold) +#define GHwrBatteryLevel (((LowMemHdrType*)PilotGlobalsP)->globals.hwrBatteryLevel) +#define GSysBatteryMinThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryMinThreshold) +#define GSysBatteryKind (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryKind) +#define GSysConsoleStackChunkP (((LowMemHdrType*)PilotGlobalsP)->globals.sysConsoleStackChunkP) +#define GSysUIShellAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysUIShellAppInfoP) +#define GSysTimerID (((LowMemHdrType*)PilotGlobalsP)->globals.sysTimerID) +#define GSysAutoOffEvtTicks (((LowMemHdrType*)PilotGlobalsP)->globals.sysAutoOffEvtTicks) +#define GSysAutoOffSeconds (((LowMemHdrType*)PilotGlobalsP)->globals.sysAutoOffSeconds) +#define GSysRandomSeed (((LowMemHdrType*)PilotGlobalsP)->globals.sysRandomSeed) +#define GSysResetFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysResetFlags) +#define GSysPrefFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysPrefFlags) +#define GSysMiscFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysMiscFlags) +#define GSysGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysGlobalsP) +#define GSysLibNet (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibNet) +#define GSysEvGroupID (((LowMemHdrType*)PilotGlobalsP)->globals.sysEvGroupID) +#define GSysLastBatteryWarning (((LowMemHdrType*)PilotGlobalsP)->globals.sysLastBatteryWarning) +#define GSysLowMemChecksum (((LowMemHdrType*)PilotGlobalsP)->globals.sysLowMemChecksum) +#define GSysProfileRefcon (((LowMemHdrType*)PilotGlobalsP)->globals.sysProfileRefcon) +#define GSysProfileProcP (((LowMemHdrType*)PilotGlobalsP)->globals.sysProfileProcP) + +#define GNetPktFreeQ (((LowMemHdrType*)PilotGlobalsP)->globals.netPktFreeQ) + + +#define GSlkGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.slkGlobalsP) +#define GSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.serGlobalsP) +#define GSer681GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq3GlobalsP) +#define GScrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.scrGlobalsP) +#define GFplGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.fplGlobalsP) +#define GPenGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.penGlobalsP) +#define GSysEvtMgrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysEvtMgrGlobalsP) +#define GSndGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sndGlobalsP) +#define GTimGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.timGlobalsP) +#define GAlmGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.almGlobalsP) +#define GFtrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.ftrGlobalsP) +#define GGrfGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.grfGlobalsP) +#define GKeyGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.keyGlobalsP) +//#define GPADGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.padGlobalsP) // not used vmk 8/15/97 + +#define GSndOffTicks (((LowMemHdrType*)PilotGlobalsP)->globals.sndOffTicks) + +#define GUIGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.uiGlobals) + +#define GNextUIAppDBID (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppDBID) +#define GNextUIAppCardNo (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCardNo) +#define GNextUIAppCmd (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCmd) +#define GNextUIAppCmdPBP (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCmdPBP) +#if EMULATION_LEVEL != EMULATION_NONE +#define GCurUIAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.curUIAppInfoP) +#endif + +#define GHwrDataWELevel (((LowMemHdrType*)PilotGlobalsP)->globals.hwrDataWELevel) +#define GHwrWakeUp (((LowMemHdrType*)PilotGlobalsP)->globals.hwrWakeUp) +#define GHwrCPUDutyCycle (((LowMemHdrType*)PilotGlobalsP)->globals.hwrCPUDutyCycle) +#define GHwrPenDown (((LowMemHdrType*)PilotGlobalsP)->globals.hwrPenDown) +#define GHwrCurTicks (((LowMemHdrType*)PilotGlobalsP)->globals.hwrCurTicks) +#define GHwrTotalRAMSize (((LowMemHdrType*)PilotGlobalsP)->globals.hwrTotalRAMSize) +#define GHwrDozeSubTicks (((LowMemHdrType*)PilotGlobalsP)->globals.hwrDozeSubTicks) +#define GHwrHardwareRev (((LowMemHdrType*)PilotGlobalsP)->globals.hwrHardwareRev) +#define GHwrMiscFlags (((LowMemHdrType*)PilotGlobalsP)->globals.hwrMiscFlags) +#define GHwrMiscFlagsExt (((LowMemHdrType*)PilotGlobalsP)->globals.hwrMiscFlagsExt) + +#define GSysLibTableP (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableP) +#define GSysLibTableEntries (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableEntries) +#define GDbgSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.dbgSerGlobalsP) + +#define GIrLibGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irLibGlobalsP) +#define GExgActiveLib (((LowMemHdrType*)PilotGlobalsP)->globals.exgActiveLib) +#define GSysUIBusyCount (((LowMemHdrType*)PilotGlobalsP)->globals.uiBusyCount) + +#define GIrq1GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq1GlobalsP) +#define GIrq2GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq2GlobalsP) +#define GIrq3GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq3GlobalsP) +#define GIrq6GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq6GlobalsP) + +#define GIntlMgrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.intlMgrGlobalsP) + +#define GInlineStart (((LowMemHdrType*)PilotGlobalsP)->globals.inlineStart) +#define GInlineEnd (((LowMemHdrType*)PilotGlobalsP)->globals.inlineEnd) +#define GInlineActive (((LowMemHdrType*)PilotGlobalsP)->globals.inlineActive) +#define GInlineStatus (((LowMemHdrType*)PilotGlobalsP)->globals.inlineStatus) +#define GInlineLibRef (((LowMemHdrType*)PilotGlobalsP)->globals.inlineLibRef) +#define GInlineHighlightLen (((LowMemHdrType*)PilotGlobalsP)->globals.inlineHighlightLen) + +#define GSysBatteryDataP (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryDataP) +#define GSysBatteryValidKindsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryValidKindsP) +#define GSysInShutdown (((LowMemHdrType*)PilotGlobalsP)->globals.sysInShutdown) +#define GSysMinWakeupThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysMinWakeupThreshold) + +#define GSysUseCritWarnTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysUseCritWarnTimer) +#define GSysCritWarnTimerRunning (((LowMemHdrType*)PilotGlobalsP)->globals.sysCritWarnTimerRunning) +#define GSysCritWarnRTCDayStarted (((LowMemHdrType*)PilotGlobalsP)->globals.sysCritWarnRTCDayStarted) +#define GSysCritWarnTickTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysCritWarnTickTimer) +#define GSysCritWarnLastTick (((LowMemHdrType*)PilotGlobalsP)->globals.sysCritWarnLastTick) +#define GSysCharging (((LowMemHdrType*)PilotGlobalsP)->globals.sysCharging) +#define GSysUpdateVoltageLevel (((LowMemHdrType*)PilotGlobalsP)->globals.sysUpdateVoltageLevel) + +#define GSysNotifyGlobalsH (((LowMemHdrType*)PilotGlobalsP)->globals.notifyGlobalsH) + + +#endif //__GLOBALS_H__ + +#endif // NON_PORTABLE diff --git a/sdk-3.1/include/Core/System/Graffiti.h b/sdk-3.1/include/Core/System/Graffiti.h new file mode 100644 index 0000000..9095d0f --- /dev/null +++ b/sdk-3.1/include/Core/System/Graffiti.h @@ -0,0 +1,212 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * Graffiti.h + * + * Description: + * Header for the Graffiti interface + * + * History: + * 6/30 RM - Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __GRAFFITI_H__ +#define __GRAFFITI_H__ + +#include + +#define grfNoShortCut 0xffff // Index which isn't a shortcut + +/*------------------------------------------------------------------------------ + * Match info structure. Returned by GrfMatch and GrfMatchGlyph + *-----------------------------------------------------------------------------*/ +typedef struct { + Byte glyphID; /* glyph ID of this match */ + Byte unCertainty; /* unCertainty of this match (0 most certain) */ + } GrfMatchType; + + +#define grfMaxMatches 4 +typedef struct { + Word numMatches; /* number of matches returned in this structure */ + GrfMatchType match[grfMaxMatches]; + } GrfMatchInfoType; +typedef GrfMatchInfoType* GrfMatchInfoPtr; + +#define grfNameLength 8 // eight letters possible (don't forget CR) +//#define grfTextLength 56 // Use + + +//---------------------------------------------------------------------------- +// 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 +#define grfVirtualSequence 0x01 + +// In dictionary to tell us about temp shift state changes. +#define grfShiftSequence 0x02 + +// In dictionary/macros to hide special features +#define grfSpecialSequence 0x03 + +// Char indicating a seqeunce of characters to expand. +#define grfExpansionSequence '@' + +// Chars indicating what to expand into +#define expandDateChar 'D' +#define expandTimeChar 'T' +#define expandStampChar 'S' // This follows 'D' or 'T' for the sake + // of the mnemonic name. + +#define shortcutBinaryDataFlag 0x01 + + +// Determine if a string has a sequence +#define HasVirtualSequence(s) (s[0] == grfVirtualSequence) +#define HasSpecialSequence(s) (s[0] == grfSpecialSequence) +#define HasExpansionSequence(s) (s[0] == grfExpansionSequence) + + + +/*------------------------------------------------------------------------------ + * Temp shift states, returned by GrfGetState + *-----------------------------------------------------------------------------*/ +#define grfTempShiftPunctuation 1 +#define grfTempShiftExtended 2 +#define grfTempShiftUpper 3 +#define grfTempShiftLower 4 + + + +/************************************************************ + * Graffiti result codes + *************************************************************/ +#define grfErrBadParam (grfErrorClass | 1) +#define grfErrPointBufferFull (grfErrorClass | 2) +#define grfErrNoGlyphTable (grfErrorClass | 3) +#define grfErrNoDictionary (grfErrorClass | 4) +#define grfErrNoMapping (grfErrorClass | 5) +#define grfErrMacroNotFound (grfErrorClass | 6) +#define grfErrDepthTooDeep (grfErrorClass | 7) +#define grfErrMacroPtrTooSmall (grfErrorClass | 8) +#define grfErrNoMacros (grfErrorClass | 9) + +#define grfErrMacroIncomplete (grfErrorClass | 129) // (grfWarningOffset+1) +#define grfErrBranchNotFound (grfErrorClass | 130) // (grfWarningOffset+2) + + +/************************************************************ + * Graffiti interface procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err GrfInit (void) + SYS_TRAP(sysTrapGrfInit); + +Err GrfFree (void) + SYS_TRAP(sysTrapGrfFree); + +Err GrfProcessStroke(PointType* startPtP, PointType* endPtP, + Boolean upShift) + SYS_TRAP(sysTrapGrfProcessStroke); + +Err GrfFieldChange(Boolean resetState, UIntPtr characterToDelete) + SYS_TRAP(sysTrapGrfFieldChange); + +Err GrfGetState(Boolean* capsLockP, Boolean* numLockP, + WordPtr tempShiftP, Boolean* autoShiftedP) + SYS_TRAP(sysTrapGrfGetState); + +Err GrfSetState(Boolean capsLock, Boolean numLock, + Boolean upperShift) + SYS_TRAP(sysTrapGrfSetState); + + +//----------------------------------------------------------------- +// Mid Level Calls +//------------------------------------------------------------------ + +Err GrfFlushPoints (void) + SYS_TRAP(sysTrapGrfFlushPoints); + +Err GrfAddPoint (PointType* pt) + SYS_TRAP(sysTrapGrfAddPoint); + +Err GrfInitState(void) + SYS_TRAP(sysTrapGrfInitState); + +Err GrfCleanState(void) + SYS_TRAP(sysTrapGrfCleanState); + +Err GrfMatch (WordPtr flagsP, void* dataPtrP, WordPtr dataLenP, + WordPtr uncertainLenP, GrfMatchInfoPtr matchInfoP) + SYS_TRAP(sysTrapGrfMatch); + +Err GrfGetMacro(CharPtr nameP, BytePtr macroDataP, + WordPtr dataLenP) + SYS_TRAP(sysTrapGrfGetMacro); + +Err GrfGetAndExpandMacro(CharPtr nameP, BytePtr macroDataP, + WordPtr dataLenP) + SYS_TRAP(sysTrapGrfGetAndExpandMacro); + + +//----------------------------------------------------------------- +// Low Level Calls +//------------------------------------------------------------------ +Err GrfFilterPoints (void) + SYS_TRAP(sysTrapGrfFilterPoints); + +Err GrfGetNumPoints(WordPtr numPtsP) + SYS_TRAP(sysTrapGrfGetNumPoints); + +Err GrfGetPoint(Word index, PointType* pointP) + SYS_TRAP(sysTrapGrfGetPoint); + +Err GrfFindBranch(Word flags) + SYS_TRAP(sysTrapGrfFindBranch); + +Err GrfMatchGlyph (GrfMatchInfoPtr matchInfoP, + Word maxUnCertainty, Word maxMatches) + SYS_TRAP(sysTrapGrfMatchGlyph); + +Err GrfGetGlyphMapping (Word glyphID, WordPtr flagsP, + void* dataPtrP, WordPtr dataLenP, WordPtr uncertainLenP) + SYS_TRAP(sysTrapGrfGetGlyphMapping); + +Err GrfGetMacroName(Word index, CharPtr nameP) + SYS_TRAP(sysTrapGrfGetMacroName); + +Err GrfDeleteMacro(Word index) + SYS_TRAP(sysTrapGrfDeleteMacro); + +Err GrfAddMacro(CharPtr nameP, BytePtr macroDataP, + Word dataLen) + SYS_TRAP(sysTrapGrfAddMacro); + + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SYSEVTMGR_H__ + + + diff --git a/sdk-3.1/include/Core/System/GraffitiReference.h b/sdk-3.1/include/Core/System/GraffitiReference.h new file mode 100644 index 0000000..67abe99 --- /dev/null +++ b/sdk-3.1/include/Core/System/GraffitiReference.h @@ -0,0 +1,64 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: GraffitiReference.h + * AUTHOR: Roger Flores: June 25, 1996 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the Graffiti Reference routines. + * + ***********************************************************************/ + +#ifndef __GRR_H__ +#define __GRR_H__ + +typedef enum + { + referenceAlpha, + referencePunc1, + referencePunc2, + +#if COUNTRY != COUNTRY_JAPAN + referencePunc3, +#endif + + referenceExtended, + +#if COUNTRY != COUNTRY_JAPAN + referenceAccent, +#endif + + referenceDefault = 0xff // based on graffiti mode (referenceAlpha) + } ReferenceType; + +#define referenceFirst referenceAlpha + +#if COUNTRY != COUNTRY_JAPAN +#define referenceLast referenceAccent +#else +#define referenceLast referenceExtended +#endif + + +/************************************************************ + * Graffiti Reference procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +extern void SysGraffitiReferenceDialog (ReferenceType referenceType) + SYS_TRAP(sysTrapSysGraffitiReferenceDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __GRR_H__ diff --git a/sdk-3.1/include/Core/System/HostControl.h b/sdk-3.1/include/Core/System/HostControl.h new file mode 100644 index 0000000..bbb12ed --- /dev/null +++ b/sdk-3.1/include/Core/System/HostControl.h @@ -0,0 +1,288 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1998 -- All Rights Reserved + * + * PROJECT: Pilot + * FILE: HostControl.h + * AUTHOR: Roger Flores/Douglas Anderson: August 17, 1998 + * + * DECLARER: System + * + * DESCRIPTION: + * + * + **********************************************************************/ + +#ifndef _HOSTCONTROL_H_ +#define _HOSTCONTROL_H_ + +/* + Set the base value for selectors. Note that this value MUST be + two bytes long and have the high byte be non-zero. The reason + for this has to do with the way SysGremlins was originally + declared. It took a GremlinsSelector enumerated value. Originally, + there was only one value, and it was zero. The way the 68K compiler + works, it decides that GremlinsSelectors are only one byte long, + so a call to SysGremlins would push one byte onto the stack. Because + all values on the stack need to be word-aligned, the processor + subtracts 1 from the stack before pushing on the byte. Therefore, + the stack looks like: + + previous contents + garbage byte + selector + return address + + With this setup, we have two choices: leave the selector size at + one byte and limit ourselves to 256 functions, or define the selector + to be a two byte value, with the first 256 values (all those with 0x00 + in the upper byte) to be GremlinIsOn. The latter sounds preferable, so + we start the new selectors at 0x0100. +*/ + +#define hostSelectorBase 0x0100 +#define hostSelectorChunk 0x0100 +#define hostSection(x) (hostSelectorBase + (hostSelectorChunk * (x))) + +typedef enum +{ + // Host information selectors + + hostSelectorGetHostVersion = hostSection(0), + hostSelectorGetHostID, + hostSelectorGetHostPlatform, + hostSelectorIsSelectorImplemented, + hostSelectorGestalt, + hostSelectorIsCallingTrap, + + // Profiler selectors + + hostSelectorProfileInit = hostSection(1), + hostSelectorProfileStart, + hostSelectorProfileStop, + hostSelectorProfileDump, + hostSelectorProfileCleanup, + + // Std C Library wrapper selectors + + hostSelectorErrNo = hostSection(2), + + hostSelectorFClose, + hostSelectorFEOF, + hostSelectorFError, + hostSelectorFFlush, + hostSelectorFGetC, + hostSelectorFGetPos, + hostSelectorFGetS, + hostSelectorFOpen, + hostSelectorFPrintF, // Floating point not yet supported in Poser + hostSelectorFPutC, + hostSelectorFPutS, + hostSelectorFRead, + hostSelectorRemove, // Not yet implemented in Poser + hostSelectorRename, // Not yet implemented in Poser + hostSelectorFReopen, // Not yet implemented in Poser + hostSelectorFScanF, // Not yet implemented + hostSelectorFSeek, + hostSelectorFSetPos, + hostSelectorFTell, + hostSelectorFWrite, + hostSelectorTmpFile, + hostSelectorTmpNam, // Not yet implemented in Poser + hostSelectorGetEnv, + + hostSelectorMalloc, // Not yet implemented in Poser + hostSelectorRealloc, // Not yet implemented in Poser + hostSelectorFree, // Not yet implemented in Poser + + // Gremlin selectors + + hostSelectorGremlinIsRunning = hostSection(3), + hostSelectorGremlinNumber, + hostSelectorGremlinCounter, + hostSelectorGremlinLimit, +// hostSelectorGremlinApp, + + // Database selectors + + hostSelectorImportFile = hostSection(4), + hostSelectorExportFile, + + // Preferences selectors + + hostSelectorSetDebugOption = hostSection(5), // Not yet implemented + hostSelectorSetWindowScale, // Not yet implemented + hostSelectorSetWindowBackground, // Not yet implemented + + // Logging selectors + + hostSelectorLogFile = hostSection(6), + hostSelectorSetLogFileSize, + + hostSelectorLastTrapNumber +} HostControlTrapNumber; + + +typedef struct HostControlParamsType +{ + long unused; +} HostControlParamsType; + + + +typedef struct HostFILE +{ + long _field; +} HostFILE; + + + +typedef long HostBool; +typedef long HostErr; +typedef long HostID; +typedef long HostPlatform; +typedef long HostBG; + +#ifndef hostErrorClass + #define hostErrorClass 0x1C00 // Host Control Manager +#else + #if hostErrorClass != 0x1C00 + #error "You cannot change hostErrorClass without telling us." + #endif +#endif + +enum // HostErr values +{ + hostErrNone = 0, + + hostErrBase = hostErrorClass, + + hostErrUnknownGestaltSelector, + + hostErrDiskError, + + hostErrOutOfMemory, + hostErrMemReadOutOfRange, + hostErrMemWriteOutOfRange, + hostErrMemInvalidPtr, + + hostErrInvalidParameter +}; + + +enum // HostID values +{ + hostIDPalmOS, + hostIDPalmOSEmulator, // The Copilot thingy + hostIDPalmOSSimulator // The Mac libraries you link with thingy +}; + + +enum // HostPlatform values +{ + hostPlatformPalmOS, + hostPlatformWindows, + hostPlatformMacintosh, + hostPlatformUnix +}; + + +enum // HostBG values +{ + hostBGGray, + hostBGWhite +}; + +#ifdef EMULATION_LEVEL + #define EMULATION_LEVEL_DEFINED 1 +#else + #define EMULATION_LEVEL_DEFINED 0 +#endif + +#if EMULATION_LEVEL_DEFINED && EMULATION_LEVEL == EMULATION_NONE +#define HOST_TRAP(selector) \ + FIVEWORD_INLINE( \ + 0x3F3C, selector, /* MOVE.W #selector, -(A7) */ \ + m68kTrapInstr + sysDispatchTrapNum, /* TRAP $F */ \ + sysTrapHostControl, /* sysTrapHostControl */ \ + 0x544F) /* ADD.Q #2, A7 */ +#else + +// The simulator implements each function separately and directly calls each function. +#define HOST_TRAP(selector) + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +long HostGetHostVersion (void) HOST_TRAP (hostSelectorGetHostVersion); +HostID HostGetHostID (void) HOST_TRAP (hostSelectorGetHostID); +HostPlatform HostGetHostPlatform (void) HOST_TRAP (hostSelectorGetHostPlatform); +HostBool HostIsSelectorImplemented (long selector) HOST_TRAP (hostSelectorIsSelectorImplemented); +HostErr HostGestalt (long gestSel, long* response) HOST_TRAP (hostSelectorGestalt); +HostBool HostIsCallingTrap (void) HOST_TRAP (hostSelectorIsCallingTrap); + +HostErr HostProfileInit (long maxCalls, long maxDepth) HOST_TRAP (hostSelectorProfileInit); +HostErr HostProfileStart (void) HOST_TRAP (hostSelectorProfileStart); +HostErr HostProfileStop (void) HOST_TRAP (hostSelectorProfileStop); +HostErr HostProfileDump (const char* filename) HOST_TRAP (hostSelectorProfileDump); +HostErr HostProfileCleanup (void) HOST_TRAP (hostSelectorProfileCleanup); + +long HostErrNo (void) HOST_TRAP (hostSelectorErrNo); + +long HostFClose (HostFILE* f) HOST_TRAP (hostSelectorFClose); +long HostFEOF (HostFILE* f) HOST_TRAP (hostSelectorFEOF); +long HostFError (HostFILE* f) HOST_TRAP (hostSelectorFError); +long HostFFlush (HostFILE* f) HOST_TRAP (hostSelectorFFlush); +long HostFGetC (HostFILE* f) HOST_TRAP (hostSelectorFGetC); +long HostFGetPos (HostFILE* f, long* posP) HOST_TRAP (hostSelectorFGetPos); +char* HostFGetS (char* s, long n, HostFILE* f) HOST_TRAP (hostSelectorFGetS); +HostFILE* HostFOpen (const char* name, const char* mode) HOST_TRAP (hostSelectorFOpen); +long HostFPrintF (HostFILE* f, const char* fmt, ...) HOST_TRAP (hostSelectorFPrintF); +long HostFPutC (long c, HostFILE* f) HOST_TRAP (hostSelectorFPutC); +long HostFPutS (const char* s, HostFILE* f) HOST_TRAP (hostSelectorFPutS); +long HostFRead (void* buffer, long size, long count, HostFILE* f) + HOST_TRAP (hostSelectorFRead); +long HostRemove (const char* name) HOST_TRAP (hostSelectorRemove); +long HostRename (const char* oldName, const char* newName) HOST_TRAP (hostSelectorRename); +HostFILE* HostFReopen (const char* name, const char* mode, HostFILE *f) + HOST_TRAP (hostSelectorFReopen); +long HostFScanF (HostFILE* f, const char *fmt, ...) HOST_TRAP(hostSelectorFScanF); +long HostFSeek (HostFILE* f, long offset, long origin) HOST_TRAP (hostSelectorFSeek); +long HostFSetPos (HostFILE* f, long* pos) HOST_TRAP (hostSelectorFSetPos); +long HostFTell (HostFILE* f) HOST_TRAP (hostSelectorFTell); +long HostFWrite (const void* buffer, long size, long count, HostFILE* f) + HOST_TRAP (hostSelectorFWrite); +HostFILE* HostTmpFile (void) HOST_TRAP (hostSelectorTmpFile); +char* HostTmpNam (char *name) HOST_TRAP (hostSelectorTmpNam); +char* HostGetEnv (const char* name) HOST_TRAP (hostSelectorGetEnv); + +void* HostMalloc (long size) HOST_TRAP (hostSelectorMalloc); +void* HostRealloc (void* p, long size) HOST_TRAP (hostSelectorRealloc); +void HostFree (void* p) HOST_TRAP (hostSelectorFree); + +HostBool HostGremlinIsRunning (void) HOST_TRAP (hostSelectorGremlinIsRunning); +long HostGremlinNumber (void) HOST_TRAP (hostSelectorGremlinNumber); +long HostGremlinCounter (void) HOST_TRAP (hostSelectorGremlinCounter); +long HostGremlinLimit (void) HOST_TRAP (hostSelectorGremlinLimit); + +HostErr HostImportFile (const char* fileName, long cardNum) HOST_TRAP (hostSelectorImportFile); +HostErr HostExportFile (const char* fileName, long cardNum, const char* dbName) + HOST_TRAP (hostSelectorExportFile); + +HostBool HostSetDebugOption (HostBool newSetting) HOST_TRAP (hostSelectorSetDebugOption); +long HostSetWindowScale (long newScale) HOST_TRAP (hostSelectorSetWindowScale); +HostBG HostSetWindowBackground (HostBG newBackground) HOST_TRAP (hostSelectorSetWindowBackground); + +HostFILE* HostLogFile (void) HOST_TRAP (hostSelectorLogFile); +void HostSetLogFileSize (long) HOST_TRAP (hostSelectorSetLogFileSize); + +#ifdef __cplusplus +} +#endif + + +#endif /* _HOSTCONTROL_H_ */ diff --git a/sdk-3.1/include/Core/System/ImcUtils.h b/sdk-3.1/include/Core/System/ImcUtils.h new file mode 100644 index 0000000..5503459 --- /dev/null +++ b/sdk-3.1/include/Core/System/ImcUtils.h @@ -0,0 +1,78 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * ImcUtils.c + * + * Description: + * Routines to handle Internet Mail Consortium specs + * + * History: + * 8/6/97 roger - Created + * + *******************************************************************/ + + +#ifndef _IMC_UTILS_H +#define _IMC_UTILS_H + +#ifndef EOF +#define EOF 0xffff +#endif + + +// Constants for some common IMC spec values. +#define parameterDelimeterChr ';' +#define valueDelimeterChr ':' +#define groupDelimeterChr '.' +#define paramaterNameDelimiterChr '=' +#define endOfLineChr 0x0D + +#define imcFilenameLength 32 +#define imcUnlimitedChars 0xFFFE // 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 +typedef Word GetCharF (const void *); +typedef void PutStringF(const void *, const Char * const stringP); + + +// maxChars does NOT include trailing null, buffer may be 1 larger. +// use imcUnlimitedChars if you don't want a max. +extern CharPtr ImcReadFieldNoSemicolon(const VoidPtr inputStream, + const GetCharF inputFunc, WordPtr c, const Word maxChars) + SYS_TRAP(sysTrapImcReadFieldNoSemicolon); + +// maxChars does NOT include trailing null, buffer may be 1 larger. +// use imcUnlimitedChars if you don't want a max. +extern CharPtr ImcReadFieldQuotablePrintable(const VoidPtr inputStream, const GetCharF inputFunc, WordPtr c, + const Char stopAt, const Boolean quotedPrintable, const Word maxChars) + SYS_TRAP(sysTrapImcReadFieldQuotablePrintable); + +extern void ImcReadPropertyParameter(const VoidPtr inputStream, const GetCharF inputFunc, + WordPtr cP, const CharPtr nameP, const CharPtr valueP) + SYS_TRAP(sysTrapImcReadPropertyParameter); + +extern void ImcSkipAllPropertyParameters(const VoidPtr inputStream, const GetCharF inputFunc, + WordPtr cP, const CharPtr identifierP, Boolean *quotedPrintableP) + SYS_TRAP(sysTrapImcSkipAllPropertyParameters); + +extern void ImcReadWhiteSpace(const VoidPtr inputStream, const GetCharF inputFunc, + const Word * const charAttrP, WordPtr c) + SYS_TRAP(sysTrapImcReadWhiteSpace); + +extern void ImcWriteQuotedPrintable(const VoidPtr outputStream, const PutStringF outputFunc, + const CharPtr stringP, const Boolean noSemicolons) + SYS_TRAP(sysTrapImcWriteQuotedPrintable); + +extern void ImcWriteNoSemicolon(const VoidPtr outputStream, const PutStringF outputFunc, + const Char * const stringP) + SYS_TRAP(sysTrapImcWriteNoSemicolon); + +extern Boolean ImcStringIsAscii(const Char * const stringP) + SYS_TRAP(sysTrapImcStringIsAscii); + + +#endif // _IMC_UTILS_H diff --git a/sdk-3.1/include/Core/System/IrLib.h b/sdk-3.1/include/Core/System/IrLib.h new file mode 100644 index 0000000..1a0c933 --- /dev/null +++ b/sdk-3.1/include/Core/System/IrLib.h @@ -0,0 +1,200 @@ +/******************************************************************* + * Pilot Software + * + * Copyright(c) 1997, Palm Computing Inc., All Rights Reserved + * + *------------------------------------------------------------------- + * FileName: + * IrLib.h + * + * Description: + * Include file for IrDA Library + * + * History: + * 5/23/97 Created by Gavin Peacock + * + *******************************************************************/ + +#ifndef __IR_LIB_H +#define __IR_LIB_H + +// The Ir library is used mainly as an Obx library. ObxLib.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 OBX interface. The Stack API comes after +// the Obx API in the library. +#include + +// include counterpoint library headers - fix this later so that we only include +// what is needed for our API... +#include + +// name of Ir library +#define irLibName "IrDA Library" + +// Feature Creators and numbers, for use with the FtrGet() call. This +// feature can be obtained to get the current version of the Ir Library +#define irFtrCreator sysFileCIrLib +#define 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 +#define irOpenOptBackground 0x80000000 +#define irOpenOptSpeed115200 IRLAP_SPEED115200 +#define irOpenOptSpeed57600 IRLAP_SPEED57600 +#define irOpenOptSpeed9600 IRLAP_SPEED9600 + +// Option codes for ExgLibControl +// These options are all unique to the Ir transport +#define irGetScanningMode exgLibCtlSpecificOp | 1 // returns scanning enabled +#define irSetScanningMode exgLibCtlSpecificOp | 2 // en/disables ir scanning mode +#define irGetStatistics exgLibCtlSpecificOp | 3 // returns performance stats +#define irSetSerialMode exgLibCtlSpecificOp | 4 // sets driver to use direct serial +#define irSetBaudMask exgLibCtlSpecificOp | 5 // set possible baud rates (irOpenOpts) +#define irSetSupported exgLibCtlSpecificOp | 6 // disables the ir not supported dialog + +// structure returned by irGetStatistics +typedef struct { + Word recLineErrors; // # of serial errors since library opend + Word crcErrors; // # of crc errors ... +} IrStatsType; + +//----------------------------------------------------------------------------- +// Ir library call ID's. Each library call gets the trap number: +// irLibTrapXXXX 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 IrLibDispatch.c!!! +//----------------------------------------------------------------------------- +#pragma mark Traps +typedef enum { + irLibTrapBind = exgLibTrapLast, // these start after the ObxLib interface... + irLibTrapUnBind, + irLibTrapDiscoverReq, + irLibTrapConnectIrLap, + irLibTrapDisconnectIrLap, + irLibTrapConnectReq, + irLibTrapConnectRsp, + irLibTrapDataReq, + irLibTrapLocalBusy, + irLibTrapMaxTxSize, + irLibTrapMaxRxSize, + irLibTrapSetDeviceInfo, + irLibTrapIsNoProgress, + irLibTrapIsRemoteBusy, + irLibTrapIsMediaBusy, + irLibTrapIsIrLapConnected, + irLibTrapTestReq, + irLibTrapIAS_Add, + irLibTrapIAS_Query, + irLibTrapIAS_SetDeviceName, + irLibTrapIAS_Next, + irLibTrapIrOpen, + irLibTrapHandleEvent, + irLibTrapWaitForEvent, + + irLibTrapLast + } IrLibTrapNumberEnum; + + +/************************************************************ + * Net Library procedures. + *************************************************************/ +#pragma mark Functions +#ifdef __cplusplus +extern "C" { +#endif + +#if EMULATION_LEVEL != EMULATION_NONE +// Private entrypoint used by emulator to install library +Err IrdPrvInstallDispatcher(UInt refNum, SysLibTblEntryPtr entryP); +#endif + + +IrStatus IrBind(UInt refNum,IrConnect* con, IrCallBack callBack) + SYS_TRAP(irLibTrapBind); + +IrStatus IrUnbind(UInt refNum,IrConnect* con) + SYS_TRAP(irLibTrapUnBind); + +IrStatus IrDiscoverReq(UInt refNum,IrConnect* con) + SYS_TRAP(irLibTrapDiscoverReq); + +IrStatus IrConnectIrLap(UInt refNum,IrDeviceAddr deviceAddr) + SYS_TRAP(irLibTrapConnectIrLap); + +IrStatus IrDisconnectIrLap(UInt refNum) + SYS_TRAP(irLibTrapDisconnectIrLap); + +IrStatus IrConnectReq(UInt refNum,IrConnect* con, IrPacket* packet, U8 credit) + SYS_TRAP(irLibTrapConnectReq); + +IrStatus IrConnectRsp(UInt refNum,IrConnect* con,IrPacket* packet, U8 credit) + SYS_TRAP(irLibTrapConnectRsp); + +IrStatus IrDataReq(UInt refNum,IrConnect* con, IrPacket* packet) + SYS_TRAP(irLibTrapDataReq); + +void IrLocalBusy(UInt refNum,BOOL flag) + SYS_TRAP(irLibTrapLocalBusy); + +U16 IrMaxTxSize(UInt refNum,IrConnect* con) + SYS_TRAP(irLibTrapMaxTxSize); + +U16 IrMaxRxSize(UInt refNum,IrConnect* con) + SYS_TRAP(irLibTrapMaxRxSize); + +IrStatus IrSetDeviceInfo(UInt refNum,U8* info, U8 len) + SYS_TRAP(irLibTrapSetDeviceInfo); + +BOOL IrIsNoProgress(UInt refNum) + SYS_TRAP(irLibTrapIsNoProgress); + +BOOL IrIsRemoteBusy(UInt refNum) + SYS_TRAP(irLibTrapIsRemoteBusy); + +BOOL IrIsMediaBusy(UInt refNum) + SYS_TRAP(irLibTrapIsMediaBusy); + +BOOL IrIsIrLapConnected(UInt refNum) + SYS_TRAP(irLibTrapIsIrLapConnected); + +IrStatus IrTestReq(UInt refNum,IrDeviceAddr devAddr, IrConnect* con, IrPacket* packet) + SYS_TRAP(irLibTrapTestReq); + + +IrStatus IrIAS_Add(UInt refNum,IrIasObject* obj) + SYS_TRAP(irLibTrapIAS_Add); + +IrStatus IrIAS_Query(UInt refNum,IrIasQuery* token) + SYS_TRAP(irLibTrapIAS_Query); + +IrStatus IrIAS_SetDeviceName(UInt refNum,U8* name, U8 len) + SYS_TRAP(irLibTrapIAS_SetDeviceName); + +U8* IrIAS_Next(UInt refNum,IrIasQuery* token) + SYS_TRAP(irLibTrapIAS_Next); + +Err IrOpen(UInt refNum,ULong options) + SYS_TRAP(irLibTrapIrOpen); + +Err IrClose (Word libRefnum) + SYS_TRAP(sysLibTrapClose); + +Boolean IrHandleEvent(Word libRefnum) + SYS_TRAP(irLibTrapHandleEvent); + +Err IrWaitForEvent(Word libRefnum,Long timeout) + SYS_TRAP(irLibTrapWaitForEvent); + + +#endif // IR_LIB_H + + diff --git a/sdk-3.1/include/Core/System/KeyMgr.h b/sdk-3.1/include/Core/System/KeyMgr.h new file mode 100644 index 0000000..c5ed244 --- /dev/null +++ b/sdk-3.1/include/Core/System/KeyMgr.h @@ -0,0 +1,75 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * KeyMgr.h + * + * Description: + * Include file for Key manager + * + * History: + * 9/13/95 Created by Ron Marianetti + * 2/04/98 srj- added contrast key defines + * 8/23/98 SCL- Cross-merged 3.1 and 3.2 + * + *******************************************************************/ + +#ifndef __KEYMGR_H__ +#define __KEYMGR_H__ + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Definition of bit field returned from KeyCurrentState + ********************************************************************/ +#define keyBitPower 0x0001 // Power key +#define keyBitPageUp 0x0002 // Page-up +#define keyBitPageDown 0x0004 // Page-down +#define keyBitHard1 0x0008 // App #1 +#define keyBitHard2 0x0010 // App #2 +#define keyBitHard3 0x0020 // App #3 +#define keyBitHard4 0x0040 // App #4 +#define keyBitCradle 0x0080 // Button on cradle +#define keyBitReserved 0x0100 // Reserved for PalmOS 3.2 +#define keyBitContrast 0x0200 // Contrast key + +#define keyBitsAll 0xFFFFFFFF // all keys + + +#define slowestKeyDelayRate 0xff +#define slowestKeyPeriodRate 0xff + + +/******************************************************************** + * Key manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Set/Get the auto-key repeat rate +Err KeyRates(Boolean set, WordPtr initDelayP, WordPtr periodP, + WordPtr doubleTapDelayP, BooleanPtr queueAheadP) + SYS_TRAP(sysTrapKeyRates); + +// Get the current state of the hardware keys +// This is now updated every tick, even when more than 1 key is held down. +DWord KeyCurrentState(void) + SYS_TRAP(sysTrapKeyCurrentState); + +// Set the state of the hardware key mask which controls if the key +// generates a keyDownEvent +DWord KeySetMask(DWord keyMask) + SYS_TRAP(sysTrapKeySetMask); + +#ifdef __cplusplus +} +#endif + + +#endif //__KEYMGR_H__ diff --git a/sdk-3.1/include/Core/System/Keyboard.h b/sdk-3.1/include/Core/System/Keyboard.h new file mode 100644 index 0000000..10630f6 --- /dev/null +++ b/sdk-3.1/include/Core/System/Keyboard.h @@ -0,0 +1,63 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Keyboard.h + * AUTHOR: Roger Flores: March 29, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the keyboard's structures + * and routines. + * + ***********************************************************************/ + + +#ifndef __KBD_H__ +#define __KBD_H__ + + + +#define kbdReturnKey linefeedChr +#define kbdTabKey tabChr +#define kbdBackspaceKey backspaceChr +#define kbdShiftKey 2 +#define kbdCapsKey 1 +#define kbdNoKey 0xff + + +typedef enum + { + kbdAlpha = 0, + kbdNumbersAndPunc = 1, + kbdAccent = 2, + kbdDefault = 0xff // based on graffiti mode (usually alphaKeyboard) + } KeyboardType; + + +/************************************************************ + * Keyboard procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// 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. + +extern void SysKeyboardDialogV10 () + SYS_TRAP(sysTrapSysKeyboardDialogV10); + +extern void SysKeyboardDialog (KeyboardType kbd) + SYS_TRAP(sysTrapSysKeyboardDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __KBD_H__ diff --git a/sdk-3.1/include/Core/System/Launcher.h b/sdk-3.1/include/Core/System/Launcher.h new file mode 100644 index 0000000..de84205 --- /dev/null +++ b/sdk-3.1/include/Core/System/Launcher.h @@ -0,0 +1,58 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Launcher.h + * AUTHOR: Roger Flores: April 27, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * These are the routines for the launcher. + * + **********************************************************************/ +#ifndef __LAUNCHER_H__ +#define __LAUNCHER_H__ + +#include +#include +#include +#include +#include + +typedef struct { + FormPtr form; + Int numItems; // numItems of applications available via the launcher + Int columns; + Int rows; + Int topItem; + SByte selection; + VoidHand appInfoH; // an array is to be allocated + TimeFormatType timeFormat; // Format to display time in + char timeString[timeStringLength]; + FormPtr savedForm; // the currently active dialog. +} LauncherType; + +typedef LauncherType * LauncherPtr; + + + +/************************************************************ + * Launcher procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +void SysAppLauncherDialog() + SYS_TRAP(sysTrapSysAppLauncherDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __LAUNCHER_H__ + diff --git a/sdk-3.1/include/Core/System/Localize.h b/sdk-3.1/include/Core/System/Localize.h new file mode 100644 index 0000000..a7098fc --- /dev/null +++ b/sdk-3.1/include/Core/System/Localize.h @@ -0,0 +1,44 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * Localize.c + * + * Description: + * Functions to localize data. + * + * History: + * 8/28/96 Roger - Initial version + * + *******************************************************************/ + +#ifndef __LOCALIZE_H__ +#define __LOCALIZE_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +#ifdef __cplusplus +extern "C" { +#endif + + +void LocGetNumberSeparators(NumberFormatType numberFormat, + Char *thousandSeparator, Char *decimalSeparator) + SYS_TRAP(sysTrapLocGetNumberSeparators); + + + +#ifdef __cplusplus +} +#endif + + +#endif // __LOCALIZE_H__ + + diff --git a/sdk-3.1/include/Core/System/MemoryMgr.h b/sdk-3.1/include/Core/System/MemoryMgr.h new file mode 100644 index 0000000..32c0c77 --- /dev/null +++ b/sdk-3.1/include/Core/System/MemoryMgr.h @@ -0,0 +1,343 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * MemoryMgr.h + * + * Description: + * Include file for Memory Manager + * + * History: + * 10/25/94 RM - Created by Ron Marianetti + * + *******************************************************************/ + + +#ifndef __MEMORYMGR_H__ +#define __MEMORYMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +/************************************************************ + * Memory Manager Types + *************************************************************/ +typedef enum { memIDPtr, memIDHandle } LocalIDKind; + + + +/************************************************************ + * Flags accepted as parameter for MemNewChunk. + *************************************************************/ +#define memNewChunkFlagPreLock 0x0100 +#define memNewChunkFlagNonMovable 0x0200 +#define memNewChunkFlagAtStart 0x0400 // force allocation at front of heap +#define memNewChunkFlagAtEnd 0x0800 // force allocation at end of heap + + + +/************************************************************ + * Memory Manager Debug settings for the MemSetDebugMode function + *************************************************************/ +#define memDebugModeCheckOnChange 0x0001 +#define memDebugModeCheckOnAll 0x0002 +#define memDebugModeScrambleOnChange 0x0004 +#define memDebugModeScrambleOnAll 0x0008 +#define memDebugModeFillFree 0x0010 +#define memDebugModeAllHeaps 0x0020 +#define memDebugModeRecordMinDynHeapFree 0x0040 + + + + +/************************************************************ + * Memory Manager result codes + *************************************************************/ +#define memErrChunkLocked (memErrorClass | 1) +#define memErrNotEnoughSpace (memErrorClass | 2) +#define memErrInvalidParam (memErrorClass | 3) /* invalid param or requested size is too big */ +#define memErrChunkNotLocked (memErrorClass | 4) +#define memErrCardNotPresent (memErrorClass | 5) +#define memErrNoCardHeader (memErrorClass | 6) +#define memErrInvalidStoreHeader (memErrorClass | 7) +#define memErrRAMOnlyCard (memErrorClass | 8) +#define memErrWriteProtect (memErrorClass | 9) +#define memErrNoRAMOnCard (memErrorClass | 10) +#define memErrNoStore (memErrorClass | 11) + + + +/******************************************************************** + * Memory Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err MemInit(void) + SYS_TRAP(sysTrapMemInit); + +Err MemKernelInit(void) + SYS_TRAP(sysTrapMemKernelInit); + +Err MemInitHeapTable(UInt cardNo) + SYS_TRAP(sysTrapMemInitHeapTable); + +//------------------------------------------------------------------- +// Card formatting and Info +//------------------------------------------------------------------- +UInt MemNumCards(void) + SYS_TRAP(sysTrapMemNumCards); + +Err MemCardFormat(UInt cardNo, CharPtr cardNameP, + CharPtr manufNameP, CharPtr ramStoreNameP) + SYS_TRAP(sysTrapMemCardFormat); + +Err MemCardInfo(UInt cardNo, + CharPtr cardNameP, CharPtr manufNameP, + UIntPtr versionP, ULongPtr crDateP, + ULongPtr romSizeP, ULongPtr ramSizeP, + ULongPtr freeBytesP) + SYS_TRAP(sysTrapMemCardInfo); + + +//------------------------------------------------------------------- +// Store Info +//------------------------------------------------------------------- +Err MemStoreInfo(UInt cardNo, UInt storeNumber, + UIntPtr versionP, UIntPtr flagsP, CharPtr nameP, + ULongPtr crDateP, ULongPtr bckUpDateP, + ULongPtr heapListOffsetP, ULongPtr initCodeOffset1P, + ULongPtr initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreInfo); + +Err MemStoreSetInfo(UInt cardNo, UInt storeNumber, + UIntPtr versionP, UIntPtr flagsP, CharPtr nameP, + ULongPtr crDateP, ULongPtr bckUpDateP, + ULongPtr heapListOffsetP, ULongPtr initCodeOffset1P, + ULongPtr initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreSetInfo); + + +//------------------------------------------------------------------- +// Heap Info & Utilities +//------------------------------------------------------------------- +UInt MemNumHeaps(UInt cardNo) + SYS_TRAP(sysTrapMemNumHeaps); + +UInt MemNumRAMHeaps(UInt cardNo) + SYS_TRAP(sysTrapMemNumRAMHeaps); + +UInt MemHeapID(UInt cardNo, UInt heapIndex) + SYS_TRAP(sysTrapMemHeapID); + +Boolean MemHeapDynamic(UInt heapID) + SYS_TRAP(sysTrapMemHeapDynamic); + +Err MemHeapFreeBytes(UInt heapID, ULongPtr freeP, ULongPtr maxP) + SYS_TRAP(sysTrapMemHeapFreeBytes); + +ULong MemHeapSize(UInt heapID) + SYS_TRAP(sysTrapMemHeapSize); + +UInt MemHeapFlags(UInt heapID) + SYS_TRAP(sysTrapMemHeapFlags); + + +// Heap utilities +Err MemHeapCompact(UInt heapID) + SYS_TRAP(sysTrapMemHeapCompact); + +Err MemHeapInit(UInt heapID, Int numHandles, Boolean initContents) + SYS_TRAP(sysTrapMemHeapInit); + +Err MemHeapFreeByOwnerID(UInt heapID, UInt ownerID) + SYS_TRAP(sysTrapMemHeapFreeByOwnerID); + + +//------------------------------------------------------------------- +// Low Level Allocation +//------------------------------------------------------------------- +VoidPtr MemChunkNew(UInt heapID, ULong size, UInt attr) + SYS_TRAP(sysTrapMemChunkNew); + +Err MemChunkFree(VoidPtr chunkDataP) + SYS_TRAP(sysTrapMemChunkFree); + + + +//------------------------------------------------------------------- +// Pointer (Non-Movable) based Chunk Routines +//------------------------------------------------------------------- +VoidPtr MemPtrNew(ULong size) + SYS_TRAP(sysTrapMemPtrNew); + +#define MemPtrFree( p) \ + MemChunkFree(p) + +// Getting Attributes +VoidHand MemPtrRecoverHandle(VoidPtr p) + SYS_TRAP(sysTrapMemPtrRecoverHandle); + +UInt MemPtrFlags(VoidPtr p) + SYS_TRAP(sysTrapMemPtrFlags); + +ULong MemPtrSize(VoidPtr p) + SYS_TRAP(sysTrapMemPtrSize); + +UInt MemPtrOwner(VoidPtr p) + SYS_TRAP(sysTrapMemPtrOwner); + +UInt MemPtrHeapID(VoidPtr p) + SYS_TRAP(sysTrapMemPtrHeapID); + +Boolean MemPtrDataStorage(VoidPtr p) + SYS_TRAP(sysTrapMemPtrDataStorage); + +UInt MemPtrCardNo(VoidPtr p) + SYS_TRAP(sysTrapMemPtrCardNo); + +LocalID MemPtrToLocalID(VoidPtr p) + SYS_TRAP(sysTrapMemPtrToLocalID); + +// Setting Attributes +Err MemPtrSetOwner(VoidPtr p, UInt owner) + SYS_TRAP(sysTrapMemPtrSetOwner); + +Err MemPtrResize(VoidPtr p, ULong newSize) + SYS_TRAP(sysTrapMemPtrResize); + +Err MemPtrResetLock(VoidPtr p) + SYS_TRAP(sysTrapMemPtrResetLock); + +Err MemPtrUnlock(VoidPtr p) + SYS_TRAP(sysTrapMemPtrUnlock); + + +//------------------------------------------------------------------- +// Handle (Movable) based Chunk Routines +//------------------------------------------------------------------- +VoidHand MemHandleNew(ULong size) + SYS_TRAP(sysTrapMemHandleNew); + +Err MemHandleFree(VoidHand h) + SYS_TRAP(sysTrapMemHandleFree); + +// Getting Attributes +UInt MemHandleFlags(VoidHand h) + SYS_TRAP(sysTrapMemHandleFlags); + +ULong MemHandleSize(VoidHand h) + SYS_TRAP(sysTrapMemHandleSize); + +UInt MemHandleOwner(VoidHand h) + SYS_TRAP(sysTrapMemHandleOwner); + +UInt MemHandleLockCount(VoidHand h) + SYS_TRAP(sysTrapMemHandleLockCount); + +UInt MemHandleHeapID(VoidHand h) + SYS_TRAP(sysTrapMemHandleHeapID); + +Boolean MemHandleDataStorage(VoidHand h) + SYS_TRAP(sysTrapMemHandleDataStorage); + +UInt MemHandleCardNo(VoidHand h) + SYS_TRAP(sysTrapMemHandleCardNo); + +LocalID MemHandleToLocalID(VoidHand h) + SYS_TRAP(sysTrapMemHandleToLocalID); + + +// Setting Attributes +Err MemHandleSetOwner( VoidHand h, UInt owner) + SYS_TRAP(sysTrapMemHandleSetOwner); + +Err MemHandleResize(VoidHand h, ULong newSize) + SYS_TRAP(sysTrapMemHandleResize); + +VoidPtr MemHandleLock(VoidHand h) + SYS_TRAP(sysTrapMemHandleLock); + +Err MemHandleUnlock(VoidHand h) + SYS_TRAP(sysTrapMemHandleUnlock); + +Err MemHandleResetLock(VoidHand h) + SYS_TRAP(sysTrapMemHandleResetLock); + + + + +//------------------------------------------------------------------- +// Local ID based routines +//------------------------------------------------------------------- +VoidPtr MemLocalIDToGlobal(LocalID local, UInt cardNo) + SYS_TRAP(sysTrapMemLocalIDToGlobal); + +LocalIDKind MemLocalIDKind(LocalID local) + SYS_TRAP(sysTrapMemLocalIDKind); + +VoidPtr MemLocalIDToPtr(LocalID local, UInt cardNo) + SYS_TRAP(sysTrapMemLocalIDToPtr); + +VoidPtr MemLocalIDToLockedPtr(LocalID local, UInt cardNo) + SYS_TRAP(sysTrapMemLocalIDToLockedPtr); + + +//------------------------------------------------------------------- +// Utilities +//------------------------------------------------------------------- +Err MemMove(const VoidPtr dstP, const void * const sP, ULong numBytes) + SYS_TRAP(sysTrapMemMove); + +Err MemSet(const VoidPtr dstP, ULong numBytes, Byte value) + SYS_TRAP(sysTrapMemSet); + +Int MemCmp (const void * const s1, const void * const s2, ULong numBytes) + SYS_TRAP(sysTrapMemCmp); + +Err MemSemaphoreReserve(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreReserve); + +Err MemSemaphoreRelease(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreRelease); + +//------------------------------------------------------------------- +// Debugging Support +//------------------------------------------------------------------- +Word MemDebugMode(void) + SYS_TRAP(sysTrapMemDebugMode); + +Err MemSetDebugMode(Word flags) + SYS_TRAP(sysTrapMemSetDebugMode); + +Err MemHeapScramble(UInt heapID) + SYS_TRAP(sysTrapMemHeapScramble); + +Err MemHeapCheck(UInt heapID) + SYS_TRAP(sysTrapMemHeapCheck); + + +#ifdef __cplusplus +} +#endif + + + + + +#endif // __MEMORYMGR_H__ + diff --git a/sdk-3.1/include/Core/System/MemoryPrv.h b/sdk-3.1/include/Core/System/MemoryPrv.h new file mode 100644 index 0000000..298c23f --- /dev/null +++ b/sdk-3.1/include/Core/System/MemoryPrv.h @@ -0,0 +1,425 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * MemoryMgrPrv.h + * + * Description: + * Private includes for Memory Manager + * + * History: + * 7/20/95 RM - Created by Ron Marianetti + * + *******************************************************************/ + +// If using the version 2 Memory Manager, include the new MemoryPrv.h +// and ignore this one. Eventually, we will throw out support for +// building version 1 and rename MemoryPrvNew.h as MemoryPrv.h, etc. +#if MEMORY_VERSION == MEMORY_VERSION_2 +#include +#else + +#ifdef NON_PORTABLE + +// SystemPrv.h must be included before this header file. SystemPrv.h will +// then in turn include this header. +#ifndef __SYSTEMPRV_H__ +#include +#endif + +#ifndef __MEMORYMGRPRV_H__ +#define __MEMORYMGRPRV_H__ + + + +/******************************************************************** + * Structure of a Master Pointer chunk + * The first master pointer chunk is always immediately following the + * heap header. As more movable chunks are created, new master + * pointer chunks are allocated dynamically and linked together through + * the nextTblOffset field and prevTblOffset field. + ********************************************************************/ +typedef struct { + Word numEntries; // number of master pointer entries + Word nextTblOffset; // offset from start of heap to next table + //Ptr mstrP[numEntries]; // array of pointers to movable chunks + } MstrPtrTableType; +typedef MstrPtrTableType* MstrPtrTablePtr; + + +/******************************************************************** + * Structure of a Heap + * + * A heap starts with a HeapHeader + * Followed by the offset table (numHandles) + * Followed by movable chunks + * Followed by non-movable chunks + ********************************************************************/ +typedef struct { + Word flags; // heap flags; + Word size; // size of heap - 0 means 64K; + MstrPtrTableType mstrPtrTbl; // Master pointer table + } HeapHeaderType; +typedef HeapHeaderType* HeapHeaderPtr; + +// Flags Field +#define memHeapFlagReadOnly 0x0001 // heap is read-only (ROM based) +#define memHeapFlagVers2 0x8000 // version 2 heap (> 64K) + +#define memMstrPtrTableGrowBy 50 // # of entries to grow master pointer tables by +#define memMstrPtrTableInitSizeD 40 // # of entries to allocate initially for dynamic heap(s) +#define memMstrPtrTableInitSizeS 200 // # of entries to allocate initially for storage heap(s) + + + +/******************************************************************** + * Structure of a Chunk + * + ********************************************************************/ +typedef struct { + Word size; // size of block in bytes, including header + Byte lockOwner; // lock count in high nibble, owner in low + Byte flags; // flags, size adj in low nibble + SWord hOffset; // offset/2 to handle for movables + } ChunkHeaderType; +typedef ChunkHeaderType* ChunkHeaderPtr; + +// Definition of ChunkHeaderType.flags -------------------------------- +#define memChunkFlagFree 0x80 // free bit +#define memChunkFlagUnused1 0x40 // unused +#define memChunkFlagUnused2 0x20 // unused +#define memChunkFlagUnused3 0x10 // unused +#define memChunkFlagSizeAdj 0x0F // mask for size adjustment + + +// This macro is used to grab all the flags at once and place them into +// a byte +#define memChunkFlags(p) (((ChunkHeaderPtr)p)->flags & 0xF0) + + +// A non-movable chunk has 0xF as the lock count +#define memChunkLockMask 0xF0 +#define memChunkOwnerMask 0x0F + +// A lockcount of memPtrLockCount means a permanently unmovable chunk +#define memPtrLockCount 15 + +// A ownerID of 15 is used for master pointer chunks +#define memOwnerMasterPtrTbl 15 + + +// This equate returns the name of the ChunkHeaderType. This was created +// so that we can change the name of the CHunkHeaderType (as we did for V2 of +// the Memory Manager) and souce code won't know the difference +#define memChunkHeaderTypeName ChunkHeaderType + + +/******************************************************************** + * These macros pave the way for the version 2 Memory Manager that + * supports >64K chunks. + * + * They are a general way to get info out of a Chunk header + * whether it be a version 1 or version 2 header. They are used almost + * exclusively by the Pilot Debugger and Simulator Heap Dump utility + * since it must be able to do heap dumps of both versions of the Pilot + * Memory Manager. + * + * The 'ver' parameter to these macros is either 1 for version 1 or + * 2 for version 2 and the 'p' parameter is the chunk header pointer. + ********************************************************************/ +// This structure is big enough to read in a version 1 or version 2 +// Master Pointer Table into +typedef struct { + MstrPtrTableType ver1; + } MemMstrPtrTableUnionType; + +#define memUSizeOfMstrPtrTable(ver) \ + (ver>1 ? DbgSrcBreak(),0 : sizeof(MstrPtrTableType)) + +#define memUMstrPtrTableNextTblOffset(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((MstrPtrTablePtr)p)->nextTblOffset) + +#define memUMstrPtrTableNumEntries(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((MstrPtrTablePtr)p)->numEntries) + + +typedef struct { + HeapHeaderType ver1; + } MemHeapHeaderUnionType; + +#define memUSizeOfHeapHeader(ver) \ + (ver>1 ? DbgSrcBreak(),0 : sizeof(HeapHeaderType)) + +#define memUHeapSize(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((HeapHeaderPtr)p)->size) + +#define memUHeapFlags(p) \ + (((HeapHeaderPtr)p)->flags) + +#define memUHeapMstrPtrEntries(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((HeapHeaderPtr)p)->mstrPtrTbl.numEntries) + +#define memUHeapMstrPtrAddr(p,ver) \ + (ver>1 ? 0 : &((HeapHeaderPtr)p)->mstrPtrTbl) + + + +typedef struct { + ChunkHeaderType ver1; + } MemChunkHeaderUnionType; + +#define memUSizeOfHeapTerminator(ver) \ + (ver>1 ? DbgSrcBreak(),0 : sizeof(Word)) + +#define memUSizeOfChunkHeader(ver) \ + (ver>1 ? DbgSrcBreak(),0 : sizeof(ChunkHeaderType)) + +#define memUChunkSize(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->size) + +#define memUChunkFlags(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->flags & 0xF0) + +#define memUChunkSizeAdj(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->flags & memChunkFlagSizeAdj) + +#define memUChunkLockCount(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->lockOwner >> 4) + +#define memUChunkOwner(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->lockOwner & memChunkOwnerMask) + +#define memUChunkHOffset(p,ver) \ + (ver>1 ? DbgSrcBreak(),0 : ((ChunkHeaderPtr)p)->hOffset) + + + + +/************************************************************ + * Structure of a Card Header. + * There is 1 card header for in every card that has ROM. The + * card header is stored at sysCardHeaderOffset into the card. + * + * RAM only cards will not have a card header + *************************************************************/ +#define memMaxNameLen 32 // size of name and manuf fields including null +typedef struct { + DWord initStack; // initial stack pointer + DWord resetVector; // reset vector + DWord signature; // must be sysCardSignature + Word hdrVersion; // header version + Word flags; // card flags; + Byte name[memMaxNameLen]; // card name + Byte manuf[memMaxNameLen]; // card manufacturer's name + Word version; // card version + DWord creationDate; // card creation date + Word numRAMBlocks; // number of RAM blocks on card + DWord blockListOffset; // offset to RAM block list + Byte reserved[164]; // to bring us to 0x100 alignment + } CardHeaderType; +typedef CardHeaderType* CardHeaderPtr; + +#define memCardHeaderFlagRAMOnly 0x0001 // RAM only card + + + +/************************************************************ + * Structure of a Storage Header. + * There is 1 of these for every "store" on a memory card. A + * "store" can be all the RAM on a card or all the ROM on a card. + * + * The RAM storage header is stored at sysRAMHeader offset into the + * card. and the ROM storage header is stored at sysROMHeader offset + * into the card. + *************************************************************/ +typedef struct { + DWord signature; // must be sysStoreSignature + Word version; // version of header + Word flags; // flags + Byte name[memMaxNameLen]; // name of store + DWord creationDate; // creation date + DWord backupDate; // last backup date + DWord heapListOffset; // offset to heap list for store + DWord initCodeOffset1; // init code for store, if any + DWord initCodeOffset2; // second init code for store, if any + LocalID databaseDirID; // local ID of database dir. + DWord rsvSpace; // where first heap starts. + DWord dynHeapSpace; // how big the dynamic heap area is + // (always 0 for ROM stores) + DWord firstRAMBlockSize; // Copy of firstRAMBlock size from cardinfo + // Used to determine if we're rebooting + // with a different amount of RAM. + + // The following fields are used to store non-volatile information that + // must be accessed by the system but that is not convenient to store + // in a database due to access time or frequency. It is only valid + // in the RAM STORE ON CARD #0!. + SysNVParamsType nvParams; + + // Filler bytes - reserved for future use. Size adjusted to + // keep total size of storage header at 0x100 bytes. + Byte reserved[176-sizeof(SysNVParamsType)]; + + // CRC value + DWord crc; // crc to check validity + } StorageHeaderType; +typedef StorageHeaderType* StorageHeaderPtr; + +#define memStoreHeaderFlagRAMOnly 0x0001 // RAM store + + +// A Heap list for each store on a card (either RAM or ROM) gives a list of +// heaps' starting offsets for that store +typedef struct { + Word numHeaps; // Number of heaps in store + DWord heapOffset[1]; // offset to heap + } HeapListType; + + + +/******************************************************************** + * CardInfo structure + * The Pilot globals has a pointer to an array of CardInfo structures. + * + * This array is initialized by the Boot code before the Memory Manager + * starts up. Among other things, it tells the Memory Manager where + * every card is and the size of each card. + ********************************************************************/ +typedef struct { + + // These fields are filled in by the boot code BEFORE + // MemInit() is called. + BytePtr baseP; // base address of card + DWord size; // address range of card + DWord firstRAMBlockSize; // size of RAM block at offset 0 + DWord targetROMShift; // used only under Emulation mode, must be + // added to emulated ROM pointers when calculating + // a LocalID for use in the device ROM. + + + DWord cardHeaderOffset; // offset to card header (usually in ROM) + // = 0 if RAM only card + + DWord rsvSpace; // reserve space in RAM before first heap + DWord dynHeapSpace; // how much space to reserve for dynamic heap(s) + StorageHeaderPtr ramStoreP; // pointer to RAM store header + // This location depends on how much space + // was reserved on the card for the dynamic + // heap. + + // These fields are copies of information in the card and storage headers + // they are cached here for quicker access by the Memory Manager. They + // are filled in by the Memory Manager during MemInit. + Word numRAMHeaps; // Number of RAM heaps - for quick access + DWordPtr ramHeapOffsetsP; // Table of RAM heap offsets - for quick access + Word numROMHeaps; // Number of RAM heaps - for quick access + DWordPtr romHeapOffsetsP; // Table of RAM heap offsets - for quick access + + } CardInfoType; +typedef CardInfoType* CardInfoPtr; + +// The constant hwrNumCardSlots, defined in Hardware.h defines the maximum number +// of cards supported by the hardware. + + + + +/************************************************************ + * Private Memory Manager Constants + *************************************************************/ +// Private constant - # of dynamic heaps +#define memDynamicHeaps 1 + + + + +/************************************************************ + * Private Memory Manager Macros. These macros are not + * guaranteed to be compatible in the future and should + * only be used in system code, not applications. + * + * To use these, define NON_PORTABLE at the top of your + * source code module. + * + * WARNING: This macro must only be used on Locked chunks!!! + * When running with error checking, it will verify + * that the chunk is locked before it dereferences it. + *************************************************************/ + +#if MEMORY_FORCE_LOCK == MEMORY_FORCE_LOCK_ON + #define memHandleProtect(h) \ + ((VoidHand)((DWord)h | 0x80000000)) + #define memHandleUnProtect(h) \ + ((VoidHand)((DWord)h & 0x7FFFFFFF)) +#else + #define memHandleProtect(h) (h) + #define memHandleUnProtect(h) (h) +#endif + + +#if MEMORY_TYPE == MEMORY_LOCAL + #if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + #define MemDeref(h) \ + (MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : (*memHandleUnProtect(h))) + #else + #define MemDeref(h) \ + (*(memHandleUnProtect(h))) + #endif + +#else + #if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + #define MemDeref(h) \ + (MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : ((Ptr)ShlDWord(h))) + #else + #define MemDeref(h) \ + ((Ptr)ShlDWord(memHandleUnProtect(h))) + #endif +#endif + + + + +// Typecast access to the MemCardInfo Ptr +#define memCardInfoP(cardNo) \ + ( ((CardInfoPtr) ((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP) + cardNo) + + + +/******************************************************************** + * Memory Manager Private Routines + * These are used only by internal System code + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +HeapHeaderPtr MemHeapPtr(UInt heapID) + SYS_TRAP(sysTrapMemHeapPtr); + +Err MemStoreSearch(VoidPtr startP, DWord range, StorageHeaderPtr* storePP) + SYS_TRAP(sysTrapMemStoreSearch); + +Err MemStoreInit(DWord firstHeapSize, UInt firstHeapMstrPtrs, + UInt cardNo, Word numBlocks, DWordPtr blockInfoP, + StorageHeaderPtr storeP, Word numMstrPtrs) + SYS_TRAP(sysTrapMemStoreInit); + +Err MemNVParams(Boolean set, SysNVParamsPtr paramsP) + SYS_TRAP(sysTrapMemNVParams); + +#ifdef __cplusplus +} +#endif + + + + + + +#endif // __MEMORYMGRPRV_H__ +#endif // NON_PORTABLE +#endif // MEMORY_VERSION_2 + diff --git a/sdk-3.1/include/Core/System/MemoryPrvNew.h b/sdk-3.1/include/Core/System/MemoryPrvNew.h new file mode 100644 index 0000000..7c88b9e --- /dev/null +++ b/sdk-3.1/include/Core/System/MemoryPrvNew.h @@ -0,0 +1,519 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * MemoryPrvNew.h + * + * Description: + * Private includes for Memory Manager. This file should NOT BE + * INCLUDED by source files!!!. It gets included by MemoryPrv.h if + * the define MEMORY_VERSION is set to 2 and essentially replaces + * everything in MemoryPrv.h with new stuff. + * + * History: + * 11/11/96 RM - Re-written to allow heaps > 64K in size. + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +// SystemPrv.h must be included before this header file. SystemPrv.h will +// then in turn include this header. +#ifndef __SYSTEMPRV_H__ +#include +#endif + +#ifndef __MEMORYMGRPRV_H__ +#define __MEMORYMGRPRV_H__ + + +/******************************************************************** + * Structure of a Master Pointer chunk + * The first master pointer chunk is always immediately following the + * heap header. As more movable chunks are created, new master + * pointer chunks are allocated dynamically and linked together through + * the nextTblOffset field and prevTblOffset field. + ********************************************************************/ +typedef struct { + Word numEntries; // number of master pointer entries + DWord nextTblOffset; // offset from start of heap to next table + //Ptr mstrP[numEntries]; // array of pointers to movable chunks + } MemMstrPtrTableType; +typedef MemMstrPtrTableType* MemMstrPtrTablePtr; + +/******************************************************************** + * Structure of a version 1 MasterPtrTbl. This is included + * for use by the Pilot Debugger so that it can do heap dumps of + * Pilots that use the version 1 Memory Manager. + * + ********************************************************************/ +typedef struct { + Word numEntries; // number of master pointer entries + Word nextTblOffset; // offset from start of heap to next table + //Ptr mstrP[numEntries]; // array of pointers to movable chunks + } Mem1MstrPtrTableType; +typedef Mem1MstrPtrTableType* Mem1MstrPtrTablePtr; + + + +/******************************************************************** + * Structure of a version 2 Memory Manager Chunk + * + ********************************************************************/ +typedef struct { + DWord free :1; // set if free chunk + DWord moved :1; // used by MemHeapScramble + DWord unused2 :1; // unused + DWord unused3 :1; // unused + DWord sizeAdj :4; // size adjustment + DWord size :24; // actual size of chunk + + DWord lockCount :4; // lock count + DWord owner :4; // owner ID + SDWord hOffset :24; // signed handle offset/2 + // used in free chunks to point to next free chunk + } MemChunkHeaderType; +typedef MemChunkHeaderType* MemChunkHeaderPtr; + +// The MemHeapTerminatorType is stored at the end of every heap and +// is pointed to by the last real chunk in the heap +typedef DWord MemHeapTerminatorType; + +// This macro is a quicker way of clearing a chunk header than +// MemSet... +#define memClearChunkHeader(p) { *((DWordPtr)p) = 0; *(((DWordPtr)p)+1) = 0;} + +// This macro is used to grab all the flags at once and place them into +// a byte +#define memChunkFlags(p) (*((BytePtr)p) & 0xF0) + +// This macro is used to clear all the flags at once +#define memChunkFlagsClear(p) ((*((BytePtr)p)) &= 0x0F) + +// When flags are returned by the API (by MemPtrFlags, etc.) +#define memChunkFlagFree 0x80 // free bit +#define memChunkFlagUnused1 0x40 // unused +#define memChunkFlagUnused2 0x20 // unused +#define memChunkFlagUnused3 0x10 // unused + +// A lockcount of memPtrLockCount means a permanently unmovable chunk +#define memPtrLockCount 15 + +// A ownerID of 15 is used for master pointer chunks +#define memOwnerMasterPtrTbl 15 + + +// This equate returns the name of the ChunkHeaderType. This was created +// so that we can change the name of the CHunkHeaderType (as we did for V2 of +// the Memory Manager) and souce code won't know the difference +#define memChunkHeaderTypeName MemChunkHeaderType + + +/******************************************************************** + * Structure of a version 1 Memory Manager Chunk. This is included + * for use by the Pilot Debugger so that it can do heap dumps of + * Pilots that use the version 1 Memory Manager. + * + ********************************************************************/ +typedef struct { + Word size; // size of block in bytes, including header + Byte lockOwner; // lock count in high nibble, owner in low + Byte flags; // flags, size adj in low nibble + SWord hOffset; // offset/2 to handle for movables + } Mem1ChunkHeaderType; +typedef Mem1ChunkHeaderType* Mem1ChunkHeaderPtr; + +#define mem1ChunkFlagSizeAdj 0x0F // mask for size adjustment + +// A non-movable chunk has 0xF as the lock count +#define mem1ChunkLockMask 0xF0 +#define mem1ChunkOwnerMask 0x0F + + +/******************************************************************** + * Structure of a Heap + * + * A heap starts with a HeapHeader + * Followed by the offset table (numHandles) + * Followed by movable chunks + * Followed by non-movable chunks + ********************************************************************/ +typedef struct { + Word flags; // heap flags; + DWord size; // size of heap + DWord firstFreeChunkOffset;// offset/2 to first free chunk + MemMstrPtrTableType mstrPtrTbl; // Master pointer table + } MemHeapHeaderType; +typedef MemHeapHeaderType* MemHeapHeaderPtr; + + +// Flags Field +#define memHeapFlagReadOnly 0x0001 // heap is read-only (ROM based) +#define memHeapFlagVers2 0x8000 // version 2 heap (> 64K) +#define memHeapFlagVers3 0x4000 // version 3 heap (has free list) + +#define memMstrPtrTableGrowBy 50 // # of entries to grow master pointer tables by +#define memMstrPtrTableInitSizeD 200 // # of entries to allocate initially for dynamic heap(s) +#define memMstrPtrTableInitSizeS 200 // # of entries to allocate initially for storage heap(s) + + + +/******************************************************************** + * Structure of a version 1 Memory Manager Chunk. This is included + * for use by the Pilot Debugger so that it can do heap dumps of + * Pilots that use the version 1 Memory Manager. + * + ********************************************************************/ +typedef struct { + Word flags; // heap flags; + Word size; // size of heap - 0 means 64K; + Mem1MstrPtrTableType mstrPtrTbl; // Master pointer table + } Mem1HeapHeaderType; +typedef Mem1HeapHeaderType* Mem1HeapHeaderPtr; + + +typedef struct { + Word flags; // heap flags; + DWord size; // size of heap + MemMstrPtrTableType mstrPtrTbl; // Master pointer table + } Mem2HeapHeaderType; +typedef Mem2HeapHeaderType* Mem2HeapHeaderPtr; + + +/******************************************************************** + * These macros pave the way for the version 2 Memory Manager that + * supports >64K chunks. + * + * They are a general way to get info out of a Chunk header and Heap header + * whether it be a version 1 or version 2 header. They are used almost + * exclusively by the Pilot Debugger and Simulator Heap Dump utility + * since it must be able to do heap dumps of both versions of the Pilot + * Memory Manager. + * + * The 'ver' parameter to these macros is either 1 for version 1 or + * 2 for version 2 and the 'p' parameter is the chunk header pointer. + ********************************************************************/ +// This structure is big enough to read in a version 1 or version 2 +// Master Pointer Table into +typedef struct { + union { + MemMstrPtrTableType ver2; + Mem1MstrPtrTableType ver1; + } header; + } MemMstrPtrTableUnionType; + +#define memUSizeOfMstrPtrTable(ver) \ + (ver>1 ? sizeof(MemMstrPtrTableType) : sizeof(Mem1MstrPtrTableType)) + +#define memUMstrPtrTableNextTblOffset(p,ver) \ + (ver>1 ? ((MemMstrPtrTablePtr)p)->nextTblOffset : ((Mem1MstrPtrTablePtr)p)->nextTblOffset) + +#define memUMstrPtrTableNumEntries(p,ver) \ + (ver>1 ? ((MemMstrPtrTablePtr)p)->numEntries : ((Mem1MstrPtrTablePtr)p)->numEntries) + + +// This structure is big enough to read in a version 1, version 2, or version 3 +// heap header into +typedef struct { + union { + MemHeapHeaderType ver3; + Mem2HeapHeaderType ver2; + Mem1HeapHeaderType ver1; + } header; + } MemHeapHeaderUnionType; + +#define memUHeapVer(p) \ + (memUHeapFlags(locHeapP) & memHeapFlagVers3 ? 3 : (memUHeapFlags(locHeapP) & memHeapFlagVers2 ? 2 : 1)) + +#define memUSizeOfHeapHeader(ver) \ + (ver>2 ? sizeof (MemHeapHeaderType) : (ver>1 ? sizeof(Mem2HeapHeaderType) : sizeof(Mem1HeapHeaderType))) + +#define memUHeapSize(p,ver) \ + (ver>2 ? ((MemHeapHeaderPtr)p)->size : (ver>1 ? ((Mem2HeapHeaderPtr)p)->size : ((Mem1HeapHeaderPtr)p)->size)) + +#define memUHeapFlags(p) \ + (((MemHeapHeaderPtr)p)->flags) + +#define memUHeapMstrPtrEntries(p,ver) \ + (ver>2 ? ((MemHeapHeaderPtr)p)->mstrPtrTbl.numEntries : (ver>1 ? ((Mem2HeapHeaderPtr)p)->mstrPtrTbl.numEntries : ((Mem1HeapHeaderPtr)p)->mstrPtrTbl.numEntries)) + +#define memUHeapMstrPtrAddr(p,ver) \ + (ver>2 ? (VoidPtr)&((MemHeapHeaderPtr)p)->mstrPtrTbl : (ver>1 ? (VoidPtr)&((Mem2HeapHeaderPtr)p)->mstrPtrTbl : (VoidPtr)&((Mem1HeapHeaderPtr)p)->mstrPtrTbl)) + + + +// This structure is big enough to read in a version 1 or version 2 +// chunk header into. +typedef struct { + union { + MemChunkHeaderType ver2; + Mem1ChunkHeaderType ver1; + } header; + } MemChunkHeaderUnionType; + +#define memUSizeOfHeapTerminator(ver) \ + (ver>1 ? sizeof(MemHeapTerminatorType) : sizeof(Word)) + +#define memUSizeOfChunkHeader(ver) \ + (ver>1 ? sizeof(MemChunkHeaderType) : sizeof(Mem1ChunkHeaderType)) + +#define memUChunkSize(p,ver) \ + (ver>1 ? ((MemChunkHeaderPtr)p)->size : ((Mem1ChunkHeaderPtr)p)->size) + +#define memUChunkFlags(p,ver) \ + (ver>1 ? memChunkFlags(p) : ((Mem1ChunkHeaderPtr)p)->flags & 0xF0) + +#define memUChunkSizeAdj(p,ver) \ + (ver>1 ? ((MemChunkHeaderPtr)p)->sizeAdj : ((Mem1ChunkHeaderPtr)p)->flags & mem1ChunkFlagSizeAdj) + +#define memUChunkLockCount(p,ver) \ + (ver>1 ? ((MemChunkHeaderPtr)p)->lockCount : ((Mem1ChunkHeaderPtr)p)->lockOwner >> 4) + +#define memUChunkOwner(p,ver) \ + (ver>1 ? ((MemChunkHeaderPtr)p)->owner : ((Mem1ChunkHeaderPtr)p)->lockOwner & mem1ChunkOwnerMask) + +#define memUChunkHOffset(p,ver) \ + (ver>1 ? ((MemChunkHeaderPtr)p)->hOffset : ((Mem1ChunkHeaderPtr)p)->hOffset) + + + + +/************************************************************ + * Structure of a Card Header. + * There is 1 card header for in every card that has ROM. The + * card header is stored at sysCardHeaderOffset into the card. + * + * RAM only cards will not have a card header + *************************************************************/ +#define memMaxNameLen 32 // size of name and manuf fields including null +typedef struct CardHeaderType { + DWord initStack; // initial stack pointer + DWord resetVector; // reset vector + DWord signature; // must be sysCardSignature + Word hdrVersion; // header version + Word flags; // card flags; + Byte name[memMaxNameLen]; // card name + Byte manuf[memMaxNameLen]; // card manufacturer's name + Word version; // card version + DWord creationDate; // card creation date + Word numRAMBlocks; // number of RAM blocks on card + DWord blockListOffset; // offset to RAM block list + DWord readWriteParmsOffset; // v2: offset to read/write system data if any (in ROM) + DWord readWriteParmsSize; // v2: size of read/write system data if any (in ROM) + DWord readOnlyParmsOffset; // v2: offset to read-only system data (in ROM) + DWord bigROMOffset; // v2: in SmallROM header: where SmallROM expects bigROM to live + // in BigROM header: where BigROM expects itself to live + DWord checksumBytes; // v2: size of card image in bytes (for checksum) + Word checksumValue; // v2: checksum of card image (from Crc16CalcBlock) + + DWord readWriteWorkingOffset; // v3: offset to read/write working area if any (in ROM) + DWord readWriteWorkingSize; // v3: size of read/write working area if any (in ROM) + + Byte reserved[134]; // to bring us to 0x100 alignment + } CardHeaderType; +typedef CardHeaderType* CardHeaderPtr; + +#define memCardHeaderFlagRAMOnly 0x0001 // RAM only card +#define memCardHeaderFlag328 0x0010 // ROM Supports 68328 processor +#define memCardHeaderFlagEZ 0x0020 // ROM SUpports 68EZ328 processor + + + +/************************************************************ + * Structure of a Storage Header. + * There is 1 of these for every "store" on a memory card. A + * "store" can be all the RAM on a card or all the ROM on a card. + * + * The RAM storage header is stored at sysRAMHeader offset into the + * card. and the ROM storage header is stored at sysROMHeader offset + * into the card. + *************************************************************/ +typedef struct { + DWord signature; // must be sysStoreSignature + Word version; // version of header + Word flags; // flags + Byte name[memMaxNameLen]; // name of store + DWord creationDate; // creation date + DWord backupDate; // last backup date + DWord heapListOffset; // offset to heap list for store + DWord initCodeOffset1; // init code for store, if any + DWord initCodeOffset2; // second init code for store, if any + LocalID databaseDirID; // local ID of database dir. + DWord rsvSpace; // where first heap starts. + DWord dynHeapSpace; // how big the dynamic heap area is + // (always 0 for ROM stores) + DWord firstRAMBlockSize; // Copy of firstRAMBlock size from cardinfo + // Used to determine if we're rebooting + // with a different amount of RAM. + + // The following fields are used to store non-volatile information that + // must be accessed by the system but that is not convenient to store + // in a database due to access time or frequency. It is only valid + // in the RAM STORE ON CARD #0!. + SysNVParamsType nvParams; + + // Filler bytes - reserved for future use. Size adjusted to + // keep total size of storage header at 0x100 bytes. + Byte reserved[176-sizeof(SysNVParamsType)]; + + // CRC value + DWord crc; // crc to check validity + } StorageHeaderType; +typedef StorageHeaderType* StorageHeaderPtr; + +#define memStoreHeaderFlagRAMOnly 0x0001 // RAM store + + +// A Heap list for each store on a card (either RAM or ROM) gives a list of +// heaps' starting offsets for that store +typedef struct { + Word numHeaps; // Number of heaps in store + DWord heapOffset[1]; // offset to heap + } HeapListType; + + + +/******************************************************************** + * CardInfo structure + * The Pilot globals has a pointer to an array of CardInfo structures. + * + * This array is initialized by the Boot code before the Memory Manager + * starts up. Among other things, it tells the Memory Manager where + * every card is and the size of each card. + ********************************************************************/ +typedef struct { + + // These fields are filled in by the boot code BEFORE + // MemInit() is called. + BytePtr baseP; // base address of card + DWord size; // address range of card + DWord firstRAMBlockSize; // size of RAM block at offset 0 + DWord targetROMShift; // used only under Emulation mode, must be + // added to emulated ROM pointers when calculating + // a LocalID for use in the device ROM. + + + DWord cardHeaderOffset; // offset to card header (usually in ROM) + // = 0 if RAM only card + + DWord rsvSpace; // reserve space in RAM before first heap + DWord dynHeapSpace; // how much space to reserve for dynamic heap(s) + StorageHeaderPtr ramStoreP; // pointer to RAM store header + // This location depends on how much space + // was reserved on the card for the dynamic + // heap. + + // These fields are copies of information in the card and storage headers + // they are cached here for quicker access by the Memory Manager. They + // are filled in by the Memory Manager during MemInit. + Word numRAMHeaps; // Number of RAM heaps - for quick access + DWordPtr ramHeapOffsetsP; // Table of RAM heap offsets - for quick access + Word numROMHeaps; // Number of RAM heaps - for quick access + DWordPtr romHeapOffsetsP; // Table of RAM heap offsets - for quick access + + } CardInfoType; +typedef CardInfoType* CardInfoPtr; + +// The constant hwrNumCardSlots, defined in Hardware.h defines the maximum number +// of cards supported by the hardware. + + + + +/************************************************************ + * Private Memory Manager Constants + *************************************************************/ +// Private constant - # of dynamic heaps +#define memDynamicHeaps 1 + +// Private constant - maximum chunk size allowed (0xFFFFFFFFL = up to available memory) +// We're presently limiting the maximum chunk allocation because the current HotSync cannot +// transfer records/resources larger than (0x0FFFF - 30) bytes. This restriction will +// be removed when HotSync is extended to handle larger transfers. +#define memMaxChunkAllocSize ((ULong)(0x0FFFFUL - 30UL)) + + + +/************************************************************ + * Private Memory Manager Macros. These macros are not + * guaranteed to be compatible in the future and should + * only be used in system code, not applications. + * + * To use these, define NON_PORTABLE at the top of your + * source code module. + * + * WARNING: This macro must only be used on Locked chunks!!! + * When running with error checking, it will verify + * that the chunk is locked before it dereferences it. + *************************************************************/ + +#if MEMORY_FORCE_LOCK == MEMORY_FORCE_LOCK_ON + #define memHandleProtect(h) \ + ((VoidHand)((DWord)h | 0x80000000)) + #define memHandleUnProtect(h) \ + ((VoidHand)((DWord)h & 0x7FFFFFFF)) +#else + #define memHandleProtect(h) (h) + #define memHandleUnProtect(h) (h) +#endif + + +#if MEMORY_TYPE == MEMORY_LOCAL + #if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + #define MemDeref(h) \ + (MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : (*memHandleUnProtect(h))) + #else + #define MemDeref(h) \ + (*(memHandleUnProtect(h))) + #endif + +#else + #if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + #define MemDeref(h) \ + (MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : ((Ptr)ShlDWord(h))) + #else + #define MemDeref(h) \ + ((Ptr)ShlDWord(memHandleUnProtect(h))) + #endif +#endif + + + + +// Typecast access to the MemCardInfo Ptr +#define memCardInfoP(cardNo) \ + ( ((CardInfoPtr) ((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP) + cardNo) + + + +/******************************************************************** + * Memory Manager Private Routines + * These are used only by internal System code + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +VoidPtr MemHeapPtr(UInt heapID) + SYS_TRAP(sysTrapMemHeapPtr); + +Err MemStoreSearch(VoidPtr startP, DWord range, StorageHeaderPtr* storePP) + SYS_TRAP(sysTrapMemStoreSearch); + +Err MemStoreInit(DWord firstHeapSize, UInt firstHeapMstrPtrs, + UInt cardNo, Word numBlocks, DWordPtr blockInfoP, + StorageHeaderPtr storeP, Word numMstrPtrs) + SYS_TRAP(sysTrapMemStoreInit); + +Err MemNVParams(Boolean set, SysNVParamsPtr paramsP) + SYS_TRAP(sysTrapMemNVParams); + +#ifdef __cplusplus +} +#endif + +#endif // __MEMORYMGRPRV_H__ +#endif // NON_PORTABLE diff --git a/sdk-3.1/include/Core/System/ModemMgr.h b/sdk-3.1/include/Core/System/ModemMgr.h new file mode 100644 index 0000000..0f2e16a --- /dev/null +++ b/sdk-3.1/include/Core/System/ModemMgr.h @@ -0,0 +1,147 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * ModemMgr.h + * + * Description: + * Include file for Modem Manager + * + * History: + * 9/20/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __MODEM_MGR_H__ +#define __MODEM_MGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Modem Manager constants + *************************************************************/ + +#define mdmMaxStringSize 40 + +#define mdmCmdBufSize 81 // command buffer capacity (including null) +#define mdmRespBufSize 81 // reply buffer capacity (including null) +#define mdmCmdSize 8 // max storage needed for smartmodem command + +#define mdmDefCmdTimeOut 500000L // in micro-seconds + +#define mdmDefDTWaitSec 4 +#define mdmDefDCDWaitSec 70 +#define mdmDefSpeakerVolume 1 + + +// Speaker volume settings +enum { + mdmVolumeOff = 0, + mdmVolumeLow = 1, + mdmVolumeMed = 2, + mdmVolumeHigh = 3 + }; + + +// Modem connection stages (NEW for Pilot 2.0) +typedef enum { + mdmStageInvalid = 0, // invalid state + mdmStageReserved = 1, // reserved for 1.0 compatibility + mdmStageFindingModem, // checking if modem is present + mdmStageInitializing, // initializing the modem + mdmStageDialing, // dialing the modem + mdmStageWaitingForCarrier, // waiting for carrier detect + mdmStageHangingUp // hanging up the modem + } MdmStageEnum; + +/************************************************************ + * Modem Manager data structures + *************************************************************/ +// Prototype for the "user cancel" check callback function +typedef Int (*MdmUserCanProcPtr)(DWord userRef); + +typedef struct MdmInfoType { + UInt serRefNum; // serial library reference number + ULong initialBaud; // initial baud rate to use + ULong cmdTimeOut; // number of micro-sec to wait after a cmd + Int dtWaitSec; // dialtone wait (sec) (-1 for modem's default) + Int dcdWaitSec; // dcd timeout wait (sec) (-1 for modem's default) + Int volume; // speaker volume(see mdmVolume... constants) + Boolean pulse; // pulse or tone dialing + Boolean hwHShake; // enable cts/rts handshaking + Boolean autoBaud; // enable/disable auto-baud to connected baud rate + MdmUserCanProcPtr canProcP; // ptr to user-cancel function + DWord userRef; // parameter for canProcP() + Char cmdBuf[mdmCmdBufSize]; // build all commands here + Char respBuf[mdmRespBufSize];// response buffer + ULong connectBaud; // baud at which connection was established + // (0 = unknown) + Byte curStage; // set by ModemMgr to report current MdmStageEnum + } MdmInfoType; + +typedef MdmInfoType* MdmInfoPtr; + +/************************************************************ + * Modem Manager result codes + * (mdmErrorClass is defined in SystemMgr.h) + *************************************************************/ +#pragma mark -Error Codes- + +#define mdmErrNoTone (mdmErrorClass | 1) // no dial tone +#define mdmErrNoDCD (mdmErrorClass | 2) // no carrier / timeout +#define mdmErrBusy (mdmErrorClass | 3) // busy signal heard +#define mdmErrUserCan (mdmErrorClass | 4) // cancelled by user +#define mdmErrCmdError (mdmErrorClass | 5) // command error +#define mdmErrNoModem (mdmErrorClass | 6) // no modem detected +#define mdmErrMemory (mdmErrorClass | 7) // not enough memory +#define mdmErrPrefs (mdmErrorClass | 8) // modem preferences have not been + // setup - (app should take user to modem prefs panel) +#define mdmErrDial (mdmErrorClass | 9) // dial command error - most likely the dial + // string is too long for the modem's buffer or + // contains invalid characters + + + +/******************************************************************** + * Modem Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#pragma mark -API Routines- + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +Err MdmDial(MdmInfoPtr modemP, CharPtr okDialP, CharPtr userInitP, CharPtr phoneNumP) + SYS_TRAP(sysTrapMdmDial); + +Err MdmHangUp(MdmInfoPtr modemP) + SYS_TRAP(sysTrapMdmHangUp); + + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Modem Manager Macros + *************************************************************/ + +#endif // __MODEM_MGR_H__ + diff --git a/sdk-3.1/include/Core/System/NetMgr.h b/sdk-3.1/include/Core/System/NetMgr.h new file mode 100644 index 0000000..9798bc1 --- /dev/null +++ b/sdk-3.1/include/Core/System/NetMgr.h @@ -0,0 +1,1282 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: NetMgr.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the interface definition for the TCP/IP + * library on Pilot. + * + **********************************************************************/ +#ifndef __NETMGR_H__ +#define __NETMGR_H__ + +#include +#include + + +/******************************************************************** + * Type and creator of Net Library database + ********************************************************************/ + +// Creator. Used for both the database that contains the Net Library and +// it's preferences database. +#define netCreator 'netl' // Our Net Library creator + +// Feature Creators and numbers, for use with the FtrGet() call. This +// feature can be obtained to get the current version of the Net Library +#define netFtrCreator netCreator +#define netFtrNumVersion 0 // get version of Net Library + // 0xMMmfsbbb, where MM is major version, m is minor version + // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development, + // bbb is build number for non-releases + // V1.12b3 would be: 0x01122003 + // V2.00a2 would be: 0x02001002 + // V1.01 would be: 0x01013000 + + +// Types. Used to identify the Net Library from it's prefs. +#define netLibType 'libr' // Our Net Code Resources Database type +#define netPrefsType 'rsrc' // Our Net Preferences Database type + + +// All Network interface's have the following type: +#define netIFFileType 'neti' // The filetype of all Network Interfaces + +// Each Network interface has a unique creator: +#define netIFCreatorLoop 'loop' // Loopback network interface creator. +#define netIFCreatorSLIP 'slip' // SLIP network interface creator. +#define netIFCreatorPPP 'ppp_' // PPP network interface creator. + + +//----------------------------------------------------------------------------- +// Misc. constants +//----------------------------------------------------------------------------- +#define netDrvrTypeNameLen 8 // Maximum driver type length +#define netDrvrHWNameLen 16 // Maximum driver hardware name length +#define netIFNameLen 10 // Maximum interface name (driver type + instance num) +#define netIFMaxHWAddrLen 14 // Maximum size of a hardware address + + + +//----------------------------------------------------------------------------- +// Option constants that can be passed to NetSocketOptionSet and NetSocketOptionGet +// When an option is set or retrieved, both the level of the option and the +// option number must be specified. The level refers to which layer the option +// refers to, like the uppermost socket layer, for example. +//----------------------------------------------------------------------------- + +// Socket level options +typedef enum { + // IP Level options + netSocketOptIPOptions = 1, // options in IP header (IP_OPTIONS) + + // TCP Level options + netSocketOptTCPNoDelay = 1, // don't delay send to coalesce packets + netSocketOptTCPMaxSeg = 2, // TCP maximum segment size (TCP_MAXSEG) + + // Socket level options + netSocketOptSockDebug = 0x0001, // turn on debugging info recording + netSocketOptSockAcceptConn = 0x0002, // socket has had listen + netSocketOptSockReuseAddr = 0x0004, // allow local address reuse + netSocketOptSockKeepAlive = 0x0008, // keep connections alive + netSocketOptSockDontRoute = 0x0010, // just use interface addresses + netSocketOptSockBroadcast = 0x0020, // permit sending of broadcast msgs + netSocketOptSockUseLoopback = 0x0040, // bypass hardware when possible + netSocketOptSockLinger = 0x0080, // linger on close if data present + netSocketOptSockOOBInLine = 0x0100, // leave received OutOfBand data in line + + netSocketOptSockSndBufSize = 0x1001, // send buffer size + netSocketOptSockRcvBufSize = 0x1002, // receive buffer size + netSocketOptSockSndLowWater = 0x1003, // send low-water mark + netSocketOptSockRcvLowWater = 0x1004, // receive low-water mark + netSocketOptSockSndTimeout = 0x1005, // send timeout + netSocketOptSockRcvTimeout = 0x1006, // receive timeout + netSocketOptSockErrorStatus= 0x1007, // get error status and clear + netSocketOptSockSocketType = 0x1008, // get socket type + + // The following are Pilot specific options + netSocketOptSockNonBlocking = 0x2000, // set non-blocking mode on or off + netSocketOptSockRequireErrClear = 0x2001 // return error from all further calls to socket + // unless netSocketOptSockErrorStatus is cleared. + } NetSocketOptEnum; + + + + +// Option levels for SocketOptionSet and SocketOptionGet +typedef enum { + netSocketOptLevelIP = 0, // IP level options (IPPROTO_IP) + netSocketOptLevelTCP = 6, // TCP level options (IPPROTO_TCP) + netSocketOptLevelSocket = 0xFFFF // Socket level options (SOL_SOCKET) + } NetSocketOptLevelEnum; + + +// Structure used for manipulating the linger option +typedef struct { + SWord onOff; // option on/off + SWord time; // linger time in seconds + } NetSocketLingerType; + +//----------------------------------------------------------------------------- +// Enumeration of Socket domains and types passed to NetSocketOpen +//----------------------------------------------------------------------------- +typedef enum { + netSocketAddrRaw=0, // (AF_UNSPEC, AF_RAW) + netSocketAddrINET=2 // (AF_INET) + } NetSocketAddrEnum; + +typedef enum { + netSocketTypeStream=1, // (SOCK_STREAM) + netSocketTypeDatagram=2, // (SOCK_DGRAM) + netSocketTypeRaw=3, // (SOCK_RAW) + netSocketTypeReliableMsg=4 // (SOCK_RDM) + } NetSocketTypeEnum; + +// Protocols, passed in the protocol parameter to NetLibSocketOpen +#define netSocketProtoIPICMP 1 // IPPROTO_ICMP +#define netSocketProtoIPTCP 6 // IPPROTO_TCP +#define netSocketProtoIPUDP 17 // IPPROTO_UDP +#define netSocketProtoIPRAW 255 // IPPROTO_RAW + + +//----------------------------------------------------------------------------- +// Enumeration of Socket direction, passed to NetSocketShutdown +//----------------------------------------------------------------------------- +typedef enum { + netSocketDirInput=0, + netSocketDirOutput=1, + netSocketDirBoth=2 + } NetSocketDirEnum; + + +//----------------------------------------------------------------------------- +// Basic Types +//----------------------------------------------------------------------------- +// Socket refnum +typedef SWord NetSocketRef; + +// Type used to hold internet addresses +typedef DWord NetIPAddr; // a 32-bit IP address. + + + +//----------------------------------------------------------------------------- +// Structure used to hold an internet socket address. This includes the internet +// address and the port number. This structure directly maps to the BSD unix +// struct sockaddr_in. +//----------------------------------------------------------------------------- +typedef struct NetSocketAddrINType { + SWord family; // Address family in HBO (Host Byte Order) + Word port; // the UDP port in NBO (Network Byte Order) + NetIPAddr addr; // IP address in NBO (Network Byte Order) + } NetSocketAddrINType; + +// Constant that means "use the local machine's IP address" +#define netIPAddrLocal 0 // Can be used in NetSockAddrINType.addr + + +// Structure used to hold a generic socket address. This is a generic struct +// designed to hold any type of address including internet addresses. This +// structure directly maps to the BSD unix struct sockaddr. +typedef struct NetSocketAddrType { + SWord family; // Address family + Byte data[14]; // 14 bytes of address + } NetSocketAddrType; + + +// Structure used to hold a raw socket address. When using the netSocketAddrRaw +// protocol family, the caller must bind() the socket to an interface and +// specifies the interface using this structure. IMPORTANT: NUMEROUS +// ROUTINES IN NETLIB RELY ON THE FACT THAT THIS STRUCTURE IS THE SAME +// SIZE AS A NetSocketAddrINType STRUCTURE. +typedef struct NetSocketAddrRawType { + SWord family; // Address family in HBO (Host Byte Order) + Word ifInstance; // the interface instance number + DWord ifCreator; // the interface creator + } NetSocketAddrRawType; + + + +//----------------------------------------------------------------------------- +// Structure used to hold information about data to be sent. This structure +// is passed to NetLibSendMsg and contains the optional address to send to, +// a scatter-write array of data to be sent, and optional access rights +//----------------------------------------------------------------------------- + +// Scatter/Gather array type. A pointer to an array of these structs is +// passed to the NetLibSendPB and NetLibRecvPB calls. It specifies where +// data should go to or come from as a list of buffer addresses and sizes. +typedef struct NetIOVecType { + BytePtr bufP; // buffer address + Word bufLen; // buffer length + } NetIOVecType, *NetIOVecPtr; + +#define netIOVecMaxLen 16 // max# of NetIOVecTypes in an array + +// Read/Write ParamBlock type. Passed directly to the SendPB and RecvPB calls. +typedef struct { + BytePtr addrP; // address - or 0 for default + Word addrLen; // length of address + NetIOVecPtr iov; // scatter/gather array + Word iovLen; // length of above array + BytePtr accessRights; // access rights + Word accessRightsLen; // length of accessrights + } NetIOParamType, *NetIOParamPtr; + +// Flags values for the NetLibSend, NetLibReceive calls +#define netIOFlagOutOfBand 0x01 // process out-of-band data +#define netIOFlagPeek 0x02 // peek at incoming message +#define netIOFlagDontRoute 0x04 // send without using routing + + + +//----------------------------------------------------------------------------- +// Structures used for looking up a host by name or address (NetLibGetHostByName) +//----------------------------------------------------------------------------- + +// Equates for DNS names, from RFC-1035 +#define netDNSMaxDomainName 255 +#define netDNSMaxDomainLabel 63 + +#define netDNSMaxAliases 1 // max # of aliases for a host +#define netDNSMaxAddresses 4 // max # of addresses for a host + + +// The actual results of NetLibGetHostByName() are returned in this structure. +// This structure is designed to match the "struct hostent" structure in Unix. +typedef struct { + CharPtr nameP; // official name of host + CharPtr* nameAliasesP; // array of alias's for the name + Word addrType; // address type of return addresses + Word addrLen; // the length, in bytes, of the addresses + BytePtr* addrListP; // array of ptrs to addresses in HBO + } NetHostInfoType, *NetHostInfoPtr; + + +// "Buffer" passed to call as a place to store the results +typedef struct { + NetHostInfoType hostInfo; // high level results of call are here + + // The following fields contain the variable length data that + // hostInfo points to + Char name[netDNSMaxDomainName+1]; // hostInfo->name + + CharPtr aliasList[netDNSMaxAliases+1]; // +1 for 0 termination. + Char aliases[netDNSMaxAliases][netDNSMaxDomainName+1]; + + NetIPAddr* addressList[netDNSMaxAddresses]; + NetIPAddr address[netDNSMaxAddresses]; + + } NetHostInfoBufType, *NetHostInfoBufPtr; + + +//----------------------------------------------------------------------------- +// Structures used for looking up a service (NetLibGetServByName) +//----------------------------------------------------------------------------- + +// Equates for service names +#define netServMaxName 15 // max # characters in service name +#define netProtoMaxName 15 // max # characters in protocol name +#define netServMaxAliases 1 // max # of aliases for a service + + +// The actual results of NetLibGetServByName() are returned in this structure. +// This structure is designed to match the "struct servent" structure in Unix. +typedef struct { + CharPtr nameP; // official name of service + CharPtr* nameAliasesP; // array of alias's for the name + Word port; // port number for this service + CharPtr protoP; // name of protocol to use + } NetServInfoType, *NetServInfoPtr; + +// "Buffer" passed to call as a place to store the results +typedef struct { + NetServInfoType servInfo; // high level results of call are here + + // The following fields contain the variable length data that + // servInfo points to + Char name[netServMaxName+1]; // hostInfo->name + + CharPtr aliasList[netServMaxAliases+1]; // +1 for 0 termination. + Char aliases[netServMaxAliases][netServMaxName]; + Char protoName[netProtoMaxName+1]; + + } NetServInfoBufType, *NetServInfoBufPtr; + + + + +/******************************************************************** + * Tracing Flags. These flags are ORed together and passed as a DWord + * in the netSettingTraceFlags setting and netIFSettingTraceFlags to + * enable/disable various trace options. + ********************************************************************/ +#define netTracingErrors 0x00000001 // record errors +#define netTracingMsgs 0x00000002 // record messages +#define netTracingPkts 0x00000004 // record packets I/O +#define netTracingFuncs 0x00000008 // record function flow +#define netTracingAppMsgs 0x00000010 // record application messages + // (NetLibTracePrintF, NetLibTracePutS) + + + +/******************************************************************** + * Command numbers and parameter blocks for the NetLibMaster() call. + * This call is used to put the Net library into certain debugging modes + * or for obtaining statistics from the Net Library. + * + ********************************************************************/ +#pragma mark Master +typedef enum { + // These calls return info + netMasterInterfaceInfo, + netMasterInterfaceStats, + netMasterIPStats, + netMasterICMPStats, + netMasterUDPStats, + netMasterTCPStats, + + // This call used to read the trace buffer. + netMasterTraceEventGet // get trace event by index + + } NetMasterEnum; + + +typedef struct NetMasterPBType { + + // These fields are specific to each command + union { + + //............................................................. + // InterfaceInfo command + //............................................................. + struct { + Word index; // -> index of interface + DWord creator; // <- creator + Word instance; // <- instance + VoidPtr netIFP; // <- net_if pointer + + // driver level info + Char drvrName[netDrvrTypeNameLen]; // <- type of driver (SLIP,PPP, etc) + Char hwName[netDrvrHWNameLen]; // <- hardware name (Serial Library, etc) + Byte localNetHdrLen; // <- local net header length + Byte localNetTrailerLen; // <- local net trailer length + Word localNetMaxFrame; // <- local net maximum frame size + + // media layer info + Char ifName[netIFNameLen];// <- interface name w/instance + Boolean driverUp; // <- true if interface driver up + Boolean ifUp; // <- true if interface is up + Word hwAddrLen; // <- length of hardware address + Byte hwAddr[netIFMaxHWAddrLen]; // <- hardware address + Word mtu; // <- maximum transfer unit of interface + DWord speed; // <- speed in bits/sec. + DWord lastStateChange; // <- time in milliseconds of last state change + + // Address info + NetIPAddr ipAddr; // Address of this interface + NetIPAddr subnetMask; // subnet mask of local network + NetIPAddr broadcast; // broadcast address of local network + } interfaceInfo; + + //............................................................. + // InterfaceStats command + //............................................................. + struct { + Word index; // -> index of interface + DWord inOctets; // <- .... + DWord inUcastPkts; + DWord inNUcastPkts; + DWord inDiscards; + DWord inErrors; + DWord inUnknownProtos; + DWord outOctets; + DWord outUcastPkts; + DWord outNUcastPkts; + DWord outDiscards; + DWord outErrors; + } interfaceStats; + + //............................................................. + // IPStats command + //............................................................. + struct { + DWord ipInReceives; + DWord ipInHdrErrors; + DWord ipInAddrErrors; + DWord ipForwDatagrams; + DWord ipInUnknownProtos; + DWord ipInDiscards; + DWord ipInDelivers; + DWord ipOutRequests; + DWord ipOutDiscards; + DWord ipOutNoRoutes; + DWord ipReasmReqds; + DWord ipReasmOKs; + DWord ipReasmFails; + DWord ipFragOKs; + DWord ipFragFails; + DWord ipFragCreates; + DWord ipRoutingDiscards; + DWord ipDefaultTTL; + DWord ipReasmTimeout; + } ipStats; + + //............................................................. + // ICMPStats command + //............................................................. + struct { + DWord icmpInMsgs; + DWord icmpInErrors; + DWord icmpInDestUnreachs; + DWord icmpInTimeExcds; + DWord icmpInParmProbs; + DWord icmpInSrcQuenchs; + DWord icmpInRedirects; + DWord icmpInEchos; + DWord icmpInEchoReps; + DWord icmpInTimestamps; + DWord icmpInTimestampReps; + DWord icmpInAddrMasks; + DWord icmpInAddrMaskReps; + DWord icmpOutMsgs; + DWord icmpOutErrors; + DWord icmpOutDestUnreachs; + DWord icmpOutTimeExcds; + DWord icmpOutParmProbs; + DWord icmpOutSrcQuenchs; + DWord icmpOutRedirects; + DWord icmpOutEchos; + DWord icmpOutEchoReps; + DWord icmpOutTimestamps; + DWord icmpOutTimestampReps; + DWord icmpOutAddrMasks; + DWord icmpOutAddrMaskReps; + } icmpStats; + + //............................................................. + // UDPStats command + //............................................................. + struct { + DWord udpInDatagrams; + DWord udpNoPorts; + DWord udpInErrors; + DWord udpOutDatagrams; + } udpStats; + + //............................................................. + // TCPStats command + //............................................................. + struct { + DWord tcpRtoAlgorithm; + DWord tcpRtoMin; + DWord tcpRtoMax; + DWord tcpMaxConn; + DWord tcpActiveOpens; + DWord tcpPassiveOpens; + DWord tcpAttemptFails; + DWord tcpEstabResets; + DWord tcpCurrEstab; + DWord tcpInSegs; + DWord tcpOutSegs; + DWord tcpRetransSegs; + DWord tcpInErrs; + DWord tcpOutRsts; + } tcpStats; + + //............................................................. + // TraceEventGet command + //............................................................. + struct { + Word index; // which event + CharPtr textP; // ptr to text string to return it in + } traceEventGet; + + } param; + + } NetMasterPBType, *NetMasterPBPtr; + + + + + +//----------------------------------------------------------------------------- +// Enumeration of Net settings as passed to NetLibSettingGet/Set. +//----------------------------------------------------------------------------- +#pragma mark Settings +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Global environment settings common to all attached network interfaces, +// passed to NetLibSettingGet/Set +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +typedef enum { + netSettingResetAll, // void, NetLibSettingSet only, resets all settings + // to their defaults. + + netSettingPrimaryDNS, // DWord, IP address of Primary DN Server + netSettingSecondaryDNS, // DWord, IP address of Secondary DN Server + netSettingDefaultRouter, // DWord, IP address of Default router + netSettingDefaultIFCreator, // DWord, Creator type of default interface + netSettingDefaultIFInstance, // Word, Instance# of default interface + netSettingHostName, // Char[64], name of host (not including domain) + netSettingDomainName, // Char[256], domain name of hosts's domain + netSettingHostTbl, // Char[], host table + netSettingCloseWaitTime, // DWord, time in milliseconds to stay in close-wait state + + + // The following settings are not used for configuration, but rather put the + // stack into various modes for debugging, etc. + netSettingTraceBits = 0x1000, // DWord, enable/disable various trace flags (netTraceBitXXXX) + netSettingTraceSize, // DWord, max trace buffer size in bytes. Default 0x800. + // Setting this will also clear the trace buffer. + netSettingTraceStart, // DWord, for internal use ONLY!! + netSettingTraceRoll, // Byte, if true, trace buffer will rollover after it fills. + // Default is true. + + netSettingRTPrimaryDNS, // used internally by Network interfaces + // that dynamically obtain the DNS address + netSettingRTSecondaryDNS // used internally by Network interfaces + // that dynamically obtain the DNS address + + } NetSettingEnum; + + +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Settings for each Network Interface, passed to NetLibIFSettingGet/Set +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +typedef enum { + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Reset all settings to defaults + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingResetAll, // void, NetLibIFSettingSet only, resets all settings + // to their defaults. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Status - read only + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingUp, // Byte, true if interface is UP. + netIFSettingName, // Char[32], name of interface + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Addressing + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingReqIPAddr, // DWord, requested IP address of this interface + netIFSettingSubnetMask, // DWord, subnet mask of this interface + netIFSettingBroadcast, // DWord, broadcast address for this interface + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // User Info + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingUsername, // Char[], login script user name + // If 0 length, then user will be prompted for it + netIFSettingPassword, // Char[], login script user password + // If 0 length, then user will be prompted for it + netIFSettingDialbackUsername, // Char[], login script dialback user name. + // If 0 length, then netIFSettingUsername is used + netIFSettingDialbackPassword, // Char[], login script dialback user password. + // If 0 length, then user will be prompted for it + netIFSettingAuthUsername, // Char[], PAP/CHAP name. + // If 0 length, then netIFSettingUsername is used + netIFSettingAuthPassword, // Char[], PAP/CHAP password. + // If "$", then user will be prompted for it + // else If 0 length, then netIFSettingPassword or result + // of it's prompt (if it was empty) will be used + // else it is used as-is. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Connect Settings + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingServiceName, // Char[], name of service + netIFSettingLoginScript, // Char[], login script + netIFSettingConnectLog, // Char[], connect log + netIFSettingInactivityTimeout, // Word, # of seconds of inactivity allowed before + // interface is brought down. If 0 then + // no inactivity timeout enforced. + netIFSettingEstablishmentTimeout, // Word, max delay in seconds between connection + // establishment stages + + // Serial based protocol options + netIFSettingDynamicIP, // Byte, if true, get IP address from server + // N/A for SLIP + netIFSettingVJCompEnable, // Byte, if true enable VJ Header compression + // Default is on for PPP, off for SLIP + netIFSettingVJCompSlots, // Byte, # of slots to use for VJ compression. + // Default is 4 for PPP, 16 for SLIP + // (each slot uses 256 bytes of RAM). + netIFSettingMTU, // Word, maximum transmission unit in bytes + // ignored in current PPP and SLIP interfaces + netIFSettingAsyncCtlMap, // DWord, bitmask of characters to escape + // ignored in current PPP interfaces + + // Serial settings, used by serial based network interfaces + netIFSettingPortNum, // Word, port number to use + netIFSettingBaudRate, // DWord, baud rate in bits/sec. + netIFSettingFlowControl, // Byte, flow control setting bits. Set to 0x01 for + // hardware flow control, else set to 0x00. + netIFSettingStopBits, // Byte, # of stop bits + netIFSettingParityOn, // Byte, true if parity on + netIFSettingParityEven, // Byte, true if parity even + + // Modem settings, optionally used by serial based network interfaces + netIFSettingUseModem, // Byte, if true dial-up through modem + netIFSettingPulseDial, // Byte, if true use pulse dial, else tone + netIFSettingModemInit, // Char[], modem initialization string + netIFSettingModemPhone, // Char[], modem phone number string + netIFSettingRedialCount, // Word, # of times to redial + + + //--------------------------------------------------------------------------------- + // New Settings as of PalmOS 3.0 + // Power control, usually only implemented by wireless interfaces + //--------------------------------------------------------------------------------- + netIFSettingPowerUp, // Byte, 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, // Byte, true if this interface is wireless + + + + // Option to query server for address of DNS servers + netIFSettingDNSQuery, // Byte, if true PPP queries for DNS address. Default true + + + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // The following settings are not used for configuration, but rather put the + // stack into various modes for debugging, etc. + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingTraceBits = 0x1000, // DWord, enable/disable various trace flags (netTraceBitXXXX) + netIFSettingGlobalsPtr, // DWord, (Read-Only) sinterface's globals ptr + netIFSettingActualIPAddr, // DWord, (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, // DWord, (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, // Byte, 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, // DWord, parameter to pass to raw_rcv() along with + // packet pointer. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // 3rd party settings start here... + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingCustom = 0x8000 + + } NetIFSettingEnum; + + + + + +/************************************************************ + * Net Library Macros + *************************************************************/ +// Return current time in milliseconds. +#define NetNow() (TimGetTicks() * 1000L/sysTicksPerSecond) + + +// File Descriptor macros used for the NetLibSelect() call +typedef DWord NetFDSetType; +#define netFDSetSize 32 + +#define netFDSet(n,p) ((*p) |= (1L << n)) +#define netFDClr(n,p) ((*p) &= ~(1L << n)) +#define netFDIsSet(n,p) ((*p) & (1L << n)) +#define netFDZero(p) ((*p) = 0) + + + +//----------------------------------------------------------------------------- +// Net error codes +//----------------------------------------------------------------------------- +#pragma mark ErrorCodes +#define netErrAlreadyOpen (netErrorClass | 1) +#define netErrNotOpen (netErrorClass | 2) +#define netErrStillOpen (netErrorClass | 3) +#define netErrParamErr (netErrorClass | 4) +#define netErrNoMoreSockets (netErrorClass | 5) +#define netErrOutOfResources (netErrorClass | 6) +#define netErrOutOfMemory (netErrorClass | 7) +#define netErrSocketNotOpen (netErrorClass | 8) +#define netErrSocketBusy (netErrorClass | 9) //EINPROGRESS +#define netErrMessageTooBig (netErrorClass | 10) +#define netErrSocketNotConnected (netErrorClass | 11) +#define netErrNoInterfaces (netErrorClass | 12) //ENETUNREACH +#define netErrBufTooSmall (netErrorClass | 13) +#define netErrUnimplemented (netErrorClass | 14) +#define netErrPortInUse (netErrorClass | 15) //EADDRINUSE +#define netErrQuietTimeNotElapsed (netErrorClass | 16) //EADDRINUSE +#define netErrInternal (netErrorClass | 17) +#define netErrTimeout (netErrorClass | 18) //ETIMEDOUT +#define netErrSocketAlreadyConnected (netErrorClass | 19) //EISCONN +#define netErrSocketClosedByRemote (netErrorClass | 20) +#define netErrOutOfCmdBlocks (netErrorClass | 21) +#define netErrWrongSocketType (netErrorClass | 22) +#define netErrSocketNotListening (netErrorClass | 23) +#define netErrUnknownSetting (netErrorClass | 24) +#define netErrInvalidSettingSize (netErrorClass | 25) +#define netErrPrefNotFound (netErrorClass | 26) +#define netErrInvalidInterface (netErrorClass | 27) +#define netErrInterfaceNotFound (netErrorClass | 28) +#define netErrTooManyInterfaces (netErrorClass | 29) +#define netErrBufWrongSize (netErrorClass | 30) +#define netErrUserCancel (netErrorClass | 31) +#define netErrBadScript (netErrorClass | 32) +#define netErrNoSocket (netErrorClass | 33) +#define netErrSocketRcvBufFull (netErrorClass | 34) +#define netErrNoPendingConnect (netErrorClass | 35) +#define netErrUnexpectedCmd (netErrorClass | 36) +#define netErrNoTCB (netErrorClass | 37) +#define netErrNilRemoteWindowSize (netErrorClass | 38) +#define netErrNoTimerProc (netErrorClass | 39) +#define netErrSocketInputShutdown (netErrorClass | 40) // EOF to sockets API +#define netErrCmdBlockNotCheckedOut (netErrorClass | 41) +#define netErrCmdNotDone (netErrorClass | 42) +#define netErrUnknownProtocol (netErrorClass | 43) +#define netErrUnknownService (netErrorClass | 44) +#define netErrUnreachableDest (netErrorClass | 45) +#define netErrReadOnlySetting (netErrorClass | 46) +#define netErrWouldBlock (netErrorClass | 47) //EWOULDBLOCK +#define netErrAlreadyInProgress (netErrorClass | 48) //EALREADY +#define netErrPPPTimeout (netErrorClass | 49) +#define netErrPPPBroughtDown (netErrorClass | 50) +#define netErrAuthFailure (netErrorClass | 51) +#define netErrPPPAddressRefused (netErrorClass | 52) +// The following map into the Epilogue DNS errors declared in DNS.ep.h: +// and MUST be kept in this order!! +#define netErrDNSNameTooLong (netErrorClass | 53) +#define netErrDNSBadName (netErrorClass | 54) +#define netErrDNSBadArgs (netErrorClass | 55) +#define netErrDNSLabelTooLong (netErrorClass | 56) +#define netErrDNSAllocationFailure (netErrorClass | 57) +#define netErrDNSTimeout (netErrorClass | 58) +#define netErrDNSUnreachable (netErrorClass | 59) +#define netErrDNSFormat (netErrorClass | 60) +#define netErrDNSServerFailure (netErrorClass | 61) +#define netErrDNSNonexistantName (netErrorClass | 62) +#define netErrDNSNIY (netErrorClass | 63) +#define netErrDNSRefused (netErrorClass | 64) +#define netErrDNSImpossible (netErrorClass | 65) +#define netErrDNSNoRRS (netErrorClass | 66) +#define netErrDNSAborted (netErrorClass | 67) +#define netErrDNSBadProtocol (netErrorClass | 68) +#define netErrDNSTruncated (netErrorClass | 69) +#define netErrDNSNoRecursion (netErrorClass | 70) +#define netErrDNSIrrelevant (netErrorClass | 71) +#define netErrDNSNotInLocalCache (netErrorClass | 72) +#define netErrDNSNoPort (netErrorClass | 73) +// The following map into the Epilogue IP errors declared in IP.ep.h: +// and MUST be kept in this order!! +#define netErrIPCantFragment (netErrorClass | 74) +#define netErrIPNoRoute (netErrorClass | 75) +#define netErrIPNoSrc (netErrorClass | 76) +#define netErrIPNoDst (netErrorClass | 77) +#define netErrIPktOverflow (netErrorClass | 78) +// End of Epilogue IP errors +#define netErrTooManyTCPConnections (netErrorClass | 79) +#define netErrNoDNSServers (netErrorClass | 80) +#define netErrInterfaceDown (netErrorClass | 81) + + +//----------------------------------------------------------------------------- +// Net library call ID's. Each library call gets the trap number: +// netTrapXXXX which serves as an index into the library's dispatch table. +// The constant sysLibTrapCustom is the first available trap number after +// the system predefined library traps Open,Close,Sleep & Wake. +// +// WARNING!!! This order of these traps MUST match the order of the dispatch +// table in NetDispatch.c!!! +//----------------------------------------------------------------------------- +#pragma mark Traps +typedef enum { + netLibTrapAddrINToA = sysLibTrapCustom, + netLibTrapAddrAToIN, + + netLibTrapSocketOpen, + netLibTrapSocketClose, + netLibTrapSocketOptionSet, + netLibTrapSocketOptionGet, + netLibTrapSocketBind, + netLibTrapSocketConnect, + netLibTrapSocketListen, + netLibTrapSocketAccept, + netLibTrapSocketShutdown, + + netLibTrapSendPB, + netLibTrapSend, + netLibTrapReceivePB, + netLibTrapReceive, + netLibTrapDmReceive, + netLibTrapSelect, + + netLibTrapPrefsGet, + netLibTrapPrefsSet, + + // The following traps are for internal and Network interface + // use only. + netLibTrapDrvrWake, + netLibTrapInterfacePtr, + netLibTrapMaster, + + // New Traps, re-order these later.. + netLibTrapGetHostByName, + netLibTrapSettingGet, + netLibTrapSettingSet, + netLibTrapIFAttach, + netLibTrapIFDetach, + netLibTrapIFGet, + netLibTrapIFSettingGet, + netLibTrapIFSettingSet, + netLibTrapIFUp, + netLibTrapIFDown, + netLibTrapIFMediaUp, + netLibTrapScriptExecute, + netLibTrapGetHostByAddr, + netLibTrapGetServByName, + netLibTrapSocketAddr, + netLibTrapFinishCloseWait, + netLibTrapGetMailExchangeByName, + netLibTrapPrefsAppend, + netLibTrapIFMediaDown, + netLibTrapOpenCount, + + netLibTrapTracePrintF, + netLibTrapTracePutS, + + netLibTrapOpenIfCloseWait, + netLibTrapHandlePowerOff, + + netLibTrapConnectionRefresh, + + // Traps added after 1.0 release of NetLib + netLibTrapBitMove, + netLibTrapBitPutFixed, + netLibTrapBitGetFixed, + netLibTrapBitPutUIntV, + netLibTrapBitGetUIntV, + netLibTrapBitPutIntV, + netLibTrapBitGetIntV, + + netLibTrapLast + } NetLibTrapNumberEnum; + + + +/************************************************************ + * Net Library procedures. + *************************************************************/ +#pragma mark Functions +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +Err NetLibOpen (Word libRefnum, WordPtr netIFErrsP) + SYS_TRAP(sysLibTrapOpen); + +Err NetLibClose (Word libRefnum, Word immediate) + SYS_TRAP(sysLibTrapClose); + +Err NetLibSleep (Word libRefnum) + SYS_TRAP(sysLibTrapSleep); + +Err NetLibWake (Word libRefnum) + SYS_TRAP(sysLibTrapWake); + + +// This call forces the library to complete a close if it's +// currently in the close-wait state. Returns 0 if library is closed, +// Returns netErrFullyOpen if library is still open by some other task. +Err NetLibFinishCloseWait(Word libRefnum) + SYS_TRAP(netLibTrapFinishCloseWait); + +// This call is for use by the Network preference panel only. It +// causes the NetLib to fully open if it's currently in the close-wait +// state. If it's not in the close wait state, it returns an error code +Err NetLibOpenIfCloseWait(Word libRefnum) + SYS_TRAP(netLibTrapOpenIfCloseWait); + +// Get the open Count of the NetLib +Err NetLibOpenCount (Word refNum, WordPtr countP) + SYS_TRAP(netLibTrapOpenCount); + +// Give NetLib a chance to close the connection down in response +// to a power off event. Returns non-zero if power should not be +// turned off. EventP points to the event that initiated the power off +// which is either a keyDownEvent of the hardPowerChr or the autoOffChr. +Err NetLibHandlePowerOff (Word refNum, EventPtr eventP) + SYS_TRAP(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. +Err NetLibConnectionRefresh(Word refNum, Boolean refresh, + BytePtr allInterfacesUpP, WordPtr netIFErrP) + SYS_TRAP(netLibTrapConnectionRefresh); + + + +//-------------------------------------------------- +// Net address translation and conversion routines. +//-------------------------------------------------- + +// convert host short to network short +#define NetHToNS(x) (x) + +// convert host long to network long +#define NetHToNL(x) (x) + +// convert network short to host short +#define NetNToHS(x) (x) + +// convert network long to host long +#define NetNToHL(x) (x) + +// Convert 32-bit IP address to ascii dotted decimal form. The Sockets glue +// macro inet_ntoa will pass the address of an application global string in +// spaceP. +CharPtr NetLibAddrINToA(Word libRefnum, NetIPAddr inet, CharPtr spaceP) + SYS_TRAP(netLibTrapAddrINToA); + +// Convert a dotted decimal ascii string format of an IP address into +// a 32-bit value. +NetIPAddr NetLibAddrAToIN(Word libRefnum, CharPtr a) + SYS_TRAP(netLibTrapAddrAToIN); + + + +//-------------------------------------------------- +// Socket creation and option setting +//-------------------------------------------------- + +// Create a socket and return a refnum to it. Protocol is normally 0. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +NetSocketRef NetLibSocketOpen(Word libRefnum, NetSocketAddrEnum domain, + NetSocketTypeEnum type, SWord protocol, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketOpen); + +// Close a socket. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketClose(Word libRefnum, NetSocketRef socket, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketClose); + +// Set a socket option. Level is usually netSocketOptLevelSocket. Option is one of +// netSocketOptXXXXX. OptValueP is a pointer to the new value and optValueLen is +// the length of the option value. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketOptionSet(Word libRefnum, NetSocketRef socket, + Word /*NetSocketOptLevelEnum*/ level, Word /*NetSocketOptEnum*/ option, + VoidPtr optValueP, Word optValueLen, + SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketOptionSet); + +// Get a socket option. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketOptionGet(Word libRefnum, NetSocketRef socket, + Word /*NetSocketOptLevelEnum*/ level, Word /*NetSocketOptEnum*/ option, + VoidPtr optValueP, WordPtr optValueLenP, + SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketOptionGet); + + +//-------------------------------------------------- +// Socket Control +//-------------------------------------------------- + +// Bind a source address and port number to a socket. This makes the +// socket accept incoming packets destined for the given socket address. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketBind(Word libRefnum, NetSocketRef socket, + NetSocketAddrType* sockAddrP, SWord addrLen, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketBind); + + +// Connect to a remote socket. For a stream based socket (i.e. TCP), this initiates +// a 3-way handshake with the remote machine to establish a connection. For +// non-stream based socket, this merely specifies a destination address and port +// number for future outgoing packets from this socket. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketConnect(Word libRefnum, NetSocketRef socket, + NetSocketAddrType* sockAddrP, SWord addrLen, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketConnect); + + +// Makes a socket ready to accept incoming connection requests. The queueLen +// specifies the max number of pending connection requests that will be enqueued +// while the server is busy handling other requests. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketListen(Word libRefnum, NetSocketRef socket, + Word queueLen, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketListen); + + +// Blocks the current process waiting for an incoming connection request. The socket +// must have previously be put into listen mode through the NetLibSocketListen call. +// On return, *sockAddrP will have the remote machines address and port number. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketAccept(Word libRefnum, NetSocketRef socket, + NetSocketAddrType* sockAddrP, SWord* addrLenP, SDWord timeout, + Err* errP) + SYS_TRAP(netLibTrapSocketAccept); + + +// Shutdown a connection in one or both directions. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketShutdown(Word libRefnum, NetSocketRef socket, + SWord /*NetSocketDirEnum*/ direction, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketShutdown); + + + +// Gets the local and remote addresses of a socket. Useful for TCP sockets that +// get dynamically bound at connect time. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +SWord NetLibSocketAddr(Word libRefnum, NetSocketRef socketRef, + NetSocketAddrType* locAddrP, SWord* locAddrLenP, + NetSocketAddrType* remAddrP, SWord* remAddrLenP, + SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSocketAddr); + + + +//-------------------------------------------------- +// Sending and Receiving +//-------------------------------------------------- +// Send data through a socket. The data is specified through the NetIOParamType +// structure. +// Flags is one or more of netMsgFlagXXX. +// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled +// in with error code. +SWord NetLibSendPB(Word libRefNum, NetSocketRef socket, + NetIOParamType* pbP, Word flags, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSendPB); + +// Send data through a socket. The data to send is passed in a single buffer, +// unlike NetLibSendPB. If toAddrP is not nil, the data will be sent to +// address *toAddrP. +// Flags is one or more of netMsgFlagXXX. +// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled +// in with error code. +SWord NetLibSend(Word libRefNum, NetSocketRef socket, + const VoidPtr bufP, Word bufLen, Word flags, + VoidPtr toAddrP, Word toLen, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapSend); + +// Receive data from a socket. The data is gatthered into buffers specified in the +// NetIOParamType structure. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +SWord NetLibReceivePB(Word libRefNum, NetSocketRef socket, + NetIOParamType* pbP, Word flags, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapReceivePB); + +// Receive data from a socket. The data is read into a single buffer, unlike +// NetLibReceivePB. If fromAddrP is not nil, *fromLenP must be initialized to +// the size of the buffer that fromAddrP points to and on exit *fromAddrP will +// have the address of the sender in it. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +SWord NetLibReceive(Word libRefNum, NetSocketRef socket, + VoidPtr bufP, Word bufLen, Word flags, + VoidPtr fromAddrP, WordPtr fromLenP, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapReceive); + + +// Receive data from a socket directly into a (write-protected) Data Manager +// record. +// If fromAddrP is not nil, *fromLenP must be initialized to +// the size of the buffer that fromAddrP points to and on exit *fromAddrP will +// have the address of the sender in it. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +SWord NetLibDmReceive(Word libRefNum, NetSocketRef socket, + VoidPtr recordP, DWord recordOffset, Word rcvLen, Word flags, + VoidPtr fromAddrP, WordPtr fromLenP, SDWord timeout, Err* errP) + SYS_TRAP(netLibTrapDmReceive); + + +//-------------------------------------------------- +// Name Lookups +//-------------------------------------------------- +NetHostInfoPtr NetLibGetHostByName(Word libRefNum, CharPtr nameP, + NetHostInfoBufPtr bufP, Long timeout, Err* errP) + SYS_TRAP(netLibTrapGetHostByName); + + +NetHostInfoPtr NetLibGetHostByAddr(Word libRefNum, BytePtr addrP, Word len, Word type, + NetHostInfoBufPtr bufP, Long timeout, Err* errP) + SYS_TRAP(netLibTrapGetHostByAddr); + + +NetServInfoPtr NetLibGetServByName(Word libRefNum, CharPtr servNameP, + CharPtr protoNameP, NetServInfoBufPtr bufP, + Long timeout, Err* errP) + SYS_TRAP(netLibTrapGetServByName); + +// Looks up a mail exchange name and returns a list of hostnames for it. Caller +// must pass space for list of return names (hostNames), space for +// list of priorities for those hosts (priorities) and max # of names to +// return (maxEntries). +// Returns # of entries found, or -1 on error. If error, *errP gets filled in +// with error code. +SWord NetLibGetMailExchangeByName(Word libRefNum, CharPtr mailNameP, + Word maxEntries, + Char hostNames[][netDNSMaxDomainName+1], Word priorities[], + Long timeout, Err* errP) + SYS_TRAP(netLibTrapGetMailExchangeByName); + + +//-------------------------------------------------- +// Interface setup +//-------------------------------------------------- +Err NetLibIFGet(Word libRefNum, Word index, DWordPtr ifCreatorP, + WordPtr ifInstanceP) + SYS_TRAP(netLibTrapIFGet); + +Err NetLibIFAttach(Word libRefNum, DWord ifCreator, Word ifInstance, + SDWord timeout) + SYS_TRAP(netLibTrapIFAttach); + +Err NetLibIFDetach(Word libRefNum, DWord ifCreator, Word ifInstance, + SDWord timeout) + SYS_TRAP(netLibTrapIFDetach); + +Err NetLibIFUp(Word libRefNum, DWord ifCreator, Word ifInstance) + SYS_TRAP(netLibTrapIFUp); + +Err NetLibIFDown(Word libRefNum, DWord ifCreator, Word ifInstance, + SDWord timeout) + SYS_TRAP(netLibTrapIFDown); + + + + +//-------------------------------------------------- +// Settings +//-------------------------------------------------- +// General settings +Err NetLibSettingGet(Word libRefNum, + Word /*NetSettingEnum*/ setting, VoidPtr valueP, WordPtr valueLenP) + SYS_TRAP(netLibTrapSettingGet); + +Err NetLibSettingSet(Word libRefNum, + Word /*NetSettingEnum*/ setting, VoidPtr valueP, Word valueLen) + SYS_TRAP(netLibTrapSettingSet); + +// Network interface specific settings. +Err NetLibIFSettingGet(Word libRefNum, DWord ifCreator, Word ifInstance, + Word /*NetIFSettingEnum*/ setting, VoidPtr valueP, WordPtr valueLenP) + SYS_TRAP(netLibTrapIFSettingGet); + +Err NetLibIFSettingSet(Word libRefNum, DWord ifCreator, Word ifInstance, + Word /*NetIFSettingEnum*/ setting, VoidPtr valueP, Word valueLen) + SYS_TRAP(netLibTrapIFSettingSet); + + + +//-------------------------------------------------- +// System level +//-------------------------------------------------- +SWord NetLibSelect(Word libRefNum, Word width, NetFDSetType* readFDs, + NetFDSetType* writeFDs, NetFDSetType* exceptFDs, + Long timeout, Err* errP) + SYS_TRAP(netLibTrapSelect); + + + +//-------------------------------------------------- +// Debugging support +//-------------------------------------------------- +Err NetLibMaster(Word libRefNum, Word cmd, NetMasterPBPtr pbP, + Long timeout) + SYS_TRAP(netLibTrapMaster); + +Err NetLibTracePrintF(Word libRefNum, CharPtr formatStr, ...) + SYS_TRAP(netLibTrapTracePrintF); + +Err NetLibTracePutS(Word libRefNum, CharPtr strP) + SYS_TRAP(netLibTrapTracePutS); + + + +//-------------------------------------------------- +// Bit Moving functions. For "slim" bit packing protocols +// used over wireless. +//-------------------------------------------------- +void NetLibBitMove(Word libRefNum, BytePtr dstP, DWordPtr dstBitOffsetP, + BytePtr srcP, DWordPtr srcBitOffsetP, + DWord numBits) + SYS_TRAP(netLibTrapBitMove); + + +void NetLibBitPutFixed(Word libRefNum, BytePtr dstP, DWordPtr dstBitOffsetP, + DWord value, Word numBits) + SYS_TRAP(netLibTrapBitPutFixed); + +DWord NetLibBitGetFixed(Word libRefNum, BytePtr dstP, DWordPtr dstBitOffsetP, + Word numBits) + SYS_TRAP(netLibTrapBitGetFixed); + +void NetLibBitPutUIntV(Word libRefNum, BytePtr dstP, DWordPtr dstBitOffsetP, + DWord value) + SYS_TRAP(netLibTrapBitPutUIntV); + +DWord NetLibBitGetUIntV(Word libRefNum, BytePtr dstP, DWordPtr dstBitOffsetP) + SYS_TRAP(netLibTrapBitGetUIntV); + +void NetLibBitPutIntV(Word libRefNum, BytePtr dstP, DWordPtr dstBitOffsetP, + SDWord value) + SYS_TRAP(netLibTrapBitPutUIntV); + +SDWord NetLibBitGetIntV(Word libRefNum, BytePtr dstP, DWordPtr dstBitOffsetP) + SYS_TRAP(netLibTrapBitGetUIntV); + + + +#ifdef __cplusplus +} +#endif + + +#endif // __NETMGR_H__ + + + + + + diff --git a/sdk-3.1/include/Core/System/NewFloatMgr.h b/sdk-3.1/include/Core/System/NewFloatMgr.h new file mode 100644 index 0000000..9b3bae1 --- /dev/null +++ b/sdk-3.1/include/Core/System/NewFloatMgr.h @@ -0,0 +1,488 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * NewFloatMgr.h + * + * 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 SDWords + * so total size of FlpCompDouble is 64 bits, not 96. + * 2/ 5/97 - Added note about FlpBase10Info reporting "negative" zero. + * + *******************************************************************/ + +#ifndef __NEWFLOATMGR_H__ +#define __NEWFLOATMGR_H__ + +#ifndef __GNUC__ +#if __option(IEEEdoubles) == off +//#error "IEEEdoubles ('8-Byte Doubles' option in the 68K Processor preference panel) MUST be on!!" +#pragma IEEEdoubles on // force 8-byte doubles for our initialization!! +#endif +#endif + + +#ifndef _DONT_USE_FP_TRAPS_ +#if EMULATION_LEVEL != EMULATION_NONE +#define _DONT_USE_FP_TRAPS_ 1 // always direct link to FP for emulator builds +#endif +#endif + + +#include + + +/************************************************************************ + * 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 + ***********************************************************************/ + +#define flpVersion 0x02008000 // first version of NewFloatMgr (PalmOS 2.0) + +/* + * These constants are passed to and received from the _fp_round routine. + */ + +#define flpToNearest 0 +#define flpTowardZero 1 +#define flpUpward 3 +#define flpDownward 2 +#define flpModeMask 0x00000030 +#define 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. + */ + +#define flpInvalid 0x00008000 +#define flpOverflow 0x00004000 +#define flpUnderflow 0x00002000 +#define flpDivByZero 0x00001000 +#define flpInexact 0x00000800 + +/* + * These constants are returned by _d_cmp, _d_cmpe, _f_cmp, and _f_cmpe: + */ + +#define flpEqual 0 +#define flpLess 1 +#define flpGreater 2 +#define flpUnordered 3 + + +/************************************************************************ + * New Floating point manager types (private) + ***********************************************************************/ +typedef struct { + SDWord high; + SDWord low; +} _sfpe_64_bits; // for internal use only + +typedef _sfpe_64_bits sfpe_long_long; // for internal use only +typedef _sfpe_64_bits sfpe_unsigned_long_long; // for internal use only + + +/************************************************************************ + * New Floating point manager types (public) + ***********************************************************************/ +typedef SDWord FlpFloat; +typedef _sfpe_64_bits FlpDouble; +typedef _sfpe_64_bits FlpLongDouble; + +/* +* 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. +*/ + +typedef struct { + SDWord sign : 1; + SDWord exp : 11; + DWord manH : 20; + DWord manL; +} FlpDoubleBits; // for accessing specific fields + +typedef union { + double d; // for easy assignment of values + FlpDouble fd; // for calling New Floating point manager routines + DWord 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 + DWord ul; // for accessing bits of the float +} FlpCompFloat; + + +/************************************************************************ + * Useful macros... + ***********************************************************************/ +#define BIG_ENDIAN 1 +#define __FIRST32(x) *((DWord *) &x) +#define __SECOND32(x) *((DWord *) &x + 1) +#define __ALL32(x) *((DWord *) &x) + +#ifdef LITTLE_ENDIAN +#define __LO32(x) *((DWord *) &x) +#define __HI32(x) *((DWord *) &x + 1) +#define __HIX 1 +#define __LOX 0 +#else +#define __HI32(x) *((DWord *) &x) +#define __LO32(x) *((DWord *) &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) + + +// DOLATER - Should we remove FlpNegate? There is an fp (_d_neg) call for this... +#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 + *******************************************************************/ +#define flpErrOutOfRange (flpErrorClass | 1) + + +/************************************************************ + * New Floating point manager trap macros + *************************************************************/ +#define m68kMoveQd2Instr 0x7400 + +#if _DONT_USE_FP_TRAPS_ + +#define FLOAT_TRAP(floatSelectorNum) +#define FLOAT_EM_TRAP(floatSelectorNum) + +#else + +#define FLOAT_TRAP(floatSelectorNum) \ + THREEWORD_INLINE(m68kMoveQd2Instr + floatSelectorNum, \ + m68kTrapInstr+sysDispatchTrapNum, sysTrapFlpDispatch) +#define FLOAT_EM_TRAP(floatEmSelectorNum) \ + THREEWORD_INLINE(m68kMoveQd2Instr + floatEmSelectorNum, \ + m68kTrapInstr+sysDispatchTrapNum, sysTrapFlpEmDispatch) +#endif + +/************************************************************ + * New Floating point manager selectors + *************************************************************/ +typedef enum { // The order of this enum *MUST* match the + // sysFloatSelector table in NewFloatDispatch.c + sysFloatBase10Info = 0, // 0 + sysFloatFToA, // 1 + sysFloatAToF, // 2 + sysFloatCorrectedAdd, // 3 + sysFloatCorrectedSub, // 4 + sysFloatVersion, // 5 + + flpMaxFloatSelector = sysFloatVersion // used by NewFloatDispatch.c +} sysFloatSelector; + + +typedef enum { // The order of this enum *MUST* match the + // sysFloatSelector table in NewFloatDispatch.c + sysFloatEm_fp_round = 0,// 0 + sysFloatEm_fp_get_fpscr,// 1 + sysFloatEm_fp_set_fpscr,// 2 + + sysFloatEm_f_utof, // 3 + sysFloatEm_f_itof, // 4 + sysFloatEm_f_ulltof, // 5 + sysFloatEm_f_lltof, // 6 + + sysFloatEm_d_utod, // 7 + sysFloatEm_d_itod, // 8 + sysFloatEm_d_ulltod, // 9 + sysFloatEm_d_lltod, // 10 + + sysFloatEm_f_ftod, // 11 + sysFloatEm_d_dtof, // 12 + sysFloatEm_f_ftoq, // 13 + sysFloatEm_f_qtof, // 14 + sysFloatEm_d_dtoq, // 15 + sysFloatEm_d_qtod, // 16 + + sysFloatEm_f_ftou, // 17 + sysFloatEm_f_ftoi, // 18 + sysFloatEm_f_ftoull, // 19 + sysFloatEm_f_ftoll, // 20 + + sysFloatEm_d_dtou, // 21 + sysFloatEm_d_dtoi, // 22 + sysFloatEm_d_dtoull, // 23 + sysFloatEm_d_dtoll, // 24 + + sysFloatEm_f_cmp, // 25 + sysFloatEm_f_cmpe, // 26 + sysFloatEm_f_feq, // 27 + sysFloatEm_f_fne, // 28 + sysFloatEm_f_flt, // 29 + sysFloatEm_f_fle, // 30 + sysFloatEm_f_fgt, // 31 + sysFloatEm_f_fge, // 32 + sysFloatEm_f_fun, // 33 + sysFloatEm_f_for, // 34 + + sysFloatEm_d_cmp, // 35 + sysFloatEm_d_cmpe, // 36 + sysFloatEm_d_feq, // 37 + sysFloatEm_d_fne, // 38 + sysFloatEm_d_flt, // 39 + sysFloatEm_d_fle, // 40 + sysFloatEm_d_fgt, // 41 + sysFloatEm_d_fge, // 42 + sysFloatEm_d_fun, // 43 + sysFloatEm_d_for, // 44 + + sysFloatEm_f_neg, // 45 + sysFloatEm_f_add, // 46 + sysFloatEm_f_mul, // 47 + sysFloatEm_f_sub, // 48 + sysFloatEm_f_div, // 49 + + sysFloatEm_d_neg, // 50 + sysFloatEm_d_add, // 51 + sysFloatEm_d_mul, // 52 + sysFloatEm_d_sub, // 53 + sysFloatEm_d_div // 54 +} sysFloatEmSelector; + + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************ + * 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. +Err FlpBase10Info(FlpDouble a, DWord* mantissaP, SWord* exponentP, SWord* signP) + FLOAT_TRAP(sysFloatBase10Info); + +Err FlpFToA(FlpDouble a, Char* s) + FLOAT_TRAP(sysFloatFToA); + +FlpDouble FlpAToF(Char* s) + FLOAT_TRAP(sysFloatAToF); + +FlpDouble FlpCorrectedAdd(FlpDouble firstOperand, FlpDouble secondOperand, SWord howAccurate) + FLOAT_TRAP(sysFloatCorrectedAdd); + +FlpDouble FlpCorrectedSub(FlpDouble firstOperand, FlpDouble secondOperand, SWord howAccurate) + FLOAT_TRAP(sysFloatCorrectedSub); + +DWord FlpVersion(void) + FLOAT_TRAP(sysFloatVersion); + +void FlpSelectorErrPrv (Word flpSelector) + ; // 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 + */ + +SDWord _fp_round(SDWord) FLOAT_EM_TRAP(sysFloatEm_fp_round); + +/* + * Constants passed to _fp_set_fpscr and received from _fp_get_fpscr are: + * flpInvalid, flpOverflow, flpUnderflow, flpDivByZero, or flpInexact + */ + +SDWord _fp_get_fpscr(void) FLOAT_EM_TRAP(sysFloatEm_fp_get_fpscr); +void _fp_set_fpscr(SDWord) FLOAT_EM_TRAP(sysFloatEm_fp_set_fpscr); + + +/* + * The shorthand here can be determined from the context: + * i --> long (SDWord) + * u --> unsigned long (DWord) + * ll --> long long int + * ull --> unsigned long 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 + */ + +FlpFloat _f_utof(DWord) FLOAT_EM_TRAP(sysFloatEm_f_utof); +FlpFloat _f_itof(SDWord) FLOAT_EM_TRAP(sysFloatEm_f_itof); +FlpFloat _f_ulltof(sfpe_unsigned_long_long) FLOAT_EM_TRAP(sysFloatEm_f_ulltof); +FlpFloat _f_lltof(sfpe_long_long) FLOAT_EM_TRAP(sysFloatEm_f_lltof); + +FlpDouble _d_utod(DWord) FLOAT_EM_TRAP(sysFloatEm_d_utod); +FlpDouble _d_itod(SDWord) FLOAT_EM_TRAP(sysFloatEm_d_itod); +FlpDouble _d_ulltod(sfpe_unsigned_long_long) FLOAT_EM_TRAP(sysFloatEm_d_ulltod); +FlpDouble _d_lltod(sfpe_long_long) FLOAT_EM_TRAP(sysFloatEm_d_lltod); + + +FlpDouble _f_ftod(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftod); +FlpFloat _d_dtof(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtof); + +FlpLongDouble _f_ftoq(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoq); +FlpFloat _f_qtof(const FlpLongDouble *) FLOAT_EM_TRAP(sysFloatEm_f_qtof); + +FlpLongDouble _d_dtoq(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoq); +FlpDouble _d_qtod(const FlpLongDouble *) FLOAT_EM_TRAP(sysFloatEm_d_qtod); + + +DWord _f_ftou(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftou); +SDWord _f_ftoi(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoi); + +sfpe_unsigned_long_long _f_ftoull(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoull); +sfpe_long_long _f_ftoll(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoll); + +DWord _d_dtou(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtou); +SDWord _d_dtoi(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoi); + +sfpe_unsigned_long_long _d_dtoull(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoull); +sfpe_long_long _d_dtoll(FlpDouble) FLOAT_EM_TRAP(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) + */ + +SDWord _f_cmp(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_cmp); +SDWord _f_cmpe(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_cmpe); +SDWord _f_feq(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_feq); +SDWord _f_fne(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fne); +SDWord _f_flt(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_flt); +SDWord _f_fle(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fle); +SDWord _f_fgt(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fgt); +SDWord _f_fge(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fge); +SDWord _f_fun(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fun); +SDWord _f_for(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_for); + +SDWord _d_cmp(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_cmp); +SDWord _d_cmpe(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_cmpe); +SDWord _d_feq(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_feq); +SDWord _d_fne(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fne); +SDWord _d_flt(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_flt); +SDWord _d_fle(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fle); +SDWord _d_fgt(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fgt); +SDWord _d_fge(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fge); +SDWord _d_fun(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fun); +SDWord _d_for(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_for); + + +FlpFloat _f_neg(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_neg); +FlpFloat _f_add(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_add); +FlpFloat _f_mul(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_mul); +FlpFloat _f_sub(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_sub); +FlpFloat _f_div(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_div); + +FlpDouble _d_neg(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_neg); +FlpDouble _d_add(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_add); +FlpDouble _d_mul(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_mul); +FlpDouble _d_sub(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_sub); +FlpDouble _d_div(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_div); + + +#ifdef __cplusplus +} +#endif + + +#endif //__NEWFLOATMGR_H__ + + diff --git a/sdk-3.1/include/Core/System/Password.h b/sdk-3.1/include/Core/System/Password.h new file mode 100644 index 0000000..2866a10 --- /dev/null +++ b/sdk-3.1/include/Core/System/Password.h @@ -0,0 +1,43 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * Password.h + * + * Description: + * Password include file + * + * History: + * 4/1/95 - created by Roger Flores + * + *******************************************************************/ + + #ifndef __PASSWORD_H__ + #define __PASSWORD_H__ + + + +#define pwdLength 32 +#define pwdEncryptionKeyLength 64 + +Boolean PwdExists() + SYS_TRAP(sysTrapPwdExists); + +Boolean PwdVerify(CharPtr string) + SYS_TRAP(sysTrapPwdVerify); + +void PwdSet(CharPtr oldPassword, CharPtr newPassword) + SYS_TRAP(sysTrapPwdSet); + +void PwdRemove(void) + SYS_TRAP(sysTrapPwdRemove); + + +#endif // __PASSWORD_H__ + + + + + diff --git a/sdk-3.1/include/Core/System/PenMgr.h b/sdk-3.1/include/Core/System/PenMgr.h new file mode 100644 index 0000000..0c53b01 --- /dev/null +++ b/sdk-3.1/include/Core/System/PenMgr.h @@ -0,0 +1,94 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * PenMgr.h + * + * Description: + * Include file for Pen manager + * + * History: + * 6/5/96 Created by Ron Marianetti + * + *******************************************************************/ + +#ifndef __PEN_MGR_H +#define __PEN_MGR_H + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Pen Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ +#define penErrBadParam (penErrorClass | 1) + + + +/******************************************************************** + * Pen manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initializes the Pen Manager +Err PenOpen(void) + SYS_TRAP(sysTrapPenOpen); + +// Closes the Pen Manager and frees whatever memory it allocated +Err PenClose(void) + SYS_TRAP(sysTrapPenClose); + + +// Put pen to sleep +Err PenSleep(void) + SYS_TRAP(sysTrapPenSleep); + +// Wake pen +Err PenWake(void) + SYS_TRAP(sysTrapPenWake); + + +// Get the raw pen coordinates from the hardware. +Err PenGetRawPen(PointType* penP) + SYS_TRAP(sysTrapPenGetRawPen); + +// Reset calibration in preparation for setting it again +Err PenResetCalibration (void) + SYS_TRAP(sysTrapPenResetCalibration); + +// Set calibration settings for the pen +Err PenCalibrate (PointType* digTopLeftP, PointType* digBotRightP, + PointType* scrTopLeftP, PointType* scrBotRightP) + SYS_TRAP(sysTrapPenCalibrate); + +// Scale a raw pen coordinate into screen coordinates +Err PenRawToScreen(PointType* penP) + SYS_TRAP(sysTrapPenRawToScreen); + +// Scale a screen pen coordinate back into a raw coordinate +Err PenScreenToRaw(PointType* penP) + SYS_TRAP(sysTrapPenScreenToRaw); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _PenGetRawPen \ + ASM_SYS_TRAP(sysTrapPenGetRawPen) + + + +#endif //__PEN_MGR_H diff --git a/sdk-3.1/include/Core/System/PilotStdio.h b/sdk-3.1/include/Core/System/PilotStdio.h new file mode 100644 index 0000000..6c58edf --- /dev/null +++ b/sdk-3.1/include/Core/System/PilotStdio.h @@ -0,0 +1,90 @@ +/******************************************************************* + Copyright Š 1995 - 1998, 3Com Corporation or its subsidiaries ("3Com"). + All rights reserved. + + This software may be copied and used solely for developing products for + the Palm Computing platform and for archival and backup purposes. Except + for the foregoing, no part of this software may be reproduced or transmitted + in any form or by any means or used to make any derivative work (such as + translation, transformation or adaptation) without express written consent + from 3Com. + + 3Com reserves the right to revise this software and to make changes in content + from time to time without obligation on the part of 3Com to provide notification + of such revision or changes. + 3COM MAKES NO REPRESENTATIONS OR WARRANTIES THAT THE SOFTWARE IS FREE OF ERRORS + OR THAT THE SOFTWARE IS SUITABLE FOR YOUR USE. THE SOFTWARE IS PROVIDED ON AN + "AS IS" BASIS. 3COM MAKES NO WARRANTIES, TERMS OR CONDITIONS, EXPRESS OR IMPLIED, + EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, INCLUDING WARRANTIES, + TERMS, OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND + SATISFACTORY QUALITY. + + TO THE FULL EXTENT ALLOWED BY LAW, 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS + ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT (INCLUDING NEGLIGENCE), FOR + DIRECT, INCIDENTAL, CONSEQUENTIAL, INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF + ANY KIND, OR FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF INFORMATION + OR DATA, OR OTHER FINANCIAL LOSS ARISING OUT OF OR IN CONNECTION WITH THIS SOFTWARE, + EVEN IF 3COM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + 3Com, HotSync, Palm Computing, and Graffiti are registered trademarks, and + Palm III and Palm OS are trademarks of 3Com Corporation or its subsidiaries. + + IF THIS SOFTWARE IS PROVIDED ON A COMPACT DISK, THE OTHER SOFTWARE AND + DOCUMENTATION ON THE COMPACT DISK ARE SUBJECT TO THE LICENSE AGREEMENT + ACCOMPANYING THE COMPACT DISK. + + *------------------------------------------------------------------- + * FileName: + * PilotStdio.h + * + * Description: + * Pilot standard IO equivalents. + * + * History: + * 11/24/97 vmk - Created by Vitaly Kruglikov + * + *******************************************************************/ + +#ifndef __PILOTSTDIO_H__ +#define __PILOTSTDIO_H__ + +#include + + +#define FILE VoidPtr +#define size_t ULong + +#ifndef EOF + #define EOF (-1) +#endif + +#define SEEK_SET fileOriginBeginning +#define SEEK_CUR fileOriginCurrent +#define SEEK_END fileOriginEnd + +#define fopenHelper(cardNo, filename, mode) \ + FileOpen((cardNo)/*cardNo*/, (filename), 0/*def type*/, 0/*def creator*/, \ + (((mode)[0] == 'r' && (mode)[1] == '+') ? (fileModeUpdate | fileModeExclusive) : \ + ((mode)[0] == 'r') ? (fileModeReadOnly) : \ + ((mode)[0] == 'w') ? (fileModeReadWrite | fileModeExclusive) : \ + ((mode)[0] == 'a') ? (fileModeAppend | fileModeExclusive) : \ + 0) | fileModeAnyTypeCreator, \ + NULL) + +#define fopen(filename, mode) fopenHelper(0/*cardNo*/, (filename), (mode)) +#define fclose(stream) (FileClose(stream) ? EOF : 0) +#define fread(buffer, objsize, count, stream) FileRead(stream, buffer, objsize, count, NULL) +#define fwrite(buffer, objsize, count, stream) FileWrite(stream, buffer, objsize, count, NULL) +#define ferror(stream) FileError(stream) +#define feof(stream) FileEOF(stream) +#define ftell(stream) FileTell(stream, NULL, NULL) +#define clearerr(stream) FileClearerr(stream) +#define fseek(stream, offset, whence) FileSeek(stream, offset, whence) +#define rewind(stream) FileRewind(stream) +#define fflush(stream) (FileFlush(stream) ? EOF : 0) +#define unlink(filename) (FileDelete(0, (filename)) ? -1 : 0) + + +#define assert(condition) ErrFatalDisplayIf(!(condition), "assertion failed: " # condition ); + +#endif diff --git a/sdk-3.1/include/Core/System/Preferences.h b/sdk-3.1/include/Core/System/Preferences.h new file mode 100644 index 0000000..a7f7d33 --- /dev/null +++ b/sdk-3.1/include/Core/System/Preferences.h @@ -0,0 +1,409 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * Preferences.h + * + * Description: + * Header for the system preferences + * + * History: + * 2/31/95 rsf - Created by Roger Flores + * + *******************************************************************/ + +#ifndef __PREFERENCES_H__ +#define __PREFERENCES_H__ + + +/*********************************************************************** + * Constants + ***********************************************************************/ + +#define noPreferenceFound -1 + +// Preference version constants +#define preferenceDataVer2 2 +#define preferenceDataVer3 3 +#define preferenceDataVer4 4 +#define preferenceDataVer5 5 + +// Be sure to update "preferenceDataVerLatest" when adding a new prefs version... +#define preferenceDataVerLatest preferenceDataVer5 + + +#define defaultAutoOffDuration 2 // minutes + + +// Obsolete after V20 +#if EMULATION_LEVEL == EMULATION_NONE + #define defaultSysSoundLevel slOn + #define defaultGameSoundLevel slOn + #define defaultAlarmSoundLevel slOn +#else // EMULATION_LEVEL != EMULATION_NONE + #define defaultSysSoundLevel slOff + #define defaultGameSoundLevel slOff + #define defaultAlarmSoundLevel slOn +#endif + + +#if EMULATION_LEVEL == EMULATION_NONE + #define defaultSysSoundVolume sndMaxAmp + #define defaultGameSoundVolume sndMaxAmp + #define defaultAlarmSoundVolume sndMaxAmp +#else // EMULATION_LEVEL != EMULATION_NONE + #define defaultSysSoundVolume 0 + #define defaultGameSoundVolume 0 + #define defaultAlarmSoundVolume sndMaxAmp +#endif + + +typedef enum + { + cAustralia = 0, // 0 + cAustria, // 1 + cBelgium, // 2 + cBrazil, // 3 + cCanada, // 4 + cDenmark, // 5 + cFinland, // 6 + cFrance, // 7 + cGermany, // 8 + cHongKong, // 9 + cIceland, // 10 + cIreland, // 11 + cItaly, // 12 + cJapan, // 13 + cLuxembourg, // 14 + cMexico, // 15 + cNetherlands, // 16 + cNewZealand, // 17 + cNorway, // 18 + cSpain, // 19 + cSweden, // 20 + cSwitzerland, // 21 + cUnitedKingdom, // 22 + cUnitedStates // 23 + + // Always add new countries at the end! + + } CountryType; + +#define countryFirst cAustralia +#define countryLast cUnitedStates +#define countryCount (countryLast - countryFirst + 1) + + +typedef enum + { + tfColon, + tfColonAMPM, // 1:00 pm + tfColon24h, // 13:00 + tfDot, + tfDotAMPM, // 1.00 pm + tfDot24h, // 13.00 + tfHoursAMPM, // 1 pm + tfHours24h, // 13 + tfComma24h // 13,00 + } TimeFormatType; + + +typedef enum { + dsNone, // Daylight Savings Time not observed + dsUSA, // United States Daylight Savings Time + dsAustralia, // Australian Daylight Savings Time + dsWesternEuropean, // Western European Daylight Savings Time + dsMiddleEuropean, // Middle European Daylight Savings Time + dsEasternEuropean, // Eastern European Daylight Savings Time + dsGreatBritain, // Great Britain and Eire Daylight Savings Time + dsRumania, // Rumanian Daylight Savings Time + dsTurkey, // Turkish Daylight Savings Time + dsAustraliaShifted // Australian Daylight Savings Time with shift in 1986 + } DaylightSavingsTypes; + + +// pass a TimeFormatType +#define Use24HourFormat(t) ((t) == tfColon24h || (t) == tfDot24h || (t) == tfHours24h || (t) == tfComma24h) +#define TimeSeparator(t) ( t <= tfColon24h ? ':' : (t <= tfDot24h ? '.' : ',')) + + +typedef enum { + dfMDYWithSlashes, // 12/31/95 + dfDMYWithSlashes, // 31/12/95 + dfDMYWithDots, // 31.12.95 + dfDMYWithDashes, // 31-12-95 + dfYMDWithSlashes, // 95/12/31 + dfYMDWithDots, // 95.12.31 + dfYMDWithDashes, // 95-12-31 + + dfMDYLongWithComma, // Dec 31, 1995 + dfDMYLong, // 31 Dec 1995 + dfDMYLongWithDot, // 31. Dec 1995 + dfDMYLongNoDay, // Dec 1995 + dfDMYLongWithComma, // 31 Dec, 1995 + dfYMDLongWithDot, // 1995.12.31 + dfYMDLongWithSpace, // 1995 Dec 31 + + dfMYMed, // Dec '95 + dfMYMedNoPost // Dec 95 (added for French 2.0 ROM) + } DateFormatType; + + +// The number format (thousands separator and decimal point). This defines +// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland). +typedef enum { + nfCommaPeriod, + nfPeriodComma, + nfSpaceComma, + nfApostrophePeriod, + nfApostropheComma + } NumberFormatType; + + +// These sound levels must corrospond to positions in the popup lists +// used by the preferences app. These are made obsolete after V20. The +// loudness of the sound is now represented as a number from 0 to sndMaxAmp. +typedef enum { + slOn = 0, + slOff = 1 + } SoundLevelTypeV20; + + +#define countryNameLength 20 +#define currencyNameLength 20 +#define currencySymbolLength 6 + +// An array of these structures (one per country) is kept in the system +// resource. +typedef struct + { + CountryType country; // Country the structure represents + Char countryName[countryNameLength]; + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Byte weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + Char currencyName[currencyNameLength]; // Dollars + Char currencySymbol[currencySymbolLength]; // $ + Char uniqueCurrencySymbol[currencySymbolLength]; // US$ + Byte currencyDecimalPlaces; // 2 for 1.00 + DaylightSavingsTypes daylightSavings; // Type of daylight savings correction + DWord minutesWestOfGMT; // minutes west of Greenwich + } CountryPreferencesType; + +// The number format (thousands separator and decimal point). This defines +// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland). +typedef enum { + alOff, // Never show an animation + alEventsOnly, // Show an animation for an event + alEventsAndRandom, // Also show random animation + alEventsAndMoreRandom // Show random animations more frequently + } AnimationLevelType; + + +typedef enum + { + prefVersion, + prefCountry, + prefDateFormat, + prefLongDateFormat, + prefWeekStartDay, + prefTimeFormat, + prefNumberFormat, + prefAutoOffDuration, + prefSysSoundLevelV20, // slOn or slOff - error beeps and other non-alarm/game sounds + prefGameSoundLevelV20, // slOn or slOff - game sound effects + prefAlarmSoundLevelV20, // slOn or slOff - alarm sound effects + prefHidePrivateRecords, + prefDeviceLocked, + prefLocalSyncRequiresPassword, + prefRemoteSyncRequiresPassword, + prefSysBatteryKind, + prefAllowEasterEggs, + prefMinutesWestOfGMT, + prefDaylightSavings, + prefRonamaticChar, + prefHard1CharAppCreator, // App creator for hard key #1 + prefHard2CharAppCreator, // App creator for hard key #2 + prefHard3CharAppCreator, // App creator for hard key #3 + prefHard4CharAppCreator, // App creator for hard key #4 + prefCalcCharAppCreator, // App creator for calculator soft key + prefHardCradleCharAppCreator, // App creator for hard cradle key + prefLauncherAppCreator, // App creator for launcher soft key + prefSysPrefFlags, + prefHardCradle2CharAppCreator, // App creator for 2nd hard cradle key + prefAnimationLevel, + + // Additions for PalmOS 3.0: + prefSysSoundVolume, // actual amplitude - error beeps and other non-alarm/game sounds + prefGameSoundVolume, // actual amplitude - game sound effects + prefAlarmSoundVolume, // actual amplitude - alarm sound effects + prefBeamReceive, // False turns off IR sniffing, sends still work. + prefCalibrateDigitizerAtReset, // True makes the user calibrate at soft reset time + prefSystemKeyboardID, // ID of the preferred keyboard resource + prefDefSerialPlugIn, // creator ID of the default serial plug-in + + // Additions for PalmOS 3.1: + prefStayOnWhenPluggedIn, // don't sleep after timeout when using line current + prefStayLitWhenPluggedIn // keep backlight on when not sleeping on line current + } SystemPreferencesChoice; + + +typedef struct { + Word version; // Version of preference info + + // International preferences + CountryType country; // Country the device is in + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Byte weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + + // system preferences + Byte autoOffDuration; // Time period before shutting off + SoundLevelTypeV20 sysSoundLevel; // slOn or slOff - error beeps and other non-alarm sounds + SoundLevelTypeV20 alarmSoundLevel; // slOn or slOff - alarm only + Boolean hideSecretRecords; // True to not display records with + // their secret bit attribute set + Boolean deviceLocked; // Device locked until the system + // password is entered + Word sysPrefFlags; // Miscellaneous system pref flags + // copied into the global GSysPrefFlags + // at boot time. + SysBatteryKind sysBatteryKind; // The type of batteries installed. This + // is copied into the globals GSysbatteryKind + // at boot time. + + } SystemPreferencesTypeV10; + + + +// Any entries added to this structure must be initialized in +// Prefereces.c:GetPreferenceResource + +typedef struct + { + Word version; // Version of preference info + + // International preferences + CountryType country; // Country the device is in + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Byte weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + + // system preferences + Byte autoOffDuration; // Time period in minutes before shutting off + SoundLevelTypeV20 sysSoundLevelV20; // slOn or slOff - error beeps and other non-alarm/game sounds + SoundLevelTypeV20 gameSoundLevelV20; // slOn or slOff - game sound effects + SoundLevelTypeV20 alarmSoundLevelV20; // slOn or slOff - alarm sound effects + Boolean hideSecretRecords; // True to not display records with + // their secret bit attribute set + Boolean deviceLocked; // Device locked until the system + // password is entered + Boolean localSyncRequiresPassword; // User must enter password on Pilot + Boolean remoteSyncRequiresPassword; // User must enter password on Pilot + Word sysPrefFlags; // Miscellaneous system pref flags + // copied into the global GSysPrefFlags + // at boot time. Constants are + // sysPrefFlagXXX defined in SystemPrv.h + SysBatteryKind sysBatteryKind; // The type of batteries installed. This + // is copied into the globals GSysbatteryKind + // at boot time. + DWord minutesWestOfGMT; // minutes west of Greenwich + DaylightSavingsTypes daylightSavings; // Type of daylight savings correction + UInt ronamaticChar; // character to generate from ronamatic stroke. + // Typically it popups the onscreen keyboard. + DWord hard1CharAppCreator; // creator of application to launch in response + // to the hard button #1. Used by SysHandleEvent. + DWord hard2CharAppCreator; // creator of application to launch in response + // to the hard button #2. Used by SysHandleEvent. + DWord hard3CharAppCreator; // creator of application to launch in response + // to the hard button #3. Used by SysHandleEvent. + DWord hard4CharAppCreator; // creator of application to launch in response + // to the hard button #4. Used by SysHandleEvent. + DWord calcCharAppCreator; // creator of application to launch in response + // to the Calculator icon. Used by SysHandleEvent. + DWord hardCradleCharAppCreator; // creator of application to launch in response + // to the Cradle button. Used by SysHandleEvent. + DWord launcherCharAppCreator; // creator of application to launch in response + // to the launcher button. Used by SysHandleEvent. + DWord hardCradle2CharAppCreator; // creator of application to launch in response + // to the 2nd Cradle button. Used by SysHandleEvent. + AnimationLevelType animationLevel; // amount of animation to display + + // Additions for PalmOS 3.0: + Word sysSoundVolume; // system amplitude (0 - sndMaxAmp) - taps, beeps + Word gameSoundVolume; // game amplitude (0 - sndMaxAmp) - explosions + Word alarmSoundVolume; // alarm amplitude (0 - sndMaxAmp) + Boolean beamReceive; // False turns off IR sniffing, sends still work. + Boolean calibrateDigitizerAtReset; // True makes the user calibrate at soft reset time + Word systemKeyboardID; // ID of the preferred keyboard resource + DWord defSerialPlugIn; // creator ID of the default serial plug-in + + // Additions for PalmOS 3.1: + Boolean stayOnWhenPluggedIn; // don't sleep after timeout when using line current + Boolean stayLitWhenPluggedIn; // keep backlight on when not sleeping on line current + + } SystemPreferencesType; + + + +typedef SystemPreferencesType * SystemPreferencesPtr; + + +//------------------------------------------------------------------- +// Preferences routines +//------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + + +extern DmOpenRef PrefOpenPreferenceDBV10 (void) + SYS_TRAP(sysTrapPrefOpenPreferenceDBV10); + +extern DmOpenRef PrefOpenPreferenceDB (Boolean saved) + SYS_TRAP(sysTrapPrefOpenPreferenceDB); + +extern void PrefGetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefGetPreferences); + +extern void PrefSetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefSetPreferences); + +extern DWord PrefGetPreference(SystemPreferencesChoice choice) + SYS_TRAP(sysTrapPrefGetPreference); + +extern void PrefSetPreference(SystemPreferencesChoice choice, DWord value) + SYS_TRAP(sysTrapPrefSetPreference); + +extern SWord PrefGetAppPreferences (DWord creator, Word id, VoidPtr prefs, + Word *prefsSize, Boolean saved) + SYS_TRAP(sysTrapPrefGetAppPreferences); + +extern Boolean PrefGetAppPreferencesV10 (DWord type, SWord version, VoidPtr prefs, + Word prefsSize) + SYS_TRAP(sysTrapPrefGetAppPreferencesV10); + +extern void PrefSetAppPreferences (DWord creator, Word id, SWord version, + VoidPtr prefs, Word prefsSize, Boolean saved) + SYS_TRAP(sysTrapPrefSetAppPreferences); + +extern void PrefSetAppPreferencesV10 (DWord creator, SWord version, VoidPtr prefs, + Word prefsSize) + SYS_TRAP(sysTrapPrefSetAppPreferencesV10); + + +#ifdef __cplusplus +} +#endif + + +#endif // __PREFERENCES_H__ diff --git a/sdk-3.1/include/Core/System/SerialLinkMgr.h b/sdk-3.1/include/Core/System/SerialLinkMgr.h new file mode 100644 index 0000000..e395674 --- /dev/null +++ b/sdk-3.1/include/Core/System/SerialLinkMgr.h @@ -0,0 +1,431 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SerialLinkMgr.c + * + * Description: + * Source for Serial Link Routines on Pilot + * + * History: + * 2/6/95 replaces DSerial.h from Debugger + * + *******************************************************************/ + +#ifndef __SERIAL_LINK_H +#define __SERIAL_LINK_H + + + +// Pilot common definitions +#include +#include + + + +//************************************************************************* +// Pre-defined, fixxed Socket ID's +//************************************************************************* +#define slkSocketDebugger 0 // Debugger Socket +#define slkSocketConsole 1 // Console Socket +#define slkSocketRemoteUI 2 // Remote UI Socket +#define slkSocketDLP 3 // Desktop Link Socket +#define slkSocketFirstDynamic 4 // first dynamic socket ID + + +//************************************************************************* +// Packet Types +//************************************************************************* +#define slkPktTypeSystem 0 // System packets +#define slkPktTypeUnused1 1 // used to be: Connection Manager packets +#define slkPktTypePAD 2 // PAD Protocol packets +#define slkPktTypeLoopBackTest 3 // Loop-back test packets + + + +//************************************************************************* +// +// Packet structure: +// header +// body (0-dbgMaxPacketBodyLength bytes of data) +// footer +// +//************************************************************************* + +//---------------------------------------------------------------------- +// packet header +// Fields marked with -> must be filled in by caller +// Fields marked with X will be filled in by SlkSendPacket. +//---------------------------------------------------------------------- + +typedef Byte SlkPktHeaderChecksum; + +typedef struct SlkPktHeaderType { + Word signature1; // X first 2 bytes of signature + Byte signature2; // X 3 and final byte of signature + Byte dest; // -> destination socket Id + Byte src; // -> src socket Id + Byte type; // -> packet type + Word bodySize; // X size of body + Byte transId; // -> transaction Id + // if 0 specified, it will be replaced + SlkPktHeaderChecksum checksum; // X check sum of header + } SlkPktHeaderType; + +typedef SlkPktHeaderType* SlkPktHeaderPtr; + +#define slkPktHeaderSignature1 0xBEEF +#define slkPktHeaderSignature2 0xED + +#define slkPktHeaderSigFirst 0xBE // First byte +#define slkPktHeaderSigSecond 0xEF // second byte +#define slkPktHeaderSigThird 0xED // third byte + +//---------------------------------------------------------------------- +// packet footer +//---------------------------------------------------------------------- +typedef struct SlkPktFooterType { + Word crc16; // header and body crc + } SlkPktFooterType; + +typedef SlkPktFooterType* SlkPktFooterPtr; + + +//************************************************************************* +// +// Write Data Structure passed to SlkSendPacket. This structure +// Tells SlkSendPacket where each of the chunks that comprise the body are +// and the size of each. SlkSendPacket accepts a pointer to an array +// of SlkWriteDataTypes, the last one has a size field of 0. +// +//************************************************************************* +typedef struct SlkWriteDataType { + Word size; // last one has size of 0 + void* dataP; // pointer to data + } SlkWriteDataType; +typedef SlkWriteDataType* SlkWriteDataPtr; + + + + +//************************************************************************* +// +// CPU-dependent macros for getting/setting values from/to packets +// +//************************************************************************* + +//-------------------------------------------------------------------- +// macros to get packet values +//-------------------------------------------------------------------- + +#define slkGetPacketByteVal(srcP) (*(BytePtr)(srcP)) + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketWordVal(srcP) \ + ( (Word) \ + ( \ + ((Word)((BytePtr)(srcP))[0] << 8) | \ + ((Word)((BytePtr)(srcP))[1]) \ + ) \ + ) +#else +#define slkGetPacketWordVal(srcP) \ + ( *((WordPtr)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketDWordVal(srcP) \ + ( (DWord) \ + ( \ + ((DWord)((BytePtr)(srcP))[0] << 24) | \ + ((DWord)((BytePtr)(srcP))[1] << 16) | \ + ((DWord)((BytePtr)(srcP))[2] << 8) | \ + ((DWord)((BytePtr)(srcP))[3]) \ + ) \ + ) +#else +#define slkGetPacketDWordVal(srcP) \ + ( *((DWordPtr)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#define slkGetPacketSignature1(sigP) \ + slkGetPacketWordVal(sigP) + +#define slkGetPacketSignature2(sigP) \ + slkGetPacketByteVal(sigP) + + +#define slkGetPacketDest(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketSrc(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketType(commandP) \ + slkGetPacketByteVal(commandP) + + +#define slkGetPacketBodySize(lengthP) \ + slkGetPacketWordVal(lengthP) + +#define slkGetPacketTransId(transIDP) \ + slkGetPacketByteVal(transIDP) + +#define slkGetPacketHdrChecksum(checksumP) \ + slkGetPacketByteVal(checksumP) + + +#define slkGetPacketTotalChecksum(checksumP) \ + slkGetPacketWordVal(checksumP) + + + + + + +//-------------------------------------------------------------------- +// macros to set packet values +//-------------------------------------------------------------------- + + +#define slkSetPacketByteVal(srcByteVal, destP) \ + ( *(BytePtr)(destP) = (Byte)(srcByteVal) ) + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketWordVal(srcWordVal, destP) \ + \ + do { \ + Word ___srcVal; \ + BytePtr ___srcValP; \ + \ + ___srcVal = (Word)(srcWordVal); \ + ___srcValP = (BytePtr)(&___srcVal); \ + \ + ((BytePtr)(destP))[0] = ___srcValP[1]; \ + ((BytePtr)(destP))[1] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketWordVal(srcWordVal, destP) \ + ( *((WordPtr)(destP)) = (Word)(srcWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + do { \ + DWord ___srcVal; \ + BytePtr ___srcValP; \ + \ + ___srcVal = (DWord)(srcDWordVal); \ + ___srcValP = (BytePtr)(&___srcVal); \ + \ + ((BytePtr)(destP))[0] = ___srcValP[3]; \ + ((BytePtr)(destP))[1] = ___srcValP[2]; \ + ((BytePtr)(destP))[2] = ___srcValP[1]; \ + ((BytePtr)(destP))[3] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + ( *((DWordPtr)(destP)) = (DWord)(srcDWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + + +#define slkSetPacketSignature1(magic, destP) \ + slkSetPacketWordVal(magic, destP) + +#define slkSetPacketSignature2(magic, destP) \ + slkSetPacketByteVal(magic, destP) + + +#define slkSetPacketDest(dest, destP) \ + slkSetPacketByteVal(dest, destP) + +#define slkSetPacketSrc(src, destP) \ + slkSetPacketByteVal(src, destP) + + +#define slkSetPacketType(type, destP) \ + slkSetPacketByteVal(type, destP) + + +#define slkSetPacketBodySize(numBytes, destP) \ + slkSetPacketWordVal(numBytes, destP) + + +#define slkSetPacketTransId(transID, destP) \ + slkSetPacketByteVal(transID, destP) + +#define slkSetPacketHdrChecksum(checksum, destP) \ + slkSetPacketByteVal(checksum, destP) + +#define slkSetPacketTotalChecksum(checksum, destP) \ + slkSetPacketWordVal(checksum, destP) + + + + + + +/******************************************************************* + * Serial Link Manager Errors + * the constant slkErrorClass is defined in SystemMgr.h + *******************************************************************/ +#define slkErrChecksum (slkErrorClass | 1) +#define slkErrFormat (slkErrorClass | 2) +#define slkErrBuffer (slkErrorClass | 3) +#define slkErrTimeOut (slkErrorClass | 4) +#define slkErrHandle (slkErrorClass | 5) +#define slkErrBodyLimit (slkErrorClass | 6) +#define slkErrTransId (slkErrorClass | 7) +#define slkErrResponse (slkErrorClass | 8) +#define slkErrNoDefaultProc (slkErrorClass | 9) +#define slkErrWrongPacketType (slkErrorClass | 10) +#define slkErrBadParam (slkErrorClass | 11) +#define slkErrAlreadyOpen (slkErrorClass | 12) +#define slkErrOutOfSockets (slkErrorClass | 13) +#define slkErrSocketNotOpen (slkErrorClass | 14) +#define slkErrWrongDestSocket (slkErrorClass | 15) +#define slkErrWrongPktType (slkErrorClass | 16) +#define slkErrBusy (slkErrorClass | 17) // called while sending a packet + // only returned on single-threaded + // emulation implementations +#define slkErrNotOpen (slkErrorClass | 18) + + + +/******************************************************************* + * Type definition for a Serial Link Socket Listener + * + *******************************************************************/ +typedef void (*SlkSocketListenerProcPtr) + (SlkPktHeaderPtr headerP, void* bodyP); + +typedef struct SlkSocketListenType { + SlkSocketListenerProcPtr listenerP; + SlkPktHeaderPtr headerBufferP; // App allocated buffer for header + void* bodyBufferP; // App allocated buffer for body + ULong bodyBufferSize; + } SlkSocketListenType; +typedef SlkSocketListenType* SlkSocketListenPtr; + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// Initializes the Serial Link Manager +//------------------------------------------------------------------- +Err SlkOpen(void) + SYS_TRAP(sysTrapSlkOpen); + +//------------------------------------------------------------------- +// Close down the Serial Link Manager +//------------------------------------------------------------------- +Err SlkClose(void) + SYS_TRAP(sysTrapSlkClose); + + + + +//------------------------------------------------------------------- +// Open up another Serial Link socket. The caller must have already +// opened the comm library and set it to the right settings. +//------------------------------------------------------------------- +Err SlkOpenSocket(UInt libRefNum, UIntPtr socketP, Boolean staticSocket) + SYS_TRAP(sysTrapSlkOpenSocket); + +//------------------------------------------------------------------- +// Close up a Serial Link socket. +// Warning: This routine is assymetrical with SlkOpenSocket because it +// WILL CLOSE the library for the caller (unless the refNum is the +// refNum of the debugger comm library). +//------------------------------------------------------------------- +Err SlkCloseSocket(UInt socket) + SYS_TRAP(sysTrapSlkCloseSocket); + + +//------------------------------------------------------------------- +// Get the library refNum for a particular Socket +//------------------------------------------------------------------- +Err SlkSocketRefNum(UInt socket, UIntPtr refNumP) + SYS_TRAP(sysTrapSlkSocketRefNum); + + +//------------------------------------------------------------------- +// Set the in-packet timeout for a socket +//------------------------------------------------------------------- +Err SlkSocketSetTimeout(UInt socket, Long timeout) + SYS_TRAP(sysTrapSlkSocketSetTimeout); + + + + + +//------------------------------------------------------------------- +// Flush a Socket +//------------------------------------------------------------------- +Err SlkFlushSocket(UInt socket, Long timeout) + SYS_TRAP(sysTrapSlkFlushSocket); + + +//------------------------------------------------------------------- +// Set up a Socket Listener +//------------------------------------------------------------------- +Err SlkSetSocketListener(UInt socket, SlkSocketListenPtr socketP) + SYS_TRAP(sysTrapSlkSetSocketListener); + + +//------------------------------------------------------------------- +// Sends a packet's header, body, footer. Stuffs the header's +// magic number and checksum fields. Expects all other +// header fields to be filled in by caller. +// errors returned: dseHandle, dseLine, dseIO, dseParam, dseBodyLimit, +// dseOther +//------------------------------------------------------------------- +Err SlkSendPacket(SlkPktHeaderPtr headerP, SlkWriteDataPtr writeList) + SYS_TRAP(sysTrapSlkSendPacket); + + +//------------------------------------------------------------------- +// Receives and validates an entire packet. +// errors returned: dseHandle, dseParam, dseLine, dseIO, dseFormat, +// dseChecksum, dseBuffer, dseBodyLimit, dseTimeOut, +// dseOther +//------------------------------------------------------------------- +Err SlkReceivePacket( UInt socket, Boolean andOtherSockets, + SlkPktHeaderPtr headerP, void* bodyP, UInt bodySize, + Long timeout) + SYS_TRAP(sysTrapSlkReceivePacket); + + +//------------------------------------------------------------------- +// Do Default processing of a System packet +//------------------------------------------------------------------- +Err SlkSysPktDefaultResponse(SlkPktHeaderPtr headerP, void* bodyP) + SYS_TRAP(sysTrapSlkSysPktDefaultResponse); + +//------------------------------------------------------------------- +// Do RPC call +//------------------------------------------------------------------- +Err SlkProcessRPC(SlkPktHeaderPtr headerP, void* bodyP) + SYS_TRAP(sysTrapSlkProcessRPC); + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIAL_LINK_H diff --git a/sdk-3.1/include/Core/System/SerialLinkPrv.h b/sdk-3.1/include/Core/System/SerialLinkPrv.h new file mode 100644 index 0000000..6ace44f --- /dev/null +++ b/sdk-3.1/include/Core/System/SerialLinkPrv.h @@ -0,0 +1,80 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SerialLinkPrv.c + * + * Description: + * Private Serial Link includes + * + * History: + * 2/6/95 replaces DSerial.h from Debugger + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __SERIALLINKPRV_H +#define __SERIALLINKPRV_H + +#include + + +//************************************************************************* +// Misc Constants +//************************************************************************* +// Default timeout value once into receiving a packet in ticks +#define slkDefaultInPktTimeout (sysTicksPerSecond*2) + + + + +/******************************************************************* + * Serial Link Globals + * + *******************************************************************/ +#define slkMaxSockets 5 // max # of sockets +#define slkMaxRefNums slkMaxSockets // max # of refNums in use at any one time +#define slkAnySocket 0xFF + +#define slkEmptyRefNum 0xFF // used to track empty refInfos + +// We keep an array of these (slkMaxSockets in size) to track which +// librarie's we've received packet headers for. Since we can have up +// to slkMaxSockets unique refNums in use at any one time, we must make +// the array at least that size. +typedef struct SlkRefInfoType { + Byte refNum; // refNum of library, or 0xFF if empty + SByte destID; // dest socketID, or -1 if none + } SlkRefInfoType; +typedef SlkRefInfoType* SlkRefInfoPtr; + +typedef struct SlkGlobalsType { + UInt openCount; + + Byte socketRefNum[slkMaxSockets]; + Boolean socketOpen[slkMaxSockets]; + SlkSocketListenPtr socketListenP[slkMaxSockets]; + Word socketTimeout[slkMaxSockets]; // inPacket timeout + + + // We can keep track of packets coming in for up to slkMaxRefNums libraries. + // This array holds the destination socket ID for packets received from + // each library. + SlkRefInfoType refInfo[slkMaxRefNums]; + + Byte transId; // next transaction ID + DWord xmitSemaphoreID; // Semaphore ID for transmitting + Word numReceived; // # of packets received since serial link + // was opened. + } SlkGlobalsType; + +typedef SlkGlobalsType* SlkGlobalsPtr; + + + +#endif //__SERIALLINKPRV_H + +#endif //NON_PORTABLE diff --git a/sdk-3.1/include/Core/System/SerialMgr.h b/sdk-3.1/include/Core/System/SerialMgr.h new file mode 100644 index 0000000..1cddd9d --- /dev/null +++ b/sdk-3.1/include/Core/System/SerialMgr.h @@ -0,0 +1,348 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SerialMgr.h + * + * 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 + * + *******************************************************************/ + +#ifndef __SERIAL_MGR_H +#define __SERIAL_MGR_H + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Serial Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ +#pragma mark -Error Codes- + +#define serErrBadParam (serErrorClass | 1) +#define serErrBadPort (serErrorClass | 2) +#define serErrNoMem (serErrorClass | 3) +#define serErrBadConnID (serErrorClass | 4) +#define serErrTimeOut (serErrorClass | 5) +#define serErrLineErr (serErrorClass | 6) +#define serErrAlreadyOpen (serErrorClass | 7) +#define serErrStillOpen (serErrorClass | 8) +#define serErrNotOpen (serErrorClass | 9) +#define serErrNotSupported (serErrorClass | 10) // functionality not supported + + +/******************************************************************** + * Serial Port Definitions + ********************************************************************/ +#pragma mark -Port Definitions- + +#define serPortDefault 0x0000 // Use prefDefSerialPlugIn +#define serPortLocalHotSync 0x8000 // Use physical HotSync port +#define serPortMaskLocal 0x7FFF // Mask off HotSync "hint" (for SerialMgr) + + +/******************************************************************** + * Serial Settings Descriptor + ********************************************************************/ +#pragma mark -Configuration Settings- + +typedef struct SerSettingsType { + ULong baudRate; // baud rate + ULong flags; // miscellaneous settings + Long ctsTimeout; // max # of ticks to wait for CTS to become asserted + // before transmitting; used only when + // configured with serSettingsFlagCTSAutoM. + } SerSettingsType; +typedef SerSettingsType* SerSettingsPtr; + +#define serSettingsFlagStopBitsM 0x00000001 // mask for stop bits field +#define serSettingsFlagStopBits1 0x00000000 // 1 stop bits +#define serSettingsFlagStopBits2 0x00000001 // 2 stop bits +#define serSettingsFlagParityOnM 0x00000002 // mask for parity on +#define serSettingsFlagParityEvenM 0x00000004 // mask for parity even +#define serSettingsFlagXonXoffM 0x00000008 // (NOT IMPLEMENTED) mask for Xon/Xoff flow control +#define serSettingsFlagRTSAutoM 0x00000010 // mask for RTS rcv flow control +#define serSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control +#define serSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char +#define serSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char +#define serSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char +#define serSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char +#define serSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char + + +// Default settings +#define serDefaultSettings (serSettingsFlagBitsPerChar8 | \ + serSettingsFlagStopBits1 | \ + serSettingsFlagRTSAutoM) + +#define serDefaultCTSTimeout (5*sysTicksPerSecond); + +// +// mask values for the lineErrors from SerGetStatus +// +#pragma mark -Line Errors- + +#define serLineErrorParity 0x0001 // parity error +#define serLineErrorHWOverrun 0x0002 // HW overrun +#define serLineErrorFraming 0x0004 // framing error +#define serLineErrorBreak 0x0008 // break signal asserted +#define serLineErrorHShake 0x0010 // line hand-shake error +#define serLineErrorSWOverrun 0x0020 // HW overrun + + + + +/******************************************************************** + * Type of a wakeup handler procedure which can be installed through the + * SerSetWakeupHandler() call. + ********************************************************************/ +typedef void (*SerWakeupHandler) (DWord refCon); + +/******************************************************************** + * Type of an emulator-mode only blocking hook routine installed via + * SerControl function serCtlEmuSetBlockingHook. This is supported only + * under emulation mode. The argument to the function is the value + * specified in the SerCallbackEntryType structure. The intention of the + * return value is to return false if serial manager should abort the + * current blocking action, such as when an app quit event has been received; + * otherwise, it should return true. However, in the current implementation, + * this return value is ignored. The callback can additionally process + * events to enable user interaction with the UI, such as interacting with the + * debugger. + ********************************************************************/ +typedef Boolean (*SerBlockingHookHandler) (DWord userRef); + + + + +/******************************************************************** + * Serial Library Control Enumerations (Pilot 2.0) + ********************************************************************/ +#pragma mark -Control Enumerations- + +/******************************************************************** + * Structure for specifying callback routines. + ********************************************************************/ +typedef struct SerCallbackEntryType { + Ptr funcP; // function pointer + DWord userRef; // ref value to pass to callback + } SerCallbackEntryType; +typedef SerCallbackEntryType* SerCallbackEntryPtr; + +// v2.0 extension +// DOLATER... add DTR control and status +typedef enum SerCtlEnum { + serCtlFirstReserved = 0, // RESERVE 0 + + serCtlStartBreak, // 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, // turn RS232 break signal off: + // valueP = 0, valueLenP = 0 + + serCtlBreakStatus, // Get RS232 break signal status(on or off): + // valueP = ptr to Word for returning status(0 = off, !0 = on) + // *valueLenP = sizeof(Word) + + serCtlStartLocalLoopback, // Start local loopback test + // valueP = 0, valueLenP = 0 + + serCtlStopLocalLoopback, // Stop local loopback test + // valueP = 0, valueLenP = 0 + + serCtlMaxBaud, // Get maximum supported baud rate: + // valueP = ptr to DWord for returned baud + // *valueLenP = sizeof(DWord) + + serCtlHandshakeThreshold, // retrieve HW handshake threshold; this is the maximum baud rate + // which does not require hardware handshaking + // valueP = ptr to DWord for returned baud + // *valueLenP = sizeof(DWord) + + serCtlEmuSetBlockingHook, // Set a blocking hook routine FOR EMULATION + // MODE ONLY - NOT SUPPORTED ON THE PILOT + //PASS: + // valueP = ptr to SerCallbackEntryType + // *valueLenP = sizeof(SerCallbackEntryType) + //RETURNS: + // the old settings in the first argument + + + serCtlIrDAEnable, // Enable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + serCtlIrDADisable, // Disable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + serCtlIrScanningOn, // Start Ir Scanning mode + + serCtlIrScanningOff, // Stop Ir Scanning mode + + serCtlRxEnable, // enable receiver ( for IrDA ) + + serCtlRxDisable, // disable receiver ( for IrDA ) + + serCtlLAST // ADD NEW ENTRIES BEFORE THIS ONE + } SerCtlEnum; + + + +/******************************************************************** + * Serial Library Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#pragma mark -API Functions- + +#ifdef __cplusplus +extern "C" { +#endif + +// Used by mac applications to map the pilot serial port to a particular +// macintosh port. +UInt SerSetMapPort( UInt pilotPort, UInt macPort ); + +// Acquires and opens a serial port with given baud and default settings. +Err SerOpen(UInt refNum, UInt port, ULong baud) + SYS_TRAP(sysLibTrapOpen); + +// Used by debugger to re-initialize serial port if necessary +Err SerDbgAssureOpen(UInt refNum, UInt port, ULong baud); + +// Closes the serial connection previously opened with SerOpen. +Err SerClose(UInt refNum) + SYS_TRAP(sysLibTrapClose); + +// Puts serial library to sleep +Err SerSleep(UInt refNum) + SYS_TRAP(sysLibTrapSleep); + +// Wake Serial library +Err SerWake(UInt refNum) + SYS_TRAP(sysLibTrapWake); + +// Get attributes of the serial connection +Err SerGetSettings(UInt refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom); + +// Set attributes of the serial connection +Err SerSetSettings(UInt refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom+1); + +// Return status of serial connection +Word SerGetStatus(UInt refNum, BooleanPtr ctsOnP, + BooleanPtr dsrOnP) + SYS_TRAP(sysLibTrapCustom+2); + +// Reset error condition of serial connection +Err SerClearErr(UInt refNum) + SYS_TRAP(sysLibTrapCustom+3); + + + + +// Sends a buffer of data (may queue it up and return). +Err SerSend10(UInt refNum, VoidPtr bufP, ULong size) + SYS_TRAP(sysLibTrapCustom+4); + +// Waits until the serial transmit buffer empties. +// The timeout arg is ignored; CTS timeout is used +Err SerSendWait(UInt refNum, Long timeout) + SYS_TRAP(sysLibTrapCustom+5); + +// Returns how many characters are left in the send queue waiting +// for transmission +Err SerSendCheck(UInt refNum, ULongPtr numBytesP) + SYS_TRAP(sysLibTrapCustom+6); + +// Flushes the data out of the transmit buffer +Err SerSendFlush(UInt refNum) + SYS_TRAP(sysLibTrapCustom+7); + + + + +// Receives a buffer of data of the given size. +Err SerReceive10(UInt refNum, VoidPtr bufP, ULong bytes, Long timeout) + SYS_TRAP(sysLibTrapCustom+8); + +// Waits for at least 'bytes' bytes of data to arrive at the serial input. +// but does not read them in +Err SerReceiveWait(UInt refNum, ULong bytes, Long timeout) + SYS_TRAP(sysLibTrapCustom+9); + +// Returns how many characters are in the receive queue +Err SerReceiveCheck(UInt refNum, ULongPtr numBytesP) + SYS_TRAP(sysLibTrapCustom+10); + +// Flushes any data coming into the serial port, discarding the data. +void SerReceiveFlush(UInt refNum, Long timeout) + SYS_TRAP(sysLibTrapCustom+11); + + +// Specify a new input buffer. To restore the original buffer, pass +// bufSize = 0. +Err SerSetReceiveBuffer(UInt refNum, VoidPtr bufP, UInt bufSize) + SYS_TRAP(sysLibTrapCustom+12); + + +// The receive character interrupt service routine, called by kernel when +// a UART interrupt is detected. DOLATER... generalize ISP's for multiple Serial libs +Boolean SerReceiveISP(void) + SYS_TRAP(sysTrapSerReceiveISP); + + + +// "Back Door" into the serial receive queue. Used by applications (like TCP Media layers) +// that need faster access to received characters +Err SerReceiveWindowOpen(UInt refNum, BytePtr* bufPP, DWordPtr sizeP) + SYS_TRAP(sysLibTrapCustom+13); + +Err SerReceiveWindowClose(UInt refNum, DWord bytesPulled) + SYS_TRAP(sysLibTrapCustom+14); + +// Can be called by applications that need an alternate wakeup mechanism +// when characters get enqueued by the interrupt routine. +Err SerSetWakeupHandler(UInt refNum, SerWakeupHandler procP, + DWord refCon) + SYS_TRAP(sysLibTrapCustom+15); + +// Called to prime wakeup handler +Err SerPrimeWakeupHandler(UInt refNum, Word minBytes) + SYS_TRAP(sysLibTrapCustom+16); + +// Called to perform a serial manager control operation +// (v2.0 extension) +Err SerControl(UInt refNum, Word op, VoidPtr valueP, WordPtr valueLenP) + SYS_TRAP(sysLibTrapCustom+17); + + +// Sends a buffer of data (may queue it up and return). +ULong SerSend(UInt refNum, VoidPtr bufP, ULong count, Err* errP) + SYS_TRAP(sysLibTrapCustom+18); + +// Receives a buffer of data of the given size. +ULong SerReceive(UInt refNum, VoidPtr bufP, ULong count, Long timeout, Err* errP) + SYS_TRAP(sysLibTrapCustom+19); + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIAL_MGR_H diff --git a/sdk-3.1/include/Core/System/SoundMgr.h b/sdk-3.1/include/Core/System/SoundMgr.h new file mode 100644 index 0000000..f72616f --- /dev/null +++ b/sdk-3.1/include/Core/System/SoundMgr.h @@ -0,0 +1,309 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SoundMgr.h + * + * Description: + * Include file for Sound Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *******************************************************************/ + + +#ifndef __SOUNDMGR_H__ +#define __SOUNDMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Sound Manager constants + * + *************************************************************/ + +// Sound Manager max and default volume levels +#define sndMaxAmp 64 +//#define sndVolumeMask 0x0ff +#define sndDefaultAmp sndMaxAmp + +#define sndMidiNameLength 32 // MIDI track name length *including* NULL terminator + + +/************************************************************ + * Sound Manager data structures + * + *************************************************************/ + +// +// Command numbers for SndCommandType's cmd field +// +typedef enum SndCmdIDType { + + sndCmdFreqDurationAmp = 1, // play a sound, blocking for the entire duration (except for zero amplitude) + // param1 = frequency in Hz + // param2 = duration in milliseconds + // param3 = amplitude (0 - sndMaxAmp); if 0, will return immediately + + // Commands added in PilotOS v3.0 + // ***IMPORTANT*** + // Please note that SndDoCmd() in PilotOS before v3.0 will Fatal Error on unknown + // commands (anything other than sndCmdFreqDurationAmp). For this reason, + // applications wishing to take advantage of these new commands while staying + // compatible with the earlier version of the OS, _must_ avoid using these commands + // when running on OS versions less thatn v3.0 (see sysFtrNumROMVersion in SystemMgr.h). + // Beginning with v3.0, SndDoCmd has been fixed to return sndErrBadParam when an + // unknown command is passed. + // + sndCmdNoteOn, // start a sound given its MIDI key index, max duration and velocity; + // the call will not wait for the sound to complete, returning imeediately; + // any other sound play request made before this one completes will interrupt it. + // param1 = MIDI key index (0-127) + // param2 = maximum duration in milliseconds + // param3 = velocity (0 - 127) (will be interpolated as amplitude) + + sndCmdFrqOn, // start a sound given its frequency in Hz, max duration and amplitude; + // the call will not wait for the sound to complete, returning imeediately; + // any other sound play request made before this one completes will interrupt it. + // param1 = frequency in Hz + // param2 = maximum duration in milliseconds + // param3 = amplitude (0 - sndMaxAmp) + + sndCmdQuiet // stop current sound + // param1 = 0 + // param2 = 0 + // param3 = 0 + + } SndCmdIDType; + + + + +// +// SndCommandType: used by SndDoCmd() +// + +typedef struct SndCommandType { +SndCmdIDType cmd; // command id +Long param1; // first parameter +UInt param2; // second parameter +UInt param3; // third parameter +} SndCommandType; + +typedef SndCommandType* SndCommandPtr; + + +// +// Beep numbers used by SndSysBeep() +// + +typedef enum SndSysBeepType { + sndInfo = 1, + sndWarning, + sndError, + sndStartUp, + sndAlarm, + sndConfirmation, + sndClick + } SndSysBeepType; + + +/************************************************************ + * Standard MIDI File (SMF) support structures + *************************************************************/ + + +// Structure of records in the MIDI sound database: +// +// Each MIDI record consists of a record header followed immediately by the +// Standard MIDI File (SMF) data stream. Only SMF format #0 is presently supported. +// The first byte of the record header is the byte offset from the beginning of the record +// to the SMF data stream. The name of the record follows the byte offset +// field. sndMidiNameLength is the limit on name size (including NULL). +#define sndMidiRecSignature 'PMrc' +typedef struct SndMidiRecHdrType { + DWord signature; // set to sndMidiRecSignature + Byte bDataOffset; // offset from the beginning of the record + // to the Standard Midi File data stream + Byte reserved; // set to zero + } SndMidiRecHdrType; + +typedef struct SndMidiRecType { + SndMidiRecHdrType hdr; // offset from the beginning of the record + // to the Standard Midi File data stream + Char name[1]; // Track name: 1 or more chars including NULL terminator. + // If a track has no name, the NULL character must still + // be provided. + } SndMidiRecType; + + +// Midi records found by SndCreateMidiList. +typedef struct SndMidiListItemType + { + Char name[sndMidiNameLength]; // including NULL terminator + ULong uniqueRecID; + LocalID dbID; + UInt cardNo; + } SndMidiListItemType; + + +// Commands for SndPlaySmf +typedef enum SndSmfCmdEnum { + sndSmfCmdPlay = 1, // play the selection + sndSmfCmdDuration // get the duration in milliseconds of the entire track + } SndSmfCmdEnum; + +typedef void SndComplFuncType(void* chanP, DWord dwUserData); +typedef SndComplFuncType* SndComplFuncPtr; + + +// Return true to continue, false to abort +typedef Boolean SndBlockingFuncType(void* chanP, DWord dwUserData, Long sysTicksAvailable); +typedef SndBlockingFuncType* SndBlockingFuncPtr; + +typedef struct SndCallbackInfoType { + Ptr funcP; // pointer to the callback function (NULL = no function) + DWord dwUserData; // value to be passed in the dwUserData parameter of the callback function + } SndCallbackInfoType; + + +typedef struct SndSmfCallbacksType { + SndCallbackInfoType completion; // completion callback function (see SndComplFuncType) + SndCallbackInfoType blocking; // blocking hook callback function (see SndBlockingFuncType) + SndCallbackInfoType reserved; // RESERVED -- SET ALL FIELDS TO ZERO BEFORE PASSING + } SndSmfCallbacksType; + + +#define sndSmfPlayAllMilliSec 0xFFFFFFFFUL + +typedef struct SndSmfOptionsType { + // dwStartMilliSec and dwEndMilliSec are used as inputs to the function for sndSmfCmdPlay and as + // outputs for sndSmfCmdDuration + DWord dwStartMilliSec; // 0 = "start from the beginning" + DWord dwEndMilliSec; // sndSmfPlayAllMilliSec = "play the entire track"; + // the default is "play entire track" if this structure + // is not passed in + + // The amplitude and interruptible fields are used only for sndSmfCmdPlay + UInt amplitude; // relative volume: 0 - sndMaxAmp, inclusively; the default is + // sndMaxAmp if this structure is not passed in; if 0, the play will + // be skipped and the call will return immediately + + Boolean interruptible; // if true, sound play will be interrupted if + // user interacts with the controls (digitizer, buttons, etc.); + // if false, the paly will not be interrupted; the default behavior + // is "interruptible" if this structure is not passed in + + DWord reserved; // RESERVED! -- MUST SET TO ZERO BEFORE PASSING + } SndSmfOptionsType; + + +typedef struct SndSmfChanRangeType { + Byte bFirstChan; // first MIDI channel (0-15 decimal) + Byte bLastChan; // last MIDI channel (0-15 decimal) + } SndSmfChanRangeType; + + + + +/************************************************************ + * Sound Manager result codes + * (sndErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define sndErrBadParam (sndErrorClass | 1) +#define sndErrBadChannel (sndErrorClass | 2) +#define sndErrMemory (sndErrorClass | 3) +#define sndErrOpen (sndErrorClass | 4) +#define sndErrQFull (sndErrorClass | 5) +#define sndErrQEmpty (sndErrorClass | 6) // internal +#define sndErrFormat (sndErrorClass | 7) // unsupported data format +#define sndErrBadStream (sndErrorClass | 8) // invalid data stream +#define sndErrInterrupted (sndErrorClass | 9) // play was interrupted + + + +/******************************************************************** + * Sound Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- + +// Initializes the Sound Manager. Should only be called by +// Pilot initialization code. +Err SndInit(void) SYS_TRAP(sysTrapSndInit); + +// Frees the Sound Manager. +//void SndFree(void) SYS_TRAP(sysTrapSndFree); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// Sets default sound volume levels +// +// Any parameter may be passed as NULL +extern void SndSetDefaultVolume(UIntPtr alarmAmpP, UIntPtr sysAmpP, UIntPtr defAmpP) + SYS_TRAP(sysTrapSndSetDefaultVolume); + +// Gets default sound volume levels +// +// Any parameter may be passed as NULL +extern void SndGetDefaultVolume(UIntPtr alarmAmpP, UIntPtr sysAmpP, UIntPtr masterAmpP) + SYS_TRAP(sysTrapSndGetDefaultVolume); + +// Executes a sound command on the given sound channel (pass +// channelP = 0 to use the shared channel). +extern Err SndDoCmd(VoidPtr /*SndChanPtr*/ channelP, SndCommandPtr cmdP, Boolean noWait) + SYS_TRAP(sysTrapSndDoCmd); + +// Plays one of several defined system beeps/sounds (see sndSysBeep... +// constants). +extern void SndPlaySystemSound(SndSysBeepType beepID) + SYS_TRAP(sysTrapSndPlaySystemSound); + + +// NEW FOR v3.0 +// Performs an operation on a Standard MIDI File (SMF) Format #0 +extern Err SndPlaySmf(void* chanP, SndSmfCmdEnum cmd, BytePtr smfP, SndSmfOptionsType* selP, + SndSmfChanRangeType* chanRangeP, SndSmfCallbacksType* callbacksP, + Boolean bNoWait) + SYS_TRAP(sysTrapSndPlaySmf); + +// NEW FOR v3.0 +// Creates a list of all midi records. Useful for displaying in lists. +// For creator wildcard, pass creator=0; +extern Boolean SndCreateMidiList(ULong creator, Boolean multipleDBs, WordPtr wCountP, Handle *entHP) + SYS_TRAP(sysTrapSndCreateMidiList); + + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Sound Manager Macros + * + *************************************************************/ + +#endif // __SOUND_MGR_H__ + diff --git a/sdk-3.1/include/Core/System/StringMgr.h b/sdk-3.1/include/Core/System/StringMgr.h new file mode 100644 index 0000000..d23f986 --- /dev/null +++ b/sdk-3.1/include/Core/System/StringMgr.h @@ -0,0 +1,98 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * StringMgr.h + * + * 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 Int) + * + *******************************************************************/ + + + +#ifndef __STRINGMGR_H__ +#define __STRINGMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +#ifdef __cplusplus +extern "C" { +#endif + +// String Manipulation routines +CharPtr StrCopy(CharPtr dst, const Char* src) + SYS_TRAP(sysTrapStrCopy); + +CharPtr StrNCopy(CharPtr dst, const Char* src, Word n) + SYS_TRAP(sysTrapStrNCopy); + +CharPtr StrCat(CharPtr dst, const Char* src) + SYS_TRAP(sysTrapStrCat); + +CharPtr StrNCat(CharPtr dst, const Char* src, Word n) + SYS_TRAP(sysTrapStrNCat); + +UInt StrLen(const Char* src) + SYS_TRAP(sysTrapStrLen); + +Int StrCompare(const Char* s1, const Char* s2) + SYS_TRAP(sysTrapStrCompare); + +Int StrNCompare(const Char* s1, const Char* s2, DWord n) + SYS_TRAP(sysTrapStrNCompare); + +Int StrCaselessCompare(const Char* s1, const Char* s2) + SYS_TRAP(sysTrapStrCaselessCompare); + +Int StrNCaselessCompare(const Char* s1, const Char* s2, DWord n) + SYS_TRAP(sysTrapStrNCaselessCompare); + +CharPtr StrToLower(CharPtr dst, const Char* src) + SYS_TRAP(sysTrapStrToLower); + +CharPtr StrIToA(CharPtr s, Long i) + SYS_TRAP(sysTrapStrIToA); + +CharPtr StrIToH(CharPtr s, ULong i) + SYS_TRAP(sysTrapStrIToH); + +CharPtr StrLocalizeNumber(CharPtr s, Char thousandSeparator, Char decimalSeparator) + SYS_TRAP(sysTrapStrLocalizeNumber); + +CharPtr StrDelocalizeNumber(CharPtr s, Char thousandSeparator, Char decimalSeparator) + SYS_TRAP(sysTrapStrDelocalizeNumber); + +CharPtr StrChr (const Char* str, WChar chr) + SYS_TRAP(sysTrapStrChr); + +CharPtr StrStr (const Char* str, const Char* token) + SYS_TRAP(sysTrapStrStr); + +Long StrAToI (const Char* str) + SYS_TRAP(sysTrapStrAToI); + +SWord StrPrintF(CharPtr s, const Char* formatStr, ...) + SYS_TRAP(sysTrapStrPrintF); + +SWord StrVPrintF(CharPtr s, const Char* formatStr, const VoidPtr arg) + SYS_TRAP(sysTrapStrVPrintF); + +#ifdef __cplusplus +} +#endif + + + + +#endif //__STRINGMGR_H diff --git a/sdk-3.1/include/Core/System/SysAll.h b/sdk-3.1/include/Core/System/SysAll.h new file mode 100644 index 0000000..50e8b90 --- /dev/null +++ b/sdk-3.1/include/Core/System/SysAll.h @@ -0,0 +1,90 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SysAll.h + * + * Description: + * Includes all system header files in order to help compiler + * do pre-compiled headers + * + * History: + * 11/17/94 RM - Created by Ron Marianetti + * 2/24/97 roger - changed to handle c++ versions. + * 4/16/97 SCL - Added + * 5/5/98 art - Added + * + *******************************************************************/ + +#ifndef __SYSALL_H__ +#define __SYSALL_H__ + + +//********************************************************************* +// If not included from Pilot.h, as is the case when compiling UI modules, +// use the SysAll pre-compiled header file. +//********************************************************************* +#ifndef __PILOT_H__ + #ifndef PILOT_PRECOMPILED_HEADERS_OFF + + // Use Metrowerk's precompiled headers option + #if defined(__MWERKS__) + #if !__option(precompile) + #if __PALMOS_TRAPS__ + #ifdef __cplusplus + #include "SysAll.h++.mch" + #else + #include "SysAll.h.mch" + #endif + #else + #ifdef CMD_LINE_BUILD + #ifdef __cplusplus + #include "SysAll.h++.mpw.mch" + #else + #include "SysAll.h.mpw.mch" + #endif + #else + #ifdef __cplusplus + #include "SysAll.h++.sim.mch" + #else + #include "SysAll.h.sim.mch" + #endif + #endif + #endif + #define __INCLUDED_SYSALL_H_OBJ__ + #endif + #endif + + #endif +#endif + + +// Fastest compilation speed is obtained by not including these +// headers when the pre-compiled header is used. +#ifndef __INCLUDED_SYSALL_H_OBJ__ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#endif + + +#endif // __SYSALL_H__ diff --git a/sdk-3.1/include/Core/System/SysEvtMgr.h b/sdk-3.1/include/Core/System/SysEvtMgr.h new file mode 100644 index 0000000..9faceb9 --- /dev/null +++ b/sdk-3.1/include/Core/System/SysEvtMgr.h @@ -0,0 +1,174 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SysEvtMgr.h + * + * Description: + * Header for the System Event Manager + * + * History: + * 03/22/95 RM Created by Ron Marianetti + * 07/23/98 kwk Changed UInt param in EvtEnqueueKey to WChar. + * + *******************************************************************/ + +#ifndef __SYSEVTMGR_H__ +#define __SYSEVTMGR_H__ + +#include + +/************************************************************ + * System Event Manager Errors + *************************************************************/ +#define evtErrParamErr (evtErrorClass | 1) +#define evtErrQueueFull (evtErrorClass | 2) +#define evtErrQueueEmpty (evtErrorClass | 3) + + +/************************************************************ + * System Event Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err EvtSysInit(void) + SYS_TRAP(sysTrapEvtSysInit); + +// Return next "System" event. This routine will send strokes to Graffiti as necessary +// and return a key event. Otherwise, it will return a simple pen down or pen +// up event, or put the processor to sleep for a max time of 'timeout' if +// no events are available. +void EvtGetSysEvent(EventPtr eventP, Long timeout) + SYS_TRAP(sysTrapEvtGetSysEvent); + + +// Return true if there is a low level system event (pen or key) available +Boolean EvtSysEventAvail(Boolean ignorePenUps) + SYS_TRAP(sysTrapEvtSysEventAvail); + + + +// Translate a stroke in the silk screen area to a key event +Err EvtProcessSoftKeyStroke(PointType* startPtP, PointType* endPtP) + SYS_TRAP(sysTrapEvtProcessSoftKeyStroke); + + +//----------------------------------------------------------------- +// Pen Queue Utilties +//------------------------------------------------------------------ + +// Replace current pen queue with another of the given size +Err EvtSetPenQueuePtr(Ptr penQueueP, ULong size) + SYS_TRAP(sysTrapEvtSetPenQueuePtr); + +// Return size of current pen queue in bytes +ULong EvtPenQueueSize(void) + SYS_TRAP(sysTrapEvtPenQueueSize); + +// Flush the pen queue +Err EvtFlushPenQueue(void) + SYS_TRAP(sysTrapEvtFlushPenQueue); + + +// Append a point to the pen queue. Passing -1 for x and y means +// pen-up (terminate the current stroke). Called by digitizer interrupt routine +Err EvtEnqueuePenPoint(PointType* ptP) + SYS_TRAP(sysTrapEvtEnqueuePenPoint); + + +// Return the stroke info for the next stroke in the pen queue. This MUST +// be the first call when removing a stroke from the queue +Err EvtDequeuePenStrokeInfo(PointType* startPtP, PointType* endPtP) + SYS_TRAP(sysTrapEvtDequeuePenStrokeInfo); + +// Dequeue the next point from the pen queue. Returns non-0 if no +// more points. The point returned will be (-1,-1) at the end +// of the stroke. +Err EvtDequeuePenPoint(PointType* retP) + SYS_TRAP(sysTrapEvtDequeuePenPoint); + + +// Flush the entire stroke from the pen queue and dispose it +Err EvtFlushNextPenStroke() + SYS_TRAP(sysTrapEvtFlushNextPenStroke); + + + + +//----------------------------------------------------------------- +// Key Queue Utilties +//------------------------------------------------------------------ + +// Replace current key queue with another of the given size. This routine will +// intialize the given key queue before installing it +Err EvtSetKeyQueuePtr(Ptr keyQueueP, ULong size) + SYS_TRAP(sysTrapEvtSetKeyQueuePtr); + +// Return size of current key queue in bytes +ULong EvtKeyQueueSize(void) + SYS_TRAP(sysTrapEvtKeyQueueSize); + +// Flush the key queue +Err EvtFlushKeyQueue(void) + SYS_TRAP(sysTrapEvtFlushKeyQueue); + + +// Append a key to the key queue. +Err EvtEnqueueKey(WChar ascii, UInt keycode, UInt modifiers) + SYS_TRAP(sysTrapEvtEnqueueKey); + +// Return true of key queue empty. +Boolean EvtKeyQueueEmpty(void) + SYS_TRAP(sysTrapEvtKeyQueueEmpty); + + +// Pop off the next key event from the key queue and fill in the given +// event record structure. Returns non-zero if there aren't any keys in the +// key queue. If peek is non-zero, key will be left in key queue. +Err EvtDequeueKeyEvent(EventPtr eventP, Word peek) + SYS_TRAP(sysTrapEvtDequeueKeyEvent); + + +//----------------------------------------------------------------- +// General Utilities +//------------------------------------------------------------------ +// Force the system to wake-up. This will result in a null event being +// sent to the current app. +Err EvtWakeup(void) + SYS_TRAP(sysTrapEvtWakeup); + +// Reset the auto-off timer. This is called by the SerialLink Manager in order +// so we don't auto-off while receiving data over the serial port. +Err EvtResetAutoOffTimer(void) + SYS_TRAP(sysTrapEvtResetAutoOffTimer); + + +// Set Graffiti enabled or disabled. +void EvtEnableGraffiti(Boolean enable) + SYS_TRAP(sysTrapEvtEnableGraffiti); + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _EvtEnqueuePenPoint \ + ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint) + + + +#endif //__SYSEVTMGR_H__ + + + diff --git a/sdk-3.1/include/Core/System/SysTraps.h b/sdk-3.1/include/Core/System/SysTraps.h new file mode 100644 index 0000000..9baee51 --- /dev/null +++ b/sdk-3.1/include/Core/System/SysTraps.h @@ -0,0 +1,1116 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SysTraps.h + * + * Description: + * Pilot Traps + * + * History: + * 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 sysTrapWinDrawChar, sysTrapWinDrawTruncChars, + * and sysTrapFntWidthToOffset 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, sysTrapEvtPeekEvent 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 Merged FtrPtr* traps from Main + * + *******************************************************************/ + + #ifndef __SYSTRAPS_H_ + #define __SYSTRAPS_H_ + +// Include elementary types +#include +#include + +// Regular traps start here and go up by 1's +#define sysTrapBase 0xA000 +typedef enum { + sysTrapMemInit = sysTrapBase, + sysTrapMemInitHeapTable, + sysTrapMemStoreInit, + sysTrapMemCardFormat, + sysTrapMemCardInfo, + sysTrapMemStoreInfo, + sysTrapMemStoreSetInfo, + sysTrapMemNumHeaps, + sysTrapMemNumRAMHeaps, + sysTrapMemHeapID, + sysTrapMemHeapPtr, + sysTrapMemHeapFreeBytes, + sysTrapMemHeapSize, + sysTrapMemHeapFlags, + sysTrapMemHeapCompact, + sysTrapMemHeapInit, + sysTrapMemHeapFreeByOwnerID, + sysTrapMemChunkNew, + sysTrapMemChunkFree, + sysTrapMemPtrNew, + sysTrapMemPtrRecoverHandle, + sysTrapMemPtrFlags, + sysTrapMemPtrSize, + sysTrapMemPtrOwner, + sysTrapMemPtrHeapID, + sysTrapMemPtrCardNo, + sysTrapMemPtrToLocalID, + sysTrapMemPtrSetOwner, + sysTrapMemPtrResize, + sysTrapMemPtrResetLock, + sysTrapMemHandleNew, + sysTrapMemHandleLockCount, + sysTrapMemHandleToLocalID, + sysTrapMemHandleLock, + sysTrapMemHandleUnlock, + sysTrapMemLocalIDToGlobal, + sysTrapMemLocalIDKind, + sysTrapMemLocalIDToPtr, + sysTrapMemMove, + sysTrapMemSet, + sysTrapMemStoreSearch, + sysTrapMemPtrDataStorage, + sysTrapMemKernelInit, + sysTrapMemHandleFree, + sysTrapMemHandleFlags, + sysTrapMemHandleSize, + sysTrapMemHandleOwner, + sysTrapMemHandleHeapID, + sysTrapMemHandleDataStorage, + sysTrapMemHandleCardNo, + sysTrapMemHandleSetOwner, + sysTrapMemHandleResize, + sysTrapMemHandleResetLock, + sysTrapMemPtrUnlock, + sysTrapMemLocalIDToLockedPtr, + sysTrapMemSetDebugMode, + sysTrapMemHeapScramble, + sysTrapMemHeapCheck, + sysTrapMemNumCards, + sysTrapMemDebugMode, + sysTrapMemSemaphoreReserve, + sysTrapMemSemaphoreRelease, + sysTrapMemHeapDynamic, + sysTrapMemNVParams, + + + sysTrapDmInit, + sysTrapDmCreateDatabase, + sysTrapDmDeleteDatabase, + sysTrapDmNumDatabases, + sysTrapDmGetDatabase, + sysTrapDmFindDatabase, + sysTrapDmDatabaseInfo, + sysTrapDmSetDatabaseInfo, + sysTrapDmDatabaseSize, + sysTrapDmOpenDatabase, + sysTrapDmCloseDatabase, + sysTrapDmNextOpenDatabase, + sysTrapDmOpenDatabaseInfo, + sysTrapDmResetRecordStates, + sysTrapDmGetLastErr, + sysTrapDmNumRecords, + sysTrapDmRecordInfo, + sysTrapDmSetRecordInfo, + sysTrapDmAttachRecord, + sysTrapDmDetachRecord, + sysTrapDmMoveRecord, + sysTrapDmNewRecord, + sysTrapDmRemoveRecord, + sysTrapDmDeleteRecord, + sysTrapDmArchiveRecord, + sysTrapDmNewHandle, + sysTrapDmRemoveSecretRecords, + sysTrapDmQueryRecord, + sysTrapDmGetRecord, + sysTrapDmResizeRecord, + sysTrapDmReleaseRecord, + sysTrapDmGetResource, + sysTrapDmGet1Resource, + sysTrapDmReleaseResource, + sysTrapDmResizeResource, + sysTrapDmNextOpenResDatabase, + sysTrapDmFindResourceType, + sysTrapDmFindResource, + sysTrapDmSearchResource, + sysTrapDmNumResources, + sysTrapDmResourceInfo, + sysTrapDmSetResourceInfo, + sysTrapDmAttachResource, + sysTrapDmDetachResource, + sysTrapDmNewResource, + sysTrapDmRemoveResource, + sysTrapDmGetResourceIndex, + sysTrapDmQuickSort, + sysTrapDmQueryNextInCategory, + sysTrapDmNumRecordsInCategory, + sysTrapDmPositionInCategory, + sysTrapDmSeekRecordInCategory, + sysTrapDmMoveCategory, + sysTrapDmOpenDatabaseByTypeCreator, + sysTrapDmWrite, + sysTrapDmStrCopy, + sysTrapDmGetNextDatabaseByTypeCreator, + sysTrapDmWriteCheck, + sysTrapDmMoveOpenDBContext, + sysTrapDmFindRecordByID, + sysTrapDmGetAppInfoID, + sysTrapDmFindSortPositionV10, + sysTrapDmSet, + sysTrapDmCreateDatabaseFromImage, + + + sysTrapDbgSrcMessage, + sysTrapDbgMessage, + sysTrapDbgGetMessage, + sysTrapDbgCommSettings, + + sysTrapErrDisplayFileLineMsg, + sysTrapErrSetJump, + sysTrapErrLongJump, + sysTrapErrThrow, + sysTrapErrExceptionList, + + sysTrapSysBroadcastActionCode, + sysTrapSysUnimplemented, + sysTrapSysColdBoot, + sysTrapSysReset, + sysTrapSysDoze, + sysTrapSysAppLaunch, + sysTrapSysAppStartup, + sysTrapSysAppExit, + sysTrapSysSetA5, + sysTrapSysSetTrapAddress, + sysTrapSysGetTrapAddress, + sysTrapSysTranslateKernelErr, + sysTrapSysSemaphoreCreate, + sysTrapSysSemaphoreDelete, + sysTrapSysSemaphoreWait, + sysTrapSysSemaphoreSignal, + sysTrapSysTimerCreate, + sysTrapSysTimerWrite, + sysTrapSysTaskCreate, + sysTrapSysTaskDelete, + sysTrapSysTaskTrigger, + sysTrapSysTaskID, + sysTrapSysTaskUserInfoPtr, + sysTrapSysTaskDelay, + sysTrapSysTaskSetTermProc, + sysTrapSysUILaunch, + sysTrapSysNewOwnerID, + sysTrapSysSemaphoreSet, + sysTrapSysDisableInts, + sysTrapSysRestoreStatus, + sysTrapSysUIAppSwitch, + sysTrapSysCurAppInfoPV20, + sysTrapSysHandleEvent, + sysTrapSysInit, + sysTrapSysQSort, + sysTrapSysCurAppDatabase, + sysTrapSysFatalAlert, + sysTrapSysResSemaphoreCreate, + sysTrapSysResSemaphoreDelete, + sysTrapSysResSemaphoreReserve, + sysTrapSysResSemaphoreRelease, + sysTrapSysSleep, + sysTrapSysKeyboardDialogV10, + sysTrapSysAppLauncherDialog, + sysTrapSysSetPerformance, + sysTrapSysBatteryInfoV20, + sysTrapSysLibInstall, + sysTrapSysLibRemove, + sysTrapSysLibTblEntry, + sysTrapSysLibFind, + sysTrapSysBatteryDialog, + sysTrapSysCopyStringResource, + sysTrapSysKernelInfo, + sysTrapSysLaunchConsole, + sysTrapSysTimerDelete, + sysTrapSysSetAutoOffTime, + sysTrapSysFormPointerArrayToStrings, + sysTrapSysRandom, + sysTrapSysTaskSwitching, + sysTrapSysTimerRead, + + + sysTrapStrCopy, + sysTrapStrCat, + sysTrapStrLen, + sysTrapStrCompare, + sysTrapStrIToA, + sysTrapStrCaselessCompare, + sysTrapStrIToH, + sysTrapStrChr, + sysTrapStrStr, + sysTrapStrAToI, + sysTrapStrToLower, + + sysTrapSerReceiveISP, + + sysTrapSlkOpen, + sysTrapSlkClose, + sysTrapSlkOpenSocket, + sysTrapSlkCloseSocket, + sysTrapSlkSocketRefNum, + sysTrapSlkSocketSetTimeout, + sysTrapSlkFlushSocket, + sysTrapSlkSetSocketListener, + sysTrapSlkSendPacket, + sysTrapSlkReceivePacket, + sysTrapSlkSysPktDefaultResponse, + sysTrapSlkProcessRPC, + + + sysTrapConPutS, + sysTrapConGetS, + + sysTrapFplInit, + sysTrapFplFree, + sysTrapFplFToA, + sysTrapFplAToF, + sysTrapFplBase10Info, + sysTrapFplLongToFloat, + sysTrapFplFloatToLong, + sysTrapFplFloatToULong, + sysTrapFplMul, + sysTrapFplAdd, + sysTrapFplSub, + sysTrapFplDiv, + + sysTrapScrInit, + sysTrapScrCopyRectangle, + sysTrapScrDrawChars, + sysTrapScrLineRoutine, + sysTrapScrRectangleRoutine, + sysTrapScrScreenInfo, + sysTrapScrDrawNotify, + sysTrapScrSendUpdateArea, + sysTrapScrCompressScanLine, + sysTrapScrDeCompressScanLine, + + + sysTrapTimGetSeconds, + sysTrapTimSetSeconds, + sysTrapTimGetTicks, + sysTrapTimInit, + sysTrapTimSetAlarm, + sysTrapTimGetAlarm, + sysTrapTimHandleInterrupt, + sysTrapTimSecondsToDateTime, + sysTrapTimDateTimeToSeconds, + sysTrapTimAdjust, + sysTrapTimSleep, + sysTrapTimWake, + + sysTrapCategoryCreateListV10, + sysTrapCategoryFreeListV10, + sysTrapCategoryFind, + sysTrapCategoryGetName, + sysTrapCategoryEditV10, + sysTrapCategorySelectV10, + sysTrapCategoryGetNext, + sysTrapCategorySetTriggerLabel, + sysTrapCategoryTruncateName, + + sysTrapClipboardAddItem, + sysTrapClipboardCheckIfItemExist, + sysTrapClipboardGetItem, + + sysTrapCtlDrawControl, + sysTrapCtlEraseControl, + sysTrapCtlHideControl, + sysTrapCtlShowControl, + sysTrapCtlGetValue, + sysTrapCtlSetValue, + sysTrapCtlGetLabel, + sysTrapCtlSetLabel, + sysTrapCtlHandleEvent, + sysTrapCtlHitControl, + sysTrapCtlSetEnabled, + sysTrapCtlSetUsable, + sysTrapCtlEnabled, + + + sysTrapEvtInitialize, + sysTrapEvtAddEventToQueue, + sysTrapEvtCopyEvent, + sysTrapEvtGetEvent, + sysTrapEvtGetPen, + sysTrapEvtSysInit, + sysTrapEvtGetSysEvent, + sysTrapEvtProcessSoftKeyStroke, + sysTrapEvtGetPenBtnList, + sysTrapEvtSetPenQueuePtr, + sysTrapEvtPenQueueSize, + sysTrapEvtFlushPenQueue, + sysTrapEvtEnqueuePenPoint, + sysTrapEvtDequeuePenStrokeInfo, + sysTrapEvtDequeuePenPoint, + sysTrapEvtFlushNextPenStroke, + sysTrapEvtSetKeyQueuePtr, + sysTrapEvtKeyQueueSize, + sysTrapEvtFlushKeyQueue, + sysTrapEvtEnqueueKey, + sysTrapEvtDequeueKeyEvent, + sysTrapEvtWakeup, + sysTrapEvtResetAutoOffTimer, + sysTrapEvtKeyQueueEmpty, + sysTrapEvtEnableGraffiti, + + + sysTrapFldCopy, + sysTrapFldCut, + sysTrapFldDrawField, + sysTrapFldEraseField, + sysTrapFldFreeMemory, + sysTrapFldGetBounds, + sysTrapFldGetTextPtr, + sysTrapFldGetSelection, + sysTrapFldHandleEvent, + sysTrapFldPaste, + sysTrapFldRecalculateField, + sysTrapFldSetBounds, + sysTrapFldSetText, + sysTrapFldGetFont, + sysTrapFldSetFont, + sysTrapFldSetSelection, + sysTrapFldGrabFocus, + sysTrapFldReleaseFocus, + sysTrapFldGetInsPtPosition, + sysTrapFldSetInsPtPosition, + sysTrapFldSetScrollPosition, + sysTrapFldGetScrollPosition, + sysTrapFldGetTextHeight, + sysTrapFldGetTextAllocatedSize, + sysTrapFldGetTextLength, + sysTrapFldScrollField, + sysTrapFldScrollable, + sysTrapFldGetVisibleLines, + sysTrapFldGetAttributes, + sysTrapFldSetAttributes, + sysTrapFldSendChangeNotification, + sysTrapFldCalcFieldHeight, + sysTrapFldGetTextHandle, + sysTrapFldCompactText, + sysTrapFldDirty, + sysTrapFldWordWrap, + sysTrapFldSetTextAllocatedSize, + sysTrapFldSetTextHandle, + sysTrapFldSetTextPtr, + sysTrapFldGetMaxChars, + sysTrapFldSetMaxChars, + sysTrapFldSetUsable, + sysTrapFldInsert, + sysTrapFldDelete, + sysTrapFldUndo, + sysTrapFldSetDirty, + sysTrapFldSendHeightChangeNotification, + sysTrapFldMakeFullyVisible, + + + sysTrapFntGetFont, + sysTrapFntSetFont, + sysTrapFntGetFontPtr, + sysTrapFntBaseLine, + sysTrapFntCharHeight, + sysTrapFntLineHeight, + sysTrapFntAverageCharWidth, + sysTrapFntCharWidth, + sysTrapFntCharsWidth, + sysTrapFntDescenderHeight, + sysTrapFntCharsInWidth, + sysTrapFntLineWidth, + + + sysTrapFrmInitForm, + sysTrapFrmDeleteForm, + sysTrapFrmDrawForm, + sysTrapFrmEraseForm, + sysTrapFrmGetActiveForm, + sysTrapFrmSetActiveForm, + sysTrapFrmGetActiveFormID, + sysTrapFrmGetUserModifiedState, + sysTrapFrmSetNotUserModified, + sysTrapFrmGetFocus, + sysTrapFrmSetFocus, + sysTrapFrmHandleEvent, + sysTrapFrmGetFormBounds, + sysTrapFrmGetWindowHandle, + sysTrapFrmGetFormId, + sysTrapFrmGetFormPtr, + sysTrapFrmGetNumberOfObjects, + sysTrapFrmGetObjectIndex, + sysTrapFrmGetObjectId, + sysTrapFrmGetObjectType, + sysTrapFrmGetObjectPtr, + sysTrapFrmHideObject, + sysTrapFrmShowObject, + sysTrapFrmGetObjectPosition, + sysTrapFrmSetObjectPosition, + sysTrapFrmGetControlValue, + sysTrapFrmSetControlValue, + sysTrapFrmGetControlGroupSelection, + sysTrapFrmSetControlGroupSelection, + sysTrapFrmCopyLabel, + sysTrapFrmSetLabel, + sysTrapFrmGetLabel, + sysTrapFrmSetCategoryLabel, + sysTrapFrmGetTitle, + sysTrapFrmSetTitle, + sysTrapFrmAlert, + sysTrapFrmDoDialog, + sysTrapFrmCustomAlert, + sysTrapFrmHelp, + sysTrapFrmUpdateScrollers, + sysTrapFrmGetFirstForm, + sysTrapFrmVisible, + sysTrapFrmGetObjectBounds, + sysTrapFrmCopyTitle, + sysTrapFrmGotoForm, + sysTrapFrmPopupForm, + sysTrapFrmUpdateForm, + sysTrapFrmReturnToForm, + sysTrapFrmSetEventHandler, + sysTrapFrmDispatchEvent, + sysTrapFrmCloseAllForms, + sysTrapFrmSaveAllForms, + sysTrapFrmGetGadgetData, + sysTrapFrmSetGadgetData, + sysTrapFrmSetCategoryTrigger, + + + sysTrapUIInitialize, + sysTrapUIReset, + + sysTrapInsPtInitialize, + sysTrapInsPtSetLocation, + sysTrapInsPtGetLocation, + sysTrapInsPtEnable, + sysTrapInsPtEnabled, + sysTrapInsPtSetHeight, + sysTrapInsPtGetHeight, + sysTrapInsPtCheckBlink, + + sysTrapLstSetDrawFunction, + sysTrapLstDrawList, + sysTrapLstEraseList, + sysTrapLstGetSelection, + sysTrapLstGetSelectionText, + sysTrapLstHandleEvent, + sysTrapLstSetHeight, + sysTrapLstSetSelection, + sysTrapLstSetListChoices, + sysTrapLstMakeItemVisible, + sysTrapLstGetNumberOfItems, + sysTrapLstPopupList, + sysTrapLstSetPosition, + + sysTrapMenuInit, + sysTrapMenuDispose, + sysTrapMenuHandleEvent, + sysTrapMenuDrawMenu, + sysTrapMenuEraseStatus, + sysTrapMenuGetActiveMenu, + sysTrapMenuSetActiveMenu, + + + sysTrapRctSetRectangle, + sysTrapRctCopyRectangle, + sysTrapRctInsetRectangle, + sysTrapRctOffsetRectangle, + sysTrapRctPtInRectangle, + sysTrapRctGetIntersection, + + + sysTrapTblDrawTable, + sysTrapTblEraseTable, + sysTrapTblHandleEvent, + sysTrapTblGetItemBounds, + sysTrapTblSelectItem, + sysTrapTblGetItemInt, + sysTrapTblSetItemInt, + sysTrapTblSetItemStyle, + sysTrapTblUnhighlightSelection, + sysTrapTblSetRowUsable, + sysTrapTblGetNumberOfRows, + sysTrapTblSetCustomDrawProcedure, + sysTrapTblSetRowSelectable, + sysTrapTblRowSelectable, + sysTrapTblSetLoadDataProcedure, + sysTrapTblSetSaveDataProcedure, + sysTrapTblGetBounds, + sysTrapTblSetRowHeight, + sysTrapTblGetColumnWidth, + sysTrapTblGetRowID, + sysTrapTblSetRowID, + sysTrapTblMarkRowInvalid, + sysTrapTblMarkTableInvalid, + sysTrapTblGetSelection, + sysTrapTblInsertRow, + sysTrapTblRemoveRow, + sysTrapTblRowInvalid, + sysTrapTblRedrawTable, + sysTrapTblRowUsable, + sysTrapTblReleaseFocus, + sysTrapTblEditing, + sysTrapTblGetCurrentField, + sysTrapTblSetColumnUsable, + sysTrapTblGetRowHeight, + sysTrapTblSetColumnWidth, + sysTrapTblGrabFocus, + sysTrapTblSetItemPtr, + sysTrapTblFindRowID, + sysTrapTblGetLastUsableRow, + sysTrapTblGetColumnSpacing, + sysTrapTblFindRowData, + sysTrapTblGetRowData, + sysTrapTblSetRowData, + sysTrapTblSetColumnSpacing, + + + + sysTrapWinCreateWindow, + sysTrapWinCreateOffscreenWindow, + sysTrapWinDeleteWindow, + sysTrapWinInitializeWindow, + sysTrapWinAddWindow, + sysTrapWinRemoveWindow, + sysTrapWinSetActiveWindow, + sysTrapWinSetDrawWindow, + sysTrapWinGetDrawWindow, + sysTrapWinGetActiveWindow, + sysTrapWinGetDisplayWindow, + sysTrapWinGetFirstWindow, + sysTrapWinEnableWindow, + sysTrapWinDisableWindow, + sysTrapWinGetWindowFrameRect, + sysTrapWinDrawWindowFrame, + sysTrapWinEraseWindow, + sysTrapWinSaveBits, + sysTrapWinRestoreBits, + sysTrapWinCopyRectangle, + sysTrapWinScrollRectangle, + sysTrapWinGetDisplayExtent, + sysTrapWinGetWindowExtent, + sysTrapWinDisplayToWindowPt, + sysTrapWinWindowToDisplayPt, + sysTrapWinGetClip, + sysTrapWinSetClip, + sysTrapWinResetClip, + sysTrapWinClipRectangle, + sysTrapWinDrawLine, + sysTrapWinDrawGrayLine, + sysTrapWinEraseLine, + sysTrapWinInvertLine, + sysTrapWinFillLine, + sysTrapWinDrawRectangle, + sysTrapWinEraseRectangle, + sysTrapWinInvertRectangle, + sysTrapWinDrawRectangleFrame, + sysTrapWinDrawGrayRectangleFrame, + sysTrapWinEraseRectangleFrame, + sysTrapWinInvertRectangleFrame, + sysTrapWinGetFramesRectangle, + sysTrapWinDrawChars, + sysTrapWinEraseChars, + sysTrapWinInvertChars, + sysTrapWinGetPattern, + sysTrapWinSetPattern, + sysTrapWinSetUnderlineMode, + sysTrapWinDrawBitmap, + sysTrapWinModal, + sysTrapWinGetWindowBounds, + sysTrapWinFillRectangle, + sysTrapWinDrawInvertedChars, + + + + sysTrapPrefOpenPreferenceDBV10, + sysTrapPrefGetPreferences, + sysTrapPrefSetPreferences, + sysTrapPrefGetAppPreferencesV10, + sysTrapPrefSetAppPreferencesV10, + + + sysTrapSndInit, + sysTrapSndSetDefaultVolume, + sysTrapSndGetDefaultVolume, + sysTrapSndDoCmd, + sysTrapSndPlaySystemSound, + + + sysTrapAlmInit, + sysTrapAlmCancelAll, + sysTrapAlmAlarmCallback, + sysTrapAlmSetAlarm, + sysTrapAlmGetAlarm, + sysTrapAlmDisplayAlarm, + sysTrapAlmEnableNotification, + + + sysTrapHwrGetRAMMapping, + sysTrapHwrMemWritable, + sysTrapHwrMemReadable, + sysTrapHwrDoze, + sysTrapHwrSleep, + sysTrapHwrWake, + sysTrapHwrSetSystemClock, + sysTrapHwrSetCPUDutyCycle, + sysTrapHwrLCDInit, + sysTrapHwrLCDSleep, + sysTrapHwrTimerInit, + sysTrapHwrCursor, + sysTrapHwrBatteryLevel, + sysTrapHwrDelay, + sysTrapHwrEnableDataWrites, + sysTrapHwrDisableDataWrites, + sysTrapHwrLCDBaseAddr, + sysTrapHwrLCDDrawBitmap, + sysTrapHwrTimerSleep, + sysTrapHwrTimerWake, + sysTrapHwrLCDWake, + sysTrapHwrIRQ1Handler, + sysTrapHwrIRQ2Handler, + sysTrapHwrIRQ3Handler, + sysTrapHwrIRQ4Handler, + sysTrapHwrIRQ5Handler, + sysTrapHwrIRQ6Handler, + sysTrapHwrDockSignals, + sysTrapHwrPluggedIn, + + + sysTrapCrc16CalcBlock, + + + sysTrapSelectDayV10, + sysTrapSelectTime, + + sysTrapDayDrawDaySelector, + sysTrapDayHandleEvent, + sysTrapDayDrawDays, + sysTrapDayOfWeek, + sysTrapDaysInMonth, + sysTrapDayOfMonth, + + sysTrapDateDaysToDate, + sysTrapDateToDays, + sysTrapDateAdjust, + sysTrapDateSecondsToDate, + sysTrapDateToAscii, + sysTrapDateToDOWDMFormat, + sysTrapTimeToAscii, + + + sysTrapFind, + sysTrapFindStrInStr, + sysTrapFindSaveMatch, + sysTrapFindGetLineBounds, + sysTrapFindDrawHeader, + + sysTrapPenOpen, + sysTrapPenClose, + sysTrapPenGetRawPen, + sysTrapPenCalibrate, + sysTrapPenRawToScreen, + sysTrapPenScreenToRaw, + sysTrapPenResetCalibration, + sysTrapPenSleep, + sysTrapPenWake, + + + sysTrapResLoadForm, + sysTrapResLoadMenu, + + sysTrapFtrInit, + sysTrapFtrUnregister, + sysTrapFtrGet, + sysTrapFtrSet, + sysTrapFtrGetByIndex, + + + + sysTrapGrfInit, + sysTrapGrfFree, + sysTrapGrfGetState, + sysTrapGrfSetState, + sysTrapGrfFlushPoints, + sysTrapGrfAddPoint, + sysTrapGrfInitState, + sysTrapGrfCleanState, + sysTrapGrfMatch, + sysTrapGrfGetMacro, + sysTrapGrfFilterPoints, + sysTrapGrfGetNumPoints, + sysTrapGrfGetPoint, + sysTrapGrfFindBranch, + sysTrapGrfMatchGlyph, + sysTrapGrfGetGlyphMapping, + sysTrapGrfGetMacroName, + sysTrapGrfDeleteMacro, + sysTrapGrfAddMacro, + sysTrapGrfGetAndExpandMacro, + sysTrapGrfProcessStroke, + sysTrapGrfFieldChange, + + + sysTrapGetCharSortValue, + sysTrapGetCharAttr, + sysTrapGetCharCaselessValue, + + + sysTrapPwdExists, + sysTrapPwdVerify, + sysTrapPwdSet, + sysTrapPwdRemove, + + sysTrapGsiInitialize, + sysTrapGsiSetLocation, + sysTrapGsiEnable, + sysTrapGsiEnabled, + sysTrapGsiSetShiftState, + + sysTrapKeyInit, + sysTrapKeyHandleInterrupt, + sysTrapKeyCurrentState, + sysTrapKeyResetDoubleTap, + sysTrapKeyRates, + sysTrapKeySleep, + sysTrapKeyWake, + + + sysTrapDlkControl, // was sysTrapCmBroadcast + + sysTrapDlkStartServer, + sysTrapDlkGetSyncInfo, + sysTrapDlkSetLogEntry, + + sysTrapIntlDispatch, // REUSED IN v3.1 (was sysTrapPsrInit in 1.0, removed in 2.0) + sysTrapSysLibLoad, // REUSED IN v2.0 (was sysTrapPsrClose) + sysTrapSndPlaySmf, // REUSED IN v3.0 (was sysTrapPsrGetCommand in 1.0, removed in 2.0) + sysTrapSndCreateMidiList, // REUSED IN v3.0 (was sysTrapPsrSendReply in 1.0, removed in 2.0) + + sysTrapAbtShowAbout, + + sysTrapMdmDial, + sysTrapMdmHangUp, + + sysTrapDmSearchRecord, + + sysTrapSysInsertionSort, + sysTrapDmInsertionSort, + + sysTrapLstSetTopItem, + + + // PalmOS 2.X traps + sysTrapSclSetScrollBar, + sysTrapSclDrawScrollBar, + sysTrapSclHandleEvent, + + sysTrapSysMailboxCreate, + sysTrapSysMailboxDelete, + sysTrapSysMailboxFlush, + sysTrapSysMailboxSend, + sysTrapSysMailboxWait, + + sysTrapSysTaskWait, + sysTrapSysTaskWake, + sysTrapSysTaskWaitClr, + sysTrapSysTaskSuspend, + sysTrapSysTaskResume, + + sysTrapCategoryCreateList, + sysTrapCategoryFreeList, + sysTrapCategoryEditV20, + sysTrapCategorySelect, + + sysTrapDmDeleteCategory, + + sysTrapSysEvGroupCreate, + sysTrapSysEvGroupSignal, + sysTrapSysEvGroupRead, + sysTrapSysEvGroupWait, + + sysTrapEvtEventAvail, + sysTrapEvtSysEventAvail, + sysTrapStrNCopy, + + sysTrapKeySetMask, + + sysTrapSelectDay, + + sysTrapPrefGetPreference, + sysTrapPrefSetPreference, + sysTrapPrefGetAppPreferences, + sysTrapPrefSetAppPreferences, + + sysTrapFrmPointInTitle, + + sysTrapStrNCat, + + sysTrapMemCmp, + + sysTrapTblSetColumnEditIndicator, + + sysTrapFntWordWrap, + + sysTrapFldGetScrollValues, + + sysTrapSysCreateDataBaseList, + sysTrapSysCreatePanelList, + + sysTrapDlkDispatchRequest, + + sysTrapStrPrintF, + sysTrapStrVPrintF, + + sysTrapPrefOpenPreferenceDB, + + sysTrapSysGraffitiReferenceDialog, + + sysTrapSysKeyboardDialog, + + sysTrapFntWordWrapReverseNLines, + sysTrapFntGetScrollValues, + + sysTrapTblSetRowStaticHeight, + sysTrapTblHasScrollBar, + + sysTrapSclGetScrollBar, + + sysTrapFldGetNumberOfBlankLines, + + sysTrapSysTicksPerSecond, + sysTrapHwrBacklight, + sysTrapDmDatabaseProtect, + + sysTrapTblSetBounds, + + sysTrapStrNCompare, + sysTrapStrNCaselessCompare, + + sysTrapPhoneNumberLookup, + + sysTrapFrmSetMenu, + + sysTrapEncDigestMD5, + + sysTrapDmFindSortPosition, + + sysTrapSysBinarySearch, + sysTrapSysErrString, + sysTrapSysStringByIndex, + + sysTrapEvtAddUniqueEventToQueue, + + sysTrapStrLocalizeNumber, + sysTrapStrDelocalizeNumber, + sysTrapLocGetNumberSeparators, + + sysTrapMenuSetActiveMenuRscID, + + sysTrapLstScrollList, + + sysTrapCategoryInitialize, + + sysTrapEncDigestMD4, + sysTrapEncDES, + + sysTrapLstGetVisibleItems, + + sysTrapWinSetWindowBounds, + + sysTrapCategorySetName, + + sysTrapFldSetInsertionPoint, + + sysTrapFrmSetObjectBounds, + + sysTrapWinSetColors, + + sysTrapFlpDispatch, + sysTrapFlpEmDispatch, + + + // PalmOS 3.0 traps + sysTrapExgInit, + sysTrapExgConnect, + sysTrapExgPut, + sysTrapExgGet, + sysTrapExgAccept, + sysTrapExgDisconnect, + sysTrapExgSend, + sysTrapExgReceive, + sysTrapExgRegisterData, + sysTrapExgNotifyReceive, + sysTrapExgControl, + + sysTrapPrgStartDialogV10, // eleven has a new version (which is not in Sumo yet) + sysTrapPrgStopDialog, + sysTrapPrgUpdateDialog, + sysTrapPrgHandleEvent, + + sysTrapImcReadFieldNoSemicolon, + sysTrapImcReadFieldQuotablePrintable, + sysTrapImcReadPropertyParameter, + sysTrapImcSkipAllPropertyParameters, + sysTrapImcReadWhiteSpace, + sysTrapImcWriteQuotedPrintable, + sysTrapImcWriteNoSemicolon, + sysTrapImcStringIsAscii, + + sysTrapTblGetItemFont, + sysTrapTblSetItemFont, + + sysTrapFontSelect, + sysTrapFntDefineFont, + + sysTrapCategoryEdit, + + sysTrapSysGetOSVersionString, + sysTrapSysBatteryInfo, + sysTrapSysUIBusy, + + sysTrapWinValidateHandle, + sysTrapFrmValidatePtr, + sysTrapCtlValidatePointer, + sysTrapWinMoveWindowAddr, + sysTrapFrmAddSpaceForObject, + sysTrapFrmNewForm, + sysTrapCtlNewControl, + sysTrapFldNewField, + sysTrapLstNewList, + sysTrapFrmNewLabel, + sysTrapFrmNewBitmap, + sysTrapFrmNewGadget, + + sysTrapFileOpen, + sysTrapFileClose, + sysTrapFileDelete, + sysTrapFileReadLow, + sysTrapFileWrite, + sysTrapFileSeek, + sysTrapFileTell, + sysTrapFileTruncate, + sysTrapFileControl, + + sysTrapFrmActiveState, + + sysTrapSysGetAppInfo, + sysTrapSysGetStackInfo, + + sysTrapScrDisplayMode, + sysTrapHwrLCDGetDepth, + sysTrapHwrGetROMToken, + + sysTrapDbgControl, + + sysTrapExgDBRead, + sysTrapExgDBWrite, + + sysTrapSysGremlins, + sysTrapFrmRemoveObject, + + // The following traps were included in the PalmOS 3.0 ROM (and later) + sysTrapSysReserved1, // "Extra" trap available in PalmOS 3.0 and later trap table + sysTrapSysReserved2, // "Extra" trap available in PalmOS 3.0 and later trap table + sysTrapSysReserved3, // "Extra" trap available in PalmOS 3.0 and later trap table + sysTrapSysReserved4, // "Extra" trap available in PalmOS 3.0 and later trap table + + + // 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.) + + // PalmOS 3.1 traps + + sysTrapHwrLCDContrast, + sysTrapSysLCDContrast, + sysTrapContrastAdjust, + sysTrapHwrDockStatus, + + sysTrapFntWidthToOffset, + sysTrapSelectOneTime, + sysTrapWinDrawChar, + sysTrapWinDrawTruncChars, + + sysTrapNotifyInit, // Notification Manager traps + sysTrapNotifyRegister, + sysTrapNotifyUnregister, + sysTrapNotifyBroadcast, + sysTrapNotifyBroadcastDeferred, + sysTrapNotifyDatabaseAdded, + sysTrapNotifyDatabaseRemoved, + + sysTrapSysWantEvent, + + sysTrapFtrPtrNew, + sysTrapFtrPtrFree, + sysTrapFtrPtrResize, + + sysTrapSysReserved5, // "Extra" trap available in PalmOS 3.1 and later trap table + + // WARNING!! LEAVE THIS AT THE END AND ALWAYS ADD NEW TRAPS TO + // THE END OF THE TRAP TABLE BUT RIGHT BEFORE THIS TRAP!!!!!!!!! + sysTrapLastTrapNumber + } SysTrapNumber; + +#define sysNumTraps (sysTrapLastTrapNumber - sysTrapBase) + + + +//-------------------------------------------------------------------- +// Define Library Trap Numbers +//-------------------------------------------------------------------- +// Library traps start here and go up by 1's +#define sysLibTrapBase 0xA800 +typedef enum { + sysLibTrapName = sysLibTrapBase, + sysLibTrapOpen, + sysLibTrapClose, + sysLibTrapSleep, + sysLibTrapWake, + sysLibTrapCustom + } SysLibTrapNumber; + + + + +/************************************************************ + * Pilot specific TRAP instruction numbers + *************************************************************/ +#define sysDbgBreakpointTrapNum 0 // For soft breakpoints +#define sysDbgTrapNum 8 // For compiled breakpoints +#define sysDispatchTrapNum 15 // Trap dispatcher + +#ifdef __GNUC__ + + #define SYS_TRAP(trapNum) \ + __attribute__ ((systrap (trapNum))) + +#else + + #define SYS_TRAP(trapNum) \ + TWOWORD_INLINE(m68kTrapInstr+sysDispatchTrapNum,trapNum) + +#endif + + +#define ASM_SYS_TRAP(trapNum) \ + DC.W m68kTrapInstr+sysDispatchTrapNum; \ + DC.W trapNum + + +#endif //__SYSTRAPS_H_ + + diff --git a/sdk-3.1/include/Core/System/SysUtils.h b/sdk-3.1/include/Core/System/SysUtils.h new file mode 100644 index 0000000..2e28b10 --- /dev/null +++ b/sdk-3.1/include/Core/System/SysUtils.h @@ -0,0 +1,103 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: SysUtils.h + * AUTHOR: Roger Flores: April 27, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * These are miscellaneous routines. + * + **********************************************************************/ +#ifndef __SYSUTILS_H__ +#define __SYSUTILS_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + + +//typedef Int _comparF (const void *, const void *, Int other); +typedef Int _comparF (VoidPtr, VoidPtr, Long other); +typedef _comparF * CmpFuncPtr; + +typedef Int _searchF (ConstVoidPtr searchData, ConstVoidPtr arrayData, Long other); +typedef _searchF * SearchFuncPtr; + + +typedef enum + { + GremlinIsOn // return non zero if gremlins is currently running + } GremlinFunctionType; + +typedef struct + { + DWord unused; + } GremlinParamsType; + + +/************************************************************ + * Constants + *************************************************************/ +#define sysRandomMax 0x7FFF // Max value returned from SysRandom() + + +/************************************************************ + * Macros + *************************************************************/ +#define Abs(a) ((a >= 0) ? a : (-a)) + +/************************************************************ + * procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Boolean SysBinarySearch (ConstVoidPtr baseP, const UInt numOfElements, const UInt width, + SearchFuncPtr searchF, ConstVoidPtr searchData, + const Long other, ULongPtr position, const Boolean findFirst) + SYS_TRAP(sysTrapSysBinarySearch); + +void SysInsertionSort (VoidPtr baseP, UInt numOfElements, UInt width, + const CmpFuncPtr comparF, const Long other) + SYS_TRAP(sysTrapSysInsertionSort); + +void SysQSort (VoidPtr baseP, UInt numOfElements, UInt width, + const CmpFuncPtr comparF, const Long other) + SYS_TRAP(sysTrapSysQSort); + +void SysCopyStringResource (CharPtr string, UInt theID) + SYS_TRAP(sysTrapSysCopyStringResource); + +VoidHand SysFormPointerArrayToStrings(CharPtr c, Int stringCount) + SYS_TRAP(sysTrapSysFormPointerArrayToStrings); + + +// Return a random number ranging from 0 to sysRandomMax. +// Normally, 0 is passed unless you want to start with a new seed. +Int SysRandom(ULong newSeed) + SYS_TRAP(sysTrapSysRandom); + + +CharPtr SysStringByIndex(Word resID, Word index, CharPtr strP, Word maxLen) + SYS_TRAP(sysTrapSysStringByIndex); + +CharPtr SysErrString(Err err, CharPtr strP, Word maxLen) + SYS_TRAP(sysTrapSysErrString); + +DWord SysGremlins(GremlinFunctionType selector, GremlinParamsType *params) + SYS_TRAP(sysTrapSysGremlins); + + +#ifdef __cplusplus +} +#endif + +#endif // __SYSUTILS_H__ + diff --git a/sdk-3.1/include/Core/System/SystemMgr.h b/sdk-3.1/include/Core/System/SystemMgr.h new file mode 100644 index 0000000..80d205d --- /dev/null +++ b/sdk-3.1/include/Core/System/SystemMgr.h @@ -0,0 +1,1024 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SystemMgr.h + * + * Description: + * Pilot system equates + * + * History: + * 10/27/94 RM Created by Ron Marianetti + * 10/07/96 SCL Added sysAppLaunchFlagDataRelocated flag + * 11/13/96 vmk Added sysErrDelayWakened error code + * 07/01/98 kwk Added sysFtrDefaultBoldFont feature. + * 07/07/98 srj Added SysLCDContrast() trap for Palm V + * 08/18/98 SCL Added sysFtrNumHwrMiscFlags and ...FlagsExt. + * Redefined sysFtrNumProcessorID. + * 08/20/98 kwk Added tsmErrorClass. + * 09/07/98 kwk Added SysWantEvent routine declaration. + * + *******************************************************************/ + + #ifndef __SYSTEMMGR_H__ + #define __SYSTEMMGR_H__ + +// Include elementary types +#include +#include // Trap Numbers. + +// Other types +#include // Resource definitions. + + +// UI Headers +#include +#include +#include +#include +#include +#include +#include +#include // for DmOpenRef + + + +/************************************************************ + * System Constants + *************************************************************/ +// Define the number of ticks/second +#if EMULATION_LEVEL == EMULATION_MAC + #define sysTicksPerSecond 60 // 60/sec on Macintosh +#elif EMULATION_LEVEL == EMULATION_NONE + #define sysTicksPerSecond 100 // 100/sec on Pilot +#elif EMULATION_LEVEL == EMULATION_WINDOWS + #define sysTicksPerSecond 1000 // 1000/sec on Windows PC +#else + #error +#endif + + + +/************************************************************ + * Rules for creating and using the Command Parameter Block + * passed to SysUIAppSwitch + *************************************************************/ + +// A parameter block containing application-specific information may be passed +// to an application when launching it via SysUIAppSwitch. To create the +// parameter block, you allocate a memory block using MemPtrNew and then you must +// call MemPtrSetOwner to set the block's owner ID to 0. This assigns the block's +// ownership to the system so that it will not be automatically freed by the system +// when the calling app exits. The command block must be self contained. It must not +// have pointers to anything on the stack or in memory blocks owned by an application. +// The launching and launched applications do not need to worry about freeing the +// command block since the system will do this after the launched application exits. +// If no parameter block is being passed, this parameter must be NULL. + + +/************************************************************ + * Action Codes + * + * IMPORTANT ACTION CODE CONSIDERATIONS: + * + * Many action codes are "sent" to apps via a direct function call into the app's + * PilotMain() function without launching the app. For these action codes, the + * application's global and static variables are *not* available, unless the + * application is already running. Some action codes are synchronized with the + * currently running UI applcation via the event manager (alarm action codes, + * for example), while others, such as HotSync action codes, are sent from a + * background thread. To find out if your app is running (is the current UI + * app) when an action code is received, test the sysAppLaunchFlagSubCall flag + * (defined in SystemMgr.h) which is passed to your PilotMain in the + * launchFlags parameter (the third PilotMain parameter). If it is non-zero, + * you may assume that your app is currently running and the global variables + * are accessible. This information is useful if your app maintains an open + * data database (or another similar resource) when it is running. If the app + * receives an action code and the sysAppLaunchFlagSubCall is set in + * launchFlags, the handler may access global variables and use the open + * database handle while handling the call. On the other hand, if the + * sysAppLaunchFlagSubCall flag is not set (ie., zero), the handler will need + * to open and close the database itself and is not allowed to access global + * or static variables. + * + *************************************************************/ + +// NOTE: for defining custom action codes, see sysAppLaunchCmdCustomBase below. + +// System SysAppLaunch Commands +#define sysAppLaunchCmdNormalLaunch 0 // Normal Launch + +#define sysAppLaunchCmdFind 1 // Find string + +#define sysAppLaunchCmdGoTo 2 // Launch and go to a particular record + +#define sysAppLaunchCmdSyncNotify 3 // Sent to apps whose databases changed during + // HotSync after the sync has been completed, + // including when the app itself has been installed + // by HotSync. The data database(s) must have the + // same creator ID as the application for this + // mechanism to function correctly. This is a + // good opportunity to update/initialize/validate + // the app's data, such as resorting records, + // setting alarms, etc. + // + // Parameter block: None. + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a + // direct function call into the app's + // PilotMain function from the background + // thread of the HotSync application. + + +#define sysAppLaunchCmdTimeChange 4 // Sent to all applications and preference + // panels when the system time is changed. + // This notification is the right place to + // update alarms and other time-related + // activities and resources. + // + // Parameter block: None. + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdSystemReset 5 // Sent to all applications and preference + // panels when the system is either soft-reset + // or hard-reset. This notification is the + // right place to initialize and/or validate + // your application's preferences/features/ + // database(s) as well as to update alarms and + // other time-related activities and resources. + // + // Parameter block: SysAppLaunchCmdSystemResetType + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdAlarmTriggered 6 // Sent to an application at the time its + // alarm time expires (even when another app + // is already displaying its alarm dialog box). + // This call is intended to allow the app to + // perform some very quick activity, such as + // scheduling the next alarm or performing a + // quick maintenance task. The handler for + // sysAppLaunchCmdAlarmTriggered must take as + // little time as possible and is *not* allowed + // to block (this would delay notification for + // alarms set by other applications). + // + // Parameter block: SysAlarmTriggeredParamType + // (defined in AlarmMgr.h) + // Restrictions: No accessing of global or + // static variables unless sysAppLaunchFlagSubCall + // flag is set, as discussed above. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdDisplayAlarm 7 // Sent to an application when it is time + // to display the alarm UI. The application + // is responsible for making any alarm sounds + // and for displaying the alarm UI. + // sysAppLaunchCmdDisplayAlarm calls are ordered + // chronoligically and are not overlapped. + // This means that your app will receive + // sysAppLaunchCmdDisplayAlarm only after + // all earlier alarms have been displayed. + // + // Parameter block: SysDisplayAlarmParamType + // (defined in AlarmMgr.h) + // Restrictions: No accessing of global or + // static variables unless sysAppLaunchFlagSubCall + // flag is set, as discussed above. UI calls are + // allowed to display the app's alarm dialog. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdCountryChange 8 // The country has changed + +#define sysAppLaunchCmdSyncRequestLocal 9 // Sent to the HotSync application to request a + // local HotSync. ("HotSync" button was pressed.) + +#define sysAppLaunchCmdSyncRequest sysAppLaunchCmdSyncRequestLocal // for backward compatibility + +#define sysAppLaunchCmdSaveData 10 // Sent to running app before sysAppLaunchCmdFind + // or other action codes that will cause data + // searches or manipulation. + +#define sysAppLaunchCmdInitDatabase 11 // Sent to an application when a database with + // a matching Creator ID is created during + // HotSync (in response to a "create db" + // request). This allows the application to + // initialize a newly-created database during + // HotSync. This might include creating some + // default records, setting up the database's + // application and sort info blocks, etc. + // + // Parameter block: SysAppLaunchCmdInitDatabaseType + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a + // direct function call into the app's + // PilotMain function from the background + // thread of the HotSync application. + +#define sysAppLaunchCmdSyncCallApplicationV10 12 // Used by DesktopLink Server command "call application"; + // Pilot v1.0 only!!! + +//------------------------------------------------------------------------ +// New launch codes defined for PalmOS 2.0 +//------------------------------------------------------------------------ + +#define sysAppLaunchCmdPanelCalledFromApp 13 // The panel should display a done + // button instead of the pick list. + // The Done button will return the user + // to the last app. + +#define sysAppLaunchCmdReturnFromPanel 14 // A panel returned to this app + +#define sysAppLaunchCmdLookup 15 // Lookup info managed by an app + +#define sysAppLaunchCmdSystemLock 16 // Lock the system until a password is entered. + +#define sysAppLaunchCmdSyncRequestRemote 17 // Sent to the HotSync application to request + // a remote HotSync. ("Remote HotSync" button + // was pressed.) + +#define sysAppLaunchCmdHandleSyncCallApp 18 // Pilot v2.0 and greater. Sent by DesktopLink Server to an application to handle + // the "call application" command; use DlkControl with + // control code dlkCtlSendCallAppReply to send the reply(see DLServer.h). + // This action code replaces the v1.0 code sysAppLaunchCmdSyncCallApplication. + // vmk 11/26/96 + +#define sysAppLaunchCmdAddRecord 19 // Add a record to an applications's database. + + +//------------------------------------------------------------------------ +// Standard Service Panel launch codes (used by network panel, dialer panel, etc.) +// (DOLATER... document parameter block structures) +//------------------------------------------------------------------------ +#define sysSvcLaunchCmdSetServiceID 20 +#define sysSvcLaunchCmdGetServiceID 21 +#define sysSvcLaunchCmdGetServiceList 22 +#define sysSvcLaunchCmdGetServiceInfo 23 + + +#define sysAppLaunchCmdFailedAppNotify 24 // An app just switched to failed. +#define sysAppLaunchCmdEventHook 25 // Application event hook callback +#define sysAppLaunchCmdExgReceiveData 26 // Exg command for app to receive data. +#define sysAppLaunchCmdExgAskUser 27 // Exg command sent before asking user. + + +//------------------------------------------------------------------------ +// Standard Dialer Service launch codes (30 - 39 reserved) +// (DOLATER... document parameter block structures) +//------------------------------------------------------------------------ + +// sysDialLaunchCmdDial: dials the modem(optionally displays dial progress UI), given service id +// and serial library reference number +#define sysDialLaunchCmdDial 30 +// sysDialLaunchCmdHangUp: hangs up the modem(optionally displays disconnect progress UI), given service id +// and serial library reference number +#define sysDialLaunchCmdHangUp 31 +#define sysDialLaunchCmdLast 39 + + +//------------------------------------------------------------------------ +// Additional standard Service Panel launch codes (used by network panel, dialer panel, etc) +// (40-49 reserved) +//------------------------------------------------------------------------ + +#define sysSvcLaunchCmdGetQuickEditLabel 40 // SvcQuickEditLabelInfoType +#define sysSvcLaunchCmdLast 49 + + +#define sysAppLaunchCmdNotify 51 // This is a NotifyMgr notification sent + // via SysNotifyBroadcast. The cmdPBP ptr + // points to a SysNotifyParamType structure + // containing more specific information + // about the notification (e.g., what it's for). + +// ***ADD NEW SYSTEM ACTION CODES BEFORE THIS COMMENT*** + +//------------------------------------------------------------------------ +// Custom action code base (custom action codes begin at this value) +//------------------------------------------------------------------------ +#define sysAppLaunchCmdCustomBase 0x8000 + +// Your custom launch codes can be defined like this: +// +// typedef enum { +// myAppCmdDoSomething = sysAppLaunchCmdCustomBase, +// myAppCmdDoSomethingElse, +// myAppCmdEtcetera +// +// } MyAppCustomActionCodes; + + + +//------------------------------------------------------------------------ +// SysAppLaunch flags (passed to PilotMain) +//------------------------------------------------------------------------ + +#define sysAppLaunchFlagNewThread 0x01 // create a new thread for application + // - implies sysAppLaunchFlagNewStack +#define sysAppLaunchFlagNewStack 0x02 // create separate stack for application +#define sysAppLaunchFlagNewGlobals 0x04 // create new globals world for application + // - implies new owner ID for Memory chunks +#define sysAppLaunchFlagUIApp 0x08 // notifies launch routine that this is a UI app being + // launched. +#define sysAppLaunchFlagSubCall 0x10 // notifies launch routine that the app is calling it's + // entry point as a subroutine call. This tells the launch + // code that it's OK to keep the A5 (globals) pointer valid + // through the call. + // IMPORTANT: This flag is for internal use by + // SysAppLaunch only!!! It should NEVER be set + // by the caller. +#define sysAppLaunchFlagDataRelocated 0x80 // global data (static ptrs) have been "relocated" + // by either SysAppStartup or StartupCode.c + // IMPORTANT: This flag is for internal use by + // SysAppLaunch only!!! It should NEVER be set + // by the caller. + +// The set of private, internal flags that should never be set by the caller +#define sysAppLaunchFlagPrivateSet (sysAppLaunchFlagSubCall | sysAppLaunchFlagDataRelocated) + + + +//------------------------------------------------------------------- +// Parameter blocks for action codes +// NOTE: The parameter block for the sysAppLaunchCmdFind and sysAppLaunchCmdGoTo +// action codes are defined in "Find.h"; +//--------------------------------------------------------------------------- + +// For sysAppLaunchCmdSaveData +typedef struct { + Boolean uiComing; // true if system dialog will be put up + // before coming action code arrives. + } SysAppLaunchCmdSaveDataType; + +// For sysAppLaunchCmdSystemReset +typedef struct { + Boolean hardReset; // true if system was hardReset, false if soft-reset. + Boolean createDefaultDB; // true if app should create default database. + } SysAppLaunchCmdSystemResetType; + + +// For sysAppLaunchCmdInitDatabase +typedef struct SysAppLaunchCmdInitDatabaseType { + DmOpenRef dbP; // Handle of the newly-created database, + // already open for read/write access. + // IMPORTANT: The handler *MUST* leave + // this database handle open on return. + ULong creator; // Creator ID of the newly-created database + ULong type; // Type ID of the newly-created database + UInt version; // Version number of the newly-created database + } SysAppLaunchCmdInitDatabaseType; + + +// For sysAppLaunchCmdSyncCallApplicationV10 +// This structure used on Pilot v1.0 only. See sysAppLaunchCmdHandleSyncCallApp +// for later platforms. +typedef struct SysAppLaunchCmdSyncCallApplicationTypeV10 { + Word action; // call action id (app-specific) + Word paramSize; // parameter size + VoidPtr paramP; // ptr to parameter + Byte remoteSocket; // remote socket id + Byte tid; // command transaction id + Boolean handled; // if handled, MUST be set true by the app + } SysAppLaunchCmdSyncCallApplicationTypeV10; + + +// For sysAppLaunchCmdHandleSyncCallApp (Pilot v2.0 and greater). +// This structure replaces SysAppLaunchCmdSyncCallApplicationType +// which was used in Pilot v1.0 +typedef struct SysAppLaunchCmdHandleSyncCallAppType { + Word pbSize; // this parameter block size (set to sizeof SysAppLaunchCmdHandleSyncCallAppType) + Word action; // call action id (app-specific) + VoidPtr paramP; // ptr to parameter + DWord dwParamSize; // parameter size + VoidPtr dlRefP; // DesktopLink reference pointer for passing + // to DlkControl()'s dlkCtlSendCallAppReply code + + Boolean handled; // initialized to FALSE by DLServer; if + // handled, MUST be set TRUE by the app(the + // handler MUST call DlkControl with + // control code dlkCtlSendCallAppReply); + // if the handler is not going to send a reply, + // it should leave this field set to FALSE, in which + // case DesktopLink Server will send the default + // "unknown request" reply. + + Err replyErr; // error from dlkCtlSendCallAppReply + + // RESERVED FOR FUTURE EXTENSIONS + DWord dwReserved1; // RESERVED -- set to null!!! + DWord dwReserved2; // RESERVED -- set to null!!! + + // Target executable creator and type for testing the mechanism + // in EMULATION MODE ONLY!!! + #if EMULATION_LEVEL != EMULATION_NONE + DWord creator; + DWord type; + #endif + + } SysAppLaunchCmdHandleSyncCallAppType; + +// For sysAppLaunchCmdFailedAppNotify +typedef struct + { + DWord creator; + DWord type; + Err result; + } SysAppLaunchCmdFailedAppNotifyType; + + +/************************************************************ + * Function prototype for libraries + *************************************************************/ + +// ***IMPORTANT*** +// ***IMPORTANT*** +// ***IMPORTANT*** +// +// The assembly level TrapDispatcher() function uses a hard-coded value for +// the size of the structure SysLibTblEntryType to obtain a pointer to a +// library entry in the library table. Therefore, any changes to this structure, +// require corresponding changes in TrapDispatcher() in ROMBoot.c. Furthermore, +// it is advantageous to keep the size of the structure a power of 2 as this +// improves performance by allowing the entry offset to be calculated by shifting +// left instead of using the multiply instruction. vmk 8/27/96 (yes, I fell into +// this trap myself) +typedef struct SysLibTblEntryType { + Ptr* dispatchTblP; // pointer to library dispatch table + void* globalsP; // Library globals + + // New INTERNAL fields for v2.0 (vmk 8/27/96): + LocalID dbID; // database id of the library + VoidPtr codeRscH; // library code resource handle for RAM-based libraries + } SysLibTblEntryType; +typedef SysLibTblEntryType* SysLibTblEntryPtr; + +// Library entry point procedure +typedef Err (*SysLibEntryProcPtr)(UInt refNum, SysLibTblEntryPtr entryP); + +// This library refNum is reserved for the Debugger comm library +#define sysDbgCommLibraryRefNum 0 + +// This refNum signals an invalid refNum +#define sysInvalidRefNum 0xFFFF + + +/************************************************************ + * Function prototype for Kernel + *************************************************************/ +// Task termination procedure prototype for use with SysTaskSetTermProc +typedef void (*SysTermProcPtr)(ULong taskID, Long reason); + +// Timer procedure for use with SysTimerCreate +typedef void (*SysTimerProcPtr)(Long timerID, Long param); + + + + +/************************************************************ + * Error Classes for each manager + *************************************************************/ +#define memErrorClass 0x0100 // Memory Manager +#define dmErrorClass 0x0200 // Data Manager +#define serErrorClass 0x0300 // Serial Manager +#define slkErrorClass 0x0400 // Serial Link Manager +#define sysErrorClass 0x0500 // System Manager +#define fplErrorClass 0x0600 // Floating Point Library +#define flpErrorClass 0x0680 // New Floating Point Library +#define evtErrorClass 0x0700 // System Event Manager +#define sndErrorClass 0x0800 // Sound Manager +#define almErrorClass 0x0900 // Alarm Manager +#define timErrorClass 0x0A00 // Time Manager +#define penErrorClass 0x0B00 // Pen Manager +#define ftrErrorClass 0x0C00 // Feature Manager +#define cmpErrorClass 0x0D00 // Connection Manager +#define dlkErrorClass 0x0E00 // Desktop Link Manager +#define padErrorClass 0x0F00 // PAD Manager +#define grfErrorClass 0x1000 // Graffiti Manager +#define mdmErrorClass 0x1100 // Modem Manager +#define netErrorClass 0x1200 // Net Library +#define htalErrorClass 0x1300 // HTAL Library +#define inetErrorClass 0x1400 // INet Library +#define exgErrorClass 0x1500 // Exg Manager +#define fileErrorClass 0x1600 // File Stream Manager +#define rfutErrorClass 0x1700 // RFUT Library +#define txtErrorClass 0x1800 // Text Manager +#define tsmErrorClass 0x1900 // Text Services Library + +#define appErrorClass 0x8000 // Application-defined errors + +/************************************************************ + * System Errors + *************************************************************/ +#define sysErrTimeout (sysErrorClass | 1) +#define sysErrParamErr (sysErrorClass | 2) +#define sysErrNoFreeResource (sysErrorClass | 3) +#define sysErrNoFreeRAM (sysErrorClass | 4) +#define sysErrNotAllowed (sysErrorClass | 5) +#define sysErrSemInUse (sysErrorClass | 6) +#define sysErrInvalidID (sysErrorClass | 7) +#define sysErrOutOfOwnerIDs (sysErrorClass | 8) +#define sysErrNoFreeLibSlots (sysErrorClass | 9) +#define sysErrLibNotFound (sysErrorClass | 10) +#define sysErrDelayWakened (sysErrorClass | 11) // SysTaskDelay wakened by SysTaskWake before delay completed. +#define sysErrRomIncompatible (sysErrorClass | 12) +#define sysErrBufTooSmall (sysErrorClass | 13) +#define sysErrPrefNotFound (sysErrorClass | 14) + +// NotifyMgr error codes: +#define sysNotifyErrEntryNotFound (sysErrorClass | 16) // could not find registration entry in the list +#define sysNotifyErrDuplicateEntry (sysErrorClass | 17) // identical entry already exists +#define sysNotifyErrBroadcastBusy (sysErrorClass | 19) // a broadcast is already in progress - try again later. +#define sysNotifyErrBroadcastCancelled (sysErrorClass | 20) // a handler cancelled the broadcast + + +/************************************************************ + * System Features + *************************************************************/ +#define sysFtrCreator sysFileCSystem // Feature Creator + +#define sysFtrNumROMVersion 1 // ROM Version + // 0xMMmfsbbb, where MM is major version, m is minor version + // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development, + // bbb is build number for non-releases + // V1.12b3 would be: 0x01122003 + // V2.00a2 would be: 0x02001002 + // V1.01 would be: 0x01013000 + +#define sysFtrNumProcessorID 2 // Product id + // 0xMMMMRRRR, where MMMM is the processor model and RRRR is the revision. +#define sysFtrNumProcessorMask 0xFFFF0000 // Mask to obtain processor model +#define sysFtrNumProcessor328 0x00010000 // Motorola 68328 (Dragonball) +#define sysFtrNumProcessorEZ 0x00020000 // Motorola 68EZ328 (Dragonball EZ) +#define sysFtrNumProductID sysFtrNumProcessorID // old (obsolete) define + +#define sysFtrNumBacklight 3 // Backlight + // bit 0: 1 if present. 0 if Feature does not exist or backlight is not present + +#define sysFtrNumEncryption 4 // Which encryption schemes are present +#define sysFtrNumEncryptionMaskDES 0x00000001 // bit 0: 1 if DES is present + +#define sysFtrNumCountry 5 // International ROM identifier + // Result is of type CountryType as defined in Preferences.h. + // Result is essentially the "default" country for this ROM. + // Assume cUnitedStates if sysFtrNumROMVersion >= 02000000 + // and feature does not exist. +#define sysFtrNumLanguage 6 // Language identifier + // Result is of untyped; values are defined in Incs:BuildRules.h + // Result is essentially the "default" language for this ROM. + // This is new for the WorkPad (v2.0.2) and did NOT exist for any of the + // following: GermanPersonal, GermanPro, FrenchPersonal, FrenchPro + // Thus we can't really assume anything if the feature doesn't exist, + // though the actual language MAY be determined from sysFtrNumCountry, above. + +#define sysFtrNumDisplayDepth 7 // Display depth + // Result is the "default" display depth for the screen. (Added in PalmOS 3.0) + // This value is used by ScrDisplayMode when setting the default display depth. + +#define sysFtrNumHwrMiscFlags 8 // HwrMiscFlags value (Added in PalmOS 3.1) +#define sysFtrNumHwrMiscFlagsExt 9 // HwrMiscFlagsExt value (Added in PalmOS 3.1) + +#define sysFtrNumIntlMgr 10 + // Result is a set of flags that define functionality supported + // by the Int'l Manager. + +#define sysFtrNumEncoding 11 + // Result is the character encoding (defined in TextMgr.h) supported + // by this ROM. If this feature doesn't exist then the assumed encoding + // is latin (Windows code page 1252). + +#define sysFtrDefaultFont 12 + // Default font ID used for displaying text. + +#define sysFtrDefaultBoldFont 13 + // Default font ID used for displaying bold text. + + +/************************************************************ + * ROM token information (for SysGetROMToken, below) + *************************************************************/ +// Additional tokens and token information is located in +#define sysROMTokenSnum 'snum' // Memory Card Flash ID (serial number) + + +/************************************************************ + * Macros for extracting and combining ROM/OS version components + *************************************************************/ + +// ROM/OS stage numbers +#define sysROMStageDevelopment (0) +#define sysROMStageAlpha (1) +#define sysROMStageBeta (2) +#define sysROMStageRelease (3) + + +// MACRO: sysMakeROMVersion +// +// Builds a ROM version value from the major, minor, fix, stage, and build numbers +// +#define sysMakeROMVersion(major, minor, fix, stage, buildNum) \ + ( \ + (((DWord)((Byte)(major) & 0x0FF)) << 24) | \ + (((DWord)((Byte)(minor) & 0x00F)) << 20) | \ + (((DWord)((Byte)(fix) & 0x00F)) << 16) | \ + (((DWord)((Byte)(stage) & 0x00F)) << 12) | \ + (((DWord)((Word)(buildNum) & 0x0FFF))) \ + ) + + +// Macros for parsing the ROM version number +// (the system OS version is obtained by calling +// FtrGet(sysFtrCreator, sysFtrNumROMVersion, dwOSVerP), where dwOSVerP is +// a pointer to to a DWord variable that is to receive the OS version number) +#define sysGetROMVerMajor(dwROMVer) (((Word)((dwROMVer) >> 24)) & 0x00FF) +#define sysGetROMVerMinor(dwROMVer) (((Word)((dwROMVer) >> 20)) & 0x000F) +#define sysGetROMVerFix(dwROMVer) (((Word)((dwROMVer) >> 16)) & 0x000F) +#define sysGetROMVerStage(dwROMVer) (((Word)((dwROMVer) >> 12)) & 0x000F) +#define sysGetROMVerBuild(dwROMVer) (((Word)(dwROMVer)) & 0x0FFF) + + + + +/************************************************************ + * System Types + *************************************************************/ + +// Types of batteries installed. +typedef enum { + sysBatteryKindAlkaline=0, + sysBatteryKindNiCad, + sysBatteryKindLiIon, + sysBatteryKindRechAlk, + sysBatteryKindLast=0xFF // insert new battery types BEFORE this one + } SysBatteryKind; + + +// SysCreateDataBaseList can generate a list of database. +typedef struct + { + Char name[dmDBNameLength]; + ULong creator; + ULong type; + UInt version; + LocalID dbID; + UInt cardNo; + BitmapPtr iconP; + } SysDBListItemType; + + +// Structure of a generic message that can be send to a mailbox +// through the SysMailboxSend call. Note, this structure MUST +// be CJ_MAXMSZ bytes large, where CJ_MAXMSZ is defined in +// the AMX includes. +typedef struct { + DWord data[3]; + } SysMailboxMsgType; + + +// Constants used by the SysEvGroupSignal call +#define sysEvGroupSignalConstant 0 +#define sysEvGroupSignalPulse 1 + +// Constants used by the SysEvGroupWait call +#define sysEvGroupWaitOR 0 +#define sysEvGroupWaitAND 1 + + + +/************************************************************ + * System Pre-defined "file descriptors" + * These are used by applications that use the Net Library's + * NetLibSelect() call + *************************************************************/ +#define sysFileDescStdIn 0 + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Prototype for Pilot applications entry point +DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags); + + +// SystemMgr routines +void SysUnimplemented(void) + SYS_TRAP(sysTrapSysUnimplemented); + +void SysColdBoot(Ptr card0P, ULong card0Size, + Ptr card1P, ULong card1Size, + DWord sysCardHeaderOffset) + SYS_TRAP(sysTrapSysColdBoot); + +void SysInit(void) + SYS_TRAP(sysTrapSysInit); + +void SysReset(void) + SYS_TRAP(sysTrapSysReset); + +void SysPowerOn(Ptr card0P, ULong card0Size, + Ptr card1P, ULong card1Size, + DWord sysCardHeaderOffset, Boolean reFormat); + + +void SysDoze(Boolean onlyNMI) + SYS_TRAP(sysTrapSysDoze); + +Err SysSetPerformance(ULongPtr sysClockP, UIntPtr cpuDutyP) + SYS_TRAP(sysTrapSysSetPerformance); + +void SysSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapSysSleep); + +UInt SysSetAutoOffTime(UInt seconds) + SYS_TRAP(sysTrapSysSetAutoOffTime); + +Word SysTicksPerSecond(void) + SYS_TRAP(sysTrapSysTicksPerSecond); + +Err SysLaunchConsole(void) + SYS_TRAP(sysTrapSysLaunchConsole); + +Boolean SysHandleEvent(EventPtr eventP) + SYS_TRAP(sysTrapSysHandleEvent); + +Boolean SysWantEvent(EventPtr eventP, Boolean *needsUI) + SYS_TRAP(sysTrapSysWantEvent); + +void SysUILaunch(void) + SYS_TRAP(sysTrapSysUILaunch); + +Err SysUIAppSwitch(UInt cardNo, LocalID dbID, Word cmd, Ptr cmdPBP) + SYS_TRAP(sysTrapSysUIAppSwitch); + +Err SysCurAppDatabase(UIntPtr cardNoP, LocalID* dbIDP) + SYS_TRAP(sysTrapSysCurAppDatabase); + +Err SysBroadcastActionCode(Word cmd, Ptr cmdPBP) + SYS_TRAP(sysTrapSysBroadcastActionCode); + +Err SysAppLaunch(UInt cardNo, LocalID dbID, UInt launchFlags, + Word cmd, Ptr cmdPBP, DWord* resultP) + SYS_TRAP(sysTrapSysAppLaunch); + +UInt SysNewOwnerID(void) + SYS_TRAP(sysTrapSysNewOwnerID); + +DWord SysSetA5(DWord newValue) + SYS_TRAP(sysTrapSysSetA5); + + +Ptr SysCardImageInfo(UInt cardNo, ULongPtr sizeP); + +void SysCardImageDeleted(UInt cardNo); + +Word SysUIBusy(Boolean set, Boolean value) + SYS_TRAP(sysTrapSysUIBusy); + +Byte SysLCDContrast(Boolean set, Byte newContrastLevel) + SYS_TRAP(sysTrapSysLCDContrast); + + +// System Dialogs +void SysBatteryDialog(void) + SYS_TRAP(sysTrapSysBatteryDialog); + +// Utilities +Err SysSetTrapAddress(UInt trapNum, VoidPtr procP) + SYS_TRAP(sysTrapSysSetTrapAddress); + +VoidPtr SysGetTrapAddress(UInt trapNum) + SYS_TRAP(sysTrapSysGetTrapAddress); + +Word SysDisableInts(void) + SYS_TRAP(sysTrapSysDisableInts); + +void SysRestoreStatus(Word status) + SYS_TRAP(sysTrapSysRestoreStatus); + +extern CharPtr SysGetOSVersionString() + SYS_TRAP(sysTrapSysGetOSVersionString); + +// The following trap is a public definition of HwrGetROMToken from +// See token definitions (like sysROMTokenSerial) above... +Err SysGetROMToken(Word cardNo, DWord token, BytePtr *dataP, WordPtr sizeP ) + SYS_TRAP(sysTrapHwrGetROMToken); + + +// Library Management +Err SysLibInstall(SysLibEntryProcPtr libraryP, UIntPtr refNumP) + SYS_TRAP(sysTrapSysLibInstall); + +Err SysLibLoad(DWord libType, DWord libCreator, UIntPtr refNumP) + SYS_TRAP(sysTrapSysLibLoad); + + +Err SysLibRemove(UInt refNum) + SYS_TRAP(sysTrapSysLibRemove); + +Err SysLibFind(CharPtr nameP, UIntPtr refNumP) + SYS_TRAP(sysTrapSysLibFind); + +SysLibTblEntryPtr SysLibTblEntry(UInt refNum) + SYS_TRAP(sysTrapSysLibTblEntry); + +// Generic Library calls +Err SysLibOpen(UInt refNum) + SYS_TRAP(sysLibTrapOpen); +Err SysLibClose(UInt refNum) + SYS_TRAP(sysLibTrapClose); +Err SysLibSleep(UInt refNum) + SYS_TRAP(sysLibTrapSleep); +Err SysLibWake(UInt refNum) + SYS_TRAP(sysLibTrapWake); + + +//----------------------------------------------------- +// Kernel Prototypes +//----------------------------------------------------- +// Task Creation and deleation +Err SysTranslateKernelErr(Err err) + SYS_TRAP(sysTrapSysTranslateKernelErr); + +Err SysTaskCreate(DWordPtr taskIDP, DWordPtr creator, ProcPtr codeP, + Ptr stackP, DWord stackSize, DWord attr, DWord priority, + DWord tSlice) + SYS_TRAP(sysTrapSysTaskCreate); + +Err SysTaskDelete(DWord taskID, DWord priority) + SYS_TRAP(sysTrapSysTaskDelete); + +Err SysTaskTrigger(DWord taskID) + SYS_TRAP(sysTrapSysTaskTrigger); + +ULong SysTaskID() + SYS_TRAP(sysTrapSysTaskID); + +Err SysTaskDelay(SDWord delay) + SYS_TRAP(sysTrapSysTaskDelay); + +Err SysTaskSetTermProc(DWord taskID, SysTermProcPtr termProcP) + SYS_TRAP(sysTrapSysTaskSetTermProc); + +Err SysTaskSwitching(Boolean enable) + SYS_TRAP(sysTrapSysTaskSwitching); + +Err SysTaskWait(SDWord timeout) + SYS_TRAP(sysTrapSysTaskWait); + +Err SysTaskWake(DWord taskID) + SYS_TRAP(sysTrapSysTaskWake); + +Err SysTaskWaitClr(void) + SYS_TRAP(sysTrapSysTaskWaitClr); + +Err SysTaskSuspend(DWord taskID) + SYS_TRAP(sysTrapSysTaskSuspend); + +Err SysTaskResume(DWord taskID) + SYS_TRAP(sysTrapSysTaskResume); + + +// Counting Semaphores +Err SysSemaphoreCreate(DWordPtr smIDP, DWordPtr tagP, SDWord initValue) + SYS_TRAP(sysTrapSysSemaphoreCreate); + +Err SysSemaphoreDelete(DWord smID) + SYS_TRAP(sysTrapSysSemaphoreDelete); + +Err SysSemaphoreWait(DWord smID, DWord priority, SDWord timeout) + SYS_TRAP(sysTrapSysSemaphoreWait); + +Err SysSemaphoreSignal(DWord smID) + SYS_TRAP(sysTrapSysSemaphoreSignal); + +Err SysSemaphoreSet(DWord smID) + SYS_TRAP(sysTrapSysSemaphoreSet); + + +// Resource Semaphores +Err SysResSemaphoreCreate(DWordPtr smIDP, DWordPtr tagP) + SYS_TRAP(sysTrapSysResSemaphoreCreate); + +Err SysResSemaphoreDelete(DWord smID) + SYS_TRAP(sysTrapSysResSemaphoreDelete); + +Err SysResSemaphoreReserve(DWord smID, DWord priority, SDWord timeout) + SYS_TRAP(sysTrapSysResSemaphoreReserve); + +Err SysResSemaphoreRelease(DWord smID) + SYS_TRAP(sysTrapSysResSemaphoreRelease); + + + +// Timers +Err SysTimerCreate(DWordPtr timerIDP, DWordPtr tagP, + SysTimerProcPtr timerProc, DWord periodicDelay, + DWord param) + SYS_TRAP(sysTrapSysTimerCreate); + +Err SysTimerDelete(DWord timerID) + SYS_TRAP(sysTrapSysTimerDelete); + +Err SysTimerWrite(DWord timerID, DWord value) + SYS_TRAP(sysTrapSysTimerWrite); + +Err SysTimerRead(DWord timerID, DWordPtr valueP) + SYS_TRAP(sysTrapSysTimerRead); + + +// Information +Err SysKernelInfo(VoidPtr paramP) + SYS_TRAP(sysTrapSysKernelInfo); + +Boolean SysCreateDataBaseList(ULong type, ULong creator, WordPtr dbCount, + Handle *dbIDs, Boolean lookupName) + SYS_TRAP(sysTrapSysCreateDataBaseList); + +Boolean SysCreatePanelList(WordPtr panelCount, Handle *panelIDs) + SYS_TRAP(sysTrapSysCreatePanelList); + +UInt SysBatteryInfo(Boolean set, UIntPtr warnThresholdP, UIntPtr criticalThresholdP, + UIntPtr maxTicksP, SysBatteryKind* kindP, Boolean* pluggedIn, BytePtr percentP) + SYS_TRAP(sysTrapSysBatteryInfo); + +UInt SysBatteryInfoV20(Boolean set, UIntPtr warnThresholdP, UIntPtr criticalThresholdP, + UIntPtr maxTicksP, SysBatteryKind* kindP, Boolean* pluggedIn) + SYS_TRAP(sysTrapSysBatteryInfoV20); + +Boolean SysGetStackInfo(Ptr *startPP, Ptr *endPP) + SYS_TRAP(sysTrapSysGetStackInfo); + + + +// Mailboxes +Err SysMailboxCreate(DWordPtr mbIDP, DWordPtr tagP, DWord depth) + SYS_TRAP(sysTrapSysMailboxCreate); + +Err SysMailboxDelete(DWord mbID) + SYS_TRAP(sysTrapSysMailboxDelete); + +Err SysMailboxFlush(DWord mbID) + SYS_TRAP(sysTrapSysMailboxFlush); + +Err SysMailboxSend(DWord mbID, VoidPtr msgP, DWord wAck) + SYS_TRAP(sysTrapSysMailboxSend); + +Err SysMailboxWait(DWord mbID, VoidPtr msgP, DWord priority, + SDWord timeout) + SYS_TRAP(sysTrapSysMailboxWait); + +// Event Groups +Err SysEvGroupCreate(DWordPtr evIDP, DWordPtr tagP, DWord init) + SYS_TRAP(sysTrapSysEvGroupCreate); + +//Err SysEvGroupDelete(DWord evID) // save trap table space - don't need + //SYS_TRAP(sysTrapSysEvGroupDelete); + +Err SysEvGroupSignal(DWord evID, DWord mask, DWord value, SDWord type) + SYS_TRAP(sysTrapSysEvGroupSignal); + +Err SysEvGroupRead(DWord evID, DWordPtr valueP) + SYS_TRAP(sysTrapSysEvGroupRead); + +Err SysEvGroupWait(DWord evID, DWord mask, DWord value, SDWord matchType, + SDWord timeout) + SYS_TRAP(sysTrapSysEvGroupWait); + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _SysSemaphoreSignal \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSignal) + +#define _SysSemaphoreSet \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSet) + +#define _SysDoze \ + ASM_SYS_TRAP(sysTrapSysDoze) + + +#endif //__SYSTEMMGR_H__ diff --git a/sdk-3.1/include/Core/System/SystemMgr.rh b/sdk-3.1/include/Core/System/SystemMgr.rh new file mode 100644 index 0000000..c363b4d --- /dev/null +++ b/sdk-3.1/include/Core/System/SystemMgr.rh @@ -0,0 +1,254 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SystemMgr.rh + * + * Description: + * Include file for both PilotRez 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: + * 2/27/95 Created by Ron Marianetti + * 8/4/95 vmk Added system resource id for Desktop Link user info + * 2/3/98 tlw Changed sysFileCDefaultApp from sysFileCMemory which + * no longer exists to sysFileCPreferences. + * + *******************************************************************/ + +#ifndef __SYSTEMMGR_RH__ +#define __SYSTEMMGR_RH__ + +//----------------------------------------------------------- +// This section is common to both the C and Resource Compiler +//----------------------------------------------------------- + +//................................................................ +// File types and creators +// +// Each database shall have a creator ID and a type. +// +// The creator ID shall establish which application, patch, or extension +// a particular database is associated with. The creator ID should identify +// the application/patch/extension, NOT who created it. +// +// The type will determine which part of an application, +// patch, or extension a particular database is. +// +// There can be only one database per application, patch, or extension +// which has type 'application', 'patch', or 'extension'. +// +// Creators: +// +// ROM-based applications created by Palm Computing have all-lower case +// creator ID's. Third-party applications have creator ID's which +// are either all caps, or mixed case. The same requirements go for +// system patches and extensions. +// +// All applications, system patches and extensions shall have unique creator +// ID's. +// +// Types: +// +// 'Application', 'Extension', and 'Patch' file/database types for ROM-based +// apps shall be all-lower case (they are defined below). Other +// file/database types must be mixed-case, +// or all caps. These other types are internal to the applications, and +// therefore the system is unconcerned with their exact values. +//................................................................ +#define sysFileCSystem 'psys' // Creator type for System files +#define sysFileCGraffiti 'graf' // Creator type for Graffiti databases +#define sysFileCSystemPatch 'ptch' // Creator for System resource file patches + +#define sysFileCCalculator 'calc' // Creator type for Calculator App +#define sysFileCSecurity 'secr' // Creator type for Security App +#define sysFileCPreferences 'pref' // Creator type for Preferences App +#define sysFileCAddress 'addr' // Creator type for Address App +#define sysFileCToDo 'todo' // Creator type for To Do App +#define sysFileCDatebook 'date' // Creator type for Datebook App +#define sysFileCMemo 'memo' // Creator type for MemoPad App +#define sysFileCSync 'sync' // Creator type for HotSync App +#define sysFileCMemory 'memr' // Creator type for Memory App +#define sysFileCMail 'mail' // Creator type for Mail App +#define sysFileCExpense 'exps' // Creator type for Expense App +#define sysFileCLauncher 'lnch' // Creator type for Launcher App +#define sysFileCSetup 'setp' // Creator type for setup app. + +// Demo Apps +#define sysFileCGraffitiDemo 'gdem' // Creator type for Graffiti Demo +#define sysFileCMailDemo 'mdem' // Creator type for Mail Demo + +#define sysFileCFirstApp sysFileCPreferences // Creator type for First App after reset +#define sysFileCAltFirstApp sysFileCSetup // Creator type for First alternate App after reset (with hard key pressed) +#define sysFileCDefaultApp sysFileCPreferences // Creator type for Default app +#define sysFileCDefaultButton1App sysFileCDatebook // Creator type for dflt hard button 1 app +#define sysFileCDefaultButton2App sysFileCAddress // Creator type for dflt hard button 2 app +#define sysFileCDefaultButton3App sysFileCToDo // Creator type for dflt hard button 3 app +#define sysFileCDefaultButton4App sysFileCMemo // Creator type for dflt hard button 4 app +#define sysFileCDefaultCalcButtonApp sysFileCCalculator // Creator type for dflt calc button app +#define sysFileCDefaultCradleApp sysFileCSync // Creator type for dflt hot sync button app +#define sysFileCDefaultModemApp sysFileCSync // Creator type for dflt modem button app +#define sysFileCNullApp '0000' // Creator type for non-existing app + +#define sysFileCDigitizer 'digi' // Creator type for Digitizer Panel +#define sysFileCGeneral 'gnrl' // Creator type for General Panel +#define sysFileCFormats 'frmt' // Creator type for Formats Panel +#define sysFileCShortCuts 'shct' // Creator type for ShortCuts Panel +#define sysFileCButtons 'bttn' // Creator type for Buttons Panel +#define sysFileCOwner 'ownr' // Creator type for Owner Panel +#define sysFileCModemPanel 'modm' // Creator type for Modem Panel +#define sysFileCDialPanel 'dial' // Creator type for Dial Panel +#define sysFileCNetworkPanel 'netw' // Creator type for Network Panel +#define sysFileCPADHtal 'hpad' // Creator type for PAD HTAL lirary +#define sysFileCTCPHtal 'htcp' // Creator type for TCP HTAL lirary +#define sysFileCMineHunt 'mine' // Creator type for MineHunt App +#define sysFileCPuzzle15 'puzl' // Creator type for Puzzle "15" App +#define sysFileCOpenLibInfo 'olbi' // Creator type for Feature Manager features + // used for saving open library info under PalmOS v1.x + + +// Libraries. If the resource used by these are expected to be treated as part of +// the system's usage then the Memory app must be changed. +#define sysFileTLibrary 'libr' // File type of Shared Libraries +#define sysFileTLibraryExtension 'libx' // File type of library extensions + +#define sysFileCNet 'netl' // Net Library +#define sysFileCIrLib 'irda' // Creator type for Ir Library + +#define sysFileCSerialHwrMgr 'shwm' // Creator type for SerialHWMgr +#define sysFileCSerialWrapper 'swrp' // Creator type for Serial Wrapper Library +#define sysFileCIrSerialWrapper 'iwrp' // Creator type for Ir Serial Wrapper Library + +#define sysFileCRailMgrEZ 'rail' // Creator type for RailMgr library. + +#define sysFileTUartPlugIn 'sdrv' // File type for SerialHWMgr UART plug-in +#define sysFileCUart328 'u328' // Creator type for '328 UART plug-in +#define sysFileCUart650 'u650' // Creator type for '650 UART plug-in + +#define sysFileTSystem 'rsrc' // File type for Main System File +#define sysFileTSystemPatch 'ptch' // File type for System resource file patches +#define sysFileTKernel 'krnl' // File type for System Kernel (AMX) +#define sysFileTUIAppShell 'uish' // File type for UI Application Shell +#define sysFileTExtension 'extn' // File type for System Extensions +#define sysFileTApplication 'appl' // File type for applications +#define sysFileTPanel 'panl' // File type for preference panels +#define sysFileTSavedPreferences 'sprf' // File type for saved preferences +#define sysFileTPreferences 'pref' // File type for preferences +#define sysFileTMidi 'smfr' // File type for Standard MIDI File record databases + +#define sysFileTGraffitiMacros 'macr' // Graffiti Macros database + +#define sysFileTHtalLib 'htal' // HTAL library + +#define sysFileTExgLib 'exgl' // Type of Exchange libraries + +#define sysFileTFileStream 'strm' // Default File Stream database type + +#define sysFileTTemp 'temp' // Temporary database type; in future versions + // of PalmOS (although likely not in 3.0), the + // system may automatically delete any db's of + // this type at reset time (however, apps are still + // responsible for deleting the ones they create + // before exiting to protect valuable storage space) + + +//................................................................ +// Resource types and IDs +//................................................................ +#define sysResTBootCode 'boot' // Resource type of boot resources +#define sysResIDBootReset 10000 // Reset code +#define sysResIDBootInitCode 10001 // Init code +#define sysResIDBootSysCodeStart 10100 // System code resources start here +#define sysResIDBootSysCodeMin 10102 // IDs 'Start' to this must exist!! +#define sysResIDBootUICodeStart 10200 // UI code resources start here +#define sysResIDBootUICodeMin 10203 // IDs 'Start' to this must exist!! + +#define sysResTAppPrefs 'pref' // Resource type of App preferences resources + +#define sysResTAppCode 'code' // Resource type of App code resources +#define sysResTAppGData 'data' // Resource type of App global data resources + +#define sysResTExtensionCode 'extn' // Resource type of Extensions code + +#define sysResTFeatures 'feat' // Resource type of System features table +#define sysResIDFeatures 10000 // Resource ID of System features table + +#define sysResTCountries 'cnty' // Resource type of System countries table +#define sysResIDCountries 10000 // Resource ID of System countries table + +#define sysResTLibrary 'libr' // Resource type of System Libraries +#define sysResIDLibrarySerMgr328 10000 // Dragonball (68328) UART +#define sysResIDLibrarySerMgr681 10001 // 68681 UART +#define sysResIDLibraryRMPPlugIn 10002 // Reliable Message Protocol NetLib Plug-in + + + +#define sysResTGrfTemplate 'tmpl' // Graffiti templates "file" +#define sysResIDGrfTemplate 10000 // Graffiti templates "file" ID +#define sysResTGrfDictionary 'dict' // Graffiti dictionary "file" +#define sysResIDGrfDictionary 10000 // Graffiti dictionary "file" ID +#define sysResIDGrfDefaultMacros 10000 // sysResTDefaultDB resource with Graffiti Macros database + +#define sysResTDefaultDB 'dflt' // Default database resource type +#define sysResIDDefaultDB 1 // resource ID of sysResTDefaultDB in each app + +#define sysResTErrStrings 'tSTL' // list of error strings +#define sysResIDErrStrings 10000 // resource ID is (errno>>8)+sysResIDErrStrings + +// System Preferences +#define sysResTSysPref sysFileCSystem +#define sysResIDSysPrefMain 0 // Main preferences +#define sysResIDSysPrefPassword 1 // Password +#define sysResIDSysPrefFindStr 2 // Find string +#define sysResIDSysPrefCalibration 3 // Digitizer calibration. +#define sysResIDDlkUserInfo 4 // Desktop Link user information. +#define sysResIDDlkLocalPC 5 // Desktop Link local PC host name +#define sysResIDDlkCondFilterTab 6 // Desktop Link conduit filter table +#define sysResIDModemMgrPref 7 // Modem Manager preferences +#define sysResIDDlkLocalPCAddr 8 // Desktop Link local PC host address +#define sysResIDDlkLocalPCMask 9 // Desktop Link local PC host subnet mask + +#define sysResTInBox 'ibox' // Data received +#define sysResTOutBox 'obox' // Data sent + +//----------------------------------------------------------- +// This section is only valid when running the resource compiler +//----------------------------------------------------------- +#ifdef RESOURCE_COMPILER + +// Definition of the Pilot Preferences Resource. This must match +// the definition of the structure SysAppPrefs in SystemMgr.h +resdef { + word priority; // AMX task priority + long stackSize; // required stack size + long minHeapSpace; // min required free space in heap + } sysResTAppPrefs; + + +// Definition of the ROM - Based Feature table +resdef { + word featureNum; // Feature number + long featureValue; // Feature value + } 'FITM'; + +resdef { + long creator; // creator type + word len(featureItems); + resource 'FITM' featureItems[]; + } 'CITM'; + +resdef { + word len(creatorItems); + resource 'CITM' creatorItems[]; + } sysResTFeatures; + + +#endif + + +#endif //__SYSTEMMGR_RH__ + diff --git a/sdk-3.1/include/Core/System/SystemPkt.h b/sdk-3.1/include/Core/System/SystemPkt.h new file mode 100644 index 0000000..685cde5 --- /dev/null +++ b/sdk-3.1/include/Core/System/SystemPkt.h @@ -0,0 +1,427 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SystemPkt.h + * + * Description: + * Structure of System Packets for the Serial Link Manager. These + * packets are used by the Debugger, Console, and Remote UI modules + * for communication with the host computer. + * + * History: + * 6/26/95 RM - Created by Ron Marianetti + * + * + *******************************************************************/ + + +#ifndef __SYSTEM_PKT_H__ +#define __SYSTEM_PKT_H__ + +#include + + +//************************************************************************* +// Constants for System Packets +// +//************************************************************************* + +// Max # of bytes we can read/write at a time with the ReadMem and WriteMem +// commands; +#define sysPktMaxMemChunk 256 + +// Maximum body size for System Packets. This is big enough to have +// 256 bytes of data for the Read and Write Mem command plus whatever other +// parameters are in the body for these commands. +#define sysPktMaxBodySize (sysPktMaxMemChunk+16) + + +// Default nitial timeout value for packet receive routines in ticks +#define sysPktInitialTimeout (sysTicksPerSecond*10) + + + +//************************************************************************* +// Packet Body Structure +//************************************************************************* + +// Common fields at the start of every body +#define _sysPktBodyCommon \ + Byte command; \ + Byte _filler + + +// Generic System Packet Body +typedef struct SysPktBodyType { + _sysPktBodyCommon; + Byte data[sysPktMaxBodySize-2]; + } SysPktBodyType; +typedef SysPktBodyType* SysPktBodyPtr; + + + +//************************************************************************* +// The max size of the array of SlkWriteDataTypes used by System Packet +// assembly routines in order to minimize stack usage. +//************************************************************************* +#define sysPktMaxBodyChunks 3 + + + +//************************************************************************* +// packet commands +//************************************************************************* + +//-------------------------------------------------------------------- +// get state command +//-------------------------------------------------------------------- +#define sysPktStateCmd 0x00 +#define sysPktStateRsp 0x80 + +//-------------------------------------------------------------------- +// read memory command +//-------------------------------------------------------------------- +#define sysPktReadMemCmd 0x01 +#define sysPktReadMemRsp 0x81 + +typedef struct SysPktReadMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to read + Word numBytes; // # of bytes to read + } SysPktReadMemCmdType; +typedef SysPktReadMemCmdType* SysPktReadMemCmdPtr; + +typedef struct SysPktReadMemRspType { + _sysPktBodyCommon; // Common Body header + // Byte data[?]; // variable size + } SysPktReadMemRspType; +typedef SysPktReadMemRspType* SysPktReadMemRspPtr; + + +//-------------------------------------------------------------------- +// write memory command +//-------------------------------------------------------------------- +#define sysPktWriteMemCmd 0x02 +#define sysPktWriteMemRsp 0x82 + +typedef struct SysPktWriteMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to write + Word numBytes; // # of bytes to write + // Byte data[?]; // variable size data + } SysPktWriteMemCmdType; +typedef SysPktWriteMemCmdType* SysPktWriteMemCmdPtr; + +typedef struct SysPktWriteMemRspType { + _sysPktBodyCommon; // Common Body header + } SysPktWriteMemRspType; +typedef SysPktWriteMemRspType* SysPktWriteMemRspPtr; + + +//-------------------------------------------------------------------- +// single-step command +//-------------------------------------------------------------------- +#define sysPktSingleStepCmd 0x03 +// no response + +//-------------------------------------------------------------------- +// get routine name command +//-------------------------------------------------------------------- +#define sysPktGetRtnNameCmd 0x04 +#define sysPktGetRtnNameRsp 0x84 + +//-------------------------------------------------------------------- +// read registers command +//-------------------------------------------------------------------- +#define sysPktReadRegsCmd 0x05 +#define sysPktReadRegsRsp 0x85 + + +//-------------------------------------------------------------------- +// write registers command +//-------------------------------------------------------------------- +#define sysPktWriteRegsCmd 0x06 +#define sysPktWriteRegsRsp 0x86 + +//-------------------------------------------------------------------- +// continue command +//-------------------------------------------------------------------- +#define sysPktContinueCmd 0x07 +// no response + + +//-------------------------------------------------------------------- +// Remote Procedure call +//-------------------------------------------------------------------- +#define sysPktRPCCmd 0x0A +#define sysPktRPCRsp 0x8A + +typedef struct SysPktRPCParamInfo { + Byte byRef; // true if param is by reference + Byte size; // # of Bytes of paramData (must be even) + Word data[1]; // variable length array of paramData + } SysPktRPCParamType; + +typedef struct SysPktRPCType { + _sysPktBodyCommon; // Common Body header + Word trapWord; // which trap to execute + DWord resultD0; // result from D0 placed here + DWord resultA0; // result from A0 placed here + Word numParams; // how many parameters follow + // Following is a variable length array ofSlkRPCParamInfo's + SysPktRPCParamType param[1]; + } SysPktRPCType; + + +//-------------------------------------------------------------------- +// Set/Get breakpoints +//-------------------------------------------------------------------- +#define sysPktGetBreakpointsCmd 0x0B +#define sysPktGetBreakpointsRsp 0x8B +#define sysPktSetBreakpointsCmd 0x0C +#define sysPktSetBreakpointsRsp 0x8C + + +//-------------------------------------------------------------------- +// Remote UI Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktRemoteUIUpdCmd 0x0C + +typedef struct SysPktRemoteUIUpdCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from traget to host after drawing operations + Word rowBytes; // rowbytes of update area + Word fromY; // top of update rect + Word fromX; // left of update rect + Word toY; // top of screen rect + Word toX; // left of screen rect + Word height; // bottom of update rect + Word width; // right of update rect + + // The actual pixels of the update area follow + Word pixels; // variable length... + + } SysPktRemoteUIUpdCmdType; + + +#define sysPktRemoteEvtCmd 0x0D + +typedef struct SysPktRemoteEvtCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from host to target to feed pen and keyboard + // events. They do not require a response. + Boolean penDown; // true if pen down + SWord penX; // X location of pen + SWord penY; // Y location of pen + + Boolean keyPress; // true if key event follows + Word keyModifiers; // keyboard modifiers + Word keyAscii; // key ascii code + Word keyCode; // key virtual code + + } SysPktRemoteEvtCmdType; + + +//-------------------------------------------------------------------- +// Enable/Disable DbgBreak's command +//-------------------------------------------------------------------- +#define sysPktDbgBreakToggleCmd 0x0D +#define sysPktDbgBreakToggleRsp 0x8D + + +//-------------------------------------------------------------------- +// Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns info on the flash in: +// manuf - manufacturer code +// device - device code +//-------------------------------------------------------------------- +#define sysPktFlashCmd 0x0E // OBSOLETE AS OF 3.0! SEE BELOW! +#define sysPktFlashRsp 0x8E // OSBOLETE AS OF 3.0! SEE BELOW! + + +//-------------------------------------------------------------------- +// Get/Set communication parameters +//-------------------------------------------------------------------- +#define sysPktCommCmd 0x0F +#define sysPktCommRsp 0x8F + +typedef struct SysPktCommCmdType { + _sysPktBodyCommon; // Common Body header + Boolean set; // true to change parameters + ULong baudRate; // new baud rate + ULong flags; // new flags + } SysPktCommCmdType; +typedef SysPktCommCmdType* SysPktCommCmdPtr; + +typedef struct SysPktCommRspType { + _sysPktBodyCommon; // Common Body header + ULong baudRate; // current baud rate + ULong flags; // current flags + } SysPktCommRspType; +typedef SysPktCommRspType* SysPktCommRspPtr; + + +//-------------------------------------------------------------------- +// Get/Set Trap Breaks +//-------------------------------------------------------------------- +#define sysPktGetTrapBreaksCmd 0x10 +#define sysPktGetTrapBreaksRsp 0x90 +#define sysPktSetTrapBreaksCmd 0x11 +#define sysPktSetTrapBreaksRsp 0x91 + + +//-------------------------------------------------------------------- +// Gremlins Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktGremlinsCmd 0x12 + +typedef struct SysPktGremlinsCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from target to host to send Gremlins stuff + Word action; + Byte data[32]; + + } SysPktGremlinsCmdType; + +// Gremlins action codes +#define sysPktGremlinsIdle 1 +#define sysPktGremlinsEvent 2 + + +//-------------------------------------------------------------------- +// Find data - searches a range of addresses for data +//-------------------------------------------------------------------- +#define sysPktFindCmd 0x13 +#define sysPktFindRsp (sysPktFindCmd | 0x80) + +typedef struct SysPktFindCmdType { + _sysPktBodyCommon; // Common Body header + + DWord firstAddr; // first address to search + DWord lastAddr; // last address to begin searching + Word numBytes; // number of data bytes to match + Boolean caseInsensitive; // if true, perform a case-insensitive search + } SysPktFindCmdType; +typedef SysPktFindCmdType* SysPktFindCmdPtr; + +typedef struct SysPktFindRspType { + _sysPktBodyCommon; // Common Body header + + DWord addr; // address where data was found + Boolean found; // true if data was found + + } SysPktFindRspType; +typedef SysPktFindRspType* SysPktFindRspPtr; + + +//-------------------------------------------------------------------- +// Get/Set Trap Conditionals. These are used to tell the debugger +// to conditionally break on a trap depending on the value of the +// first word on the stack. They are used when setting a-traps on +// library calls. This is a 3.0 feature. +//-------------------------------------------------------------------- +#define sysPktGetTrapConditionsCmd 0x14 +#define sysPktGetTrapConditionsRsp 0x94 +#define sysPktSetTrapConditionsCmd 0x15 +#define sysPktSetTrapConditionsRsp 0x95 + + +//-------------------------------------------------------------------- +// Checksum data - checksums a range of memory. +// This is a (late) 3.0 feature. +//-------------------------------------------------------------------- +#define sysPktChecksumCmd 0x16 +#define sysPktChecksumRsp (sysPktChecksumCmd | 0x80) + +typedef struct SysPktChecksumType { + _sysPktBodyCommon; // Common Body header + + DWord firstAddr; // -> first address to checksum + Word numBytes; // -> number of bytes to checksum + Word seed; // -> initial checksum value + Word checksum; // <- checksum result + } SysPktChecksumType; +typedef SysPktChecksumType* SysPktChecksumPtr; + + +//-------------------------------------------------------------------- +// NEW Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns address to store flash code. +// Supercedes Obsolete 1.0 and 2.0 sysPktFlashCmd call above in the 3.0 ROM +//-------------------------------------------------------------------- +#define sysPktExecFlashCmd 0x17 +#define sysPktExecFlashRsp (sysPktExecFlashCmd | 0x80) + + +//-------------------------------------------------------------------- +// message from remote unit +//-------------------------------------------------------------------- +#define sysPktRemoteMsgCmd 0x7f + + +//-------------------------------------------------------------------- +// sysPktRemoteMsg +// Send a text message +//-------------------------------------------------------------------- +typedef struct SysPktRemoteMsgCmdType { + _sysPktBodyCommon; // Common Body header + //Byte text; // variable length text goes here + } SysPktRemoteMsgCmdType; +typedef SysPktRemoteMsgCmdType* SysPktRemoteMsgCmdPtr; + + + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//================================================================ +// +// Host Only Routines. +// +//================================================================ +#if (EMULATION_LEVEL != EMULATION_NONE) + + + //------------------------------------------------------------------- + // RPC + //------------------------------------------------------------------ + // Init preparate on an RPC packet header and body. + Err SlkRPCInitPacket(SlkPktHeaderType* headerP, UInt dstSocket, + SysPktRPCType* bodyP, UInt trapWord); + + + // Stuff a parameter into an RPC packet body + VoidPtr SlkRPCStuffParam(SysPktRPCType* bodyP, void* dataP, + Int dataSize, Boolean byRef); + + // Send RPC packet and wait for response. + Err SlkRPCExecute(SlkPktHeaderPtr headerP, SysPktRPCType* bodyP, + Boolean async); + +#endif // (EMULATION_LEVEL != EMULATION_NONE) + + +#ifdef __cplusplus +} +#endif + + + + +#endif //__SYSTEM_PKT_H__ diff --git a/sdk-3.1/include/Core/System/SystemPrv.h b/sdk-3.1/include/Core/System/SystemPrv.h new file mode 100644 index 0000000..a992610 --- /dev/null +++ b/sdk-3.1/include/Core/System/SystemPrv.h @@ -0,0 +1,452 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * SystemPrv.h + * + * Description: + * Private Pilot system equates + * + * History: + * 8/9/95 RM - Created by Ron Marianetti + * 1/28/98 SCL - Added HotSync port "hint" for SerialHWMgr + * 2/04/98 srj - Added HW_TARGET_EZ in appropriate places. + * HW_TARGET_TD1 in this file means "any + * handheld", not non-EZ platforms. + * + *******************************************************************/ + +#ifdef NON_PORTABLE + +#ifndef __SYSTEMPRV_H__ +#define __SYSTEMPRV_H__ + +// Include fixed global type +#include +#include // for serPortLocalHotSync define + + +/************************************************************ + * Common Equates between Native and Emulation mode + *************************************************************/ +#define sysCardSignature 0xFEEDBEEFL // card signature long word +#define sysStoreSignature 0xFEEDFACEL // store signature long word + + +// This should be set to sizeof(LowMemType) for the final version, but +// until then we'll make it bigger than LowMemType so that we can +// add more globals without having to re-format memory cards. +#define sysLowMemSize 0x1510 // size of Low Memory Area +#define sysInitStack (sysLowMemSize+0x1000) // stack ptr during boot + + + +// The location of the Card Header (start of ROM) is plugged in at run +// time to the global variable GSysCardHeaderOffset. This MUST be done +// by the startup code. We make this a run-time variable so that the same +// executable ROM image can be run from ROM or RAM. +// #define sysCardHeaderOffset someConstant +#define sysRAMOnlyCardHeaderOffset 0x0000000L // RAM only card header created here +#define sysCardHeaderSize 0x0100 // size of card header + + +// Offset to ROM storage header from card header +#define sysROMStoreRelOffset sysCardHeaderSize +#define sysStoreHeaderSize 0x0100 // size of storage header + + +// This equate tells us how large of a heap info table to reserve in the +// globals for each card +#define sysMaxHeapsPerCard 128 // max # of heaps per card + + +// This equtes tells us the initial size of the Library table as held in +// the Low Memory area +#define sysDefaultLibraries DEFAULT_LIB_ENTRIES // default size of library table + + +// The default port number and baud rate for the serial port +// (send "HotSync" port hint for SerialHWMgr) +#if (HW_TARGET == HW_TARGET_TD1) || (HW_TARGET == HW_TARGET_EZ) +#define sysDefaultSerPort serPortLocalHotSync // Use port #0 +#define sysDefaultSerBaud 57600 // baud rate +#else +#define sysDefaultSerPort 1 // Use port #1 +#define sysDefaultSerBaud 57600 // baud rate +#endif + + +// Define initial setting for software + +#define sysInitialContrastSetting 0x80 + +#define HwrLCDContrastMin 0x64 +#define HwrLCDContrastScale 0x02 + + +/************************************************************ + * Structure of the PREF resource in applications. Note, this + * structure must mirror the structure of the PREF resource + * as defined in the PilotRez include file. + *************************************************************/ +typedef struct SysAppPrefs { + Word priority; // task priority + DWord stackSize; // required stack space + DWord minHeapSpace; // minimum heap space required + } SysAppPrefsType; +typedef SysAppPrefsType* SysAppPrefsPtr; + + + +/************************************************************ + * 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 handle of the + * app, the code handle, the stack chunk pointer, the owner ID, etc. + * + * As of PalmOS 3.X, one of these structures is created for each + * app running as an action code. + * + * *** + * ***IMPORTANT: ADD NEW FIELDS AT THE END OF THE STRUCTURE FOR + * *** BACKWARD COMPATIBILITY + * *** + *************************************************************/ +typedef struct SysAppInfoType { + Int cmd; // command code for app + Ptr cmdPBP; // cmd ParamBlock + UInt launchFlags; // launch flags + + Long taskID; // AMX task ID of task that app runs in + Handle codeH; // code handle of the main code segment + DmOpenRef dbP; // Application database access ptr of App + Ptr stackP; // stack chunk for the App + Ptr globalsChunkP; // globals chunk for the App + + UInt memOwnerID; // owner ID for Memory Manager chunks + Ptr dmAccessP; // pointer to linked list of opened DB's + SWord dmLastErr; // Last error from Data Manager + Ptr errExceptionP; // ErrTry,Catch exception list + + // PalmOS v3.0 fields begin here + Ptr a5Ptr; // A5 ptr for this app + Ptr stackEndP; // stack chunk end for the App (last byte) + Ptr globalEndP; // global chunk end for the App (last byte) + struct SysAppInfoType *rootP; // Points to the SysAppInfoType first + // allocated for this thread. + Ptr extraP; // unused ptr for the App. + } SysAppInfoType; +typedef SysAppInfoType* SysAppInfoPtr; + + +/************************************************************ + * Structure of the user info in the TCB of a task. This structure + * is stored in the xtcbuser fields of the AMX TCB for a task and + * must not exceed 4 DWords in length (the size reserved by AMX for + * user info). + *************************************************************/ +typedef struct SysTCBUserInfoType { + SysAppInfoPtr tmpAppInfoP; // used to pass appInfo to nested launches + SysAppInfoPtr rootAppInfoP; // App info for the root application on this task + DWord initialA5; // Inital value for A5 globals ptr + } SysTCBUserInfoType; +typedef SysTCBUserInfoType* SysTCBUserInfoPtr; + + +//***************************************************************** +// Structure of ParamBlock for the SysKernelInfo call +//***************************************************************** + +// Selector codes +typedef enum { + sysKernelInfoSelCurTaskInfo, + sysKernelInfoSelTaskInfo, + sysKernelInfoSelSemaphoreInfo, + sysKernelInfoSelTimerInfo + } SysKernelInfoSelector; + +typedef struct SysKernelInfoType { + SysKernelInfoSelector selector; // Which info to get + DWord id; // which object to get info on + + union { + struct { + DWord id; // ID of task + DWord nextID; // ID of next task + + DWord tag; // task tag + DWord status; // task status + DWord timer; // # ticks left if task's timeout + DWord timeSlice; // task's time slice + SWord priority; // task priority + Word attributes; // task attributes + SWord pendingCalls; // # of pending calls + DWord senderTaskID; // task ID of message sender + DWord msgExchangeID; // task's message exchange ID, if any + + DWord tcbP; // pointer to TCB + DWord stackP; // stack pointer of task + DWord stackStart; // top of task stack (where it started). + DWord stackSize; // size of stack + } task; + + struct { + DWord id; + DWord nextID; // ID of next semaphore + + DWord tag; // semaphore tag + SWord initValue; // semaphore initial value + // >= 0 for counting, -1 for resource + SWord curValue; // semaphore current value + // >0 available + // 0 not available + // -n not available, n tasks waiting + SWord nestLevel; // 0 for counting, >= 0 for resource + DWord ownerID; // owner ID + // 0 for counting or resource free + } semaphore; + + struct { + DWord id; + DWord nextID; // ID of next timer + + DWord tag; // timer tag + DWord ticksLeft; // ticks left till timer runs + DWord period; // timer period, if periodic + DWord proc; // timer procedure + } timer; + } param; + + } SysKernelInfoType; + + +typedef SysKernelInfoType* SysKernelInfoPtr; + + + + +//----------------------------------------------------------------- +// Bits for status field in task info parameter block +//------------------------------------------------------------------ +#define sysTaskStatusTriggerWait 0x01 // (CJ_MATSWTR) Task idle (waiting for trigger) +#define sysTaskStatusSuspended 0x02 // (CJ_MATSWSUS) Task suspended (waiting for resume) +#define sysTaskStatusWaiting 0x04 // (CJ_MATSWAIT) Task waiting (see other bits) +#define sysTaskStatusHalted 0x80 // (CJ_MATSWHLT) Task halted + +// If sysTaskStatusWaiting set, these bits tell why.... +#define sysTaskStatusWaitSemaphore 0x00100 // (CJ_MATSWSM) waiting on semaphore +#define sysTaskStatusWaitEvent 0x00200 // (CJ_MATSWEV) waiting on event group +#define sysTaskStatusWaitMailbox 0x00400 // (CJ_MATSWMB) waiting on mailbox +#define sysTaskStatusWaitMsgExchange 0x00800 // (CJ_MATSWMX) waiting on message exchange +#define sysTaskStatusWaitBuffer 0x01000 // (CJ_MATSWBUF) waiting on buffer +#define sysTaskStatusWaitTimer 0x08000 // (CJ_MATSWTM) waiting on timer + +#define sysTaskStatusWaitMailboxAck 0x00010000L // (CJ_MATSWMBAK) mailbox ack +#define sysTaskStatusWaitMsgXAck 0x00020000L // (CJ_MATSWMXAK) msg exchange ack +#define sysTaskStatusWaitTaskSig 0x00040000L // (CJ_MATSWSIG) task signal wait + +//----------------------------------------------------------------- +// Bits for attributes field in task info parameter block +//------------------------------------------------------------------ +#define sysTaskAttrNoHalt 0x02 // (CJ_MATAHLT) Task cannot be halted +#define sysTaskAttrMsgStack 0x08 // (CJ_MATAMSG) receives msgs on stack +#define sysTaskAttrMsgByRef 0x10 // (CJ_MATAPBR) messages passed by reference +#define sysTaskAttrMsgOnStack 0x4000 // (CJ_MATAMRDY) message ready on stack +#define sysTaskAttrMsgSenderWaiting 0x8000 // (CJ_MATAMSW) msg sender waiting for ack + + + +/************************************************************ + * This structure defines a section within the RAM storage header + * on Card#0 used to hold non-volatile System information. We store + * System information that can not be conveniently stored or accessed + * from a Database in this area because: + * 1.) it can be accessed earlier during the boot-up process and + * 2.) It can be accessed from an interrupt routine. + *************************************************************/ +typedef struct SysNVParamsType { + DWord rtcHours; // Real-Time clock hours - add to value + // in DragonBall RTC register to get + // actual date & time. + DWord rtcHourMinSecCopy; // Copy of latest value in rtcHourMinSec reg of + // DBall. Used as default RTC value on Reset. + Byte swrLCDContrastValue; // Contrast Value for LCD on EZ-based products + // that use the software contrast PWM (such as Sumo) + // this is the SOFTWARE value, which is scaled to + // get the hardware value from 0-255. + } SysNVParamsType; +typedef SysNVParamsType* SysNVParamsPtr; + + + +/************************************************************ + * Structure of the System Globals. This is where we place + * variable size globals that the System Manager uses. This + * is currently not used but a pointer for it is reserved + * in the low memory globals + *************************************************************/ +/* +typedef struct SysGlobalsType { + } SysGlobalsType; +typedef SysGlobalsType* SysGlobalsPtr; +*/ + + + +/************************************************************ + * Assignment of bits to the event group used for implementing the + * NetLibSelect() call. This event group is also used by the System + * Event Manager (SysEvtMgr.c) and includes a bit for "stdin" + * (pen & keyboard) besides the other bits used for Net Library socket refNums. + *************************************************************/ +#define sysFileDescNet (sysFileDescStdIn+1) // first available refNum for use by + // Net library. + + +// Macro to generate a bitmask for the event group corresponding to a particular +// refNum id and boolean indicating whether it's for input or output. The outputs +// are in the upper 16 bits of the event group and the inputs are in the +// lower 16 bits. +#define sysEvtGroupMask(fd,output) \ + (output ? (0x00010000 << (fd)) : (0x00000001 << (fd)) ) + + +/************************************************************ + * This structure defines the entire the Low Memory Area + * and includes the low memory header defined in Globals.h, + * followed by some variable size globals that may change + * from rev to rev of the System Software. + * + * When emulating under Windows, this structure ends up at some random + * place in memory and the global variable GlobalsP points to it. + * + * When running in the native environment, this structure starts at + * address sysGlobalsOffset. + * + * In order to simplify the source code, macros are defined for + * accessing commonly used globals in the optimim manner for + * each environment. + *************************************************************/ +#include +#include +#include +#include +#include +typedef struct LowMemType { + + + // Fixed size globals, defined in Globals.h + LowMemHdrType fixed; + + + //--------------------------------------------------------------------------- + // These structures are always placed at the end of the LowMem area so + // that other globals don't generally have to move when their sizes change + //--------------------------------------------------------------------------- + CardInfoType memCardInfo[hwrNumCardSlots]; // Memory Card Info Array + + SlkGlobalsType slkGlobals; // Serial Link Mgr globals + + DbgGlobalsType dbgGlobals; // Debugger globals + + SysAppInfoType sysAppInfo; // SysAppInfoType for system + + Ptr sysDispatchTable[sysNumTraps]; // trap table + + } LowMemType; + + +// Access to variable size globals +#define GMemCardInfo (((LowMemType*)PilotGlobalsP)->memCardInfo) +#define GSlkGlobals (((LowMemType*)PilotGlobalsP)->slkGlobals) +#define GDbgGlobals (((LowMemType*)PilotGlobalsP)->dbgGlobals) +#define GSysAppInfo (((LowMemType*)PilotGlobalsP)->sysAppInfo) +#define GSysLibTable (((LowMemType*)PilotGlobalsP)->sysLibTable) +#define GSysDispatchTable (((LowMemType*)PilotGlobalsP)->sysDispatchTable) + + +// Flags for the GSysResetFlags global +#define sysResetFlagHardReset 0x01 // HardReset +#define sysResetFlagCreateDefaultDBs 0x02 // create default databases +#define sysResetFlagNoExtensions 0x04 // don't execute extensions + + +// Flags for the GSysPrefFlags global +#define sysPrefFlagTaxiDisable 0x0001 // Not used in >1.0 ROM. +#define sysPrefFlagEnableEasterEggs 0x0002 // Enable easter eggs +#define sysPrefFlagTaxiDisIdle 0x8000 // Disable Idle Taxi temporarily, + // (not saved in preferences) +#define sysPrefFlagTaxiDisIdleTime 0x4000 // Copy of the 16th bit of the system + // time when sysPrefFlagTaxiDisIdle bit + // was set (not saved in preferences). + + +// Flags for the GSysMiscFlags global +#define sysMiscFlagInFatalAlert 0x0001 // Currently displaying fatal alert +#define sysMiscFlagAlwaysSwitchApp 0x0002 // Inform UI App Shell to switch + // apps even if already running +#define sysMiscFlagProfile 0x0004 // true when profiling code. +#define sysMiscFlagGrfDisable 0x0008 // true when Graffiti is disabled +#define sysMiscFlagInDemoAlert 0x0010 // true when Demo unit alert is displayed +#define sysMiscFlagBacklightDisable 0x0020 // true if backlight is disabled +#define sysMiscFlagUIInitialized 0x0040 // true after UI has been inited +#define sysMiscFlagExgEvent 0x0080 // true when a library (Ir) has data + + +// Flags for the GDbgWasEntered global + +// dbgEnteredFlagPseudoNMI: manually setting this flag in the GDbgWasEntered low mem global +// causes the HotSync cradle button IRQ handler to enter the debugger. Have to +// set each time because entering the debugger resets the flag. (this is a hack) +#define dbgEnteredFlagPseudoNMI 0x80 + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +SysTCBUserInfoPtr SysTaskUserInfoPtr(ULong taskID) + SYS_TRAP(sysTrapSysTaskUserInfoPtr); + +Err SysAppStartup(SysAppInfoPtr* appInfoPP, Ptr* prevGlobalsP, + Ptr* globalsPtrP) + SYS_TRAP(sysTrapSysAppStartup); + +Err SysAppExit(SysAppInfoPtr appInfoP, Ptr prevGlobalsP, Ptr globalsP) + SYS_TRAP(sysTrapSysAppExit); + +SysAppInfoPtr SysCurAppInfoPV20(void) + SYS_TRAP(sysTrapSysCurAppInfoPV20); + +SysAppInfoPtr SysGetAppInfo(SysAppInfoPtr *uiAppPP, SysAppInfoPtr *actionCodeAppPP) + SYS_TRAP(sysTrapSysGetAppInfo); + + +#ifdef __cplusplus +} +#endif + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _SysFatalAlert \ + ASM_SYS_TRAP(sysTrapSysFatalAlert) + +#define _SysReset \ + ASM_SYS_TRAP(sysTrapSysReset) + + + +#endif //__SYSTEMPRV_H__ + +#endif // NON_PORTABLE + diff --git a/sdk-3.1/include/Core/System/TimeMgr.h b/sdk-3.1/include/Core/System/TimeMgr.h new file mode 100644 index 0000000..9b8f221 --- /dev/null +++ b/sdk-3.1/include/Core/System/TimeMgr.h @@ -0,0 +1,76 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * TimeMgr.h + * + * Description: + * Time manager functions + * + * History: + * 1/19/95 roger - Created by Roger Flores + * + * + *******************************************************************/ + + +#ifndef __TIMEMGR_H__ +#define __TIMEMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Time Manager result codes + * (timErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define timErrMemory (timErrorClass | 1) + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err TimInit(void) SYS_TRAP(sysTrapTimInit); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// seconds since 1/1/1904 +ULong TimGetSeconds(void) + SYS_TRAP(sysTrapTimGetSeconds); + +// seconds since 1/1/1904 +void TimSetSeconds(ULong seconds) + SYS_TRAP(sysTrapTimSetSeconds); + +// ticks since power on +ULong TimGetTicks(void) + SYS_TRAP(sysTrapTimGetTicks); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __TIMEMGR_H__ + + diff --git a/sdk-3.1/include/Core/System/Unix/arpa_inet.h b/sdk-3.1/include/Core/System/Unix/arpa_inet.h new file mode 100644 index 0000000..31020d2 --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/arpa_inet.h @@ -0,0 +1,67 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: arpa/inet.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + +/* @(#)inet.h 1.8 88/08/19 SMI; from UCB 5.1 5/30/85 */ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * External definitions for + * functions in inet(3N) + */ + +#ifndef __UNIXINET_H__ +#define __UNIXINET_H__ + +#include + +//=========================================================================== +// Macros that convert Unix calls into native Pilot calls. +//=========================================================================== +// Convert a dotted decimal string representation into an IP address. +// return -1 on error +#define inet_addr(s) \ + NetLibAddrAToIN(AppNetRefnum, s) + +// Return a dotted decimal string representation of an IP address +#define inet_ntoa(in) \ + NetLibAddrINToA(AppNetRefnum, (in).s_addr, AppINETString) + + +//=========================================================================== +// Functions implemented through glue code +//=========================================================================== + +// Merge network number and local network address into an IP address +struct in_addr inet_makeaddr(DWord net, DWord lna); + +// Return the NBO network number of the dotted decimal string +DWord inet_network(CharPtr s); + +// Return the local network address of an IP address +DWord inet_lnaof(struct in_addr in); + +// Return the network number of an IP address +DWord inet_netof(struct in_addr in); + +#endif /*__UNIXINET_H__*/ + + + + + diff --git a/sdk-3.1/include/Core/System/Unix/netdb.h b/sdk-3.1/include/Core/System/Unix/netdb.h new file mode 100644 index 0000000..08f166b --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/netdb.h @@ -0,0 +1,117 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: netdb.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + +/* @(#)netdb.h 1.11 88/08/19 SMI from UCB 5.9 4/5/88 */ +/* + * Copyright (c) 1980,1983,1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + + + +#ifndef __UNIXNETDB_H__ +#define __UNIXNETDB_H__ + + +/* + * Structures returned by network data base library. + * All addresses are supplied in host order, and + * returned in network order (suitable for use in system calls). + */ + +struct hostent { + Char *h_name; /* official name of host */ + Char **h_aliases; /* alias list */ + Word h_addrtype; /* host address type */ + Word h_length; /* length of address */ + Char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + Char *n_name; /* official name of net */ + Char **n_aliases; /* alias list */ + Word n_addrtype; /* net address type */ + DWord n_net; /* network # */ +}; + +struct servent { + Char *s_name; /* official service name */ + Char **s_aliases; /* alias list */ + Word s_port; /* port # */ + Char *s_proto; /* protocol to use */ +}; + +struct protoent { + Char *p_name; /* official protocol name */ + Char **p_aliases; /* alias list */ + Word p_proto; /* protocol # */ +}; + +struct rpcent { + Char *r_name; /* name of server for this rpc program */ + Char **r_aliases; /* alias list */ + SWord r_number; /* rpc program number */ +}; + + +// Supported calls +#define gethostbyname(nameP) \ + ((struct hostent*)NetLibGetHostByName(AppNetRefnum, nameP,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define gethostbyaddr(addr,len,type) \ + ((struct hostent*)NetLibGetHostByAddr(AppNetRefnum, (BytePtr)addr,len,type,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define getservbyname(serv,proto) \ + ((struct servent*)NetLibGetServByName(AppNetRefnum, serv,proto,&AppServInfo,AppNetTimeout,&h_errno)) + + +// Unsupported calls +// struct hostent *gethostent(); +// struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); +// struct servent *getservbyport(), *getservent(); +// struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); +// struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver) + */ + +extern Err h_errno; + +#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + + +#endif // __UNIXNETDB_H__ + + + diff --git a/sdk-3.1/include/Core/System/Unix/netinet_in.h b/sdk-3.1/include/Core/System/Unix/netinet_in.h new file mode 100644 index 0000000..4dfa9b0 --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/netinet_in.h @@ -0,0 +1,197 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: netinet/in.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)in.h 1.19 90/07/27 SMI; from UCB 7.5 2/22/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981. + */ + +#ifndef __UNIXIN_H__ +#define __UNIXIN_H__ + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group control protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_HELLO 63 /* "hello" routing protocol */ +#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + +/* + * Port/socket numbers: network standard functions + */ +#define IPPORT_ECHO 7 +#define IPPORT_DISCARD 9 +#define IPPORT_SYSTAT 11 +#define IPPORT_DAYTIME 13 +#define IPPORT_NETSTAT 15 +#define IPPORT_FTP 21 +#define IPPORT_TELNET 23 +#define IPPORT_SMTP 25 +#define IPPORT_TIMESERVER 37 +#define IPPORT_NAMESERVER 42 +#define IPPORT_WHOIS 43 +#define IPPORT_MTP 57 + +/* + * Port/socket numbers: host specific functions + */ +#define IPPORT_TFTP 69 +#define IPPORT_RJE 77 +#define IPPORT_FINGER 79 +#define IPPORT_TTYLINK 87 +#define IPPORT_SUPDUP 95 + +/* + * UNIX TCP sockets + */ +#define IPPORT_EXECSERVER 512 +#define IPPORT_LOGINSERVER 513 +#define IPPORT_CMDSERVER 514 +#define IPPORT_EFSSERVER 520 + +/* + * UNIX UDP sockets + */ +#define IPPORT_BIFFUDP 512 +#define IPPORT_WHOSERVER 513 +#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Link numbers + */ +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 + +/* + * Internet address + * This definition contains obsolete fields for compatibility + * with SunOS 3.x and 4.2bsd. The presence of subnets renders + * divisions into fixed fields misleading at best. New code + * should use only the s_addr field. + */ +struct in_addr { + union { + struct { Byte s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { Word s_w1,s_w2; } S_un_w; + DWord S_addr; + } S_un; +#define s_addr S_un.S_addr /* should be used for all code */ +#define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */ +#define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */ +#define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */ +#define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */ +#define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */ +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_NONE (u_long)0xFFFFFFFF /* error from inet_aton */ +#define INADDR_LOOPBACK (u_long)0x7F000001 +#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Define a macro to stuff the loopback address into an Internet address + */ +#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ + (a)->sin_family = AF_INET;} + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + short sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + */ +#define IP_OPTIONS netSocketOptIPOptions /* set/get IP per-packet options */ + +/* + * Macros for number representation conversion. + */ +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + + +#endif /*!__IN_H__*/ diff --git a/sdk-3.1/include/Core/System/Unix/netinet_in_systm.h b/sdk-3.1/include/Core/System/Unix/netinet_in_systm.h new file mode 100644 index 0000000..2244bc6 --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/netinet_in_systm.h @@ -0,0 +1,44 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: netinet/in_systm.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)in_systm.h 1.8 88/08/19 SMI; from UCB 7.1 6/5/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +#ifndef __UNIX_NETINET_IN_SYSTM_H +#define __UNIX_NETINET_IN_SYSTM_H + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +typedef u_short n_short; /* short as received from the net */ +typedef u_long n_long; /* long as received from the net */ + +typedef u_long n_time; /* ms since 00:00 GMT, byte rev */ + +#endif /*!__UNIX_NETINET_IN_SYSTM_H*/ diff --git a/sdk-3.1/include/Core/System/Unix/netinet_ip.h b/sdk-3.1/include/Core/System/Unix/netinet_ip.h new file mode 100644 index 0000000..b4505ea --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/netinet_ip.h @@ -0,0 +1,134 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: netinet/ip.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)ip.h 1.13 88/08/19 SMI; from UCB 7.6.1.1 3/15/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ + +#ifndef __UNIX_NETINET_IP_H +#define __UNIX_NETINET_IP_H + +#define IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + * + * We declare ip_len and ip_off to be short, rather than u_short + * pragmatically since otherwise unsigned comparisons can result + * against negative integers quite easily, and fail in subtle ways. + */ +struct ip { + u_char ip_v:4, /* version */ + ip_hl:4; /* header length */ + u_char ip_tos; /* type of service */ + short ip_len; /* total length */ + u_short ip_id; /* identification */ + short ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + u_char ipt_code; /* IPOPT_TS */ + u_char ipt_len; /* size of structure (variable) */ + u_char ipt_ptr; /* index of current entry */ + u_char ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ + union ipt_timestamp { + n_long ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + n_long ipt_time; + } ipt_ta[1]; + } ipt_timestamp; +}; + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 2 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +#endif /*!__UNIX_NETINET_IP_H*/ diff --git a/sdk-3.1/include/Core/System/Unix/netinet_tcp.h b/sdk-3.1/include/Core/System/Unix/netinet_tcp.h new file mode 100644 index 0000000..be30218 --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/netinet_tcp.h @@ -0,0 +1,71 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: netinet/tcp.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)tcp.h 1.11 88/08/19 SMI; from UCB 7.2 10/28/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __UNIXTCP_H__ +#define __UNIXTCP_H__ + +typedef DWord tcp_seq; +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + Word th_sport; /* source port */ + Word th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ + Byte th_off:4, /* data offset */ + th_x2:4; /* (unused) */ + Byte th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + Word th_win; /* window */ + Word th_sum; /* checksum */ + Word th_urp; /* urgent pointer */ +}; + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + */ +#ifdef lint +#define TCP_MSS 536 +#else +#define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) +#endif + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY netSocketOptTCPNoDelay /* don't delay send to coalesce packets */ +#define TCP_MAXSEG netSocketOptTCPMaxSeg /* set maximum segment size */ + +#endif /*!__UNIXTCP_H__*/ diff --git a/sdk-3.1/include/Core/System/Unix/sys_errno.h b/sdk-3.1/include/Core/System/Unix/sys_errno.h new file mode 100644 index 0000000..3a06a32 --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/sys_errno.h @@ -0,0 +1,148 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/errno.h + * AUTHOR: Ron Marianetti 5/23/96 + * + * DESCRIPTION: + * This module contains the equivalent of the unix header + * for use in Pilot applications that wish to use the Berkeley sockets API + * + **********************************************************************/ +/* @(#)errno.h 2.14 90/01/23 SMI; from UCB 4.1 82/12/28 */ + +/* + * If error codes are added or changed here, they should be updated in + * /usr/src/lib/libc/gen/common/errlst.c as well. + */ + +/* + * Error codes. DOLATER.... map these to Net error codes.... + */ + +#ifndef _sys_errno_h +#define _sys_errno_h + +#define EPERM 1 /* Not owner */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR netErrTimeout /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No children */ +#define EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Not enough core */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Mount device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory*/ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ + +/* math software */ +#define EDOM 33 /* Argument too large */ +#define ERANGE 34 /* Result too large */ + +/* non-blocking and interrupt i/o */ +#define EWOULDBLOCK netErrWouldBlock /* Operation would block */ +#define EINPROGRESS netErrSocketBusy /* Operation now in progress */ +#define EALREADY netErrAlreadyInProgress /* Operation already in progress */ +/* ipc/network software */ + + /* argument errors */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported on socket */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by proto +col family */ +#define EADDRINUSE netErrPortInUse /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ + + /* operational errors */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH netErrNoInterfaces /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN netErrSocketAlreadyConnected /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT netErrTimeout /* Connection timed out */ +#define ECONNREFUSED 61 /* Connection refused */ + + /* */ +#define ELOOP 62 /* Too many levels of symbolic links */ +#define ENAMETOOLONG 63 /* File name too long */ + +/* should be rearranged */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ + +/* quotas & mush */ +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disc quota exceeded */ + +/* Network File System */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ + +/* streams */ +#define ENOSTR 72 /* Device is not a stream */ +#define ETIME 73 /* Timer expired */ +#define ENOSR 74 /* Out of streams resources */ +#define ENOMSG 75 /* No message of desired type */ +#define EBADMSG 76 /* Trying to read unreadable message */ + +/* SystemV IPC */ +#define EIDRM 77 /* Identifier removed */ + +/* SystemV Record Locking */ +#define EDEADLK 78 /* Deadlock condition. */ +#define ENOLCK 79 /* No record locks available. */ + +/* RFS */ +#define ENONET 80 /* Machine is not on the network */ +#define ERREMOTE 81 /* Object is remote */ +#define ENOLINK 82 /* the link has been severed */ +#define EADV 83 /* advertise error */ +#define ESRMNT 84 /* srmount error */ +#define ECOMM 85 /* Communication error on send */ +#define EPROTO 86 /* Protocol error */ +#define EMULTIHOP 87 /* multihop attempted */ +#define EDOTDOT 88 /* Cross mount point (not an error) */ +#define EREMCHG 89 /* Remote address changed */ + +/* POSIX */ +#define ENOSYS 90 /* function not implemented */ + +#endif /*!_sys_errno_h*/ diff --git a/sdk-3.1/include/Core/System/Unix/sys_socket.h b/sdk-3.1/include/Core/System/Unix/sys_socket.h new file mode 100644 index 0000000..5967c5e --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/sys_socket.h @@ -0,0 +1,290 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/socket.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +#ifndef __SOCKET_H__ +#define __SOCKET_H__ + +// Include System headers +#include + +// Include the Pilot Net Manager defines +#include + +// Include other Unix headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// This is a set of unix calls that get stubbed out or replaced by +// PilotOS calls. +// +// Although these don't really "belong" here, it seems like the best solution +// rather than having a ton of other unix like header files that don't +// provide all the functionality that unix does. +#define sleep(x) SysTaskDelay(x*sysTicksPerSecond) +#define isatty(x) 1 +#define fork() -1 // can't support fork +#define abort(x) + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB +#define getenv(x) 0 +#endif + +/*=================================================================== + * Definitions related to sockets: types, address families, options. + ===================================================================*/ + +/* + * Types + */ +#define SOCK_STREAM netSocketTypeStream /* stream socket */ +#define SOCK_DGRAM netSocketTypeDatagram /* datagram socket */ +#define SOCK_RAW netSocketTypeRaw /* raw-protocol interface */ +#define SOCK_RDM netSocketTypeReliableMsg /* reliable message */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG netSocketOptSockDebug /* turn on debugging info recording */ +#define SO_ACCEPTCONN netSocketOptSockAcceptConn /* socket has had listen() */ +#define SO_REUSEADDR netSocketOptSockReuseAddr /* allow local address reuse */ +#define SO_KEEPALIVE netSocketOptSockKeepAlive /* keep connections alive */ +#define SO_DONTROUTE netSocketOptSockDontRoute /* just use interface addresses */ +#define SO_BROADCAST netSocketOptSockBroadcast /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK netSocketOptSockUseLoopback /* bypass hardware when possible */ +#define SO_LINGER netSocketOptSockLinger /* linger on close if data present */ +#define SO_OOBINLINE netSocketOptSockOOBInLine /* leave received OOB data in line */ +/* + * N.B.: The following definition is present only for compatibility + * with release 3.0. It will disappear in later releases. + */ +#define SO_DONTLINGER (~SO_LINGER) /* ~SO_LINGER */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF netSocketOptSockSndBufSize /* send buffer size */ +#define SO_RCVBUF netSocketOptSockRcvBufSize /* receive buffer size */ +#define SO_SNDLOWAT netSocketOptSockSndLowWater /* send low-water mark */ +#define SO_RCVLOWAT netSocketOptSockRcvLowWater /* receive low-water mark */ +#define SO_SNDTIMEO netSocketOptSockSndTimeout /* send timeout */ +#define SO_RCVTIMEO netSocketOptSockRcvTimeout /* receive timeout */ +#define SO_ERROR netSocketOptSockErrorStatus /* get error status and clear */ +#define SO_TYPE netSocketOptSockSocketType /* get socket type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + SWord l_onoff; /* option on/off */ + SWord l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET netSocketOptLevelSocket /* options for socket level */ + +/* + * Address families. + */ +#define AF_INET netSocketAddrINET /* internetwork: UDP, TCP, etc. */ +#define AF_RAW netSocketAddrRaw /* raw access to data-link interface */ + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + SWord sa_family; /* address family */ + Byte sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + Word sp_family; /* address family */ + Word sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_INET AF_INET +#define PF_RAW AF_RAW + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct msghdr { + CharPtr msg_name; /* optional address */ + SWord msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + SWord msg_iovlen; /* # elements in msg_iov */ + CharPtr msg_accrights; /* access rights sent/received */ + SWord msg_accrightslen; + }; + +#define MSG_OOB netIOFlagOutOfBand /* process out-of-band data */ +#define MSG_PEEK netIOFlagPeek /* peek at incoming message */ +#define MSG_DONTROUTE netIOFlagDontRoute /* send without using routing tables */ + +#define MSG_MAXIOVLEN netIOVecMaxLen + + +//=========================================================================== +// Globals used by the Sockets API. These are declard in the Socket.c module +// which must be linked in with any application that uses the sockets API. +//=========================================================================== +extern Err errno; +extern Long AppNetTimeout; +extern Char AppINETString[]; +extern NetHostInfoBufType AppHostInfo; +extern NetServInfoBufType AppServInfo; +extern Word AppNetRefnum; + + +//=========================================================================== +// Macros that convert BSD Sockets calls into native Pilot calls. +//=========================================================================== +#define accept(socket,addr,addrlen) \ + NetLibSocketAccept(AppNetRefnum,socket,(NetSocketAddrType*)addr,(SWordPtr)addrlen,AppNetTimeout,&errno) + +#define bind(socket,localaddr,addrlen) \ + NetLibSocketBind(AppNetRefnum, socket,(NetSocketAddrType*)localaddr,addrlen,AppNetTimeout,&errno) + +#define close(socket) \ + NetLibSocketClose(AppNetRefnum, socket,AppNetTimeout,&errno) + +#define connect(socket,addr,addrlen) \ + NetLibSocketConnect(AppNetRefnum, socket,(NetSocketAddrType*)addr,addrlen,AppNetTimeout,&errno) + +#define getsockopt(socket,level,opt,optvalP,optlenP) \ + NetLibSocketOptionGet(AppNetRefnum, socket,level,opt,optvalP,(WordPtr)optlenP,AppNetTimeout,&errno) + +#define listen(socket,queuelen) \ + NetLibSocketListen(AppNetRefnum, socket,queuelen,AppNetTimeout,&errno) + +#define read(socket,buffer,buflen) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,0,0,0,AppNetTimeout,&errno) + +#define recv(socket,buffer,buflen,flags) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,flags,0,0,AppNetTimeout,&errno) + +#define recvfrom(socket,buffer,buflen,flags,from,fromlen) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,flags,from,(WordPtr)fromlen,AppNetTimeout,&errno) + +#define recvmsg(socket,msg,flags) \ + NetLibReceivePB(AppNetRefnum, socket,(NetIOParamType*)msg,flags,AppNetTimeout,&errno) + +#define send(socket,buf,buflen,flags) \ + NetLibSend(AppNetRefnum, socket,buf,buflen,flags,0,0,AppNetTimeout,&errno) + +#define sendmsg(socket,msg,flags) \ + NetLibSendPB(AppNetRefnum, socket,(NetIOParamType*)msg,flags,AppNetTimeout,&errno) + +#define sendto(socket,buf,buflen,flags,to,tolen) \ + NetLibSend(AppNetRefnum, socket,buf,buflen,flags,to,tolen,AppNetTimeout,&errno) + +#define setsockopt(socket,level,opt,optvalP,optlen) \ + NetLibSocketOptionSet(AppNetRefnum, socket,level,opt,optvalP,optlen,AppNetTimeout,&errno) + +#define shutdown(socket,direction) \ + NetLibSocketShutdown(AppNetRefnum, socket,direction,AppNetTimeout,&errno) + +#define socket(domain,type,protocol) \ + NetLibSocketOpen(AppNetRefnum, domain,type,protocol,AppNetTimeout,&errno) + +#define write(socket,buf,buflen) \ + NetLibSend(AppNetRefnum, socket,(const VoidPtr)buf,buflen,0,0,0,AppNetTimeout,&errno) + +#define getpeername(socket,nameP,nameLenP) \ + NetLibSocketAddr(AppNetRefnum, socket, 0, 0, (NetSocketAddrType*)nameP, (SWordPtr)nameLenP, AppNetTimeout, &errno) + +#define getsockname(socket,nameP,nameLenP) \ + NetLibSocketAddr(AppNetRefnum, socket, (NetSocketAddrType*)nameP, (SWordPtr)nameLenP, 0, 0, AppNetTimeout, &errno) + + +//=========================================================================== +// Sockets API calls that go through glue +//=========================================================================== +SWord getdomainname(CharPtr nameP, SWord namelen); + +SWord setdomainname(CharPtr nameP, SWord namelen); + +SWord gethostname(CharPtr nameP, SWord namelen); + +SWord sethostname(CharPtr nameP, SWord namelen); + +SWord select(SWord width, fd_set* readfds, fd_set* writefds, + fd_set* exceptfds, struct timeval* timeout); + +SWord gettimeofday(struct timeval* tp, struct timezone* tzp); + +SWord settimeofday(struct timeval* tp, struct timezone* tzp); + + + +VoidPtr MemCalloc(DWord nmemb, DWord size); + +VoidPtr MemRealloc(VoidPtr p, DWord size); + + + +//=========================================================================== +// These are high level convenience functions. +//=========================================================================== +// Open up a TCP socket and connect to the given host. If port is 0, the port +// number will be looked up by the serviceName parameter. Returns socket +// descriptor or -1 on error +NetSocketRef NetUTCPOpen(CharPtr hostName, CharPtr serviceName, SWord port); + +// Read N bytes from a descriptor. This call automatically makes repeated read +// calls to the socket until all N bytes have been received +// Returns number of bytes read or -1 if error +SDWord NetUReadN(NetSocketRef fd, BytePtr bufP, DWord numBytes); + + +// Write N bytes to a descriptor. This call automatically makes repeated write +// calls to the socket until all N bytes have been sent +// Returns number of bytes written or -1 if error +SDWord NetUWriteN(NetSocketRef fd, BytePtr bufP, DWord numBytes); + + + + + +#endif /*!__SOCKET_H__*/ diff --git a/sdk-3.1/include/Core/System/Unix/sys_socketvar.h b/sdk-3.1/include/Core/System/Unix/sys_socketvar.h new file mode 100644 index 0000000..6df7ceb --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/sys_socketvar.h @@ -0,0 +1,40 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/socketvar.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +#ifndef __UNIXSOCKETVAR_H__ +#define __UNIXSOCKETVAR_H__ + + +/* + * Socket state bits. + */ +#define SS_NOFDREF 0x001 /* no file table ref any more */ +#define SS_ISCONNECTED 0x002 /* socket connected to a peer */ +#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */ +#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ +#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */ +#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ +#define SS_RCVATMARK 0x040 /* at mark on input */ + +#define SS_PRIV 0x080 /* privileged for broadcast, raw... */ +#define SS_NBIO 0x100 /* non-blocking ops */ +#define SS_ASYNC 0x200 /* async i/o notify */ +#define SS_PIPE 0x400 /* pipe behavior for POSIX & SVID */ + +#endif // __UNIXSOCKETVAR_H__ + + + + diff --git a/sdk-3.1/include/Core/System/Unix/sys_time.h b/sdk-3.1/include/Core/System/Unix/sys_time.h new file mode 100644 index 0000000..b0ec800 --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/sys_time.h @@ -0,0 +1,48 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/time.h + * AUTHOR: Ron Marianetti 5/23/96 + * + * DESCRIPTION: + * This module contains the equivalent of the unix header + * for use in Pilot applications that wish to use the Berkeley sockets API + * + **********************************************************************/ +#ifndef __UNIXTIME_H__ +#define __UNIXTIME_H__ + + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ + +struct timeval { + SDWord tv_sec; /* seconds */ + SDWord tv_usec; /* and microseconds */ +}; + + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ +#define DST_GB 7 /* Great Britain and Eire */ +#define DST_RUM 8 /* Rumania */ +#define DST_TUR 9 /* Turkey */ +#define DST_AUSTALT 10 /* Australian style with shift in 1986 */ + + +#endif __UNIXTIME_H__ diff --git a/sdk-3.1/include/Core/System/Unix/sys_types.h b/sdk-3.1/include/Core/System/Unix/sys_types.h new file mode 100644 index 0000000..77146ca --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/sys_types.h @@ -0,0 +1,64 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/types.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the Pilot equivalent of the "standard" unix + * header file + * + **********************************************************************/ +#ifndef __UNIXTYPES_H__ +#define __UNIXTYPES_H__ + +#include // Include Pilot Net Manager equates + + + +// Common Unix types +typedef Byte u_char; +typedef Word u_short; +typedef UInt u_int; +typedef DWord u_long; + +typedef Word ushort; /* System V compatibility */ +typedef UInt uint; /* System V compatibility */ + +/* Don't let PilotStdio.h break us */ +#undef FILE +#undef size_t + +// Define this so we don't get duplicate define warnings. +#define __size_t__ +typedef DWord size_t; // must be signed for some unix apps +//typedef DWord time_t; + +typedef Byte FILE; + +// File Descriptor Utilities, Pilot native forms in +typedef NetFDSetType fd_set; +#define FD_SETSIZE netFDSetSize + +#define FD_SET(n,p) netFDSet(n,p) +#define FD_CLR(n,p) netFDClr(n,p) +#define FD_ISSET(n,p) netFDIsSet(n,p) +#define FD_ZERO(p) netFDZero(p) + + +// Basic functions +#define bcopy(b1,b2,len) \ + MemMove(b2,b1,len) + +#define bzero(b,len) \ + MemSet(b,len,0) + +#define bcmp(b1,b2,len) \ + MemCmp(b1,b2,len) + + + +#endif //__UNIXTYPES_H__ diff --git a/sdk-3.1/include/Core/System/Unix/sys_uio.h b/sdk-3.1/include/Core/System/Unix/sys_uio.h new file mode 100644 index 0000000..add6ecb --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/sys_uio.h @@ -0,0 +1,34 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: sys/uio.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ +/* @(#)uio.h 2.9 89/06/27 SMI; from UCB 7.1 6/4/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ +#ifndef __UNIXUIO_H__ +#define __UNIXUIO_H__ + + +struct iovec { + BytePtr iov_base; + Word iov_len; +}; + + + +#endif /*__UNIXUIO_H__*/ + diff --git a/sdk-3.1/include/Core/System/Unix/unix_fcntl.h b/sdk-3.1/include/Core/System/Unix/unix_fcntl.h new file mode 100644 index 0000000..820ff34 --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/unix_fcntl.h @@ -0,0 +1,72 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/fcntl.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + +/* @(#)fcntlcom.h 1.13 91/06/18 SMI; from UCB fcntl.h 5.2 1/8/86 */ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __fcntl_h +#define __fcntl_h + +/* + * Rewack the FXXXXX values as _FXXXX so that _POSIX_SOURCE works. + */ +#define _FOPEN (-1) /* from sys/file.h, kernel use only */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FSETBLK 0x0010 /* use block offsets */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ +#define _FMARK 0x10000 /* internal; mark during gc() */ +#define _FDEFER 0x20000 /* internal; defer for next gc pass */ + + +/* + * Flags that work for fcntl(fd, F_SETFL, FXXXX) + */ +#define FAPPEND _FAPPEND +#define FSYNC _FSYNC +#define FASYNC _FASYNC +#define FNBIO _FNBIO +#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */ +#define FNDELAY _FNDELAY + + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags (close on exec) */ +#define F_SETFD 2 /* Set fildes flags (close on exec) */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ + +/* Prototypes */ +#define fcntl(a,b,c) NetFCntl(a,b,c) +SWord NetFCntl(SWord fd, SWord cmd, SWord arg); + +#endif /* !__fcntl_h */ diff --git a/sdk-3.1/include/Core/System/Unix/unix_netdb.h b/sdk-3.1/include/Core/System/Unix/unix_netdb.h new file mode 100644 index 0000000..08f166b --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/unix_netdb.h @@ -0,0 +1,117 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: netdb.h + * AUTHOR: Ron Marianetti 2/14/96 + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + +/* @(#)netdb.h 1.11 88/08/19 SMI from UCB 5.9 4/5/88 */ +/* + * Copyright (c) 1980,1983,1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + + + +#ifndef __UNIXNETDB_H__ +#define __UNIXNETDB_H__ + + +/* + * Structures returned by network data base library. + * All addresses are supplied in host order, and + * returned in network order (suitable for use in system calls). + */ + +struct hostent { + Char *h_name; /* official name of host */ + Char **h_aliases; /* alias list */ + Word h_addrtype; /* host address type */ + Word h_length; /* length of address */ + Char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + Char *n_name; /* official name of net */ + Char **n_aliases; /* alias list */ + Word n_addrtype; /* net address type */ + DWord n_net; /* network # */ +}; + +struct servent { + Char *s_name; /* official service name */ + Char **s_aliases; /* alias list */ + Word s_port; /* port # */ + Char *s_proto; /* protocol to use */ +}; + +struct protoent { + Char *p_name; /* official protocol name */ + Char **p_aliases; /* alias list */ + Word p_proto; /* protocol # */ +}; + +struct rpcent { + Char *r_name; /* name of server for this rpc program */ + Char **r_aliases; /* alias list */ + SWord r_number; /* rpc program number */ +}; + + +// Supported calls +#define gethostbyname(nameP) \ + ((struct hostent*)NetLibGetHostByName(AppNetRefnum, nameP,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define gethostbyaddr(addr,len,type) \ + ((struct hostent*)NetLibGetHostByAddr(AppNetRefnum, (BytePtr)addr,len,type,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define getservbyname(serv,proto) \ + ((struct servent*)NetLibGetServByName(AppNetRefnum, serv,proto,&AppServInfo,AppNetTimeout,&h_errno)) + + +// Unsupported calls +// struct hostent *gethostent(); +// struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); +// struct servent *getservbyport(), *getservent(); +// struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); +// struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver) + */ + +extern Err h_errno; + +#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + + +#endif // __UNIXNETDB_H__ + + + diff --git a/sdk-3.1/include/Core/System/Unix/unix_stdarg.h b/sdk-3.1/include/Core/System/Unix/unix_stdarg.h new file mode 100644 index 0000000..d76f254 --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/unix_stdarg.h @@ -0,0 +1,38 @@ +/*********************************************************************** + * + * Copyright (c) Palm Computing 1999 -- All Rights Reserved + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/stdarg.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + + +#if (defined(EMULATION_LEVEL) && (EMULATION_LEVEL != EMULATION_NONE)) || defined(__GNUC__) + +#include // use the native stdarg + +#else + +#ifndef __stdarg_h +#define __stdarg_h + +#ifndef __va_list__ + #define __va_list__ + typedef char * va_list; // from +#endif /* __va_list__ */ + +#define __va_start(parm) (va_list) (&parm + 1) + +#define va_start(ap, parm) ap = __va_start(parm) +#define va_end(ap) + +#define va_arg(ap, type) (* (((type *) (ap += sizeof(type))) - 1) ) + +#endif /* !__stdarg_h */ +#endif /* EMULATION_LEVEL != EMULATION_NONE */ diff --git a/sdk-3.1/include/Core/System/Unix/unix_stdio.h b/sdk-3.1/include/Core/System/Unix/unix_stdio.h new file mode 100644 index 0000000..875c90f --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/unix_stdio.h @@ -0,0 +1,74 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/stdio.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + + +#ifndef __stdio_h +#define __stdio_h + +#include + +#define EOF -1 +#define STDIN_FILENO sysFileDescStdIn + + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB + #define sprintf StrPrintF + #define vsprintf(x,y,z) StrVPrintF(x,(const CharPtr)y,z) + +#else + int vsprintf(char *, const char *, _Va_list); + +#endif + + + +// The following are macros that simply substitute an error code +// for functions which have no equivalent in the PilotOS. To +// ignore these, #define IGNORE_STDIO_STUBS ahead of this header +#ifndef IGNORE_STDIO_STUBS +#define stderr ((unsigned char*)-1) +#define stdout ((unsigned char*)-1) +#define stdin ((char*)-1) +#define STDOUT_FILENO -1 + +#define fclose(x) (-1) +#define fopen(x,y) (0) +#define tmpnam(x) (0) +#define S_ISREG(x) (0) + +#define fflush(x) 0 +#define fread(a,b,c,d) (0) +#define fwrite(a,b,c,d) (0) +#define ferror(x) (-1) + +#define unlink(s) (-1) +#define rmdir(x) (-1) +#define mkdir(x) (-1) +#define rename(x,y) (-1) +#define open(x,y) (-1) +#define getcwd(x,y) (0) + +#endif //IGNORE_STDIO_STUBS + + +// Function prototypes +int sscanf(const char *, const char *, ...); + + +#endif /* !__stdio_h */ diff --git a/sdk-3.1/include/Core/System/Unix/unix_stdlib.h b/sdk-3.1/include/Core/System/Unix/unix_stdlib.h new file mode 100644 index 0000000..3d4825a --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/unix_stdlib.h @@ -0,0 +1,33 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/stdio.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + + +#ifndef __stdlib_h +#define __stdlib_h + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB +#define malloc(x) MemPtrNew(x) +#define calloc(x,y) MemCalloc(x,y) +#define realloc(x,y) MemRealloc(x,y) +#define free(x) MemPtrFree(x) +#define atoi(x) StrAToI(x) +#define atol(x) StrAToI(x) +#endif + +#endif /* !__stdlib_h */ diff --git a/sdk-3.1/include/Core/System/Unix/unix_string.h b/sdk-3.1/include/Core/System/Unix/unix_string.h new file mode 100644 index 0000000..a7db055 --- /dev/null +++ b/sdk-3.1/include/Core/System/Unix/unix_string.h @@ -0,0 +1,38 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot TCP/IP Library + * FILE: unix/string.h + * + * DESCRIPTION: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + **********************************************************************/ + + +#ifndef __string_h +#define __string_h + +#include + + +#define strcpy(x,y) StrCopy((Char*)x,(Char*)y) +#define strncpy(x,y,z) StrNCopy(x,y,z) +#define strcmp(x,y) StrCompare(x,y) +#define strcat(x,y) StrCat(x,y) +#define strlen(x) StrLen((Char*)x) +#define strchr(x,y) StrChr(x,y) +#define strstr(x,y) StrStr(x,y) + +#define memcpy(x,y,z) (MemMove(x,(VoidPtr)y,z) ? x : x) +#define memset(x,y,z) (MemSet(x,z,y)) +#define memcmp(x,y,z) (MemCmp(x,y,z)) +#define index(x,y) StrChr(x,y) + + + +#endif /* !__string_h */ diff --git a/sdk-3.1/include/Core/UI/AboutBox.h b/sdk-3.1/include/Core/UI/AboutBox.h new file mode 100644 index 0000000..83e26a8 --- /dev/null +++ b/sdk-3.1/include/Core/UI/AboutBox.h @@ -0,0 +1,30 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: AboutBox.h + * AUTHOR: Christopher Raff: October 25th, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines About Box routines + * + ***********************************************************************/ +#ifndef __ABOUTBOX_H__ +#define __ABOUTBOX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +extern void AbtShowAbout (const DWord creator) + SYS_TRAP(sysTrapAbtShowAbout); + +#ifdef __cplusplus +} +#endif + +#endif // __ABOUTBOX_H__ diff --git a/sdk-3.1/include/Core/UI/Category.h b/sdk-3.1/include/Core/UI/Category.h new file mode 100644 index 0000000..fc03787 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Category.h @@ -0,0 +1,100 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Category.h + * AUTHOR: Art Lamb: March 7, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines category structures and routines. + * + ***********************************************************************/ +#ifndef __CATEGORY_H__ +#define __CATEGORY_H__ + + +typedef struct { + Word renamedCategories; + Char categoryLabels [dmRecNumCategories] [dmCategoryLength]; + Byte categoryUniqIDs[dmRecNumCategories]; + Byte lastUniqID; // Uniq IDs generated by the device are between + // 0 - 127. Those from the PC are 128 - 255. +} AppInfoType; + +typedef AppInfoType * AppInfoPtr; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CategoryCreateListV10 (const DmOpenRef db, const ListPtr lst, + const Word currentCategory, const Boolean showAll) + SYS_TRAP(sysTrapCategoryCreateListV10); + +extern void CategoryCreateList (const DmOpenRef db, const ListPtr listP, + const Word currentCategory, const Boolean showAll, + const Boolean showUneditables, const Byte numUneditableCategories, + const DWord editingStrID, const Boolean resizeList) + SYS_TRAP(sysTrapCategoryCreateList); + + +extern void CategoryFreeListV10 (const DmOpenRef db, const ListPtr lst) + SYS_TRAP(sysTrapCategoryFreeListV10); + +extern void CategoryFreeList (const DmOpenRef db, const ListPtr listP, + const Boolean showAll, const DWord editingStrID) + SYS_TRAP(sysTrapCategoryFreeList); + +extern Word CategoryFind (const DmOpenRef db, const Char * const name) + SYS_TRAP(sysTrapCategoryFind); + +extern void CategoryGetName (const DmOpenRef db, const Word index, Char * const name) + SYS_TRAP(sysTrapCategoryGetName); + +extern Boolean CategoryEditV10 (const DmOpenRef db, const WordPtr category) + SYS_TRAP(sysTrapCategoryEditV10); + +extern Boolean CategoryEditV20 (const DmOpenRef db, const WordPtr category, + const DWord titleStrID) + SYS_TRAP(sysTrapCategoryEditV20); + +extern Boolean CategoryEdit (const DmOpenRef db, const WordPtr category, + const DWord titleStrID, const Byte numUneditableCategories) + SYS_TRAP(sysTrapCategoryEdit); + +extern Boolean CategorySelectV10 (const DmOpenRef db, const FormPtr frm, + const Word ctlID, const Word lstID, const Boolean title, const WordPtr categoryP, + CharPtr categoryName) + SYS_TRAP(sysTrapCategorySelectV10); + +extern Boolean CategorySelect (const DmOpenRef db, const FormPtr frm, + const Word ctlID, const Word lstID, const Boolean title, const WordPtr categoryP, + CharPtr categoryName, const Byte numUneditableCategories, DWord editingStrID) + SYS_TRAP(sysTrapCategorySelect); + +extern Word CategoryGetNext (const DmOpenRef db, Word index) + SYS_TRAP(sysTrapCategoryGetNext); + +extern void CategorySetTriggerLabel (const ControlPtr ctl, CharPtr name) + SYS_TRAP(sysTrapCategorySetTriggerLabel); + +extern void CategoryTruncateName (CharPtr name, const Word maxWidth) + SYS_TRAP(sysTrapCategoryTruncateName); + +extern void CategoryInitialize (AppInfoPtr appInfoP, const Word localizedAppInfoStrID) + SYS_TRAP(sysTrapCategoryInitialize); + + +extern void CategorySetName (const DmOpenRef db, Word index, const CharPtr nameP) + SYS_TRAP(sysTrapCategorySetName); + +#ifdef __cplusplus +} +#endif + +#endif // __CATEGORY_H__ diff --git a/sdk-3.1/include/Core/UI/CharAttr.h b/sdk-3.1/include/Core/UI/CharAttr.h new file mode 100644 index 0000000..71f8746 --- /dev/null +++ b/sdk-3.1/include/Core/UI/CharAttr.h @@ -0,0 +1,102 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: CharAttr.h + * AUTHOR: Art Lamb: April 21, 1995 + * + * DECLARER: Toolbox + * + * DESCRIPTION: + * This file defines character classification and character + * conversion macros + * + **********************************************************************/ + +#ifndef _CHAR_ATTR_H +#define _CHAR_ATTR_H + +#ifdef NON_INTERNATIONAL +// Remember that sizeof(0x0D) == 2 because 0x0D is treated like an int +#define sizeofchar(c) sizeof((char) (c)) +#define lastAsciiChr 0x00FF +#endif + +#define sizeOf7BitChar(c) 1 + +// Character attribute code bits +#define _XA 0x200 // extra alphabetic +#define _XS 0x100 // extra space +#define _BB 0x80 // BEL, BS, etc. +#define _CN 0x40 // CR, FF, HT, NL, VT +#define _DI 0x20 // '0'-'9' +#define _LO 0x10 // 'a'-'z' and lowercase extended chars. +#define _PU 0x08 // punctuation +#define _SP 0x04 // space +#define _UP 0x02 // 'A'-'Z' and uppercase extended chars. +#define _XD 0x01 // '0'-'9', 'A'-'F', 'a'-'f' + + +// Character classification macros. +// If these are used to test characters from events (keyDownEvent) +// IsAscii should be used first. Note that the TxtXXX() versions +// should be used instead; these are only included for backwards +// compatibility. + +#ifdef NON_INTERNATIONAL + +#define IsAscii(c) (c <= 255) +#define IsAlNum(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_UP|_XA)) +#define IsAlpha(attr,c) (attr[(Byte)(c)] & (_LO|_UP|_XA)) +#define IsCntrl(attr,c) (attr[(Byte)(c)] & (_BB|_CN)) +#define IsDigit(attr,c) (attr[(Byte)(c)] & _DI) +#define IsGraph(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_PU|_UP|_XA)) +#define IsLower(attr,c) (attr[(Byte)(c)] & _LO) +#define IsPrint(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_PU|_SP|_UP|_XA)) +#define IsPunct(attr,c) (attr[(Byte)(c)] & _PU) +#define IsSpace(attr,c) (attr[(Byte)(c)] & (_CN|_SP|_XS)) +#define IsUpper(attr,c) (attr[(Byte)(c)] & _UP) +#define IsHex(attr,c) (attr[(Byte)(c)] & _XD) +#define IsDelim(attr,c) (attr[(Byte)(c)] & _SP|_PU) + +#endif + +// This macro is deprecated because it relies on character code ranges, versus checking +// to ensure that the keydown event has the command bit set in the modifiers field. Use +// the TxtCharIsHardKey macro found in TextMgr.h + +#ifdef NON_INTERNATIONAL +#define ChrIsHardKey(c) ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr)) +#else +#define ChrIsHardKey(c) _Obsolete__use_TxtCharIsHardKey +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +// These routines have been replaced by new Text Manager routines found +// in TextMgr.h. + +#ifdef NON_INTERNATIONAL + +WordPtr GetCharAttr (void) + SYS_TRAP(sysTrapGetCharAttr); + +BytePtr GetCharSortValue (void) + SYS_TRAP(sysTrapGetCharSortValue); + +BytePtr GetCharCaselessValue (void) + SYS_TRAP(sysTrapGetCharCaselessValue); + +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* _CHAR_ATTR_H */ diff --git a/sdk-3.1/include/Core/UI/Chars.h b/sdk-3.1/include/Core/UI/Chars.h new file mode 100644 index 0000000..29424a2 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Chars.h @@ -0,0 +1,346 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Chars.h + * AUTHOR: Roger Flores: November 3, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the characters in fonts. + * + **********************************************************************/ +#ifndef __CHARS_H__ +#define __CHARS_H__ + +// Standard Unicode 2.0 names for the ascii characters. These exist in +// all of the text fonts, no matter what character encoding is being +// used by PalmOS. + +#define chrNull 0x0000 +#define chrStartOfHeading 0x0001 +#define chrStartOfText 0x0002 +#define chrEndOfText 0x0003 +#define chrEndOfTransmission 0x0004 +#define chrEnquiry 0x0005 +#define chrAcknowledge 0x0006 +#define chrBell 0x0007 +#define chrBackspace 0x0008 +#define chrHorizontalTabulation 0x0009 +#define chrLineFeed 0x000A +#define chrVerticalTabulation 0x000B +#define chrFormFeed 0x000C +#define chrCarriageReturn 0x000D +#define chrShiftOut 0x000E +#define chrShiftIn 0x000F +#define chrDataLinkEscape 0x0010 +#define chrDeviceControlOne 0x0011 +#define chrDeviceControlTwo 0x0012 +#define chrDeviceControlThree 0x0013 +#define chrDeviceControlFour 0x0014 +#define chrNegativeAcknowledge 0x0015 +#define chrSynchronousIdle 0x0016 +#define chrEndOfTransmissionBlock 0x0017 +#define chrCancel 0x0018 +#define chrEndOfMedium 0x0019 +#define chrSubstitute 0x001A +#define chrEscape 0x001B +#define chrFileSeparator 0x001C +#define chrGroupSeparator 0x001D +#define chrRecordSeparator 0x001E +#define chrUnitSeparator 0x001F +#define chrSpace 0x0020 +#define chrExclamationMark 0x0021 +#define chrQuotationMark 0x0022 +#define chrNumberSign 0x0023 +#define chrDollarSign 0x0024 +#define chrPercentSign 0x0025 +#define chrAmpersand 0x0026 +#define chrApostrophe 0x0027 +#define chrLeftParenthesis 0x0028 +#define chrRightParenthesis 0x0029 +#define chrAsterisk 0x002A +#define chrPlusSign 0x002B +#define chrComma 0x002C +#define chrHyphenMinus 0x002D +#define chrFullStop 0x002E +#define chrSolidus 0x002F +#define chrDigitZero 0x0030 +#define chrDigitOne 0x0031 +#define chrDigitTwo 0x0032 +#define chrDigitThree 0x0033 +#define chrDigitFour 0x0034 +#define chrDigitFive 0x0035 +#define chrDigitSix 0x0036 +#define chrDigitSeven 0x0037 +#define chrDigitEight 0x0038 +#define chrDigitNine 0x0039 +#define chrColon 0x003A +#define chrSemicolon 0x003B +#define chrLessThanSign 0x003C +#define chrEqualsSign 0x003D +#define chrGreaterThanSign 0x003E +#define chrQuestionMark 0x003F +#define chrCommercialAt 0x0040 +#define chrCapital_A 0x0041 +#define chrCapital_B 0x0042 +#define chrCapital_C 0x0043 +#define chrCapital_D 0x0044 +#define chrCapital_E 0x0045 +#define chrCapital_F 0x0046 +#define chrCapital_G 0x0047 +#define chrCapital_H 0x0048 +#define chrCapital_I 0x0049 +#define chrCapital_J 0x004A +#define chrCapital_K 0x004B +#define chrCapital_L 0x004C +#define chrCapital_M 0x004D +#define chrCapital_N 0x004E +#define chrCapital_O 0x004F +#define chrCapital_P 0x0050 +#define chrCapital_Q 0x0051 +#define chrCapital_R 0x0052 +#define chrCapital_S 0x0053 +#define chrCapital_T 0x0054 +#define chrCapital_U 0x0055 +#define chrCapital_V 0x0056 +#define chrCapital_W 0x0057 +#define chrCapital_X 0x0058 +#define chrCapital_Y 0x0059 +#define chrCapital_Z 0x005A +#define chrLeftSquareBracket 0x005B +// #define chrReverseSolidus 0x005C (not in Japanese fonts) +#define chrRightSquareBracket 0x005D +#define chrCircumflexAccent 0x005E +#define chrLowLine 0x005F +#define chrGraveAccent 0x0060 +#define chrSmall_A 0x0061 +#define chrSmall_B 0x0062 +#define chrSmall_C 0x0063 +#define chrSmall_D 0x0064 +#define chrSmall_E 0x0065 +#define chrSmall_F 0x0066 +#define chrSmall_G 0x0067 +#define chrSmall_H 0x0068 +#define chrSmall_I 0x0069 +#define chrSmall_J 0x006A +#define chrSmall_K 0x006B +#define chrSmall_L 0x006C +#define chrSmall_M 0x006D +#define chrSmall_N 0x006E +#define chrSmall_O 0x006F +#define chrSmall_P 0x0070 +#define chrSmall_Q 0x0071 +#define chrSmall_R 0x0072 +#define chrSmall_S 0x0073 +#define chrSmall_T 0x0074 +#define chrSmall_U 0x0075 +#define chrSmall_V 0x0076 +#define chrSmall_W 0x0077 +#define chrSmall_X 0x0078 +#define chrSmall_Y 0x0079 +#define chrSmall_Z 0x007A +#define chrLeftCurlyBracket 0x007B +#define chrVerticalLine 0x007C +#define chrRightCurlyBracket 0x007D +#define chrTilde 0x007E +#define chrDelete 0x007F + + +// Special meanings given to characters by the PalmOS +#define chrPageUp chrVerticalTabulation // 0x000B +#define chrPageDown chrFormFeed // 0x000C +#define chrOtaSecure chrDeviceControlFour // 0x0014 +#define chrOta chrNegativeAcknowledge // 0x0015 +#define chrCommandStroke chrSynchronousIdle // 0x0016 +#define chrShortcutStroke chrEndOfTransmissionBlock // 0x0017 +#define chrEllipsis chrCancel // 0x0018 +#define chrNumericSpace chrEndOfMedium // 0x0019 +#define chrLeftArrow chrFileSeparator // 0x001C +#define chrRightArrow chrGroupSeparator // 0x001D +#define chrUpArrow chrRecordSeparator // 0x001E +#define chrDownArrow chrUnitSeparator // 0x001F + + +// The following are key codes used for virtual events, like +// low battery warnings, etc. These keyboard events MUST +// have the commandKeyMask bit set in the modifiers in order +// to be recognized. +#define vchrLowBattery 0x0101 // Display low battery dialog +#define vchrEnterDebugger 0x0102 // Enter Debugger +#define vchrNextField 0x0103 // Go to next field in form +#define vchrStartConsole 0x0104 // Startup console task +#define vchrMenu 0x0105 // Ctl-A +#define vchrCommand 0x0106 // Ctl-C +#define vchrConfirm 0x0107 // Ctl-D +#define vchrLaunch 0x0108 // Ctl-E +#define vchrKeyboard 0x0109 // Ctl-F popup the keyboard in appropriate mode +#define vchrFind 0x010A +#define vchrCalc 0x010B +#define vchrPrevField 0x010C +#define vchrAlarm 0x010D // sent before displaying an alarm +#define vchrRonamatic 0x010E // stroke from graffiti area to top half of screen +#define vchrGraffitiReference 0x010F // popup the Graffiti reference +#define vchrKeyboardAlpha 0x0110 // popup the keyboard in alpha mode +#define vchrKeyboardNumeric 0x0111 // popup the keyboard in number mode +#define vchrLock 0x0112 // switch to the Security app and lock the device +#define vchrBacklight 0x0113 // toggle state of backlight +#define vchrAutoOff 0x0114 // power off due to inactivity timer +// Added for PalmOS 3.0 +#define vchrExgTest 0x0115 // put exchange Manager into test mode (&.t) +#define vchrSendData 0x0116 // Send data if possible +#define vchrIrReceive 0x0117 // Initiate an Ir receive manually (&.i) +// Added for PalmOS 3.1 +#define vchrTsm1 0x0118 // Text Services silk-screen button +#define vchrTsm2 0x0119 // Text Services silk-screen button +#define vchrTsm3 0x011A // Text Services silk-screen button +#define vchrTsm4 0x011B // Text Services silk-screen button + + +// The application launching buttons generate the following +// key codes and will also set the commandKeyMask bit in the +// modifiers field +#define vchrHardKeyMin 0x0200 +#define vchrHardKeyMax 0x02FF + +#define vchrHard1 0x0204 +#define vchrHard2 0x0205 +#define vchrHard3 0x0206 +#define vchrHard4 0x0207 +#define vchrHardPower 0x0208 +#define vchrHardCradle 0x0209 // Button on cradle pressed +#define vchrHardCradle2 0x020A // Button on cradle pressed and hwrDockInGeneric1 + // input on dock asserted (low). +#define vchrHardContrast 0x020B // Sumo's Contrast button + + + +// Old names for some of the characters. +#define nullChr chrNull // 0x0000 +#define backspaceChr chrBackspace // 0x0008 +#define tabChr chrHorizontalTabulation // 0x0009 +#define linefeedChr chrLineFeed // 0x000A +#define pageUpChr chrPageUp // 0x000B +#define pageDownChr chrPageDown // 0x000C +#define crChr chrCarriageReturn // 0x000D +#define returnChr chrCarriageReturn // 0x000D +#define escapeChr chrEscape // 0x001B +#define leftArrowChr chrLeftArrow // 0x001C +#define rightArrowChr chrRightArrow // 0x001D +#define upArrowChr chrUpArrow // 0x001E +#define downArrowChr chrDownArrow // 0x001F +#define spaceChr chrSpace // 0x0020 +#define quoteChr chrQuotationMark // 0x0022 '"' +#define commaChr chrComma // 0x002C ',' +#define periodChr chrFullStop // 0x002E '.' +#define colonChr chrColon // 0x003A ':' +#define lowBatteryChr vchrLowBattery // 0x0101 +#define enterDebuggerChr vchrEnterDebugger // 0x0102 +#define nextFieldChr vchrNextField // 0x0103 +#define startConsoleChr vchrStartConsole // 0x0104 +#define menuChr vchrMenu // 0x0105 +#define commandChr vchrCommand // 0x0106 +#define confirmChr vchrConfirm // 0x0107 +#define launchChr vchrLaunch // 0x0108 +#define keyboardChr vchrKeyboard // 0x0109 +#define findChr vchrFind // 0x010A +#define calcChr vchrCalc // 0x010B +#define prevFieldChr vchrPrevField // 0x010C +#define alarmChr vchrAlarm // 0x010D +#define ronamaticChr vchrRonamatic // 0x010E +#define graffitiReferenceChr vchrGraffitiReference // 0x010F +#define keyboardAlphaChr vchrKeyboardAlpha // 0x0110 +#define keyboardNumericChr vchrKeyboardNumeric // 0x0111 +#define lockChr vchrLock // 0x0112 +#define backlightChr vchrBacklight // 0x0113 +#define autoOffChr vchrAutoOff // 0x0114 +#define exgTestChr vchrExgTest // 0x0115 +#define sendDataChr vchrSendData // 0x0116 +#define irReceiveChr vchrIrReceive // 0x0117 +#define hardKeyMin vchrHardKeyMin // 0x0200 +#define hardKeyMax vchrHardKeyMax // 0x02FF +#define hard1Chr vchrHard1 // 0x0204 +#define hard2Chr vchrHard2 // 0x0205 +#define hard3Chr vchrHard3 // 0x0206 +#define hard4Chr vchrHard4 // 0x0207 +#define hardPowerChr vchrHardPower // 0x0208 +#define hardCradleChr vchrHardCradle // 0x0209 +#define hardCradle2Chr vchrHardCradle2 // 0x020A +#define hardContrastChr vchrHardContrast // 0x020B + +// Macros to determine correct character code to use for drawing numeric space +// and horizontal ellipsis. + +#define ChrNumericSpace(chP) \ + do { \ + ULong 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 { \ + ULong attribute; \ + if ((FtrGet(sysFtrCreator, sysFtrNumROMVersion, &attribute) == 0) \ + && (attribute >= sysMakeROMVersion(3, 1, 0, 0, 0))) { \ + *(chP) = chrEllipsis; \ + } else { \ + *(chP) = 0x85; \ + } \ + } while (0) + +// Characters in the 9 point symbol font. Resource ID 9003 +enum symbolChars { + symbolLeftArrow = 3, + symbolRightArrow, + symbolUpArrow, + symbolDownArrow, + symbolSmallDownArrow, + symbolSmallUpArrow, + symbolMemo = 9, + symbolHelp, + symbolNote, + symbolNoteSelected, + symbolCapsLock, + symbolNumLock, + symbolShiftUpper, + symbolShiftPunc, + symbolShiftExt, + symbolShiftNone, + symbolNoTime, + symbolAlarm, + symbolRepeat, + symbolCheckMark, + // These next four characters were moved from the 0x8D..0x90 + // range in the main fonts to the 9pt Symbol font in PalmOS 3.1 + symbolDiamondChr, + symbolClubChr, + symbolHeartChr, + symbolSpadeChr + }; + +// Character in the 7 point symbol font. Resource ID 9005 +enum symbol7Chars { + symbol7ScrollUp = 1, + symbol7ScrollDown, + symbol7ScrollUpDisabled, + symbol7ScrollDownDisabled + }; + +// Characters in the 11 point symbol font. Resource ID 9004 +enum symbol11Chars { + symbolCheckboxOff = 0, + symbolCheckboxOn, + symbol11LeftArrow, + symbol11RightArrow + }; + + +#endif // __CHARS_H__ diff --git a/sdk-3.1/include/Core/UI/ClipBoard.h b/sdk-3.1/include/Core/UI/ClipBoard.h new file mode 100644 index 0000000..09df244 --- /dev/null +++ b/sdk-3.1/include/Core/UI/ClipBoard.h @@ -0,0 +1,55 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: clipBoard.h + * AUTHOR: Art Lamb: September 1, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines clipboard structures and routines. + * + ***********************************************************************/ + +#ifndef __CLIPBOARD_H__ +#define __CLIPBOARD_H__ + + +#define numClipboardForamts 3 +#define cbdMaxTextLength 1000 + + +// Clipboard standard formats +enum clipboardFormats { clipboardText, clipboardInk, clipboardBitmap }; + +typedef enum clipboardFormats ClipboardFormatType; + +typedef struct { + VoidHand item; + Word length; +} ClipboardItem; + +//---------------------------------------------------------- +// Clipboard Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void ClipboardAddItem + (const ClipboardFormatType format, const VoidPtr ptr, Word length) + SYS_TRAP(sysTrapClipboardAddItem); + +extern VoidHand ClipboardGetItem (const ClipboardFormatType format, + const WordPtr length) + SYS_TRAP(sysTrapClipboardGetItem); + +#ifdef __cplusplus +} +#endif + +#endif // __CLIPBOARD_H__ diff --git a/sdk-3.1/include/Core/UI/Contrast.h b/sdk-3.1/include/Core/UI/Contrast.h new file mode 100644 index 0000000..c6883ca --- /dev/null +++ b/sdk-3.1/include/Core/UI/Contrast.h @@ -0,0 +1,37 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Software Contrast Control + * + * FILE: Contrast.h + * + * DESCRIPTION: Contrast control module for devices with software contrast. + * + * REVISION HISTORY: + * 1998-02-12 Bob Initial version + * + ********************************************************************/ + +#ifndef __CONTRAST_H__ +#define __CONTRAST_H__ + +#ifdef __cplusplus +extern "C" { +#endif +//----------------------------------------------------------------------- +// FUNCTION: AdjustContrast +// DESCRIPTION: Handles user interaction with the contrast dialog. +// Dialog is modal, and will be dismissed if the user +// presses the contrast button again, or presses the Done +// button, or any hardware button to launch an app. +//----------------------------------------------------------------------- +extern void ContrastAdjust() + SYS_TRAP(sysTrapContrastAdjust); + +#ifdef __cplusplus +} +#endif + +#endif // __CONTRAST_H__ diff --git a/sdk-3.1/include/Core/UI/Control.h b/sdk-3.1/include/Core/UI/Control.h new file mode 100644 index 0000000..5239647 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Control.h @@ -0,0 +1,122 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Control.h + * AUTHOR: Art Lamb: August 29, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines check box structures and routines. + * + ***********************************************************************/ +#ifndef __CONTROL_H__ +#define __CONTROL_H__ + + + +typedef struct { + Byte usable :1; // set if part of ui + Byte enabled :1; // set if interactable (not grayed out) + Byte visible :1; // set if drawn (set internally) + Byte on :1; // set if on (checked) + Byte leftAnchor :1; // set if bounds expand to the right + // clear if bounds expand to the left + Byte frame :3; +} ControlAttrType; + + +enum controlStyles {buttonCtl, pushButtonCtl, checkboxCtl, popupTriggerCtl, + selectorTriggerCtl, repeatingButtonCtl}; +typedef enum controlStyles ControlStyleType; + +enum buttonFrames {noButtonFrame, standardButtonFrame, boldButtonFrame, + rectangleButtonFrame}; +typedef enum buttonFrames ButtonFrameType; + + +typedef struct { + Word id; + RectangleType bounds; + CharPtr text; + ControlAttrType attr; + ControlStyleType style; + FontID font; + Byte group; +} ControlType; + + +typedef ControlType * ControlPtr; + + + +//---------------------------------------------------------- +// Control Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CtlDrawControl (const ControlPtr pControl) + SYS_TRAP(sysTrapCtlDrawControl); + +extern void CtlEraseControl (const ControlPtr pControl) + SYS_TRAP(sysTrapCtlEraseControl); + +extern void CtlHideControl (const ControlPtr pControl) + SYS_TRAP(sysTrapCtlHideControl); + +extern void CtlShowControl (const ControlPtr pControl) + SYS_TRAP(sysTrapCtlShowControl); + +extern Boolean CtlEnabled (const ControlPtr pControl) + SYS_TRAP(sysTrapCtlEnabled); + +extern void CtlSetEnabled (const ControlPtr pControl, const Boolean usable) + SYS_TRAP(sysTrapCtlSetEnabled); + +extern void CtlSetUsable (const ControlPtr pControl, const Boolean usable) + SYS_TRAP(sysTrapCtlSetUsable); + +extern SWord CtlGetValue (const ControlPtr pControl) + SYS_TRAP(sysTrapCtlGetValue); + +extern void CtlSetValue (const ControlPtr pControl, const SWord newValue) + SYS_TRAP(sysTrapCtlSetValue); + +extern CharPtr CtlGetLabel (const ControlPtr pControl) + SYS_TRAP(sysTrapCtlGetLabel); + +extern void CtlSetLabel (const ControlPtr pControl, const CharPtr newLabel) + SYS_TRAP(sysTrapCtlSetLabel); + +extern void CtlHitControl (const ControlPtr pControl) + SYS_TRAP(sysTrapCtlHitControl); + +extern Boolean CtlHandleEvent (const ControlPtr pControl, + const EventPtr pEvent) + SYS_TRAP(sysTrapCtlHandleEvent); + +extern Boolean CtlValidatePointer (const ControlPtr pControl) + SYS_TRAP(sysTrapCtlValidatePointer); + +extern ControlPtr CtlNewControl (VoidPtr *formPP, const Word ID, + const ControlStyleType style, const CharPtr textP, + const Word x, const Word y, const Word width, const Word height, + const FontID font, Byte group, Boolean leftAnchor) + SYS_TRAP(sysTrapCtlNewControl); + + +#ifdef __cplusplus +} +#endif + + +#endif //__CONTROL_H__ + + + diff --git a/sdk-3.1/include/Core/UI/Day.h b/sdk-3.1/include/Core/UI/Day.h new file mode 100644 index 0000000..fd461d4 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Day.h @@ -0,0 +1,60 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Day.h + * AUTHOR: Roger Flores: May 31, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the date picker month object's structures + * and routines. + * + ***********************************************************************/ +#ifndef __DAY_H__ +#define __DAY_H__ + + +#include + +typedef enum + { + selectDayByDay, // return d/m/y + selectDayByWeek, // return d/m/y with d as same day of the week + selectDayByMonth // return d/m/y with d as same day of the month + } SelectDayType; + +typedef struct + { + RectangleType bounds; + Boolean visible; + SWord visibleMonth; // month actually displayed + SWord visibleYear; // year actually displayed + DateTimeType selected; + SelectDayType selectDayBy; + } DaySelectorType; + +typedef DaySelectorType * DaySelectorPtr; + +#ifdef __cplusplus +extern "C" { +#endif + +void DayDrawDaySelector (const DaySelectorPtr pSelector) + SYS_TRAP(sysTrapDayDrawDaySelector); + +Boolean DayHandleEvent (const DaySelectorPtr pSelector, + const EventPtr pEvent) + SYS_TRAP(sysTrapDayHandleEvent); + +void DayDrawDays (const DaySelectorPtr pSelector) + SYS_TRAP(sysTrapDayDrawDays); + +#ifdef __cplusplus +} +#endif + +#endif //__DAY_H__ diff --git a/sdk-3.1/include/Core/UI/Event.h b/sdk-3.1/include/Core/UI/Event.h new file mode 100644 index 0000000..a06ba11 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Event.h @@ -0,0 +1,353 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Event.h + * AUTHOR: Art Lamb: September 26, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines event structures and routines. + * + * HISTORY: + * 05/05/98 art Add Text Services event. + * 07/23/98 kwk Changed Word 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. + * + **********************************************************************/ + +#ifndef __EVENT_H__ +#define __EVENT_H__ + + +// Types of events +enum events { + nilEvent = 0, + penDownEvent, + penUpEvent, + penMoveEvent, + keyDownEvent, + winEnterEvent, + winExitEvent, + ctlEnterEvent, + ctlExitEvent, + ctlSelectEvent, + ctlRepeatEvent, + lstEnterEvent, + lstSelectEvent, + lstExitEvent, + popSelectEvent, + fldEnterEvent, + fldHeightChangedEvent, + fldChangedEvent, + tblEnterEvent, + tblSelectEvent, + daySelectEvent, + menuEvent, + appStopEvent, + frmLoadEvent, + frmOpenEvent, + frmGotoEvent, + frmUpdateEvent, + frmSaveEvent, + frmCloseEvent, + frmTitleEnterEvent, + frmTitleSelectEvent, + tblExitEvent, + sclEnterEvent, + sclExitEvent, + sclRepeatEvent, + tsmConfirmEvent, + tsmFepButtonEvent, + + firstUserEvent = 32767 +}; + +// keyDownEvent modifers +#define shiftKeyMask 0x0001 +#define capsLockMask 0x0002 +#define numLockMask 0x0004 +#define commandKeyMask 0x0008 +#define optionKeyMask 0x0010 +#define controlKeyMask 0x0020 +#define autoRepeatKeyMask 0x0040 // True if generated due to auto-repeat +#define doubleTapKeyMask 0x0080 // True if this is a double-tap event +#define poweredOnKeyMask 0x0100 // True if this is a double-tap event +#define appEvtHookKeyMask 0x0200 // True if this is an app hook key +#define libEvtHookKeyMask 0x0400 // True if this is a library hook key + +// Event timeouts +#define evtWaitForever -1 + +// The event record. +typedef struct { + enum events eType; + Boolean penDown; + SWord screenX; + SWord screenY; + union data { + struct generic { + Word data1; + Word data2; + Word data3; + Word data4; + Word data5; + Word data6; + Word data7; + Word data8; + } generic; + + struct penUp { + PointType start; // display coord. of stroke start + PointType end; // display coord. of stroke start + } penUp; + + struct keyDown { + WChar chr; // ascii code + Word keyCode; // virtual key code + Word modifiers; + } keyDown; + + struct winEnter { + WinHandle enterWindow; + WinHandle exitWindow; + } winEnter; + + struct winExit { + WinHandle enterWindow; + WinHandle exitWindow; + } winExit; + + struct ctlEnter { + Word controlID; + void * pControl; + } ctlEnter; + + struct ctlSelect { + Word controlID; + void * pControl; + Boolean on; + } ctlSelect; + + struct ctlRepeat { + Word controlID; + void * pControl; + DWord time; + } ctlRepeat; + + struct fldEnter { + Word fieldID; + void * pField; + } fldEnter; + + struct fldHeightChanged { + Word fieldID; + void * pField; + Word newHeight; + Word currentPos; + } fldHeightChanged; + + struct fldChanged { + Word fieldID; + void * pField; + } fldChanged; + + struct fldExit { + Word fieldID; + void * pField; + } fldExit; + + struct lstEnter { + Word listID; + void * pList; + Word selection; + } lstEnter; + + struct lstExit { + Word listID; + void * pList; + } lstExit; + + struct lstSelect { + Word listID; + void * pList; + Word selection; + } lstSelect; + + struct tblEnter { + Word tableID; + void * pTable; + Word row; + Word column; + } tblEnter; + + struct tblExit { + Word tableID; + void * pTable; + Word row; + Word column; + } tblExit; + + struct tblSelect { + Word tableID; + void * pTable; + Word row; + Word column; + } tblSelect; + + struct frmLoad { + Word formID; + } frmLoad; + + struct frmOpen { + Word formID; + } frmOpen; + + struct frmGoto { + Word formID; + Word recordNum; // index of record that contain a match + Word matchPos; // postion in record of the match. + Word matchLen; // length of match. + Word matchFieldNum; // field number string was found int + DWord matchCustom; // application specific info + } frmGoto; + + struct frmClose { + Word formID; + } frmClose; + + struct frmUpdate { + Word formID; + Word updateCode; // Application specific + } frmUpdate; + + struct frmTitleEnter { + Word formID; + } frmTitleEnter; + + struct frmTitleSelect { + Word formID; + } frmTitleSelect; + + struct daySelect { + void * pSelector; + Word selection; + Boolean useThisDate; + } daySelect; + + struct menu { + Word itemID; + } menu; + + struct popSelect { + Word controlID; + void * controlP; + Word listID; + void * listP; + Word selection; + Word priorSelection; + } popSelect; + + struct sclEnter { + Word scrollBarID; + void * pScrollBar; + } sclEnter; + + struct sclExit { + Word scrollBarID; + void * pScrollBar; + Short value; + Short newValue; + } sclExit; + + struct sclRepeat { + Word scrollBarID; + void * pScrollBar; + Short value; + Short newValue; + Long time; + } sclRepeat; + + struct tsmConfirm { + CharPtr yomiText; + Word formID; + } tsmConfirm; + + struct tsmFepButton { + Word buttonID; + } tsmFepButton; + + } data; + +} EventType; + +typedef EventType * EventPtr; + + +// Events are stored in the event queue with some extra fields: +typedef struct { + EventType event; + DWord id; // used to support EvtAddUniqueEvent + } EventStoreType; + + +//--------------------------------------------------------------------- +// Event Functions +//--------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +void EvtInitialize (void) + SYS_TRAP(sysTrapEvtInitialize); + +void EvtAddEventToQueue (const EventPtr event) + SYS_TRAP(sysTrapEvtAddEventToQueue); + +void EvtAddUniqueEventToQueue(const EventPtr eventP, const DWord id, + const Boolean inPlace) + SYS_TRAP(sysTrapEvtAddUniqueEventToQueue); + +void EvtCopyEvent (const EventPtr source, const EventPtr dest) + SYS_TRAP(sysTrapEvtCopyEvent); + +void EvtGetEvent (const EventPtr event, SDWord timeout) + SYS_TRAP(sysTrapEvtGetEvent); + +Boolean EvtEventAvail (void) + SYS_TRAP(sysTrapEvtEventAvail); + +void EvtGetPen(SWord *pScreenX, SWord *pScreenY, Boolean *pPenDown) + SYS_TRAP(sysTrapEvtGetPen); + +#ifdef __cplusplus +} +#endif + + +// For Compatibility.. DOLATER... source modules should use EvtGetPen instead. +#define PenGetPoint(a,b,c) EvtGetPen(a,b,c) + + +// zzz make into a routine +#define EvtSetNullEventTick(tick) \ + if (NeedNullTickCount == 0 || \ + NeedNullTickCount > tick || \ + NeedNullTickCount <= TimGetTicks ()) \ + NeedNullTickCount = tick; + + + +#endif // __EVENT_H__ + + + + + + diff --git a/sdk-3.1/include/Core/UI/Field.h b/sdk-3.1/include/Core/UI/Field.h new file mode 100644 index 0000000..14c7037 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Field.h @@ -0,0 +1,277 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: field.h + * AUTHOR: Art Lamb: August 29, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines field structures and routines. + * + ***********************************************************************/ +#ifndef __FIELD_H__ +#define __FIELD_H__ + +#define maxFieldTextLen 0x7fff + +// Maximun number of line the a dynamicly sizing field will expand to. +#define maxFieldLines 11 + + +// kind alignment values +enum justifications {leftAlign, centerAlign, rightAlign}; +typedef enum justifications JustificationType; + + +#define undoBufferSize 100 + +typedef enum { undoNone, undoTyping, undoBackspace, undoDelete, + undoPaste, undoCut } UndoMode; + +typedef struct { + UndoMode mode; + Word start; + Word end; + Word bufferLen; + CharPtr buffer; + } FieldUndoType; + + +typedef struct { + Word usable :1; // Set if part of ui + Word visible :1; // Set if drawn, used internally + Word editable :1; // Set if editable + Word singleLine :1; // Set if only a single line is displayed + Word hasFocus :1; // Set if the field has the focus + Word dynamicSize :1; // Set if height expands as text is entered + Word insPtVisible :1; // Set if the ins pt is scolled into view + Word dirty :1; // Set if user modified + Word underlined :2; // text underlined mode + Word justification :2; // text alignment + Word autoShift :1; // Set if auto case shift + Word hasScrollBar :1; // Set if the field has a scroll bar + Word numeric :1; // Set if numeric, digits and secimal separator only +} FieldAttrType; + +typedef FieldAttrType * FieldAttrPtr; + +typedef struct { + Word start; // position in text string of first char. + Word length; // number of character in the line +} LineInfoType; + +typedef LineInfoType * LineInfoPtr; + + +typedef struct { + Word id; + RectangleType rect; + FieldAttrType attr; + CharPtr text; // pointer to the start of text string + VoidHand textHandle; // block the contains the text string + LineInfoPtr lines; + Word textLen; + Word textBlockSize; + Word maxChars; + Word selFirstPos; + Word selLastPos; + Word insPtXPos; + Word insPtYPos; + FontID fontID; +} FieldType; + + +typedef FieldType * FieldPtr; + +//--------------------------------------------------------------------- +// Field Functions +//--------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void FldCopy (const FieldPtr fld) + SYS_TRAP(sysTrapFldCopy); + +extern void FldCut (const FieldPtr fld) + SYS_TRAP(sysTrapFldCut); + +extern void FldDrawField (const FieldPtr fld) + SYS_TRAP(sysTrapFldDrawField); + +extern void FldEraseField (const FieldPtr fld) + SYS_TRAP(sysTrapFldEraseField); + +extern void FldFreeMemory (const FieldPtr fld) + SYS_TRAP(sysTrapFldFreeMemory); + +extern void FldGetBounds (const FieldPtr fld, const RectanglePtr rect) + SYS_TRAP(sysTrapFldGetBounds); + +extern FontID FldGetFont (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetFont); + +extern void FldGetSelection (const FieldPtr fld, const WordPtr startPosition, + const WordPtr endPosition) + SYS_TRAP(sysTrapFldGetSelection); + +extern Handle FldGetTextHandle (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextHandle); + +extern CharPtr FldGetTextPtr (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextPtr); + +extern Boolean FldHandleEvent (const FieldPtr fld, const EventPtr pEvent) + SYS_TRAP(sysTrapFldHandleEvent); + +extern void FldPaste (const FieldPtr fld) + SYS_TRAP(sysTrapFldPaste); + +extern void FldRecalculateField (const FieldPtr fld, const Boolean redraw) + SYS_TRAP(sysTrapFldRecalculateField); + +extern void FldSetBounds (const FieldPtr fld, const RectanglePtr rect) + SYS_TRAP(sysTrapFldSetBounds); + +extern void FldSetFont (const FieldPtr fld, const FontID fontID) + SYS_TRAP(sysTrapFldSetFont); + +extern void FldSetText (const FieldPtr fld, const VoidHand textHandle, + const Word offset, const Word size) + SYS_TRAP(sysTrapFldSetText); + +extern void FldSetTextHandle (const FieldPtr fld, const Handle textHandle) + SYS_TRAP(sysTrapFldSetTextHandle); + +extern void FldSetTextPtr (const FieldPtr fld, const CharPtr textP) + SYS_TRAP(sysTrapFldSetTextPtr); + +extern void FldSetUsable (const FieldPtr fld, const Boolean usable) + SYS_TRAP(sysTrapFldSetUsable); + +extern void FldSetSelection (const FieldPtr fld, const Word startPosition, + const Word endPosition) + SYS_TRAP(sysTrapFldSetSelection); + +extern void FldGrabFocus (const FieldPtr fld) + SYS_TRAP(sysTrapFldGrabFocus); + +extern void FldReleaseFocus (const FieldPtr fld) + SYS_TRAP(sysTrapFldReleaseFocus); + + +extern Word FldGetInsPtPosition (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetInsPtPosition); + +extern void FldSetInsPtPosition (const FieldPtr fld, const Word pos) + SYS_TRAP(sysTrapFldSetInsPtPosition); + +extern void FldSetInsertionPoint (const FieldPtr fld, const Word pos) + SYS_TRAP(sysTrapFldSetInsertionPoint); + +extern Word FldGetScrollPosition (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetScrollPosition); + +extern void FldSetScrollPosition (const FieldPtr fld, Word pos) + SYS_TRAP(sysTrapFldSetScrollPosition); + +extern void FldGetScrollValues (const FieldPtr fld, const WordPtr scrollPosP, + const WordPtr textHeightP, const WordPtr fieldHeightP) + SYS_TRAP(sysTrapFldGetScrollValues); + + +extern Word FldGetTextLength (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextLength); + +extern void FldScrollField (const FieldPtr fld, Word linesToScroll, + const DirectionType direction) + SYS_TRAP(sysTrapFldScrollField); + +extern Boolean FldScrollable (const FieldPtr fld, + const DirectionType direction) + SYS_TRAP(sysTrapFldScrollable); + +extern Word FldGetVisibleLines (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetVisibleLines); + +extern Word FldGetTextHeight (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextHeight); + +extern Word FldCalcFieldHeight (const CharPtr chars, const Word maxWidth) + SYS_TRAP(sysTrapFldCalcFieldHeight); + +Word FldWordWrap (const CharPtr chars, const Word maxWidth) + SYS_TRAP(sysTrapFldWordWrap); + +extern void FldCompactText (const FieldPtr fld) + SYS_TRAP(sysTrapFldCompactText); + +extern Boolean FldDirty (const FieldPtr fld) + SYS_TRAP(sysTrapFldDirty); + +extern void FldSetDirty (const FieldPtr fld, const Boolean dirty) + SYS_TRAP(sysTrapFldSetDirty); + +extern Word FldGetMaxChars (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetMaxChars); + +extern void FldSetMaxChars (const FieldPtr fld, const Word maxChars) + SYS_TRAP(sysTrapFldSetMaxChars); + +extern Boolean FldInsert (const FieldPtr fld, const CharPtr insertChars, + const Word insertLen) + SYS_TRAP(sysTrapFldInsert); + +extern void FldDelete (const FieldPtr fld, const Word start, const Word end) + SYS_TRAP(sysTrapFldDelete); + +extern void FldUndo (const FieldPtr fld) + SYS_TRAP(sysTrapFldUndo); + +extern Word FldGetTextAllocatedSize (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetTextAllocatedSize); + +extern void FldSetTextAllocatedSize (const FieldPtr fld, + const Word allocatedSize) + SYS_TRAP(sysTrapFldSetTextAllocatedSize); + +extern void FldGetAttributes (const FieldPtr fld, const FieldAttrPtr attrP) + SYS_TRAP(sysTrapFldGetAttributes); + +extern void FldSetAttributes (const FieldPtr fld, const FieldAttrPtr attrP) + SYS_TRAP(sysTrapFldSetAttributes); + +extern void FldSendChangeNotification (const FieldPtr fld) + SYS_TRAP(sysTrapFldSendChangeNotification); + +extern void FldSendHeightChangeNotification (const FieldPtr fld, + const Word pos, const Short numLines) + SYS_TRAP(sysTrapFldSendHeightChangeNotification); + +extern Boolean FldMakeFullyVisible (const FieldPtr fld) + SYS_TRAP(sysTrapFldMakeFullyVisible); + +extern Word FldGetNumberOfBlankLines (const FieldPtr fld) + SYS_TRAP(sysTrapFldGetNumberOfBlankLines); + +extern FieldPtr FldNewField (VoidPtr *formPP, const Word id, + const Word x, const Word y, const Word width, const Word height, + const FontID font, DWord maxChars, Boolean editable, Boolean underlined, + Boolean singleLine, Boolean dynamicSize, JustificationType justification, + Boolean autoShift, Boolean hasScrollBar, Boolean numeric) + SYS_TRAP(sysTrapFldNewField); + + +#ifdef __cplusplus +} +#endif + +#endif // __FIELD_H__ + + + diff --git a/sdk-3.1/include/Core/UI/Find.h b/sdk-3.1/include/Core/UI/Find.h new file mode 100644 index 0000000..374a855 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Find.h @@ -0,0 +1,114 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Find.h + * AUTHOR: Art Lamb: August 29, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines field structures and routines. + * + ***********************************************************************/ +#ifndef __FIND_H__ +#define __FIND_H__ + +#define maxFinds 9 +#define maxFindStrLen 16 + +typedef struct { + Word appCardNo; // card number of the application + LocalID appDbID; // LocalID of the application + Boolean foundInCaller; // true if found in app that called Find + + Word dbCardNo; // card number of the database record was found in + LocalID dbID; // LocalID of the database record was found in + Word recordNum; // index of record that contain a match + Word matchPos; // postion in record of the match. + Word matchFieldNum; // field number + DWord matchCustom; // app specific data + } FindMatchType; + +typedef FindMatchType * FindMatchPtr; + +typedef struct { + + // These fields are used by the applications. + Word dbAccesMode; // read mode and maybe show secret + Word recordNum; // index of last record that contained a match + Boolean more; // true of more matches to display + Char strAsTyped [maxFindStrLen+1]; // search string as entered + Char strToFind [maxFindStrLen+1]; // search string is lower case + + + // 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. + Word numMatches; // # of matches + Word lineNumber; // next line in the results tabel + Boolean continuation; // true if contining search of same app + Boolean searchedCaller; // true after we've searched app that initiated the find + + LocalID callerAppDbID; // dbID of app that initiated search + Word callerAppCardNo; // cardNo of app that initiated search + + LocalID appDbID; // dbID of app that we're currently searching + Word appCardNo; // card number of app that we're currently searching + + Boolean newSearch; // true for first search + DmSearchStateType searchState; // search state + FindMatchType match [maxFinds]; +} FindParamsType; + +typedef FindParamsType * FindParamsPtr; + + +// Param Block passsed with the sysAppLaunchCmdGoto Command +typedef struct { + Word searchStrLen; // length of search string. + Word dbCardNo; // card number of the database + LocalID dbID; // LocalID of the database + Word recordNum; // index of record that contain a match + Word matchPos; // postion in record of the match. + Word matchFieldNum; // field number string was found int + DWord matchCustom; // application specific info + } GoToParamsType; + +typedef GoToParamsType * GoToParamsPtr; + + +//---------------------------------------------------------- +// Find Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +void Find (GoToParamsPtr goToP) + SYS_TRAP(sysTrapFind); + + +Boolean FindStrInStr (const CharPtr strToSearch, const CharPtr strToFind, + const WordPtr posP) + SYS_TRAP(sysTrapFindStrInStr); + +Boolean FindSaveMatch (const FindParamsPtr findParams, const Word recordNum, + const Word pos, const Word fieldNum, const DWord appCustom, + const Word cardNo, const LocalID dbID) + SYS_TRAP(sysTrapFindSaveMatch); + +void FindGetLineBounds (const FindParamsPtr findParams, const RectanglePtr r) + SYS_TRAP(sysTrapFindGetLineBounds); + +Boolean FindDrawHeader (const FindParamsPtr findParams, const CharPtr title) + SYS_TRAP(sysTrapFindDrawHeader); + +#ifdef __cplusplus +} +#endif + +#endif __FIND_H__ diff --git a/sdk-3.1/include/Core/UI/Font.h b/sdk-3.1/include/Core/UI/Font.h new file mode 100644 index 0000000..b55b74c --- /dev/null +++ b/sdk-3.1/include/Core/UI/Font.h @@ -0,0 +1,172 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Font.h + * AUTHOR: Art Lamb: September 13, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines font structures and routines. + * + * HISTORY: + * 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). + * + ***********************************************************************/ + +#ifndef __FONT_H__ +#define __FONT_H__ + + +// Font types in FontType structure. +#define fontMapTable 0xC000 + +#define fntTabChrWidth 20 +#define fntMissingChar -1 + + +typedef struct { + SByte offset; + SByte width; +} FontCharInfoType, * FontCharInfoPtr; + +typedef struct { + SWord fontType; // font type + SWord firstChar; // ASCII code of first character + SWord lastChar; // ASCII code of last character + SWord maxWidth; // maximum character width + SWord kernMax; // negative of maximum character kern + SWord nDescent; // negative of descent + SWord fRectWidth; // width of font rectangle + SWord fRectHeight; // height of font rectangle + SWord owTLoc; // offset to offset/width table + SWord ascent; // ascent + SWord descent; // descent + SWord leading; // leading + SWord rowWords; // row width of bit image / 2 +} FontType; + +typedef FontType * FontPtr; + +typedef FontPtr * FontTablePtr; + + +typedef struct { + DWord rscType; + Word rscID; +} FontIndexEntryType, * FontIndexEntryPtr; + + +// Font mapping state table. +#define fntStateIsChar 1 +#define fntStateNextIsChar 2 + +typedef struct { + Byte flags; + Byte state; + Word value; +} FontMapType, * FontMapPtr; + + + +enum fontID { + stdFont = 0x00, // Small font used for the user's writing. Shows a good amount + boldFont, // Small font. Bold for easier reading. Used often for ui. + largeFont, // Larger font for easier reading. Shows a lot less. + symbolFont, // Various ui images like check boxes and arrows + symbol11Font, // Larger various ui images + symbol7Font, // Smaller various ui images + ledFont, // Calculator specific font + largeBoldFont, // A thicker version of the large font. More readable. + fntAppFontCustomBase = 0x80 // First available application-defined font ID +}; + +typedef enum fontID FontID; + +#define checkboxFont symbol11Font + +#define FntIsAppDefined(fnt) (fnt >= fntAppFontCustomBase) + + + +//-------------------------------------------------------------------- +// +// Font Function +// +//-------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern FontID FntGetFont (void) + SYS_TRAP(sysTrapFntGetFont); + +extern FontID FntSetFont (const FontID font) + SYS_TRAP(sysTrapFntSetFont); + +extern FontPtr FntGetFontPtr (void) + SYS_TRAP(sysTrapFntGetFontPtr); + +extern SWord FntBaseLine (void) + SYS_TRAP(sysTrapFntBaseLine); + +extern SWord FntCharHeight (void) + SYS_TRAP(sysTrapFntCharHeight); + +extern SWord FntLineHeight (void) + SYS_TRAP(sysTrapFntLineHeight); + +extern SWord FntAverageCharWidth (void) + SYS_TRAP(sysTrapFntAverageCharWidth); + +extern SWord FntCharWidth (const Char ch) + SYS_TRAP(sysTrapFntCharWidth); + +extern SWord FntCharsWidth (const Char * chars, Word len) + SYS_TRAP(sysTrapFntCharsWidth); + +extern Word FntWidthToOffset(ConstCharPtr pChars, Word length, + SWord pixelWidth, Boolean *leadingEdge, SWordPtr truncWidth) + SYS_TRAP(sysTrapFntWidthToOffset); + +extern void FntCharsInWidth(const Char * string, SWord *stringWidthP, + SWord *stringLengthP, Boolean *fitWithinWidth) + SYS_TRAP(sysTrapFntCharsInWidth); + +extern SWord FntDescenderHeight (void) + SYS_TRAP(sysTrapFntDescenderHeight); + +extern SWord FntLineWidth (const Char * pChars, Word length) + SYS_TRAP(sysTrapFntLineWidth); + +Word FntWordWrap (Char * const chars, const Word maxWidth) + SYS_TRAP(sysTrapFntWordWrap); + +void FntWordWrapReverseNLines (const Char * const chars, + const Word maxWidth, const WordPtr linesToScrollP, + const WordPtr scrollPosP) + SYS_TRAP(sysTrapFntWordWrapReverseNLines); + +void FntGetScrollValues (const Char * const chars, const Word width, + const Word scrollPos, const WordPtr linesP, + const WordPtr topLine) + SYS_TRAP(sysTrapFntGetScrollValues); + +extern Err FntDefineFont (FontID font, FontPtr fontP) + SYS_TRAP(sysTrapFntDefineFont); + +#ifdef __cplusplus +} +#endif + + +#endif // __FONT_H__ + + + diff --git a/sdk-3.1/include/Core/UI/FontSelect.h b/sdk-3.1/include/Core/UI/FontSelect.h new file mode 100644 index 0000000..2c1a1a5 --- /dev/null +++ b/sdk-3.1/include/Core/UI/FontSelect.h @@ -0,0 +1,33 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: FontSelect.h + * AUTHOR: Art Lamb: September 10, 1997 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the font selector routine. + * + ***********************************************************************/ + +#ifndef __SELFONT_H__ +#define __SELFONT_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +extern FontID FontSelect (FontID fontID) + SYS_TRAP(sysTrapFontSelect); + + +#ifdef __cplusplus +} +#endif + +#endif // __SELFONT_H__ diff --git a/sdk-3.1/include/Core/UI/Form.h b/sdk-3.1/include/Core/UI/Form.h new file mode 100644 index 0000000..d558a2a --- /dev/null +++ b/sdk-3.1/include/Core/UI/Form.h @@ -0,0 +1,448 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Form.h + * AUTHOR: Art Lamb: September 6, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines dialog box structures and routines. + * + ***********************************************************************/ + +#ifndef __FORM_H__ +#define __FORM_H__ + +#define noFocus 0xffff + +// Update code send as part of a frmUpdate event. +#define frmRedrawUpdateCode 0x8000 + + +// Alert constants and structures +enum alertTypes { + informationAlert, + confirmationAlert, + warningAlert, + errorAlert }; +typedef enum alertTypes AlertType; + +typedef struct { + Word alertType; + Word helpRscID; + Word numButtons; + Word defaultButton; +} AlertTemplateType; + + +// Types of object in a dialog box +enum formObjects { + frmFieldObj, + frmControlObj, + frmListObj, + frmTableObj, + frmBitmapObj, + frmLineObj, + frmFrameObj, + frmRectangleObj, + frmLabelObj, + frmTitleObj, + frmPopupObj, + frmGraffitiStateObj, + frmGadgetObj, + frmScrollBarObj }; +typedef enum formObjects FormObjectKind; + + +typedef struct { + Word usable :1; // Set if part of ui +} FormObjAttrType; + + +typedef struct { + FormObjAttrType attr; + PointType pos; + Word rscID; +} FormBitmapType; + + +typedef struct { + FormObjAttrType attr; + PointType point1; + PointType point2; +} FormLineType; + + +typedef struct { + Word id; + FormObjAttrType attr; + RectangleType rect; + Word frameType; +} FormFrameType; + + +typedef struct { + FormObjAttrType attr; + RectangleType rect; +} FormRectangleType; + + +typedef struct { + Word id; + PointType pos; + FormObjAttrType attr; + FontID fontID; + Char * text; +} FormLabelType; + + +typedef struct { + RectangleType rect; + Char * text; +} FormTitleType; + + +typedef struct { + Word controlID; + Word listID; +} FormPopupType; + + +typedef struct { + PointType pos; +} FrmGraffitiStateType; + + +typedef struct { + Word id; + FormObjAttrType attr; + RectangleType rect; + VoidPtr data; +} FormGadgetType; + + +typedef union { + void * ptr; + FieldType * field; + ControlType * control; + ListType * list; + TableType * table; + FormBitmapType * bitmap; +// FormLineType * line; +// FormFrameType * frame; +// FormRectangleType * rectangle; + FormLabelType * label; + FormTitleType * title; + FormPopupType * popup; + FrmGraffitiStateType * grfState; + FormGadgetType * gadget; + ScrollBarType * scrollBar; +} FormObjectType; + +// typedef FormObjectType * FormObjectPtr; + + +typedef struct { + FormObjectKind objectType; + FormObjectType object; +} FormObjListType; + + +typedef struct { + Word usable :1; // Set if part of ui + Word enabled :1; // Set if interactable (not grayed out) + Word visible :1; // Set if drawn, used internally + Word dirty :1; // Set if dialog has been modified + Word saveBehind :1; // Set if bits behind form are save when form ids drawn + Word graffitiShift :1; // Set if graffiti shift indicator is supported + Word reserved :11; +} FormAttrType; + + +typedef Boolean FormEventHandlerType (EventPtr eventP); + +typedef FormEventHandlerType * FormEventHandlerPtr; + +typedef struct { + WindowType window; + Word formId; + FormAttrType attr; + WinHandle bitsBehindForm; + FormEventHandlerPtr handler; + Word focus; + Word defaultButton; + Word helpRscId; + Word menuRscId; + Word numObjects; + FormObjListType * objects; +} FormType; + + +typedef FormType * FormPtr; + + +// 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 +typedef struct FormActiveStateType { + Word data[11]; + } FormActiveStateType; + + +//----------------------------------------------- +// Macros +//----------------------------------------------- + +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define ECFrmValidatePtr(frm) FrmValidatePtr(frm) +#else +#define ECFrmValidatePtr(frm) +#endif + +//-------------------------------------------------------------------- +// +// Form Function +// +//-------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern FormPtr FrmInitForm (const Word rscID) + SYS_TRAP(sysTrapFrmInitForm); + +extern void FrmDeleteForm (const FormPtr frm) + SYS_TRAP(sysTrapFrmDeleteForm); + +extern void FrmDrawForm (const FormPtr frm) + SYS_TRAP(sysTrapFrmDrawForm); + +extern void FrmEraseForm (const FormPtr frm) + SYS_TRAP(sysTrapFrmEraseForm); + +extern FormPtr FrmGetActiveForm (void) + SYS_TRAP(sysTrapFrmGetActiveForm); + +extern void FrmSetActiveForm (const FormPtr frm) + SYS_TRAP(sysTrapFrmSetActiveForm); + +extern Word FrmGetActiveFormID (void) + SYS_TRAP(sysTrapFrmGetActiveFormID); + +extern Boolean FrmGetUserModifiedState (const FormPtr frm) + SYS_TRAP(sysTrapFrmGetUserModifiedState); + +extern void FrmSetNotUserModified (const FormPtr frm) + SYS_TRAP(sysTrapFrmSetNotUserModified); + +extern Word FrmGetFocus (const FormPtr frm) + SYS_TRAP(sysTrapFrmGetFocus); + +extern void FrmSetFocus (const FormPtr frm, const Word fieldIndex) + SYS_TRAP(sysTrapFrmSetFocus); + +extern Boolean FrmHandleEvent (const FormPtr frm, const EventPtr eventP) + SYS_TRAP(sysTrapFrmHandleEvent); + +extern void FrmGetFormBounds (const FormPtr frm, const RectanglePtr r) + SYS_TRAP(sysTrapFrmGetFormBounds); + +extern WinHandle FrmGetWindowHandle (const FormPtr frm) + SYS_TRAP(sysTrapFrmGetWindowHandle); + +extern Word FrmGetFormId (const FormPtr frm) + SYS_TRAP(sysTrapFrmGetFormId); + +extern FormPtr FrmGetFormPtr (const Word formId) + SYS_TRAP(sysTrapFrmGetFormPtr); + +extern FormPtr FrmGetFirstForm (void) + SYS_TRAP(sysTrapFrmGetFirstForm); + +extern Word FrmGetNumberOfObjects (const FormPtr frm) + SYS_TRAP(sysTrapFrmGetNumberOfObjects); + +extern Word FrmGetObjectIndex (const FormPtr frm, const Word objID) + SYS_TRAP(sysTrapFrmGetObjectIndex); + +extern Word FrmGetObjectId (const FormPtr, const Word objIndex) + SYS_TRAP(sysTrapFrmGetObjectId); + +extern FormObjectKind FrmGetObjectType (const FormPtr frm, const Word objIndex) + SYS_TRAP(sysTrapFrmGetObjectType); + +extern VoidPtr FrmGetObjectPtr (const FormPtr frm, const Word objIndex) + SYS_TRAP(sysTrapFrmGetObjectPtr); + +extern void FrmGetObjectBounds (const FormPtr frm, const Word pObjIndex, + const RectanglePtr r) + SYS_TRAP(sysTrapFrmGetObjectBounds); + +extern void FrmHideObject (const FormPtr frm, const Word objIndex) + SYS_TRAP(sysTrapFrmHideObject); + +extern void FrmShowObject (const FormPtr frm, const Word objIndex) + SYS_TRAP(sysTrapFrmShowObject); + +extern void FrmGetObjectPosition (const FormPtr frm, const Word objIndex, + const SWordPtr x, const SWordPtr y) + SYS_TRAP(sysTrapFrmGetObjectPosition); + +extern void FrmSetObjectPosition (const FormPtr frm, const Word objIndex, + const SWord x, const SWord y) + SYS_TRAP(sysTrapFrmSetObjectPosition); + +extern void FrmSetObjectBounds (const FormPtr frm, const Word objIndex, + const RectanglePtr bounds) + SYS_TRAP(sysTrapFrmSetObjectBounds); + + + +extern SWord FrmGetControlValue (const FormPtr frm, const Word controlID) + SYS_TRAP(sysTrapFrmGetControlValue); + +extern void FrmSetControlValue (const FormPtr frm, const Word controlID, + SWord newValue) + SYS_TRAP(sysTrapFrmSetControlValue); + +extern Byte FrmGetControlGroupSelection (const FormPtr frm, + const Byte groupNum) + SYS_TRAP(sysTrapFrmGetControlGroupSelection); + +extern void FrmSetControlGroupSelection (const FormPtr frm, + const Byte groupNum, const Word controlID) + SYS_TRAP(sysTrapFrmSetControlGroupSelection); + +extern void FrmCopyLabel (const FormPtr frm, const Word lableID, + const CharPtr newLable) + SYS_TRAP(sysTrapFrmCopyLabel); + +extern CharPtr FrmGetLabel (const FormPtr frm, const Word lableID) + SYS_TRAP(sysTrapFrmGetLabel); + +extern void FrmSetCategoryLabel (const FormPtr frm, const Word objIndex, + const CharPtr newLabel) + SYS_TRAP(sysTrapFrmSetCategoryLabel); + +extern CharPtr FrmGetTitle (const FormPtr frm) + SYS_TRAP(sysTrapFrmGetTitle); + +extern void FrmSetTitle (const FormPtr frm, const CharPtr newTitle) + SYS_TRAP(sysTrapFrmSetTitle); + +extern void FrmCopyTitle (const FormPtr frm, const CharPtr newTitle) + SYS_TRAP(sysTrapFrmCopyTitle); + +extern VoidPtr FrmGetGadgetData (const FormPtr frm, const Word objIndex) + SYS_TRAP(sysTrapFrmGetGadgetData); + +extern void FrmSetGadgetData (const FormPtr frm, const Word objIndex, + const VoidPtr data) + SYS_TRAP(sysTrapFrmSetGadgetData); + + + +extern Word FrmDoDialog (const FormPtr frm) + SYS_TRAP(sysTrapFrmDoDialog); + +extern Word FrmAlert (const Word alertId) + SYS_TRAP(sysTrapFrmAlert); + +extern Word FrmCustomAlert (const Word alertId, const CharPtr s1, + const CharPtr s2, const CharPtr s3) + SYS_TRAP(sysTrapFrmCustomAlert); + +extern void FrmHelp (const Word helpMsgId) + SYS_TRAP(sysTrapFrmHelp); + +extern void FrmUpdateScrollers (const FormPtr frm, const Word upIndex, + const Word downIndex, const Boolean scrollableUp, + const Boolean scrollabledown) + SYS_TRAP(sysTrapFrmUpdateScrollers); + +extern Boolean FrmVisible (const FormPtr frm) + SYS_TRAP(sysTrapFrmVisible); + +extern void FrmSetEventHandler (const FormPtr frm, const FormEventHandlerPtr) + SYS_TRAP(sysTrapFrmSetEventHandler); + +extern Boolean FrmDispatchEvent (const EventPtr eventP) + SYS_TRAP(sysTrapFrmDispatchEvent); + + + + +extern void FrmPopupForm (const Word formId) + SYS_TRAP(sysTrapFrmPopupForm); + +extern void FrmGotoForm (const Word formId) + SYS_TRAP(sysTrapFrmGotoForm); + +extern void FrmUpdateForm (const Word formId, const Word updateCode) + SYS_TRAP(sysTrapFrmUpdateForm); + +extern void FrmReturnToForm (const Word formId) + SYS_TRAP(sysTrapFrmReturnToForm); + +extern void FrmCloseAllForms (void) + SYS_TRAP(sysTrapFrmCloseAllForms); + +extern void FrmSaveAllForms (void) + SYS_TRAP(sysTrapFrmSaveAllForms); + + + +extern Boolean FrmPointInTitle (const FormPtr frm, const Short x, + const Short y) + SYS_TRAP(sysTrapFrmPointInTitle); + +extern void FrmSetMenu (const FormPtr frm, const Word menuRscID) + SYS_TRAP(sysTrapFrmSetMenu); + +extern Boolean FrmValidatePtr (FormPtr frm) + SYS_TRAP(sysTrapFrmValidatePtr); + +extern Err FrmAddSpaceForObject (FormPtr *formPP, Ptr *objectPP, + FormObjectKind objectKind, Word objectSize) + SYS_TRAP(sysTrapFrmAddSpaceForObject); + +extern Err FrmRemoveObject (FormPtr *formPP, Word objIndex) + SYS_TRAP(sysTrapFrmRemoveObject); + +extern FormPtr FrmNewForm (const Word formID, const Char * const titleStrP, + Word x, Word y, Word width, Word height, const Boolean modal, + const Word defaultButton, const Word helpRscID, const Word menuRscID) + SYS_TRAP(sysTrapFrmNewForm); + +extern FormLabelType * FrmNewLabel (VoidPtr *formPP, const Word ID, const Char * const textP, + const Word x, const Word y, const FontID font) + SYS_TRAP(sysTrapFrmNewLabel); + +extern FormBitmapType * FrmNewBitmap (VoidPtr *formPP, const Word ID, + const Word rscID, const Word x, const Word y) + SYS_TRAP(sysTrapFrmNewBitmap); + +extern FormGadgetType * FrmNewGadget (VoidPtr *formPP, const Word id, + const Word x, const Word y, const Word width, const Word height) + SYS_TRAP(sysTrapFrmNewGadget); + +extern Err FrmActiveState (FormActiveStateType* stateP, Boolean save) + SYS_TRAP(sysTrapFrmActiveState); + +#define FrmSaveActiveState(stateP) FrmActiveState(stateP, true) +#define FrmRestoreActiveState(stateP) FrmActiveState(stateP, false) + + + +#ifdef __cplusplus +} +#endif + +#endif __FORM_H__ diff --git a/sdk-3.1/include/Core/UI/GraffitiShift.h b/sdk-3.1/include/Core/UI/GraffitiShift.h new file mode 100644 index 0000000..32c22a9 --- /dev/null +++ b/sdk-3.1/include/Core/UI/GraffitiShift.h @@ -0,0 +1,61 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: GriffitifShift.h + * AUTHOR: Art Lamb: Aug 24, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines Griffiti shift state indicator routines. + * + **********************************************************************/ + +#ifndef __GRFSHIFTIND_H__ +#define __GRFSHIFTIND_H__ + + +// Graffiti lock flags +#define glfCapsLock 0x01 +#define glfNumLock 0x02 + + +typedef enum { gsiShiftNone, // no indicator + gsiNumLock, // numeric lock + gsiCapsLock, // capital lock + gsiShiftPunctuation, // punctuation shift + gsiShiftExtended, // extented punctuation shift + gsiShiftUpper, // alpha upper case shift + gsiShiftLower // alpha lower case + } GsiShiftState; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void GsiInitialize (void) + SYS_TRAP(sysTrapGsiInitialize); + +extern void GsiSetLocation (const SWord x, const SWord y) + SYS_TRAP(sysTrapGsiSetLocation); + +extern void GsiEnable (const Boolean enableIt) + SYS_TRAP(sysTrapGsiEnable); + +extern Boolean GsiEnabled (void) + SYS_TRAP(sysTrapGsiEnabled); + +extern void GsiSetShiftState (const Word lockFlags, const Word tempShift) + SYS_TRAP(sysTrapGsiSetShiftState); + +#ifdef __cplusplus +} +#endif + +#endif __GRFSHIFTIND_H__ + + diff --git a/sdk-3.1/include/Core/UI/GraffitiUI.h b/sdk-3.1/include/Core/UI/GraffitiUI.h new file mode 100644 index 0000000..2ccee6d --- /dev/null +++ b/sdk-3.1/include/Core/UI/GraffitiUI.h @@ -0,0 +1,32 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Touchdown + * FILE: GraffitifUI.h + * AUTHOR: Roger Flores: Sep 15, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines Graffiti UI routines. + * + **********************************************************************/ + +#ifndef __GRFUI_H__ +#define __GRFUI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +extern void SysGrfShortCutListDialog () + SYS_TRAP(sysTrapSysGrfShortCutListDialog); + +#ifdef __cplusplus +} +#endif + +#endif __GRFUI_H__ + diff --git a/sdk-3.1/include/Core/UI/Init.h b/sdk-3.1/include/Core/UI/Init.h new file mode 100644 index 0000000..50aa9f4 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Init.h @@ -0,0 +1,36 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Init.h + * AUTHOR: Art Lamb: Jan 25, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines UI initialization routines. + * + **********************************************************************/ + +#ifndef __INIT_H__ +#define __INIT_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void UIInitialize (void) + SYS_TRAP(sysTrapUIInitialize); + +extern void UIReset (void) + SYS_TRAP(sysTrapUIReset); + +#ifdef __cplusplus +} +#endif + + +#endif __INIT_H__ diff --git a/sdk-3.1/include/Core/UI/InsPoint.h b/sdk-3.1/include/Core/UI/InsPoint.h new file mode 100644 index 0000000..16c63f9 --- /dev/null +++ b/sdk-3.1/include/Core/UI/InsPoint.h @@ -0,0 +1,56 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: InsPoint.h + * AUTHOR: Art Lamb: Jan 25, 1995 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines insertion point routines. + * + **********************************************************************/ + +#ifndef __INSPOINT_H__ +#define __INSPOINT_H__ + +// Blink interval is half of a second +#define insPtBlinkInterval (sysTicksPerSecond / 2) +#define insPtWidth 2 + +#ifdef __cplusplus +extern "C" { +#endif + +extern void InsPtInitialize (void) + SYS_TRAP(sysTrapInsPtInitialize); + +extern void InsPtSetLocation (const SWord x, const SWord y) + SYS_TRAP(sysTrapInsPtSetLocation); + +extern void InsPtGetLocation (const SWordPtr x, const SWordPtr y) + SYS_TRAP(sysTrapInsPtGetLocation); + +extern void InsPtEnable (const Boolean enableIt) + SYS_TRAP(sysTrapInsPtEnable); + +extern Boolean InsPtEnabled (void) + SYS_TRAP(sysTrapInsPtEnabled); + +extern void InsPtSetHeight (const SWord height) + SYS_TRAP(sysTrapInsPtSetHeight); + +extern SWord InsPtGetHeight (void) + SYS_TRAP(sysTrapInsPtGetHeight); + +extern void InsPtCheckBlink (void) + SYS_TRAP(sysTrapInsPtCheckBlink); + +#ifdef __cplusplus +} +#endif + +#endif __INSPOINT_H__ diff --git a/sdk-3.1/include/Core/UI/List.h b/sdk-3.1/include/Core/UI/List.h new file mode 100644 index 0000000..51b331a --- /dev/null +++ b/sdk-3.1/include/Core/UI/List.h @@ -0,0 +1,132 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: list.h + * AUTHOR: Roger Flores: November 3, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines list structures and routines. + * + ***********************************************************************/ + +#ifndef __LIST_H__ +#define __LIST_H__ + + +#define noListSelection 0xffff + +//------------------------------------------------------------------- +// List structures +//------------------------------------------------------------------- + +typedef struct { + Word usable :1; // set if part of ui + Word enabled :1; // set if interactable (not grayed out) + Word visible :1; // set if drawn + Word poppedUp :1; // set if choices displayed in popup win. + Word hasScrollBar :1; // set if the list has a scroll bar + Word search :1; // set if incremental search is enabled + Word reserved :2; +} ListAttrType; + + +// Load data callback routine prototype +typedef void ListDrawDataFuncType (Word itemNum, RectanglePtr bounds, + CharPtr *itemsText); + +typedef ListDrawDataFuncType * ListDrawDataFuncPtr; + + +typedef struct { + Word id; + RectangleType bounds; + ListAttrType attr; + CharPtr *itemsText; + Word numItems; // number of choices in the list + Word currentItem; // currently display choice + Word topItem; // top item visible when poped up + FontID font; // font used to draw list + WinHandle popupWin; // used only by popup lists + ListDrawDataFuncPtr drawItemsCallback; // 0 indicates no function +} ListType; + +typedef ListType * ListPtr; + + +//------------------------------------------------------------------- +// List routines +//------------------------------------------------------------------- +#ifdef __cplusplus +extern "C" { +#endif + +extern void LstDrawList (const ListPtr list) + SYS_TRAP(sysTrapLstDrawList); + +extern void LstEraseList (const ListPtr list) + SYS_TRAP(sysTrapLstEraseList); + +extern Word LstGetSelection (const ListPtr list) + SYS_TRAP(sysTrapLstGetSelection); + +extern CharPtr LstGetSelectionText (const ListPtr list, + const Word itemNum) + SYS_TRAP(sysTrapLstGetSelectionText); + +extern Boolean LstHandleEvent (const ListPtr list, const EventPtr event) + SYS_TRAP(sysTrapLstHandleEvent); + +extern void LstSetHeight (const ListPtr pList, Word visibleItems) + SYS_TRAP(sysTrapLstSetHeight); + +extern void LstSetPosition (const ListPtr pList, const SWord x, + const SWord y) + SYS_TRAP(sysTrapLstSetPosition); + +extern void LstSetSelection (const ListPtr list, const Word itemNum) + SYS_TRAP(sysTrapLstSetSelection); + +extern void LstSetListChoices (const ListPtr list, Char ** itemsText, + const Word numItems) + SYS_TRAP(sysTrapLstSetListChoices); + +extern void LstSetDrawFunction (const ListPtr pList, + const ListDrawDataFuncPtr func) + SYS_TRAP(sysTrapLstSetDrawFunction); + +extern void LstSetTopItem (const ListPtr pList, const Word itemNum) + SYS_TRAP(sysTrapLstSetTopItem); + +extern void LstMakeItemVisible (const ListPtr pList, const Word itemNum) + SYS_TRAP(sysTrapLstMakeItemVisible); + +extern Word LstGetNumberOfItems (const ListPtr pList) + SYS_TRAP(sysTrapLstGetNumberOfItems); + +extern SWord LstPopupList (const ListPtr list) + SYS_TRAP(sysTrapLstPopupList); + +extern Boolean LstScrollList(const ListPtr pList, + const enum directions direction, short itemCount) + SYS_TRAP(sysTrapLstScrollList); + +extern Int LstGetVisibleItems (const ListPtr pList) + SYS_TRAP(sysTrapLstGetVisibleItems); + +extern Err LstNewList (VoidPtr *formPP, const Word id, + const Word x, const Word y, const Word width, const Word height, + const FontID font, const Word visibleItems, const Word triggerId) + SYS_TRAP(sysTrapLstNewList); + + + +#ifdef __cplusplus +} +#endif + +#endif // __LIST_H__ diff --git a/sdk-3.1/include/Core/UI/Menu.h b/sdk-3.1/include/Core/UI/Menu.h new file mode 100644 index 0000000..fb2da3c --- /dev/null +++ b/sdk-3.1/include/Core/UI/Menu.h @@ -0,0 +1,107 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: menu.h + * AUTHOR: Roger Flores: November 18, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines menu structures and routines. + * + ***********************************************************************/ + +#ifndef __MENU_H__ +#define __MENU_H__ + + +#define noMenuSelection -1 +#define noMenuItemSelection -1 +#define separatorItemSelection -2 + + +// To match Apple's ResEdit the first byte of a menu item's text can +// be a special char indicating a special menu item. +#define MenuSeparatorChar '-' + + + +typedef struct { + Word id; // id of the menu item + Char command; // command key + CharPtr itemStr; // string to be displayed +} MenuItemType; + + +typedef struct { + WinHandle menuWin; // window of pull-down menu + RectangleType bounds; // bounds of the pulldown + WinHandle bitsBehind; // saving bits behind pull-down menu + RectangleType titleBounds; // bounds of the title in menu bar + CharPtr title; // menu title displayed in menu bar + Word numItems; // number of items in the menu + MenuItemType * items; // array of menu items +} MenuPullDownType; + +typedef MenuPullDownType * MenuPullDownPtr; + +typedef struct { + Word visible :1; // Set if menu bar is drawn + Word commandPending :1; // Set if next key is a command + Word insPtEnabled :1; // Set if insPt was on when menu was drawn +} MenuBarAttrType; + + +typedef struct { + WinHandle barWin; // window of menu bar + WinHandle bitsBehind; // saving bits behind menu bar + WinHandle savedActiveWin; + WinHandle bitsBehindStatus; + MenuBarAttrType attr; + SWord curMenu; // current menu or -1 if none + SWord curItem; // current item in curMenu, -1 if none + SDWord commandTick; // + SWord numMenus; // number of menus + MenuPullDownPtr menus; // array of menus +} MenuBarType; + +typedef MenuBarType * MenuBarPtr; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern MenuBarPtr MenuInit (const Word resourceId) + SYS_TRAP(sysTrapMenuInit); + +extern MenuBarPtr MenuGetActiveMenu (void) + SYS_TRAP(sysTrapMenuGetActiveMenu); + +extern MenuBarPtr MenuSetActiveMenu (const MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuSetActiveMenu); + +extern void MenuDispose (const MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuDispose); + +extern Boolean MenuHandleEvent (MenuBarPtr pMenu, const EventPtr event, + const WordPtr error) + SYS_TRAP(sysTrapMenuHandleEvent); + +extern void MenuDrawMenu (const MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuDrawMenu); + +extern void MenuEraseStatus (const MenuBarPtr pMenu) + SYS_TRAP(sysTrapMenuEraseStatus); + +extern void MenuSetActiveMenuRscID (const Word resourceId) + SYS_TRAP(sysTrapMenuSetActiveMenuRscID); + +#ifdef __cplusplus +} +#endif + +#endif //__MENU_H__ diff --git a/sdk-3.1/include/Core/UI/PhoneLookup.h b/sdk-3.1/include/Core/UI/PhoneLookup.h new file mode 100644 index 0000000..20bd590 --- /dev/null +++ b/sdk-3.1/include/Core/UI/PhoneLookup.h @@ -0,0 +1,32 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot 2.0 + * FILE: PhoneLookup.h + * AUTHOR: Art Lamb: July 23, 1996 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines phone number lookup structures and routines. + * + ***********************************************************************/ +#ifndef __PHONE_LOOKUP_H__ +#define __PHONE_LOOKUP_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void PhoneNumberLookup (const FieldPtr fld) + SYS_TRAP(sysTrapPhoneNumberLookup); + +#ifdef __cplusplus +} +#endif + + +#endif // __PHONE_LOOKUP_H__ diff --git a/sdk-3.1/include/Core/UI/Progress.h b/sdk-3.1/include/Core/UI/Progress.h new file mode 100644 index 0000000..d56dc80 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Progress.h @@ -0,0 +1,187 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot Net Library PPP Network Interface + * FILE: Progress.h + * AUTHOR: Gavin Peacock 6/4/97 from Ron Marianetti's net dialog stuff + * + * DESCRIPTION: + * This header file defines a generic progress dialog interface + * + **********************************************************************/ + +#ifndef __PROGRESS_H__ +#define __PROGRESS_H__ + +#include + + +#define progressMaxMessage 128 +#define progressMaxTitle 20 // max size for title of progress dialog + +// 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... +typedef struct +{ + Word stage; // <= current stage + CharPtr textP; // => buffer to hold text to display + Word textLen; // <= length of text buffer + CharPtr message; // <= additional text for display + Err error; // <= current error + Word bitmapId; // => resource ID of bitmap to display + Word canceled:1; // <= true if user has pressed the cancel button + Word showDetails:1; // <= true if user pressed down arrow for more details + Word textChanged:1; // => if true then update text (defaults to true) + Word timedOut:1; // <= true if update caused by a timeout + ULong timeout; // <> timeout in ticks to force next update (for animation) + + //progress bar info (Not Implemented) + DWord barMaxValue; // the maximum value for the progress bar, if = 0 then the bar is + // not visible + DWord barCurValue; // the current value of the progress bar, the bar will be drawn + // filled the percentage of maxValue \ value + CharPtr barMessage; // additional text for display below the progress bar. + Word barFlags; // reserved for future use. +} PrgCallbackData, *PrgCallbackDataPtr; + +//typedef Boolean (*PrgCallbackFunc) (Word stage,Boolean showDetails,CharPtr message,Boolean cancel,Word error,CharPtr textP, Word maxtextLen,Word *bitmapID); +typedef Boolean (*PrgCallbackFunc) (PrgCallbackDataPtr cbP); + + + +//--------------------------------------------------------------------------- +// 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. +//--------------------------------------------------------------------------- + + +typedef struct { + + // This field contains a pointer to the open progress dialog + FormPtr frmP; // 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 + ULong timeout; // max time to wait in ticks + + + // 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. + Word 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. + Word 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. + Word 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 + Word 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 + Word 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. + Word error; // 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. + Word stage; // 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(). + Char message[progressMaxMessage+1]; // connection stage message. + + // Used to cache current icon number so we don't unnecessarily redraw it + Word lastBitmapID; + + // 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. + Char ctlLabel[8]; + + CharPtr serviceNameP; + + //progress bar stuff (Sot implemented) + DWord lastBarMaxValue; + DWord lastBarCurValue; + + // stuff for saving old window state + WinHandle oldDrawWinH; + WinHandle oldActiveWinH; + FormPtr oldFrmP; + Boolean oldInsPtState; + PointType oldInsPtPos; + + PrgCallbackFunc textCallback; + + char title[progressMaxTitle+1]; + } ProgressType, *ProgressPtr; + + + + + + +// macro to test if the user has canceled +#define PrgUserCancel(prgP) (prgP)->cancel + +//----------------------------------------------------------------------- +// Prototypes +//----------------------------------------------------------------------- +ProgressPtr PrgStartDialogV10(CharPtr title,PrgCallbackFunc textCallback) + SYS_TRAP(sysTrapPrgStartDialogV10); + +void PrgStopDialog(ProgressPtr prgP,Boolean force) + SYS_TRAP(sysTrapPrgStopDialog); + +void PrgUpdateDialog(ProgressPtr prgGP, Word err, Word stage, + CharPtr messageP,Boolean updateNow) + SYS_TRAP(sysTrapPrgUpdateDialog); + +Boolean PrgHandleEvent(ProgressPtr prgGP,EventPtr eventP) + SYS_TRAP(sysTrapPrgHandleEvent); + +#endif //__PROGRESS_H__ + + + + + + diff --git a/sdk-3.1/include/Core/UI/Rect.h b/sdk-3.1/include/Core/UI/Rect.h new file mode 100644 index 0000000..afab8c1 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Rect.h @@ -0,0 +1,76 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Rect.h + * AUTHOR: Roger Flores: November 3, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines rectangle structures and routines. + * + ***********************************************************************/ + +#ifndef __RECT_H__ +#define __RECT_H__ + +typedef struct { + SWord left; + SWord top; + SWord right; + SWord bottom; +} AbsRectType; + + +typedef struct { + SWord x; + SWord y; +} PointType; + + +typedef struct { + PointType topLeft; + PointType extent; +} RectangleType; + +typedef RectangleType * RectanglePtr; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void RctSetRectangle (const RectanglePtr r, const SWord left, + const SWord top, const SWord width, const SWord height) + SYS_TRAP(sysTrapRctSetRectangle); + +extern void RctCopyRectangle (const RectanglePtr srcRect, + const RectanglePtr dstRect) + SYS_TRAP(sysTrapRctCopyRectangle); + +extern void RctInsetRectangle (const RectanglePtr r, SWord insetAmt) + SYS_TRAP(sysTrapRctInsetRectangle); + +extern void RctOffsetRectangle (const RectanglePtr r, const SWord deltaX, + const SWord deltaY) + SYS_TRAP(sysTrapRctOffsetRectangle); + +extern Boolean RctPtInRectangle (const SWord x, const SWord y, + const RectanglePtr r) + SYS_TRAP(sysTrapRctPtInRectangle); + +extern void RctGetIntersection (const RectanglePtr r1, const RectanglePtr r2, + RectanglePtr r3) + SYS_TRAP(sysTrapRctGetIntersection); + + +#ifdef __cplusplus +} +#endif + + +#endif //__RECT_H__ diff --git a/sdk-3.1/include/Core/UI/ScrDriver.h b/sdk-3.1/include/Core/UI/ScrDriver.h new file mode 100644 index 0000000..cf2d315 --- /dev/null +++ b/sdk-3.1/include/Core/UI/ScrDriver.h @@ -0,0 +1,183 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot [EMULATOR] + * + * FILE: ScrDriver.h + * + * AUTHOR: Ain McKendrick + * + * DECLARER: + * + * DESCRIPTION: Screen driver function prototypes. For use by TD applications. + * + * REVISION HISTORY: + * Name Date Description + * ---- ---- ----------- + * Ain 1/25/95 Initial creation + * Ain 2/3/95 Revised to use new WinPtr type due to name + * changes in window.h + * + **********************************************************************/ + +// If using the version 2 Graphics, include the new Window.h +// and ignore this one. Eventually, we will throw out support for +// building version 1 and rename WindowNew.h as Window.h, etc. +#if GRAPHICS_VERSION == GRAPHICS_VERSION_2 +#include +#else + +#ifndef __SCRDRIVER_H__ +#define __SCRDRIVER_H__ + +#include + + +/************************************************************************** + * Internal constants + ***************************************************************************/ +#define scrMaxLineBytes 32 // Max # of bytes in a scan line + // used in compression/decompression calls + +/************************************************************************** + * Operations for the ScrDisplayMode function + ***************************************************************************/ +typedef enum { + scrDisplayModeGetDefaults, + scrDisplayModeGet, + scrDisplayModeSetToDefaults, + scrDisplayModeSet, + scrDisplayModeGetSupportedDepths, + scrDisplayModeGetSupportsColor +} ScrDisplayModeOperation; + + +/************************************************************************** + * Internal Drawing info structure used by Screen Driver + ***************************************************************************/ +//typedef enum {scrCopy, scrAND, scrANDNOT, scrXOR, scrOR, scrCopyNOT} ScrOperation; + + +typedef struct ScrBltInfoType { + + // Common fields. + ScrOperation op; // which bit operation to do + SWord height; // height of blit operation + + WordPtr dstBaseP; // base address of window we're blitting to + Word dstRowBytes; // rowBytes of window + + WordPtr srcBaseP; // base address of window we're blitting from + Word srcRowBytes; // rowBytes of window + + + // Info for each line + Word leftMask; // mask for leftmost byte of row + Word rightMask; // mask for rightmost byte of row + SWord midWords; // # of words between left and right mask + + SWord dstRowDelta; // delta bytes from row to row + WordPtr dstP; // byte address of first dst line + + SWord srcRowDelta; // delta bytes from row to row + WordPtr srcP; // byte address of first source line + + + + // These fields only used for drawing operations. + Word* patternP; // pointer to pattern to use + Word solidPat; // color word if no pattern + //DOLATER.. used to byte byte + Boolean simple; // true if scrCopy with solid pattern + CustomPatternType pattern; // copy of modified pattern + + } ScrBltInfoType; +typedef ScrBltInfoType* ScrBltInfoPtr; + + + + +/************************************************************************** + * Structure of Screen Driver globals + ***************************************************************************/ +typedef struct ScrGlobalsType { + Word width; // width of display in pixels + Word height; // height of display in pixels + Word rowBytes; // rowBytes of display + Ptr baseAddr; // base address of display + CustomPatternType grayPat; // Gray pattern + Boolean doDrawNotify; // call ScrDrawNotify after drawing + AbsRectType updateR; // update rect when in remote mode + SDWord lastUpdate; // Tickcount of last update + } ScrGlobalsType; +typedef ScrGlobalsType* ScrGlobalsPtr; + + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Initialization +void ScrInit(void) + SYS_TRAP(sysTrapScrInit); + + +// BitBlt Functions +Err ScrCopyRectangle(WinPtr sourceWindow, WinPtr destWindow, + SWord fromX, SWord fromY, SWord toX, SWord toY, + SWord bitCount, SWord lineCount) + SYS_TRAP(sysTrapScrCopyRectangle); + + + +// Character Functions +void ScrDrawChars(WinPtr pWindow, SWord xLoc, SWord yLoc, SWord xExtent, SWord yExtent, + SWord clipTop, SWord clipLeft, SWord clipBottom, SWord clipRight, + CharPtr chars, Word len, FontPtr fontPtr) + SYS_TRAP(sysTrapScrDrawChars); + +// Line Draw Functions +void ScrLineRoutine(WinPtr pWindow, SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapScrLineRoutine); + +void ScrRectangleRoutine(WinPtr pWindow, SWord x, SWord y, SWord extentX, + SWord extentY) + SYS_TRAP(sysTrapScrRectangleRoutine); + +// Utility Functions +void ScrScreenInfo (WinPtr pWindow) + SYS_TRAP(sysTrapScrScreenInfo); + +void ScrDrawNotify(SWord updLeft, SWord updTop, SWord updWidth, SWord updHeight) + SYS_TRAP(sysTrapScrDrawNotify); + +void ScrSendUpdateArea(Boolean force) + SYS_TRAP(sysTrapScrSendUpdateArea); + +Word ScrCompressScanLine(BytePtr lineP, BytePtr prevLineP, Word width, + BytePtr dstParamP, Boolean firstLine) + SYS_TRAP(sysTrapScrCompressScanLine); + +Word ScrDeCompressScanLine(BytePtr srcP, BytePtr dstP, Word width) + SYS_TRAP(sysTrapScrDeCompressScanLine); + +Err ScrDisplayMode(ScrDisplayModeOperation operation, + DWordPtr widthP, DWordPtr heightP, DWordPtr depthP, BooleanPtr enableColorP) + SYS_TRAP(sysTrapScrDisplayMode); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __SCRDRIVER_H__ +#endif // GRAPHICS_VERSION_2 diff --git a/sdk-3.1/include/Core/UI/ScrDriverNew.h b/sdk-3.1/include/Core/UI/ScrDriverNew.h new file mode 100644 index 0000000..c533ea6 --- /dev/null +++ b/sdk-3.1/include/Core/UI/ScrDriverNew.h @@ -0,0 +1,252 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * + * FILE: ScrDriverNew.h + * + * AUTHOR: Ron Marianetti + * + * DECLARER: + * + * DESCRIPTION: Screen driver that supports color. Initially, only + * 2 bit gray is implemented + * + * REVISION HISTORY: + * Name Date Description + * ---- ---- ----------- + * RM 11/21/96 Created + * + **********************************************************************/ + +#ifndef __SCRDRIVER_H__ +#define __SCRDRIVER_H__ + +#include + + +/************************************************************************** + * Internal constants + ***************************************************************************/ +#define scrMaxLineBytes 40 // Max # of bytes in a scan line + // used in compression/decompression calls +#define scrMaxDepth 2 // Same as hwrDisplayMaxDepth + // used to reserve space for expanded patterns + // only used by WindowNew.c + + +/************************************************************************** + * Operations for the ScrDisplayMode function + ***************************************************************************/ +typedef enum { + scrDisplayModeGetDefaults, + scrDisplayModeGet, + scrDisplayModeSetToDefaults, + scrDisplayModeSet, + scrDisplayModeGetSupportedDepths, + scrDisplayModeGetSupportsColor +} ScrDisplayModeOperation; + + +/************************************************************************** + * Internal Drawing info structure used by Screen Driver. This structure is + * used to hold local variables used by the drawing operations. + * + * At the beginning of each drawing or blit operation, the basic fields + * in this structure are intialized using PrvGetBltInfo() + * (for ScrCopyRectangle and ScrDrawChars) or PrvGetDrawInfo() (for + * ScrLineRoutine and ScrRectangleRoutine. + * + * Then the masks for the left and right edge and other line specific + * information is filled in by calling PrvGetLineInfo(). Most high + * level calls call PrvGetLineInfo() only once. The exception is + * ScrDrawChars() because it essentially does a different bitblt + * operation for every character in the string. + * + ***************************************************************************/ +typedef struct ScrBltInfoType { + + + //----------------------------------------------------------------------------- + // COMMON BASE INFO + //............................................................................ + // The following fields are used by EVERY screen driver routine and are filled + // in by both PrvGetBltInfo and PrvGetDrawInfo. + //----------------------------------------------------------------------------- + ScrOperation op; // which drawing mode to use + SWord height; // height of operation + + WordPtr dstBaseP; // base address of window we're blitting to + DWord dstRowBytes; // rowBytes of window + Word dstDepth; // bits/pixel + Word dstShift; // log base 2 of dstDepth + Word dstPixelsInWordZ; // 0x0F for 1 bit, 0x07 for 2 bit, etc. + + + Word forePixels; // packed indices of foreground color + // in destination bitmap + Word backPixels; // packed indices of background color + // in destination bitmap + WordPtr oneBitTableP; // pointer to table that maps 1 bit source + // into destination depth sans color + + + //----------------------------------------------------------------------------- + // BLIT ONLY + //............................................................................ + // The following fields are only used by blitting operations (ScrCopyRectangle + // and ScrDrawChars and are filled in by PrvGetBltInfo only + //----------------------------------------------------------------------------- + WordPtr srcBaseP; // base address of window we're blitting from + DWord srcRowBytes; // rowBytes of window + Word srcDepth; // bits/pixel + Word srcShift; // log base 2 of srcDepth + Word srcPixelsInWordZ; // 0x0F for 1 bit, 0x07 for 2 bit, etc. + + WordPtr convSrcP; // pointer to buffer that can hold 1 + // scanline of source bitmap converted + // to destination bitmap format. + Word dynConvSrcP:1; // true if convSrcP was dynamically allocated + // and needs to be freed + + + //----------------------------------------------------------------------------- + // DRAW ONLY + //............................................................................ + // The following fields are only used by drawing operations (ScrDrawLineRoutine + // and ScrRectangleRoutine) and are filled in by PrvGetDrawInfo only + //----------------------------------------------------------------------------- + BytePtr patternP; // pointer to pattern to use + Boolean simple; // true if scrCopy with solid color + + + + //----------------------------------------------------------------------------- + // COMMON LINE INFO + //............................................................................ + // The following fields are are filled in by PrvGetLineInfo. These are fields that + // would change with every character drawn in ScrDrawChars() but common to the + // entire operation in the other routines (ScrCopyRectangle, ScrLineRouting, + // ScrRectangleRoutine). + //----------------------------------------------------------------------------- + WordPtr dstP; // byte address of first dst line + SDWord dstRowDelta; // delta bytes from row to row + + Word leftMask; // mask for leftmost word of row in dest + Word rightMask; // mask for rightmost word of row in dest + SWord midWords; // # of words between left and right mask in dest + + // The srcP and srcRowDelta fields are only filled in for blit operations + // (when infoP->srcBaseP is not nil). + WordPtr srcP; // byte address of first source line + SDWord srcRowDelta; // delta bytes from row to row + Word forward:1; // true if copying forward, false if + // backward. + // The srcBytesInLine field is normally initialized by PrvGetDepthConvertInfo() + // and used by the appropriate depth conversion routine. It contains the number + // of bytes of source needed to fill 1 scan line of destination + Word srcBytesInLine; + + } ScrBltInfoType; +typedef ScrBltInfoType* ScrBltInfoPtr; + + +/************************************************************ + * Function pointer to routine used to convert source bitmap into + * destination bitmap depth. It converts infoP->srcBytesInLine bytes + * of pixels from srcWP into the destination depth and stores them + * into infoP->convSrcP. + *************************************************************/ +typedef void (*ScrConvertDepthProcP)(WordPtr srcWP, ScrBltInfoPtr infoP); + + + +/************************************************************************** + * Structure of Screen Driver globals + ***************************************************************************/ +typedef struct ScrGlobalsType { + GDeviceType gDevice; // GDevice info (rowBytes, depth, etc) + // a pointer to this field is stored in + // the gDeviceP field of onscreen windows + CustomPatternType grayPat; // Gray pattern + Boolean doDrawNotify; // call ScrDrawNotify after drawing + AbsRectType updateR; // update rect when in remote mode + SDWord lastUpdate; // Tickcount of last update + + // This buffer is used to hold a scan line of a source blit that + // has been bit depth converted to match the destination bitmap. + Word expSrcSize; + BytePtr expSrcP; + + } ScrGlobalsType; +typedef ScrGlobalsType* ScrGlobalsPtr; + + + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Initialization +void ScrInit(void) + SYS_TRAP(sysTrapScrInit); + + +// BitBlt Functions +Err ScrCopyRectangle(WinPtr sourceWindow, WinPtr destWindow, + SWord fromX, SWord fromY, SWord toX, SWord toY, + SWord bitCount, SWord lineCount) + SYS_TRAP(sysTrapScrCopyRectangle); + + + +// Character Functions +void ScrDrawChars(WinPtr pWindow, SWord xLoc, SWord yLoc, SWord xExtent, SWord yExtent, + SWord clipTop, SWord clipLeft, SWord clipBottom, SWord clipRight, + const Char * const chars, Word len, FontPtr fontPtr) + SYS_TRAP(sysTrapScrDrawChars); + +// Line Draw Functions +void ScrLineRoutine(WinPtr pWindow, SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapScrLineRoutine); + +void ScrRectangleRoutine(WinPtr pWindow, SWord x, SWord y, SWord extentX, + SWord extentY) + SYS_TRAP(sysTrapScrRectangleRoutine); + +// Utility Functions +void ScrScreenInfo (WinPtr pWindow) + SYS_TRAP(sysTrapScrScreenInfo); + +void ScrDrawNotify(SWord updLeft, SWord updTop, SWord updWidth, SWord updHeight) + SYS_TRAP(sysTrapScrDrawNotify); + +void ScrSendUpdateArea(Boolean force) + SYS_TRAP(sysTrapScrSendUpdateArea); + +Word ScrCompressScanLine(BytePtr lineP, BytePtr prevLineP, Word width, + BytePtr dstParamP, Boolean firstLine) + SYS_TRAP(sysTrapScrCompressScanLine); + +Word ScrDeCompressScanLine(BytePtr srcP, BytePtr dstP, Word width) + SYS_TRAP(sysTrapScrDeCompressScanLine); + +Err ScrDisplayMode(ScrDisplayModeOperation operation, DWordPtr widthP, + DWordPtr heightP, DWordPtr depthP, BooleanPtr enableColorP) + SYS_TRAP(sysTrapScrDisplayMode); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __SCRDRIVER_H__ diff --git a/sdk-3.1/include/Core/UI/ScrollBar.h b/sdk-3.1/include/Core/UI/ScrollBar.h new file mode 100644 index 0000000..7c928e9 --- /dev/null +++ b/sdk-3.1/include/Core/UI/ScrollBar.h @@ -0,0 +1,70 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: ScrollBar.h + * AUTHOR: Art Lamb: Feb 6, 1996 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines scroll bar structures and routines. + * + ***********************************************************************/ + +#ifndef __SCROLLBAR_H__ +#define __SCROLLBAR_H__ + +typedef enum { sclUpArrow, sclDownArrow, sclUpPage, sclDownPage, sclCar } + ScrollBarRegionType; + + +typedef struct { + Word usable :1; // Set if part of ui + Word visible :1; // Set if drawn, used internally + Word hilighted :1; // Set if region is hilighted + Word shown :1; // Set if drawn and maxValue > minValue + Word activeRegion :4; // ScrollBarRegionType +} ScrollBarAttrType; + + +typedef struct { + RectangleType bounds; + Word id; + ScrollBarAttrType attr; + Short value; + Short minValue; + Short maxValue; + Short pageSize; + Short penPosInCar; + Short savePos; +} ScrollBarType; + +typedef ScrollBarType * ScrollBarPtr; + +#ifdef __cplusplus +extern "C" { +#endif + +extern void SclGetScrollBar (const ScrollBarPtr bar, const ShortPtr valueP, + const ShortPtr minP, const ShortPtr maxP, const ShortPtr pageSizeP) + SYS_TRAP(sysTrapSclGetScrollBar); + +extern void SclSetScrollBar (const ScrollBarPtr bar, Short value, + const Short min, const Short max, const Short pageSize) + SYS_TRAP(sysTrapSclSetScrollBar); + +extern void SclDrawScrollBar (const ScrollBarPtr bar) + SYS_TRAP(sysTrapSclDrawScrollBar); + +extern Boolean SclHandleEvent (const ScrollBarPtr bar, const EventPtr event) + SYS_TRAP(sysTrapSclHandleEvent); + +#ifdef __cplusplus +} +#endif + + +#endif __SCROLLBAR_H__ diff --git a/sdk-3.1/include/Core/UI/SelDay.h b/sdk-3.1/include/Core/UI/SelDay.h new file mode 100644 index 0000000..ccc3a6e --- /dev/null +++ b/sdk-3.1/include/Core/UI/SelDay.h @@ -0,0 +1,41 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: SelDay.h + * AUTHOR: Roger Flores: November 10, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines the date picker month object's structures + * and routines. + * + ***********************************************************************/ +#ifndef __SELDAY_H__ +#define __SELDAY_H__ + +#include + +#define daySelectorMinYear firstYear +#define daySelectorMaxYear lastYear + +#ifdef __cplusplus +extern "C" { +#endif + +extern Boolean SelectDayV10 (SWord *month, SWord *day, SWord *year, + const CharPtr title) + SYS_TRAP(sysTrapSelectDayV10); + +extern Boolean SelectDay (const SelectDayType selectDayBy, SWord *month, + SWord *day, SWord *year, const CharPtr title) + SYS_TRAP(sysTrapSelectDay); + +#ifdef __cplusplus +} +#endif + +#endif //__SELDAY_H__ diff --git a/sdk-3.1/include/Core/UI/SelTime.h b/sdk-3.1/include/Core/UI/SelTime.h new file mode 100644 index 0000000..5d36966 --- /dev/null +++ b/sdk-3.1/include/Core/UI/SelTime.h @@ -0,0 +1,47 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: SelTime.h + * AUTHOR: Roger Flores: December 6, 1994 + * CHANGES: Nick Twyman 8/4/98. Added SelectOneTime trap + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines select time structures and routines. + * + ***********************************************************************/ + +#ifndef __SELTIME_H__ +#define __SELTIME_H__ + +//------------------------------------------------------------------- +// structures +//------------------------------------------------------------------- + + +typedef struct { + Byte hours; + Byte minutes; + Byte seconds; +} HMSTime; + +#ifdef __cplusplus +extern "C" { +#endif + +extern Boolean SelectTime (const TimePtr startTimeP, const TimePtr EndTimeP, + const Boolean untimed, const CharPtr title, SWord startOfDay) + SYS_TRAP(sysTrapSelectTime); + +extern Boolean SelectOneTime(SWord *hour,SWord *minute,const CharPtr title) + SYS_TRAP(sysTrapSelectOneTime); + +#ifdef __cplusplus +} +#endif + +#endif // __SELTIME_H__ diff --git a/sdk-3.1/include/Core/UI/Table.h b/sdk-3.1/include/Core/UI/Table.h new file mode 100644 index 0000000..f1c8b7c --- /dev/null +++ b/sdk-3.1/include/Core/UI/Table.h @@ -0,0 +1,316 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: field.h + * AUTHOR: Art Lamb: September 1, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines table structures and routines. + * + ***********************************************************************/ +#ifndef __TABLE_H__ +#define __TABLE_H__ + +//------------------------------------------------------------------- +// Table structures +//------------------------------------------------------------------- + +#define tableDefaultColumnSpacing 1 +#define tableNoteIndicatorWidth 7 +#define tableNoteIndicatorHeight 11 +#define tableMaxTextItemSize 255 // does not incude terminating null + +// Display style of a table item +// +enum tableItemStyles { checkboxTableItem, + customTableItem, + dateTableItem, + labelTableItem, + numericTableItem, + popupTriggerTableItem, + textTableItem, + textWithNoteTableItem, + timeTableItem, + narrowTextTableItem + }; +typedef enum tableItemStyles TableItemStyleType; + + +typedef struct { + TableItemStyleType itemType; + FontID fontID; // font for drawing text + Word intValue; + CharPtr ptr; +} TableItemType; +typedef TableItemType * TableItemPtr; + + +// Draw item callback routine prototype, used only by customTableItem. +typedef void TableDrawItemFuncType + (VoidPtr table, Word row, Word column, RectanglePtr bounds); + +typedef TableDrawItemFuncType * TableDrawItemFuncPtr; + + +// Load data callback routine prototype +typedef Err TableLoadDataFuncType + (VoidPtr table, Word row, Word column, Boolean editable, + VoidHand * dataH, WordPtr dataOffset, WordPtr dataSize, FieldPtr fld); + +typedef TableLoadDataFuncType * TableLoadDataFuncPtr; + + +// Save data callback routine prototype +typedef Boolean TableSaveDataFuncType + (VoidPtr table, Word row, Word column); + +typedef TableSaveDataFuncType * TableSaveDataFuncPtr; + +typedef struct { + Word width; // width in pixels + Word unused : 6; + Word editIndicator : 1; + Word usable : 1; + Word spacing; // space after column + TableDrawItemFuncPtr drawCallback; + TableLoadDataFuncPtr loadDataCallback; + TableSaveDataFuncPtr saveDataCallback; + +} TableColumnAttrType; + + +typedef struct { + Word id; + Word height; // row height in pixels + DWord data; + + Word reserved1 : 7; + Word usable : 1; + Word reserved2 : 5; + Word invalid : 1; // true if redraw needed + Word staticHeight : 1; // Set if height does not expands as text is entered + Word selectable : 1; + + Word reserved3; + +} TableRowAttrType; + + +typedef struct { + Word visible:1; // Set if drawn, used internally + Word editable:1; // Set if editable + Word editing:1; // Set if in edit mode + Word selected:1; // Set if the current item is selected + Word hasScrollBar:1; // Set if the table has a scroll bar +} TableAttrType; + + +typedef struct { + Word id; + RectangleType bounds; + TableAttrType attr; + Word numColumns; + Word numRows; + Word currentRow; + Word currentColumn; + Word topRow; + TableColumnAttrType * columnAttrs; + TableRowAttrType * rowAttrs; + TableItemPtr items; + FieldType currentField; +} TableType; + +typedef TableType * TablePtr; + + +//------------------------------------------------------------------- +// Table routines +//------------------------------------------------------------------- +#ifdef __cplusplus +extern "C" { +#endif + +extern void TblDrawTable (const TablePtr table) + SYS_TRAP(sysTrapTblDrawTable); + +extern void TblRedrawTable (const TablePtr table) + SYS_TRAP(sysTrapTblRedrawTable); + +extern void TblEraseTable (const TablePtr table) + SYS_TRAP(sysTrapTblEraseTable); + +extern Boolean TblHandleEvent (const TablePtr table, const EventPtr event) + SYS_TRAP(sysTrapTblHandleEvent); + +extern void TblGetItemBounds (const TablePtr table, const Word row, + const Word column, const RectanglePtr r) + SYS_TRAP(sysTrapTblGetItemBounds); + +extern void TblSelectItem (const TablePtr table, const Word row, + const Word column) + SYS_TRAP(sysTrapTblSelectItem); + +extern Word TblGetItemInt (const TablePtr table, const Word row, + const Word column) + SYS_TRAP(sysTrapTblGetItemInt); + +extern void TblSetItemInt (const TablePtr table, const Word row, + const Word column, const Word value) + SYS_TRAP(sysTrapTblSetItemInt); + +extern void TblSetItemPtr (const TablePtr table, const Word row, + const Word column, const VoidPtr value) + SYS_TRAP(sysTrapTblSetItemPtr); + +extern void TblSetItemStyle (const TablePtr table, const Word row, + const Word column, const TableItemStyleType type) + SYS_TRAP(sysTrapTblSetItemStyle); + +extern void TblUnhighlightSelection (const TablePtr table) + SYS_TRAP(sysTrapTblUnhighlightSelection); + +extern Boolean TblRowUsable (const TablePtr table, const Word row) + SYS_TRAP(sysTrapTblRowUsable); + +extern void TblSetRowUsable (const TablePtr table, const Word row, + const Boolean usable) + SYS_TRAP(sysTrapTblSetRowUsable); + +extern Word TblGetLastUsableRow (const TablePtr table) + SYS_TRAP(sysTrapTblGetLastUsableRow); + + +extern void TblSetColumnUsable (const TablePtr table, const Word row, + const Boolean usable) + SYS_TRAP(sysTrapTblSetColumnUsable); + +extern void TblSetRowSelectable (const TablePtr table, const Word row, + const Boolean selectable) + SYS_TRAP(sysTrapTblSetRowSelectable); + +extern Boolean TblRowSelectable (const TablePtr table, const Word row) + SYS_TRAP(sysTrapTblRowSelectable); + +extern Word TblGetNumberOfRows (const TablePtr table) + SYS_TRAP(sysTrapTblGetNumberOfRows); + +extern void TblSetCustomDrawProcedure (const TablePtr table, const Word column, + const TableDrawItemFuncPtr drawCallback) + SYS_TRAP(sysTrapTblSetCustomDrawProcedure); + +extern void TblSetLoadDataProcedure (const TablePtr table, const Word column, + const TableLoadDataFuncPtr loadDataCallback) + SYS_TRAP(sysTrapTblSetLoadDataProcedure); + +extern void TblSetSaveDataProcedure (const TablePtr table, const Word column, + const TableSaveDataFuncPtr saveDataCallback) + SYS_TRAP(sysTrapTblSetSaveDataProcedure); + + +extern void TblGetBounds (const TablePtr table, const RectanglePtr r) + SYS_TRAP(sysTrapTblGetBounds); + +extern void TblSetBounds (const TablePtr table, const RectanglePtr r) + SYS_TRAP(sysTrapTblSetBounds); + +extern Word TblGetRowHeight (const TablePtr table, const Word row) + SYS_TRAP(sysTrapTblGetRowHeight); + +extern void TblSetRowHeight (const TablePtr table, const Word row, + const Word height) + SYS_TRAP(sysTrapTblSetRowHeight); + +extern Word TblGetColumnWidth (const TablePtr table, const Word column) + SYS_TRAP(sysTrapTblGetColumnWidth); + +extern void TblSetColumnWidth (const TablePtr table, const Word column, + const Word width) + SYS_TRAP(sysTrapTblSetColumnWidth); + +extern Word TblGetColumnSpacing (const TablePtr table, const Word column) + SYS_TRAP(sysTrapTblGetColumnSpacing); + +extern void TblSetColumnSpacing (const TablePtr table, const Word column, + const Word spacing) + SYS_TRAP(sysTrapTblSetColumnSpacing); + +extern Boolean TblFindRowID (const TablePtr table, const Word id, + const WordPtr rowP) + SYS_TRAP(sysTrapTblFindRowID); + +extern Boolean TblFindRowData (const TablePtr table, const DWord data, + const WordPtr rowP) + SYS_TRAP(sysTrapTblFindRowData); + +extern Word TblGetRowID (const TablePtr table, const Word row) + SYS_TRAP(sysTrapTblGetRowID); + +extern void TblSetRowID (const TablePtr table, const Word row, const Word id) + SYS_TRAP(sysTrapTblSetRowID); + +extern DWord TblGetRowData (const TablePtr table, const Word row) + SYS_TRAP(sysTrapTblGetRowData); + +extern void TblSetRowData (const TablePtr table, const Word row, + const DWord data) + SYS_TRAP(sysTrapTblSetRowData); + +extern Boolean TblRowInvalid (const TablePtr table, const Word row) + SYS_TRAP(sysTrapTblRowInvalid); + +extern void TblMarkRowInvalid (const TablePtr table, const Word row) + SYS_TRAP(sysTrapTblMarkRowInvalid); + +extern void TblMarkTableInvalid (const TablePtr table) + SYS_TRAP(sysTrapTblMarkTableInvalid); + +extern Boolean TblGetSelection (const TablePtr table, const WordPtr rowP, + const WordPtr columnP) + SYS_TRAP(sysTrapTblGetSelection); + +extern void TblInsertRow (const TablePtr table, const Word row) + SYS_TRAP(sysTrapTblInsertRow); + +extern void TblRemoveRow (const TablePtr table, const Word row) + SYS_TRAP(sysTrapTblRemoveRow); + +extern void TblReleaseFocus (const TablePtr table) + SYS_TRAP(sysTrapTblReleaseFocus); + +extern Boolean TblEditing (const TablePtr table) + SYS_TRAP(sysTrapTblEditing); + +extern FieldPtr TblGetCurrentField (const TablePtr table) + SYS_TRAP(sysTrapTblGetCurrentField); + +extern void TblGrabFocus (const TablePtr table, const Word row, + const Word column) + SYS_TRAP(sysTrapTblGrabFocus); + +extern void TblSetColumnEditIndicator (const TablePtr table, const Word column, + const Boolean editIndicator) + SYS_TRAP(sysTrapTblSetColumnEditIndicator); + +extern void TblSetRowStaticHeight (const TablePtr table, const Word row, + const Boolean staticHeight) + SYS_TRAP(sysTrapTblSetRowStaticHeight); + +extern void TblHasScrollBar (const TablePtr table, const Boolean hasScrollBar) + SYS_TRAP(sysTrapTblHasScrollBar); + +extern FontID TblGetItemFont (TablePtr table, Word row, Word column) + SYS_TRAP(sysTrapTblGetItemFont); + +extern void TblSetItemFont (TablePtr table, Word row, Word column, FontID fontID) + SYS_TRAP(sysTrapTblSetItemFont); + +#ifdef __cplusplus +} +#endif + +#endif //__TABLE_H__ diff --git a/sdk-3.1/include/Core/UI/UIAll.h b/sdk-3.1/include/Core/UI/UIAll.h new file mode 100644 index 0000000..74833ab --- /dev/null +++ b/sdk-3.1/include/Core/UI/UIAll.h @@ -0,0 +1,45 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * UIAll.h + * + *******************************************************************/ + + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __cplusplus +} +#endif + diff --git a/sdk-3.1/include/Core/UI/UICommon.h b/sdk-3.1/include/Core/UI/UICommon.h new file mode 100644 index 0000000..d3d87ab --- /dev/null +++ b/sdk-3.1/include/Core/UI/UICommon.h @@ -0,0 +1,423 @@ +/******************************************************************* + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * FileName: + * UICommon.h + * + *******************************************************************/ + +#ifndef __UICOMMON_H__ +#define __UICOMMON_H__ + + +//------------------------------------------------------------ +// System functions +//------------------------------------------------------------ +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define max(a, b) (((a) > (b)) ? (a) : (b)) + + + +//------------------------------------------------------------ +// Temporary resource routines +//------------------------------------------------------------ + +#define strRsc 'tSTR' +#define ainRsc 'tAIN' +#define iconType 'tAIB' +#define bitmapRsc 'Tbmp' +#define alertRscType 'Talt' +#define kbdRscType 'tkbd' +#define MenuRscType 'MBAR' +#define fontRscType 'NFNT' +#define verRsc 'tver' +#define appInfoStringsRsc 'tAIS' +#define fontIndexType 'fnti' + + + +// Application version string ID +#define appVersionID 1 // our apps use tver 1 resource +#define appVersionAlternateID 1000 // CW Constructor uses tver 1000 resource + // so we'll look for ours first, then try theirs +#define ainID 1000 + +// System Default app icon (for apps missing a tAIB) +#define defaultAppIconBitmap 10000 +#define defaultAppSmallIconBitmap 10001 + +// System version string ID - this is hidden in +// the SystemVersion.rsrc resource, because the 'system' resources +// don't have ResEdit formats. +#define systemVersionID 10000 + +// Font index, a list of font resources to load into the font table. +#define fontIndexRscId 10000 + +// System bitmaps +#define palmLogoBitmap 10000 +#define keyboardBackspaceBitmap 10001 +#define keyboardTabBitmap 10002 +#define keyboardReturnBitmap 10003 +#define InformationAlertBitmap 10004 +#define ConfirmationAlertBitmap 10005 +#define WarningAlertBitmap 10006 +#define ErrorAlertBitmap 10007 +#define keyboardShiftBitmap 10008 +#define keyboardCapBitmap 10009 + + +// System string resources +#define daysOfWeekStrID 10000 +#define dayFullNamesStrID 10001 +#define monthNamesStrID 10002 +#define monthFullNamesStrID 10003 +#define categoryAllStrID 10004 +#define categoryEditStrID 10005 +#define menuCommandStrID 10006 +#define launcherBatteryStrID 10007 +#define systemNameStrID 10008 +#define phoneLookupTitleStrID 10009 +#define phoneLookupAddStrID 10010 +#define phoneLookupFormatStrID 10011 + // Product name: If this string exists, use it instead of "PalmPilot" + // This string was first created for the IBM WorkPad (v2.0.2) ROM. +#define oemProductNameStrID 10012 + +#define proStrID 10013 // Appended to version string on Professional +#define demoStrID 10014 // Appended to version string on Demo unit + +#define sysSendStatusBeamingStrID 10015 +#define sysSendStatusReceivingStrID 10016 + + +// System Alerts +#define SelectACategoryAlert 10000 + +// This alert broke 1.0 applications and is now disabled until later. +// It is redefined below (10015). +//#define RemoveCategoryAlert 10001 +//#define RemoveCategoryRecordsButton 0 +//#define RemoveCategoryNameButton 1 +//#define RemoveCategoryCancelButton 2 + +#define LowBatteryAlert 10002 +#define VeryLowBatteryAlert 10003 +#define UndoAlert 10004 +#define UndoCancelButton 1 + +#define MergeCategoryAlert 10005 +#define MergeCategoryYes 0 +#define MergeCategoryNo 1 + +#define privateRecordInfoAlert 10006 + +#define ClipboardLimitAlert 10007 + +#define CategoryExistsAlert 10012 + +#define DeviceFullAlert 10013 + +#define categoryAllUsedAlert 10014 + +#define RemoveCategoryAlert 10015 // See alert 10001 +#define RemoveCategoryYes 0 +#define RemoveCategoryNo 1 + +#define DemoUnitAlert 10016 + +#define NoDataToBeamAlert 10017 + +// New for PalmOS 3.1 +#define LowCradleChargedBatteryAlert 10018 +#define VeryLowCradleChargedBatteryAlert 10019 + + + +// System Menu Bar and Menus +#define sysEditMenuID 10000 +#define sysEditMenuUndoCmd 10000 +#define sysEditMenuCutCmd 10001 +#define sysEditMenuCopyCmd 10002 +#define sysEditMenuPasteCmd 10003 +#define sysEditMenuSelectAllCmd 10004 +#define sysEditMenuSeparator 10005 +#define sysEditMenuKeyboardCmd 10006 +#define sysEditMenuGraffitiCmd 10007 + + +// Keyboard Menu Bar and Menus +#define sysKeyboardMenuID 10100 +#define sysKeyboardEditUndoCmd 100 +#define sysKeyboardEditCutCmd 101 +#define sysKeyboardEditCopyCmd 102 +#define sysKeyboardEditPasteCmd 103 +#define sysKeyboardEditSelectAllCmd 104 + + +// Note View Menu Bar and Menus +#define noteMenuID 10200 +#define noteUndoCmd 10000 +#define noteCutCmd 10001 +#define noteCopyCmd 10002 +#define notePasteCmd 10003 +#define noteSelectAllCmd 10004 +#define noteSeparator 10005 +#define noteKeyboardCmd 10006 +#define noteGraffitiCmd 10007 +#define noteFontCmd 10200 +#define noteTopOfPageCmd 10201 +#define noteBottomOfPageCmd 10202 +#define notePhoneLookupCmd 10203 + + + +// System Keyboard Dialog +#define SystemKeyboardID 10000 + + +// Categories Edit Dialog +#define CategoriesEditForm 10000 +#define CategoriesEditList 10002 +#define CategoriesEditOKButton 10003 +#define CategoriesEditNewButton 10004 +#define CategoriesEditRenameButton 10005 +#define CategoriesEditDeleteButton 10006 + + +// Date Selector Dialog +#define DateSelectorForm 10100 +#define DateSelectorYearLabel 10102 +#define DateSelectorPriorYearButton 10103 +#define DateSelectorNextYearButton 10104 +#define DateSelectorTodayButton 10118 +#define DateSelectorCancelButton 10119 +#define DateSelectorDayGadget 10120 +#define DateSelectorThisWeekButton 10121 +#define DateSelectorThisMonthButton 10122 + + +// Time Selector Dialog +#define TimeSelectorForm 10200 +#define TimeSelectorStartTimeButton 10204 +#define TimeSelectorEndTimeButton 10205 +#define TimeSelectorHourList 10206 +#define TimeSelectorMinuteList 10207 +#define TimeSelectorOKButton 10208 +#define TimeSelectorCancelButton 10209 +#define TimeSelectorNoTimeButton 10210 + + +// Onscreen Keyboard +#define KeyboardForm 10300 +#define KeyboardGadget 10310 + + +// Help Dialog +#define HelpForm 10400 +#define HelpField 10402 +#define HelpDoneButton 10403 +#define HelpUpButton 10404 +#define HelpDownButton 10405 + + +// Find Dialog +#define FindDialog 10500 +#define FindStrField 10503 +#define FindOKButton 10504 + + +// Find Results Dialog +#define FindResultsDialog 10600 +#define FindResultsMsgLabel 10602 +#define FindResultsTable 10603 +#define FindResultsGoToButton 10604 +#define FindResultsCancelButton 10605 +#define FindResultsMoreButton 10606 +#define FindResultsStopButton 10607 + +#define FindResultsSearchingStr 10607 +#define FindResultsMatchesStr 10608 +#define FindResultsNoMatchesStr 10609 +#define FindResultsContinueStr 10610 + + +// Note View (used by Datebook, To Do, and Address apps) +#define NoteView 10900 +#define NoteField 10901 +#define NoteDoneButton 10902 +#define NoteSmallFontButton 10903 +#define NoteLargeFontButton 10904 +#define NoteDeleteButton 10905 +#define NoteUpButton 10906 +#define NoteDownButton 10907 +#define NoteScrollBar 10908 +#define NoteFontGroup 1 +#define noteViewMaxLength 4096 // not including null, tied to tFLD rsrc 10901 + +// About Box - used by Datebook, Memo, Address, To Do, & others +#define aboutDialog 11000 +#define aboutNameLabel 11001 +#define aboutVersionLabel 11002 +#define aboutErrorStr 11003 + + +// Category New Name Dialog (used for new and renamed categories) +#define categoryNewNameDialog 11100 +#define categoryNewNameField 11103 +#define categoryNewNameOKButton 11104 + + +// Graffiti Reference Dialog +#define graffitiReferenceDialog 11200 +#define graffitiReferenceDoneButton 11202 +#define graffitiReferenceUpButton 11203 +#define graffitiReferenceDownButton 11204 +#define graffitiReferenceFirstBitmap 11205 + + +// Net Library Serial Net Interface dialogs. These don't really have to +// have ID's in the system range except in the Emulator. When running on +// the device, the interface's resource file is opened up just to get these +// resources so that the ID's don't have to be unique with the application's +// resource IDs. +#define netSerStringList 11300 // String list resource ID + +// Net Serial Progress Dialog +#define netSerProgressFrm 11300 // progress form ID +#define netSerProgressLabelStage 11302 // Label ID +#define netSerProgressBtnCancel 11303 // Cancel button ID +#define netSerPictPhone 11300 // resource ID of phone picture +#define netSerPictHandshake 11301 // resource ID of handshake picture +#define netSerPictBook 11302 // resource ID of book picture +#define netSerPictError 11303 // resource ID of error picture + +// Net Serial Prompt Dialog +#define netSerPromptFrm 11400 // Prompt for string form ID +#define netSerPromptAsk 11402 // Label - ask string +#define netSerPromptField 11403 // answer field +#define netSerPromptBtnOK 11404 // OK button ID +#define netSerPromptBtnCancel 11405 // Cancel button ID + + +// Launcher Dialog +#define launcherDialog 11500 +#define launcherGadget 11501 + + +// Progress Dialog +#define prgStringList 11600 // String list resource ID +#define prgProgressFrm 11600 // progress form ID +#define prgProgressLabelStage 11602 // Label ID +#define prgProgressBtnCancel 11603 // Cancel button ID +#define prgPictPhone 11620 // resource ID of phone picture +#define prgPictHandshake 11621 // resource ID of handshake picture +#define prgPictBook 11622 // resource ID of book picture +#define prgPictError 11623 // resource ID of error picture + +// IrLib Progress Icons +#define prgBeamSend1 11640 // resource ID of 1st beam send +#define prgBeamSend2 11641 // resource ID of 2nd beam send +#define prgBeamRec1 11642 // resource ID of 1st beam receive +#define prgBeamRec2 11643 // resource ID of 2nd beam receive +#define prgBeamPrepare1 11644 // preparing/accepting +#define prgBeamPrepare2 11645 // preparing/accepting +#define prgBeamIdle 11646 // inactive + +// Exchange Manager progress strings (defaults in system) +#define exgPrgStringList 11650 // String list resource ID for Ir Exg lib +// Indexes into the preceeding list +#define exgStrIndexOK 1 // "OK" +#define exgStrIndexCancelling 2 // "Cancelling" +#define exgStrIndexError 3 // "Error: " +#define exgStrIndexInitializing 4 // "Initializing" +#define exgStrIndexStarting 5 // "Starting" +#define exgStrIndexSearching 6 // "Searching" +#define exgStrIndexConnected 7 // "Connected" +#define exgStrIndexSending 8 // "Sending: " +#define exgStrIndexReceiving 9 // "Receiving: " +#define exgStrIndexDisconnecting 10 // "Disconnecting" +#define exgStrIndexWaitingSender 11 // "Waiting for Sender" +#define exgStrIndexPreparing 12 // "Preparing" +#define exgStrIndexAccepting 13 // "Accepting" +#define exgStrIndexInterrupted 14 // "Transfer Interrupted" + +// Exchange Manager Dialog +#define ExchangeForm 11700 // form to ask user if they want to receive +#define ExchangeOKButton 11701 +#define ExchangeCancelButton 11702 +#define ExchangeIconBitMap 11704 +#define ExchangeMessageField 11703 +#define ExchangeQuestionString 11710 // "do you want to" question string +#define ExchangeUnnamedString 11711 // name for unnamed item +#define ExchangeIrBeamString 11712 // name for Ir Library dialogs +#define ExchangeLowBatteryAlert 11720 // Low battery Ir alert +#define ExchangeReceiveDisabledAlert 11730 // Beam Receive disabled Ir alert +#define ExchangeIrUnsupportedAlert 11740 // No Ir Hardware alert +#define ExchangeNoLibraryAlert 11750 // No Exchange library alert + +// Font Selector Dialog +#define FontSelectorForm 11900 +#define FontSelector1Button 11903 +#define FontSelector2Button 11904 +#define FontSelector3Button 11905 +#define FontSelectorOKButton 11906 +#define FontSelectorCancelButton 11907 +#define FontSelectorFontGroup 1 + +// Custom Alert Dialog +#define CustomAlertDialog 12000 +#define CustomAlertBitmap 12002 +#define CustomAlertField 12003 +#define CustomAlertFirstButton 12004 + +// Time Dialog Box (SelectOneTime) +#define SelectOneTimeDialog 12100 +#define timeHourButton 12105 +#define timeMinutesTensButton 12106 +#define timeMinutesOnesButton 12107 +#define timeDecreaseButton 12109 +#define timeIncreaseButton 12108 +#define timeAMCheckbox 12110 +#define timePMCheckbox 12111 +#define timeSeparatorLabel 12102 +#define timeOkButton 12112 +#define timeCancelButton 12113 + +// Contrast Adjust Dialog +#define ContrastAdjustForm 13100 +#define ContrastSliderBackground 13101 +#define ContrastSliderControl 13102 +#define ContrastSliderDoneButton 13103 + + +//------------------------------------------------------------ +// Temporary resource routines +//------------------------------------------------------------ +#ifdef __cplusplus +extern "C" { +#endif + +VoidPtr ResLoadForm (Word rscID) + SYS_TRAP(sysTrapResLoadForm); + +VoidPtr ResLoadMenu (Word rscID) + SYS_TRAP(sysTrapResLoadMenu); + + +CharPtr ResLoadString (Word rscID); + + + +//------------------------------------------------------------ +// Temporary debugging routines +//------------------------------------------------------------ +extern Boolean HeapDump (void); + +#ifdef __cplusplus +} +#endif + +#endif //__UICOMMON_H__ diff --git a/sdk-3.1/include/Core/UI/UIGlobals.h b/sdk-3.1/include/Core/UI/UIGlobals.h new file mode 100644 index 0000000..77fb313 --- /dev/null +++ b/sdk-3.1/include/Core/UI/UIGlobals.h @@ -0,0 +1,150 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: Global.h + * AUTHOR: Art Lamb: September 12, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines global variables used by the UI routines. + * + * HISTORY: + * 5/5/98 art Added a global variable for the virtual fonts. + * + **********************************************************************/ + +#ifndef __GLOBAL_H__ +#define __GLOBAL_H__ + + +#define UIDefNumSysFonts 8 // PalmOS 3.0 has eight system fonts +#define UIDefNumAppFonts 4 // Space is initially allocated for four app fonts + +#define eventQueueSize 10 + + +typedef struct UIGlobalsType { + + // Global variables used by the window routines. + WinHandle activeWindow; + WinHandle displayWindow; + WinHandle drawWindow; + WinHandle firstWindow; + WinHandle exitWindowID; + WinHandle enterWindowID; + WinHandle exitedWindowID; + GraphicStateType gState; + + + // Global variables used by the event routines. + EventStoreType* eventQ; + Word eventQIndex; + Word eventQLength; + SWord lastScreenX; + SWord lastScreenY; + Boolean lastPenDown; + SDWord needNullTickCount; // We want a null Evt when ticks reaches this value + + + // Global variables used by the font routins. + FontPtr uiCurrentFontPtr; + FontTablePtr uiSysFontTablePtr; // new for 3.0 + FontTablePtr uiAppFontTablePtr; // new for 3.0 + Word uiNumSysFonts; // new for 3.0 + Word uiNumAppFonts; // new for 3.0 + FontTablePtr uiFontListPtr; // new for 3.1 + DWord uiUnused2; // reserved for 3.2 (new "rootWindow" global) + FontID uiCurrentFontID; + + + // Global variables used by the form routines. + FormPtr currentForm; + + + // Global variables used by the insertion point routines. + Boolean insPtIsEnabled; + Boolean insPtOn; + PointType insPtLoc; + SWord insPtHeight; + SDWord insPtLastTick; + WinHandle insPtBitsBehind; + + // Global variables used by the clipboard routines. + ClipboardItem clipboard[numClipboardForamts]; + + // Globals used by the Memory Manager + MenuBarPtr uiCurrentMenu; + Word uiCurrentMenuRscID; + + // Global variables used by the field routines. + FieldUndoType undoGlobals; + + // Global variables used by the Griffiti shift state indicator routines. + Byte gsiState; + Boolean gsiIsEnabled; + PointType gsiLocation; + + // Numeric decimal seperator, used in the field routines. + Char uiDecimalSeparator; + + } UIGlobalsType; +typedef UIGlobalsType* UIGlobalsPtr; + + +#define ActiveWindow ((UIGlobalsPtr)GUIGlobalsP)->activeWindow +#define DisplayWindow ((UIGlobalsPtr)GUIGlobalsP)->displayWindow +#define DrawWindow ((UIGlobalsPtr)GUIGlobalsP)->drawWindow +#define FirstWindow ((UIGlobalsPtr)GUIGlobalsP)->firstWindow +#define ExitWindowID ((UIGlobalsPtr)GUIGlobalsP)->exitWindowID +#define EnterWindowID ((UIGlobalsPtr)GUIGlobalsP)->enterWindowID +#define ExitedWindowID ((UIGlobalsPtr)GUIGlobalsP)->exitedWindowID +#define GState ((UIGlobalsPtr)GUIGlobalsP)->gState + +#define EventQ ((UIGlobalsPtr)GUIGlobalsP)->eventQ +#define EventQIndex ((UIGlobalsPtr)GUIGlobalsP)->eventQIndex +#define EventQLength ((UIGlobalsPtr)GUIGlobalsP)->eventQLength +#define LastScreenX ((UIGlobalsPtr)GUIGlobalsP)->lastScreenX +#define LastScreenY ((UIGlobalsPtr)GUIGlobalsP)->lastScreenY +#define LastPenDown ((UIGlobalsPtr)GUIGlobalsP)->lastPenDown +#define NeedNullTickCount ((UIGlobalsPtr)GUIGlobalsP)->needNullTickCount + +// UIFontTable no longer exists; use UISysFontPtr and UIAppFontPtr +#define UICurrentFontPtr ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentFontPtr +#define UISysFontTablePtr ((UIGlobalsPtr)GUIGlobalsP)->uiSysFontTablePtr +#define UIAppFontTablePtr ((UIGlobalsPtr)GUIGlobalsP)->uiAppFontTablePtr +#define UISysFontPtr (((UIGlobalsPtr)GUIGlobalsP)->uiSysFontTablePtr) +#define UIAppFontPtr (((UIGlobalsPtr)GUIGlobalsP)->uiAppFontTablePtr) +#define UIFontListPtr (((UIGlobalsPtr)GUIGlobalsP)->uiFontListPtr) +#define UINumSysFonts ((UIGlobalsPtr)GUIGlobalsP)->uiNumSysFonts +#define UINumAppFonts ((UIGlobalsPtr)GUIGlobalsP)->uiNumAppFonts +#define UICurrentFontID ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentFontID + +#define CurrentForm ((UIGlobalsPtr)GUIGlobalsP)->currentForm + +#define InsPtIsEnabled ((UIGlobalsPtr)GUIGlobalsP)->insPtIsEnabled +#define InsPtOn ((UIGlobalsPtr)GUIGlobalsP)->insPtOn +#define InsPtLoc ((UIGlobalsPtr)GUIGlobalsP)->insPtLoc +#define InsPtHeight ((UIGlobalsPtr)GUIGlobalsP)->insPtHeight +#define InsPtLastTick ((UIGlobalsPtr)GUIGlobalsP)->insPtLastTick +#define InsPtBitsBehind ((UIGlobalsPtr)GUIGlobalsP)->insPtBitsBehind + +#define Clipboard ((UIGlobalsPtr)GUIGlobalsP)->clipboard + +#define UICurrentMenu ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentMenu +#define UICurrentMenuRscID ((UIGlobalsPtr)GUIGlobalsP)->uiCurrentMenuRscID +#define UndoGlobals ((UIGlobalsPtr)GUIGlobalsP)->undoGlobals + +#define GsiState ((UIGlobalsPtr)GUIGlobalsP)->gsiState +#define GsiIsEnabled ((UIGlobalsPtr)GUIGlobalsP)->gsiIsEnabled +#define GsiLocation ((UIGlobalsPtr)GUIGlobalsP)->gsiLocation + +#define UIDecimalSeparator ((UIGlobalsPtr)GUIGlobalsP)->uiDecimalSeparator + + +#endif //__GLOBAL_H__ + + diff --git a/sdk-3.1/include/Core/UI/Window.h b/sdk-3.1/include/Core/UI/Window.h new file mode 100644 index 0000000..ff6b6b4 --- /dev/null +++ b/sdk-3.1/include/Core/UI/Window.h @@ -0,0 +1,360 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: window.h + * AUTHOR: Art Lamb: September 12, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines window structures and routines. + * + **********************************************************************/ +// If using the version 2 Graphics, include the new Window.h +// and ignore this one. Eventually, we will throw out support for +// building version 1 and rename WindowNew.h as Window.h, etc. +#if GRAPHICS_VERSION == GRAPHICS_VERSION_2 +#include +#else + +#ifndef __WINDOW_H__ +#define __WINDOW_H__ + + +enum directions { up = 0, down, left, right }; +typedef enum directions DirectionType; + + +enum windowFormats { screenFormat = 0, genericFormat }; +typedef enum windowFormats WindowFormatType; + + +//enum graphicModes { drawMode = 0, eraseMode, invertMode, mergeMode}; +//typedef enum graphicModes GraphicModeType; +typedef enum {scrCopy, scrAND, scrANDNOT, scrXOR, scrOR, scrCopyNOT} ScrOperation; + + +enum patterns { blackPattern, whitePattern, grayPattern, customPattern }; +typedef enum patterns PatternType; + +#define grayHLinePattern 0xAA + +enum underlineModes { noUnderline, grayUnderline, solidUnderline }; +typedef enum underlineModes UnderlineModeType; + + + +typedef struct { + Word compressed:1; // Data format: 0=raw; 1=compressed + Word reserved :15; +} BitmapFlagsType; + + +typedef struct { + Word width; + Word height; + Word rowBytes; + BitmapFlagsType flags; + Word reserved [4]; +} BitmapType; + + + +typedef BitmapType * BitmapPtr; + +typedef Word CustomPatternType [4]; + +typedef struct { + ScrOperation grafMode; + Boolean patternMode; + PatternType pattern; + CustomPatternType customPtn; + FontID fontId; + Byte padding1; + FontPtr font; + UnderlineModeType underlineMode; +} GraphicStateType; + +typedef GraphicStateType * GraphicStatePtr; + + +typedef union { + struct { + Word cornerDiam : 8; // corner diameter, max 38 + Word reserved : 4; + Word shadowWidth : 2; // Width of shadow + Word width : 2; // Width frame + } bits; + Word word; +} FrameBitsType; + +typedef Word FrameType; + +// Standard Frame Types +#define noFrame 0 +#define simpleFrame 1 +#define rectangleFrame 1 +#define roundFrame 0x0401 // corner = 7, frame = 1 +#define boldRoundFrame 0x0702 // corner = 7, frame = 2 +#define popupFrame 0x0205 // corner = 2, frame = 1, shadow = 1 +#define dialogFrame 0x0302 // corner = 3, frame = 2 +#define menuFrame popupFrame + + +typedef struct { + Word format:1; // window format: 0=screen mode; 1=generic mode + Word offscreen:1; // offscreen flag: 0=onscreen ; 1=offscreen + Word modal:1; // modal flag: 0=modeless window; 1=modal window + Word focusable:1; // focusable flag: 0=non-focusable; 1=focusable + Word enabled:1; // enabled flag: 0=disabled; 1=enabled + Word visible:1; // visible flag: 0-invisible; 1=visible + Word dialog:1; // dialog flag: 0=non-dialog; 1=dialog + Word compressed:1; // compressed flag: 0=uncompressed; 1=compressed + Word reserved :8; +} WindowFlagsType; + + +typedef struct WinTypeStruct { + Word displayWidth; + Word displayHeight; + VoidPtr displayAddr; + WindowFlagsType windowFlags; + RectangleType windowBounds; + AbsRectType clippingBounds; + PointType viewOrigin; + FrameBitsType frameType; + GraphicStatePtr gstate; + struct WinTypeStruct * nextWindow; +} WindowType; + +typedef WindowType * WinPtr; +typedef WinPtr WinHandle; + + + + + +//----------------------------------------------- +// Macros +//----------------------------------------------- + +// For now, the window handle is a pointer to a window structure, +// this however may change, so use the following macros. + +#define WinGetWindowPointer(winHandle) ((WinPtr) winHandle) + +#define WinGetWindowHandle(winPtr) ((WinHandle) winPtr) + + +//----------------------------------------------- +// Routines relating to windows management +//----------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern WinHandle WinCreateWindow (RectanglePtr bounds, FrameType frame, + Boolean modal, Boolean focusable, WordPtr error) + SYS_TRAP(sysTrapWinCreateWindow); + +extern WinHandle WinCreateOffscreenWindow (SWord width, SWord height, + WindowFormatType format, WordPtr error) + SYS_TRAP(sysTrapWinCreateOffscreenWindow); + +extern void WinDeleteWindow (WinHandle winHandle, Boolean eraseIt) + SYS_TRAP(sysTrapWinDeleteWindow); + +extern void WinInitializeWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinInitializeWindow); + +extern void WinAddWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinAddWindow); + +extern void WinRemoveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinRemoveWindow); + +extern void WinSetActiveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetActiveWindow); + +extern WinHandle WinSetDrawWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetDrawWindow); + +extern WinHandle WinGetDrawWindow (void) + SYS_TRAP(sysTrapWinGetDrawWindow); + +extern WinHandle WinGetActiveWindow (void) + SYS_TRAP(sysTrapWinGetActiveWindow); + +extern WinHandle WinGetDisplayWindow (void) + SYS_TRAP(sysTrapWinGetDisplayWindow); + +extern WinHandle WinGetFirstWindow (void) + SYS_TRAP(sysTrapWinGetFirstWindow); + +extern void WinEnableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinEnableWindow); + +extern void WinDisableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinDisableWindow); + +extern void WinGetWindowFrameRect (WinHandle winHandle, RectanglePtr r) + SYS_TRAP(sysTrapWinGetWindowFrameRect); + +extern void WinDrawWindowFrame (void) + SYS_TRAP(sysTrapWinDrawWindowFrame); + +extern void WinEraseWindow (void) + SYS_TRAP(sysTrapWinEraseWindow); + +extern WinHandle WinSaveBits (RectanglePtr source, WordPtr error) + SYS_TRAP(sysTrapWinSaveBits); + +extern void WinRestoreBits (WinHandle winHandle, SWord destX, SWord destY) + SYS_TRAP(sysTrapWinRestoreBits); + +extern void WinCopyRectangle (WinHandle srcWin, WinHandle dstWin, + RectanglePtr srcRect, SWord destX, SWord destY, ScrOperation mode) + SYS_TRAP(sysTrapWinCopyRectangle); + +extern void WinScrollRectangle + (RectanglePtr r, enum directions direction, SWord distance, + RectanglePtr vacated) + SYS_TRAP(sysTrapWinScrollRectangle); + +extern void WinGetDisplayExtent (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinGetDisplayExtent); + +extern void WinGetWindowBounds (RectanglePtr r) + SYS_TRAP(sysTrapWinGetWindowBounds); + +extern void WinSetWindowBounds (WinHandle winHandle, RectanglePtr r) + SYS_TRAP(sysTrapWinSetWindowBounds); + +extern void WinGetWindowExtent (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinGetWindowExtent); + +extern void WinDisplayToWindowPt (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinDisplayToWindowPt); + +extern void WinWindowToDisplayPt (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinWindowToDisplayPt); + +extern void WinGetClip (RectanglePtr r) + SYS_TRAP(sysTrapWinGetClip); + +extern void WinSetClip (RectanglePtr r) + SYS_TRAP(sysTrapWinSetClip); + +extern void WinResetClip (void) + SYS_TRAP(sysTrapWinResetClip); + +extern void WinClipRectangle (RectanglePtr r) + SYS_TRAP(sysTrapWinClipRectangle); + +extern Boolean WinModal (WinHandle winHandle) + SYS_TRAP(sysTrapWinModal); + +//----------------------------------------------- +// Routines to draw shapes or frames shapes +//----------------------------------------------- + +extern void WinDrawLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinDrawLine); + +extern void WinDrawGrayLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinDrawGrayLine); + +extern void WinEraseLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinEraseLine); + +extern void WinInvertLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinInvertLine); + +extern void WinFillLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinFillLine); + +extern void WinDrawRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinDrawRectangle); + +extern void WinEraseRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinEraseRectangle); + +extern void WinInvertRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinInvertRectangle); + +extern void WinFillRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinFillRectangle); + +extern void WinDrawRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinDrawRectangleFrame); + +extern void WinDrawGrayRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinDrawGrayRectangleFrame); + +extern void WinEraseRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinEraseRectangleFrame); + +extern void WinInvertRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinInvertRectangleFrame); + +extern void WinGetFramesRectangle (FrameType frame, RectanglePtr r, + RectanglePtr obscuredRect) + SYS_TRAP(sysTrapWinGetFramesRectangle); + + + +//----------------------------------------------- +// Routines relating to characters +//----------------------------------------------- + +extern void WinDrawChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawChars); + +extern void WinDrawInvertedChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawInvertedChars); + +extern void WinEraseChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinEraseChars); + +extern void WinInvertChars (CharPtr chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinInvertChars); + +extern UnderlineModeType WinSetUnderlineMode (UnderlineModeType mode) + SYS_TRAP(sysTrapWinSetUnderlineMode); + + +//----------------------------------------------- +// Routines to control patterns +//----------------------------------------------- + +extern void WinGetPattern (CustomPatternType) + SYS_TRAP(sysTrapWinGetPattern); + +extern void WinSetPattern (CustomPatternType) + SYS_TRAP(sysTrapWinSetPattern); + +//extern void WinSetPatternXferMode (enum patternXferModes mode); + +//extern enum patternXferModes WinGetPatternXferMode (void); + + +//----------------------------------------------- +// Routines relating to bitmaps +//----------------------------------------------- +extern void WinDrawBitmap (BitmapPtr bitmapP, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawBitmap); + + +#ifdef __cplusplus +} +#endif + + +#endif //__WINDOW_H__ +#endif // GRAPHICS_VERSION_2 + + diff --git a/sdk-3.1/include/Core/UI/WindowNew.h b/sdk-3.1/include/Core/UI/WindowNew.h new file mode 100644 index 0000000..36a926e --- /dev/null +++ b/sdk-3.1/include/Core/UI/WindowNew.h @@ -0,0 +1,451 @@ +/*********************************************************************** + * + * Copyright (c) 1994-1999 3Com Corporation or its subsidiaries. + * All rights reserved. + * + * PROJECT: Pilot + * FILE: WindowNew.h + * AUTHOR: Art Lamb: September 12, 1994 + * + * DECLARER: UI + * + * DESCRIPTION: + * This file defines window structures and routines. + * + * REVISION HISTORY: + * Name Date Description + * ---- ---- ----------- + * RM 11/21/96 Updated to support color. + * kwk 07/03/98 Added WinDrawChar & WinDrawTruncChars. + * + **********************************************************************/ +#ifndef __WINDOW_H__ +#define __WINDOW_H__ + + +enum directions { up = 0, down, left, right }; +typedef enum directions DirectionType; + + +enum windowFormats { screenFormat = 0, genericFormat }; +typedef enum windowFormats WindowFormatType; + + +typedef enum {scrCopy, scrAND, scrANDNOT, scrXOR, scrOR, scrCopyNOT} ScrOperation; + + +enum patterns { blackPattern, whitePattern, grayPattern, customPattern }; +typedef enum patterns PatternType; + +#define grayHLinePattern 0xAA + +// grayUnderline means dotted black +// solidUnderline means solid black +// colorUnderline means solid, in whatever the foreground color is set to +enum underlineModes { noUnderline, grayUnderline, solidUnderline, colorUnderline }; +typedef enum underlineModes UnderlineModeType; + + + +typedef struct { + Word compressed:1; // Data format: 0=raw; 1=compressed + Word hasColorTable:1; // if true, color table stored before bits[] + Word reserved :14; +} BitmapFlagsType; + + +typedef struct { + Word width; + Word height; + Word rowBytes; + BitmapFlagsType flags; + Byte pixelSize; // bits/pixel + Byte version; // version of bitmap. This is vers 1 + Word nextDepthOffset; // # of DWords to next BitmapType + // from beginnning of this one + Word reserved [2]; + + // Byte bits[] // If pixelSize == 1: + // this is the start of the pixels + // If pixelSize >= 2, we have: + // ColorTableType followed by pixels. + // In most cases the ColorTableType will + // have 0 entries however and be only 1 + // word long. +} BitmapType; + +typedef BitmapType * BitmapPtr; + +typedef Word CustomPatternType [4]; + + +// 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. A pointer to this table is stored in +// the WindowExtType structure and a pointer to the WindowExtType is +// stored in the WindowType. +typedef struct RGBColorType { + Byte unused; // unused, must be 0 + Byte r; // amount of red, 0->255 + Byte g; // amount of green, 0->255 + Byte b; // amount of blue, 0->255 + } RGBColorType; + +typedef struct ColorTableType { + Word numEntries; // number of entries in table + RGBColorType entry[1]; // array 0->numEntries-1 of colors + } ColorTableType; +typedef ColorTableType* ColorTablePtr; + + + +typedef struct { + ScrOperation grafMode; + Boolean patternMode; + PatternType pattern; + CustomPatternType customPtn; + FontID fontId; + Byte padding1; + FontPtr font; + UnderlineModeType underlineMode; + RGBColorType foreColor; + RGBColorType backColor; +} GraphicStateType; + +typedef GraphicStateType * GraphicStatePtr; + + +typedef union { + struct { + Word cornerDiam : 8; // corner diameter, max 38 + Word reserved_3 : 3; + Word threeD : 1; // Draw 3D button + Word shadowWidth : 2; // Width of shadow + Word width : 2; // Width frame + } bits; + Word word; // IMPORTANT: INITIALIZE word to zero before setting bits! +} FrameBitsType; + +typedef Word FrameType; + +// Standard Frame Types +#define noFrame 0 +#define simpleFrame 1 +#define rectangleFrame 1 +#define simple3DFrame 0x0012 // 3d, frame = 2 +#define roundFrame 0x0401 // corner = 7, frame = 1 +#define boldRoundFrame 0x0702 // corner = 7, frame = 2 +#define popupFrame 0x0205 // corner = 2, frame = 1, shadow = 1 +#define dialogFrame 0x0302 // corner = 3, frame = 2 +#define menuFrame popupFrame + + +typedef struct { + Word format:1; // window format: 0=screen mode; 1=generic mode + Word offscreen:1; // offscreen flag: 0=onscreen ; 1=offscreen + Word modal:1; // modal flag: 0=modeless window; 1=modal window + Word focusable:1; // focusable flag: 0=non-focusable; 1=focusable + Word enabled:1; // enabled flag: 0=disabled; 1=enabled + Word visible:1; // visible flag: 0-invisible; 1=visible + Word dialog:1; // dialog flag: 0=non-dialog; 1=dialog + Word reserved :9; +} WindowFlagsType; + + +// This structure is for use by the Window Manager and Screen Driver only!! It +// may change size in the future. It contains information about +// the hardware device we're drawing to such as the base address, +// size, rowBytes, bit depth, etc. +// A pointer to this structure is stored in the extendP field +// of a WindowType structure. This field used to be called viewOrigin +// in the B&W Window Manager and was unused. +typedef struct GDeviceType { + VoidPtr baseAddr; // base address + Word width; // width in pixels + Word height; // height in pixels + Word rowBytes; // rowBytes of display + Byte pixelSize; // bits/pixel + Byte version; // version of GDeviceType + // - this is version 0 + // Flags ----- + Word forDriver:1; // true if this is the GDeviceType structure + // used by the screen driver. + Word dynamic:1; // true if this structure was allocated + // using MemPtrNew and needs to be freed. + Word compressed:1; // true if pixels are compressed. + Word flags:13; // unused flags - all 0 for now + + // Color Table ---- + ColorTablePtr cTableP; // color table. If nil, then + // a default color table will be used. + } GDeviceType; +typedef GDeviceType* GDevicePtr; + + +// The Window structure. +typedef struct WinTypeStruct { + Word displayWidthV20; // use WinGetDisplayExtent instead + Word displayHeightV20; // use WinGetDisplayExtent instead + VoidPtr displayAddrV20; // use the drawing functions instead + WindowFlagsType windowFlags; + RectangleType windowBounds; + AbsRectType clippingBounds; + GDevicePtr gDeviceP; + FrameBitsType frameType; + GraphicStatePtr gstate; + struct WinTypeStruct * nextWindow; +} WindowType; + +typedef WindowType * WinPtr; +typedef WinPtr WinHandle; + + + + + +//----------------------------------------------- +// Macros +//----------------------------------------------- + +// For now, the window handle is a pointer to a window structure, +// this however may change, so use the following macros. + +#define WinGetWindowPointer(winHandle) ((WinPtr) winHandle) + +#define WinGetWindowHandle(winPtr) ((WinHandle) winPtr) + +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define ECWinValidateHandle(winHandle) WinValidateHandle(winHandle) +#else +#define ECWinValidateHandle(winHandle) +#endif + +//----------------------------------------------- +// Routines relating to windows management +//----------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern Boolean WinValidateHandle (const WinHandle winHandle) + SYS_TRAP(sysTrapWinValidateHandle); + +extern WinHandle WinCreateWindow (RectanglePtr bounds, FrameType frame, + Boolean modal, Boolean focusable, WordPtr error) + SYS_TRAP(sysTrapWinCreateWindow); + +extern WinHandle WinCreateOffscreenWindow (SWord width, SWord height, + WindowFormatType format, WordPtr error) + SYS_TRAP(sysTrapWinCreateOffscreenWindow); + +extern void WinDeleteWindow (WinHandle winHandle, Boolean eraseIt) + SYS_TRAP(sysTrapWinDeleteWindow); + +extern void WinInitializeWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinInitializeWindow); + +extern void WinAddWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinAddWindow); + +extern void WinRemoveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinRemoveWindow); + +extern void WinMoveWindowAddr (WinPtr oldLocationP, WinPtr newLocationP) + SYS_TRAP(sysTrapWinMoveWindowAddr); + +extern void WinSetActiveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetActiveWindow); + +extern WinHandle WinSetDrawWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetDrawWindow); + +extern WinHandle WinGetDrawWindow (void) + SYS_TRAP(sysTrapWinGetDrawWindow); + +extern WinHandle WinGetActiveWindow (void) + SYS_TRAP(sysTrapWinGetActiveWindow); + +extern WinHandle WinGetDisplayWindow (void) + SYS_TRAP(sysTrapWinGetDisplayWindow); + +extern WinHandle WinGetFirstWindow (void) + SYS_TRAP(sysTrapWinGetFirstWindow); + +extern void WinEnableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinEnableWindow); + +extern void WinDisableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinDisableWindow); + +extern void WinGetWindowFrameRect (WinHandle winHandle, RectanglePtr r) + SYS_TRAP(sysTrapWinGetWindowFrameRect); + +extern void WinDrawWindowFrame (void) + SYS_TRAP(sysTrapWinDrawWindowFrame); + +extern void WinEraseWindow (void) + SYS_TRAP(sysTrapWinEraseWindow); + +extern WinHandle WinSaveBits (RectanglePtr source, WordPtr error) + SYS_TRAP(sysTrapWinSaveBits); + +extern void WinRestoreBits (WinHandle winHandle, SWord destX, SWord destY) + SYS_TRAP(sysTrapWinRestoreBits); + +extern void WinCopyRectangle (WinHandle srcWin, WinHandle dstWin, + RectanglePtr srcRect, SWord destX, SWord destY, ScrOperation mode) + SYS_TRAP(sysTrapWinCopyRectangle); + +extern void WinScrollRectangle + (RectanglePtr r, enum directions direction, SWord distance, + RectanglePtr vacated) + SYS_TRAP(sysTrapWinScrollRectangle); + +extern void WinGetDisplayExtent (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinGetDisplayExtent); + +extern void WinGetWindowBounds (RectanglePtr r) + SYS_TRAP(sysTrapWinGetWindowBounds); + +extern void WinSetWindowBounds (WinHandle winHandle, RectanglePtr r) + SYS_TRAP(sysTrapWinSetWindowBounds); + +extern void WinGetWindowExtent (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinGetWindowExtent); + +extern void WinDisplayToWindowPt (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinDisplayToWindowPt); + +extern void WinWindowToDisplayPt (SWordPtr extentX, SWordPtr extentY) + SYS_TRAP(sysTrapWinWindowToDisplayPt); + +extern void WinGetClip (RectanglePtr r) + SYS_TRAP(sysTrapWinGetClip); + +extern void WinSetClip (RectanglePtr r) + SYS_TRAP(sysTrapWinSetClip); + +extern void WinResetClip (void) + SYS_TRAP(sysTrapWinResetClip); + +extern void WinClipRectangle (RectanglePtr r) + SYS_TRAP(sysTrapWinClipRectangle); + +extern Boolean WinModal (WinHandle winHandle) + SYS_TRAP(sysTrapWinModal); + +//----------------------------------------------- +// Routines to draw shapes or frames shapes +//----------------------------------------------- + +extern void WinDrawLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinDrawLine); + +extern void WinDrawGrayLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinDrawGrayLine); + +extern void WinEraseLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinEraseLine); + +extern void WinInvertLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinInvertLine); + +extern void WinFillLine (SWord x1, SWord y1, SWord x2, SWord y2) + SYS_TRAP(sysTrapWinFillLine); + +extern void WinDrawRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinDrawRectangle); + +extern void WinEraseRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinEraseRectangle); + +extern void WinInvertRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinInvertRectangle); + +extern void WinFillRectangle (RectanglePtr r, Word cornerDiam) + SYS_TRAP(sysTrapWinFillRectangle); + +extern void WinDrawRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinDrawRectangleFrame); + +extern void WinDrawGrayRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinDrawGrayRectangleFrame); + +extern void WinEraseRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinEraseRectangleFrame); + +extern void WinInvertRectangleFrame (FrameType frame, RectanglePtr r) + SYS_TRAP(sysTrapWinInvertRectangleFrame); + +extern void WinGetFramesRectangle (FrameType frame, RectanglePtr r, + RectanglePtr obscuredRect) + SYS_TRAP(sysTrapWinGetFramesRectangle); + + + +//----------------------------------------------- +// Routines relating to characters +//----------------------------------------------- + +extern void WinDrawChar (WChar theChar, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawChar); + +extern void WinDrawChars (const Char * const chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawChars); + +extern void WinDrawInvertedChars (const Char * const chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawInvertedChars); + +extern void WinDrawTruncChars(ConstCharPtr pChars, Word length, SWord x, SWord y, SWord maxWidth) + SYS_TRAP(sysTrapWinDrawTruncChars); + +extern void WinEraseChars (const Char * const chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinEraseChars); + +extern void WinInvertChars (const Char * const chars, Word len, SWord x, SWord y) + SYS_TRAP(sysTrapWinInvertChars); + +extern UnderlineModeType WinSetUnderlineMode (UnderlineModeType mode) + SYS_TRAP(sysTrapWinSetUnderlineMode); + + +//----------------------------------------------- +// Routines to patterns and colors +//----------------------------------------------- + +extern void WinGetPattern (CustomPatternType) + SYS_TRAP(sysTrapWinGetPattern); + +extern void WinSetPattern (CustomPatternType) + SYS_TRAP(sysTrapWinSetPattern); + +//extern void WinSetPatternXferMode (enum patternXferModes mode); + +//extern enum patternXferModes WinGetPatternXferMode (void); + +#define WinSetForeColor(newColorP, oldColorP) \ + WinSetColors(newColorP, oldColorP, 0, 0) + +#define WinSetBackColor(newColorP, oldColorP) \ + WinSetColors(0, 0, newColorP, oldColorP) + +extern void WinSetColors(const RGBColorType* const newForeColorP, RGBColorType* oldForeColorP, + const RGBColorType* const newBackColorP, RGBColorType* oldBackColorP) + SYS_TRAP(sysTrapWinSetColors); + + +//----------------------------------------------- +// Routines relating to bitmaps +//----------------------------------------------- +extern void WinDrawBitmap (BitmapPtr bitmapP, SWord x, SWord y) + SYS_TRAP(sysTrapWinDrawBitmap); + + +#ifdef __cplusplus +} +#endif + + +#endif //__WINDOW_H__ + diff --git a/sdk-3.1/include/Core/Us.Prefix.h b/sdk-3.1/include/Core/Us.Prefix.h new file mode 100644 index 0000000..c528d49 --- /dev/null +++ b/sdk-3.1/include/Core/Us.Prefix.h @@ -0,0 +1,63 @@ +/********************************************************************* +* + Copyright Š 1995 - 1998, 3Com Corporation or its subsidiaries ("3Com"). + All rights reserved. + + This software may be copied and used solely for developing products for + the Palm Computing platform and for archival and backup purposes. Except + for the foregoing, no part of this software may be reproduced or transmitted + in any form or by any means or used to make any derivative work (such as + translation, transformation or adaptation) without express written consent + from 3Com. + + 3Com reserves the right to revise this software and to make changes in content + from time to time without obligation on the part of 3Com to provide notification + of such revision or changes. + 3COM MAKES NO REPRESENTATIONS OR WARRANTIES THAT THE SOFTWARE IS FREE OF ERRORS + OR THAT THE SOFTWARE IS SUITABLE FOR YOUR USE. THE SOFTWARE IS PROVIDED ON AN + "AS IS" BASIS. 3COM MAKES NO WARRANTIES, TERMS OR CONDITIONS, EXPRESS OR IMPLIED, + EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, INCLUDING WARRANTIES, + TERMS, OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND + SATISFACTORY QUALITY. + + TO THE FULL EXTENT ALLOWED BY LAW, 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS + ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT (INCLUDING NEGLIGENCE), FOR + DIRECT, INCIDENTAL, CONSEQUENTIAL, INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF + ANY KIND, OR FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF INFORMATION + OR DATA, OR OTHER FINANCIAL LOSS ARISING OUT OF OR IN CONNECTION WITH THIS SOFTWARE, + EVEN IF 3COM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + 3Com, HotSync, Palm Computing, and Graffiti are registered trademarks, and + Palm III and Palm OS are trademarks of 3Com Corporation or its subsidiaries. + + IF THIS SOFTWARE IS PROVIDED ON A COMPACT DISK, THE OTHER SOFTWARE AND + DOCUMENTATION ON THE COMPACT DISK ARE SUBJECT TO THE LICENSE AGREEMENT + ACCOMPANYING THE COMPACT DISK. + +******************************************************************** +* Please see :Incs:BuildRules.h for more information. +* +* History: +* 12/13/94 PBS - Created by Phillip Shoemaker +* +* +*******************************************************************/ + +#ifndef __US_PREFIX_H__ +#define __US_PREFIX_H__ + +/* +* This file is used for CodeWarrior projects incorporating United States +* localized resources. +*/ + +#ifndef COUNTRY + #define COUNTRY COUNTRY_UNITED_STATES +#endif + +#ifndef LANGUAGE + #define LANGUAGE LANGUAGE_ENGLISH +#endif + +#endif // Us.Prefix.h + diff --git a/sdk-3.1/include/header.gcc b/sdk-3.1/include/header.gcc new file mode 100644 index 0000000..88293cb --- /dev/null +++ b/sdk-3.1/include/header.gcc @@ -0,0 +1,7 @@ +IMCUtils.h Core/System/ImcUtils.h +CharLatin.h Core/International/CharLatin.h +CharShiftJIS.h Core/International/CharShiftJIS.h +IntlMgr.h Core/International/IntlMgr.h +JapaneseFEP.h Core/International/JapaneseFEP.h +TextMgr.h Core/International/TextMgr.h +TextServices.h Core/International/TextServices.h diff --git a/sdk-3.5/include/BuildDefaults.h b/sdk-3.5/include/BuildDefaults.h new file mode 100644 index 0000000..69b2937 --- /dev/null +++ b/sdk-3.5/include/BuildDefaults.h @@ -0,0 +1,271 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: BuildDefaults.h + * + * Description: + * Build variable defaults for Palm OS. + * + * This file is included by . + * This file supercedes the old file. + * + * History: + * 07/16/99 SCL So many changes the old history is obsolete. + * 07/29/99 kwk Deleted TEXT_SERVICES & INTERNATIONAL_MGR defines. + * 09/15/99 kwk Changed COUNTRY & LANGUAGE defines into #errors. + * 10/04/99 grant Added LOCALE define (defaults to #error). + * 10/05/99 kwk Added LOCALE_SUFFIX define (defaults to ""). + * + *****************************************************************************/ + +#ifndef __BUILDDEFAULTS_H__ +#define __BUILDDEFAULTS_H__ + +#include + +// To override build options in a local component, include +// first, then define switches as need, and then include . + +// Some projects used to have a local copy of a file called "AppBuildRules.h" +// or "AppBuildRulesMSC.h", which was automatically included by +// to override certain system default compile-time switches. These local +// "prefix" files can still be used. The project source files should be changed +// to include , then "AppBuildRules.MSC.h", then +// instead of the previous + + +/************************************************************ + * Include the following when running under the CodeWarrior + * IDE so that default build options can be overriden. The default + * version of this file is in the Incs: directory. If an app wishes + * to override the default options, it should create a copy of this + * include file in its own local directory. This include file + * is never used when building from MPW since MPW can specify compiler + * defines from the command line. + * + * Other environments can override all of these settings by simply + * pre-defining CMD_LINE_BUILD and any other desired settings. + *************************************************************/ + +#ifndef CMD_LINE_BUILD // typically pre-defined only from MPW + + #if !defined(__MWERKS__) && !defined(__PALMOS_TRAPS__) && !defined(_MSC_VER) + + // assume other environments generally build only PalmOS executables + #define __PALMOS_TRAPS__ 1 + + #endif + + + #if __PALMOS_TRAPS__ // defined by CodeWarrior IDE or above + + // Settings to build a PalmOS executable + #ifndef EMULATION_LEVEL + #define EMULATION_LEVEL EMULATION_NONE // building Palm OS executable + #endif + + #ifndef USE_TRAPS + #define USE_TRAPS 1 // use Palm OS traps + #endif + + #endif + + +#endif + + + +/************************************************************ + * Settings that can be overriden in the makefile (for MPW) + * OR (for CodeWarrior) in "AppBuildRules.h". If there is no + * local copy of "AppBuildRules.h" within the project directory, + * the one in the Incs directory will be used instead. + *************************************************************/ +// This default option is probably ok for now +#ifndef EMULATION_LEVEL + #define EMULATION_LEVEL EMULATION_MAC +#endif + +// This default option is probably ok for now +#if EMULATION_LEVEL == EMULATION_NONE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +// This default option is probably ok for now +#ifndef MEMORY_TYPE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +// This default option is probably ok for now +#ifndef ENVIRONMENT + #define ENVIRONMENT ENVIRONMENT_CW +#endif + +// This default option is probably ok to leave as a default +#ifndef PLATFORM_TYPE + #define PLATFORM_TYPE PLATFORM_VIEWER +#endif + +#ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL #error "ERROR_CHECK_LEVEL not defined; Try including ''PalmOptErrorCheckLevel.h''!" + // The following allows to redefine ERROR_CHECK_LEVEL + // without letting it change ERROR_CHECK_LEVEL if it was already defined, + // such as would be the case when using a project prefix file... + #define ERROR_CHECK_LEVEL_OK_TO_REDEFINE +#endif + +// This default option is probably ok for now +#ifndef CPU_TYPE + #if defined(__INTEL__) || defined(__i386__) + #define CPU_TYPE CPU_x86 + #else + #define CPU_TYPE CPU_68K + #endif +#endif + + +#ifndef MODEL + #define MODEL #error "MODEL not defined; Try including ''PalmOptModel.h''!" +#endif + +// This default option is probably ok to leave as a default +#ifndef MEMORY_FORCE_LOCK + #define MEMORY_FORCE_LOCK MEMORY_FORCE_LOCK_ON +#endif + +// Must be defined (-d or prefix file) before using. See comment in . +#ifndef DEBUG_LEVEL + #define DEBUG_LEVEL #error "DEBUG_LEVEL must be defined before using!" +#endif + +#ifndef DEFAULT_LIB_ENTRIES + #define DEFAULT_LIB_ENTRIES 12 // space for 12 libraries in library table +#endif + +#ifndef USER_MODE + #define USER_MODE #error "USER_MODE not defined; Try including ''PalmOptUserMode.h''!" +#endif + +#ifndef INTERNAL_COMMANDS + #define INTERNAL_COMMANDS #error "INTERNAL_COMMANDS must be defined before using!" +#endif + +#ifndef INCLUDE_DES + #define INCLUDE_DES INCLUDE_DES_ON +#endif + +// Unless otherwise specified, assume CML_ENCODER is off +#ifndef CML_ENCODER + #define CML_ENCODER CML_ENCODER_OFF +#endif + +// Derive the path for resource files. +#ifndef RESOURCE_FILE_PREFIX + #define RESOURCE_FILE_PREFIX "" +#endif + +// LOCALE_SUFFIX is used for the name of merged resource files, +// and also sys.tres. +#ifndef LOCALE_SUFFIX + #define LOCALE_SUFFIX "" +#endif + + + +// Set these according to which Shell commands you want to +// link with. These are often overridden by other components +// in a local "AppBuildRules.h" which is currently obsolete. +#ifndef SHELL_COMMAND_DB + #define SHELL_COMMAND_DB 0 // Not Available +#endif + +#ifndef SHELL_COMMAND_UI + #define SHELL_COMMAND_UI 1 // Available +#endif + +#ifndef SHELL_COMMAND_APP + #define SHELL_COMMAND_APP 1 // Available +#endif + +#ifndef SHELL_COMMAND_EMULATOR + #define SHELL_COMMAND_EMULATOR 1 // Available +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef DYN_MEM_SIZE_MAX + #define DYN_MEM_SIZE_MAX #error "DYN_MEM_SIZE_MAX is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef SMALL_ROM_SIZE + #define SMALL_ROM_SIZE #error "SMALL_ROM_SIZE is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef CONSOLE_SERIAL_LIB + #define CONSOLE_SERIAL_LIB #error "CONSOLE_SERIAL_LIB is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef PILOT_SERIAL_MGR + // Palm OS 3.5 code now assumes PILOT_SERIAL_MGR == PILOT_SERIAL_MGR_NEW + #define PILOT_SERIAL_MGR #error "PILOT_SERIAL_MGR is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef MEMORY_VERSION + // Palm OS 3.5 code now assumes MEMORY_VERSION == MEMORY_VERSION_2 + #define MEMORY_VERSION #error "MEMORY_VERSION is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef GRAPHICS_VERSION + // Palm OS 3.5 code now assumes GRAPHICS_VERSION == GRAPHICS_VERSION_2 + #define GRAPHICS_VERSION #error "GRAPHICS_VERSION is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef HW_TARGET + // Palm OS 3.5 is now hardware independent; HAL should handle this + #define HW_TARGET #error "HW_TARGET is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef HW_REV + // Palm OS 3.5 is now hardware independent; HAL should handle this + #define HW_REV #error "HW_REV is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef RMP_LIB_INCLUDE + #define RMP_LIB_INCLUDE #error "RMP_LIB_INCLUDE is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef OEM_PRODUCT + #define OEM_PRODUCT #error "OEM_PRODUCT is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +// LANGUAGE/COUNTRY are no longer supported. If absolutely necessary, use LOCALE instead, but +// build-time dependencies on the target LOCALE are a _really_ bad idea. +#ifdef LANGUAGE + #undef LANGUAGE +#endif +#define LANGUAGE #error "LANGUAGE is now obsolete; use LOCALE and include PalmOptLocale.h" + +#ifndef COUNTRY + #undef COUNTRY +#endif +#define COUNTRY #error "COUNTRY is now obsolete; use LOCALE and include PalmOptLocale.h" + +// Moved to : +//#if defined(__GNUC__) && defined(__UNIX__) +// // Ensure that structure elements are 16-bit aligned +// #pragma pack(2) +//#endif + +#endif + diff --git a/sdk-3.5/include/BuildDefines.h b/sdk-3.5/include/BuildDefines.h new file mode 100644 index 0000000..632ce3f --- /dev/null +++ b/sdk-3.5/include/BuildDefines.h @@ -0,0 +1,136 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: BuildDefines.h + * + * Description: + * Build variable defines for Palm OS. + * + * This file is included by . + * It should be included by any local component that wishes + * to override any system default compile-time switches. + * For more details, refer to . + * + * This file supercedes the old file. + * + * History: + * 07/16/99 SCL So many changes the old history is obsolete. + * 07/29/99 kwk Deleted TEXT_SERVICES & INTERNATIONAL_MGR & VENDOR. + * 10/04/99 grant Added LOCALE definitions. + * + *****************************************************************************/ + +#ifndef __BUILDDEFINES_H__ +#define __BUILDDEFINES_H__ + + +/************************************************************ + * Compilation Control Options + *************************************************************/ + +// The makefile should set the define EMULATION_LEVEL to one of the following +// constants: +#define EMULATION_NONE 0 // native environment +#define EMULATION_WINDOWS 1 // emulate on Windows +#define EMULATION_DOS 2 // emulate on DOS +#define EMULATION_MAC 3 // emulate on Macintosh +#define EMULATION_UNIX 4 // emulate on Linux + + +// If emulation is not EMULATION_NONE, the following define controls +// whether we are talking to a touchdown device over the serial port, +// or if we are emulating a memory card in local RAM. +// +// The makefile should set the define MEMORY_TYPE to one of the following +// constants +#define MEMORY_LOCAL 0 // Emulate using local memory card image +#define MEMORY_REMOTE 1 // Pass calls through serial port to the device + + +// The makefile should set the define ENVIRONMENT to one of the following: +#define ENVIRONMENT_CW 0 // CodeWarrior compiler/linker (IDE or MPW) +#define ENVIRONMENT_MPW 1 // Apple's MPW compiler/linker + + +// The makefile should set the define PLATFORM_TYPE to one of the following +// constants: +#define PLATFORM_VIEWER 0 // PalmPilot Viewer +#define PLATFORM_SERVER 1 // Server code + + +// The makefile should set the define ERROR_CHECK_LEVEL to one of the +// following constants: +#define ERROR_CHECK_NONE 0 // compile no error checking code +#define ERROR_CHECK_PARTIAL 1 // display for fatal errors only +#define ERROR_CHECK_FULL 2 // display fatal or non-fatal errors + + +// The makefile should set the define CPU_TYPE to one of the +// following constants: +#define CPU_68K 0 // Motorola 68K type +#define CPU_x86 1 // Intel x86 type + + + + +// The makefile should set the define MODEL to one of the +// following constants. This equate is currently only use by +// special purpose applications like Setup that need to install different +// files for each type of product. Normally, model dependent behavior +// should be run-time based off of Features using FtrGet(). +#define MODEL_GENERIC 0 // Not one of the specific models that follow +#define MODEL_ELEVEN 1 // Eleven (Palm Seven) +#define MODEL_SUMO 2 // EZ product + + +// The makefile should set the define MEMORY_FORCE_LOCK to one of the +// following. +#define MEMORY_FORCE_LOCK_OFF 0 // Don't force all handles to be locked +#define MEMORY_FORCE_LOCK_ON 1 // Force all handles to be locked before usage + + +// The makefile should set the define DEBUG_LEVEL to one of the +// following. THIS DEFINE IS ONLY USED BY A COUPLE MODULES SO WE +// DON'T GIVE IT A DEFAULT VALUE BELOW... +// ANY MODULE THAT USES THIS DEFINE SHOULD VERIFY THAT IT IS DEFINED!! +#define DEBUG_LEVEL_NONE 1 // None: Does not auto-launch Console or Debugger +#define DEBUG_LEVEL_PARTIAL 2 // Partial: Auto-Launches Console but skips debugger +#define DEBUG_LEVEL_FULL 3 // Full: Waits in debugger on reset + + +// The makefile should set the define DEFAULT_DATA to one of the following: +// Setting this define to USE_DEFAULT_DATA will cause the core apps to include default +// data in the build. +#define DO_NOT_USE_DEFAULT_DATA 0 +#define USE_DEFAULT_DATA 1 + + +// The makefile should set the define USER_MODE to one of the +// following constants: +#define USER_MODE_NORMAL 0 // normal operation +#define USER_MODE_DEMO 1 // demo mode - Graffiti and pop-up keyboard disabled + + +// The makefile should set the define INTERNAL_COMMANDS to one of the +// following constants: +#define INTERNAL_COMMANDS_EXCLUDE 0 +#define INTERNAL_COMMANDS_INCLUDE 1 // Include internal shell commands + + +// The makefile should set the define INCLUDE_DES to one of the +// following constants: +#define INCLUDE_DES_OFF 0 +#define INCLUDE_DES_ON 1 // include it + + +// Used by Net Library to link in the CML encoder +#define CML_ENCODER_OFF 0 +#define CML_ENCODER_ON 1 + + + + +#endif + diff --git a/sdk-3.5/include/Core/CoreTraps.h b/sdk-3.5/include/Core/CoreTraps.h new file mode 100644 index 0000000..4a7a92b --- /dev/null +++ b/sdk-3.5/include/Core/CoreTraps.h @@ -0,0 +1,2554 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CoreTraps.h + * + * 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 externalize the routine + * to fix 3.5-specific issues. + * + *****************************************************************************/ + +#ifndef __CORETRAPS_H_ +#define __CORETRAPS_H_ + +// Include elementary types +#include + +#if CPU_TYPE == CPU_68K +#include +#endif + +// Regular traps start here and go up by 1's +#define sysTrapBase 0xA000 + +#ifdef __GNUC__ + +#define sysTrapMemInit 0xA000 +#define sysTrapMemInitHeapTable 0xA001 +#define sysTrapMemStoreInit 0xA002 +#define sysTrapMemCardFormat 0xA003 +#define sysTrapMemCardInfo 0xA004 +#define sysTrapMemStoreInfo 0xA005 +#define sysTrapMemStoreSetInfo 0xA006 +#define sysTrapMemNumHeaps 0xA007 +#define sysTrapMemNumRAMHeaps 0xA008 +#define sysTrapMemHeapID 0xA009 +#define sysTrapMemHeapPtr 0xA00A +#define sysTrapMemHeapFreeBytes 0xA00B +#define sysTrapMemHeapSize 0xA00C +#define sysTrapMemHeapFlags 0xA00D +#define sysTrapMemHeapCompact 0xA00E +#define sysTrapMemHeapInit 0xA00F +#define sysTrapMemHeapFreeByOwnerID 0xA010 +#define sysTrapMemChunkNew 0xA011 +#define sysTrapMemChunkFree 0xA012 +#define sysTrapMemPtrNew 0xA013 +#define sysTrapMemPtrRecoverHandle 0xA014 +#define sysTrapMemPtrFlags 0xA015 +#define sysTrapMemPtrSize 0xA016 +#define sysTrapMemPtrOwner 0xA017 +#define sysTrapMemPtrHeapID 0xA018 +#define sysTrapMemPtrCardNo 0xA019 +#define sysTrapMemPtrToLocalID 0xA01A +#define sysTrapMemPtrSetOwner 0xA01B +#define sysTrapMemPtrResize 0xA01C +#define sysTrapMemPtrResetLock 0xA01D +#define sysTrapMemHandleNew 0xA01E +#define sysTrapMemHandleLockCount 0xA01F +#define sysTrapMemHandleToLocalID 0xA020 +#define sysTrapMemHandleLock 0xA021 +#define sysTrapMemHandleUnlock 0xA022 +#define sysTrapMemLocalIDToGlobal 0xA023 +#define sysTrapMemLocalIDKind 0xA024 +#define sysTrapMemLocalIDToPtr 0xA025 +#define sysTrapMemMove 0xA026 +#define sysTrapMemSet 0xA027 +#define sysTrapMemStoreSearch 0xA028 +#define sysTrapReserved6 0xA029 /* was sysTrapMemPtrDataStorage */ +#define sysTrapMemKernelInit 0xA02A +#define sysTrapMemHandleFree 0xA02B +#define sysTrapMemHandleFlags 0xA02C +#define sysTrapMemHandleSize 0xA02D +#define sysTrapMemHandleOwner 0xA02E +#define sysTrapMemHandleHeapID 0xA02F +#define sysTrapMemHandleDataStorage 0xA030 +#define sysTrapMemHandleCardNo 0xA031 +#define sysTrapMemHandleSetOwner 0xA032 +#define sysTrapMemHandleResize 0xA033 +#define sysTrapMemHandleResetLock 0xA034 +#define sysTrapMemPtrUnlock 0xA035 +#define sysTrapMemLocalIDToLockedPtr 0xA036 +#define sysTrapMemSetDebugMode 0xA037 +#define sysTrapMemHeapScramble 0xA038 +#define sysTrapMemHeapCheck 0xA039 +#define sysTrapMemNumCards 0xA03A +#define sysTrapMemDebugMode 0xA03B +#define sysTrapMemSemaphoreReserve 0xA03C +#define sysTrapMemSemaphoreRelease 0xA03D +#define sysTrapMemHeapDynamic 0xA03E +#define sysTrapMemNVParams 0xA03F + + +#define sysTrapDmInit 0xA040 +#define sysTrapDmCreateDatabase 0xA041 +#define sysTrapDmDeleteDatabase 0xA042 +#define sysTrapDmNumDatabases 0xA043 +#define sysTrapDmGetDatabase 0xA044 +#define sysTrapDmFindDatabase 0xA045 +#define sysTrapDmDatabaseInfo 0xA046 +#define sysTrapDmSetDatabaseInfo 0xA047 +#define sysTrapDmDatabaseSize 0xA048 +#define sysTrapDmOpenDatabase 0xA049 +#define sysTrapDmCloseDatabase 0xA04A +#define sysTrapDmNextOpenDatabase 0xA04B +#define sysTrapDmOpenDatabaseInfo 0xA04C +#define sysTrapDmResetRecordStates 0xA04D +#define sysTrapDmGetLastErr 0xA04E +#define sysTrapDmNumRecords 0xA04F +#define sysTrapDmRecordInfo 0xA050 +#define sysTrapDmSetRecordInfo 0xA051 +#define sysTrapDmAttachRecord 0xA052 +#define sysTrapDmDetachRecord 0xA053 +#define sysTrapDmMoveRecord 0xA054 +#define sysTrapDmNewRecord 0xA055 +#define sysTrapDmRemoveRecord 0xA056 +#define sysTrapDmDeleteRecord 0xA057 +#define sysTrapDmArchiveRecord 0xA058 +#define sysTrapDmNewHandle 0xA059 +#define sysTrapDmRemoveSecretRecords 0xA05A +#define sysTrapDmQueryRecord 0xA05B +#define sysTrapDmGetRecord 0xA05C +#define sysTrapDmResizeRecord 0xA05D +#define sysTrapDmReleaseRecord 0xA05E +#define sysTrapDmGetResource 0xA05F +#define sysTrapDmGet1Resource 0xA060 +#define sysTrapDmReleaseResource 0xA061 +#define sysTrapDmResizeResource 0xA062 +#define sysTrapDmNextOpenResDatabase 0xA063 +#define sysTrapDmFindResourceType 0xA064 +#define sysTrapDmFindResource 0xA065 +#define sysTrapDmSearchResource 0xA066 +#define sysTrapDmNumResources 0xA067 +#define sysTrapDmResourceInfo 0xA068 +#define sysTrapDmSetResourceInfo 0xA069 +#define sysTrapDmAttachResource 0xA06A +#define sysTrapDmDetachResource 0xA06B +#define sysTrapDmNewResource 0xA06C +#define sysTrapDmRemoveResource 0xA06D +#define sysTrapDmGetResourceIndex 0xA06E +#define sysTrapDmQuickSort 0xA06F +#define sysTrapDmQueryNextInCategory 0xA070 +#define sysTrapDmNumRecordsInCategory 0xA071 +#define sysTrapDmPositionInCategory 0xA072 +#define sysTrapDmSeekRecordInCategory 0xA073 +#define sysTrapDmMoveCategory 0xA074 +#define sysTrapDmOpenDatabaseByTypeCreator 0xA075 +#define sysTrapDmWrite 0xA076 +#define sysTrapDmStrCopy 0xA077 +#define sysTrapDmGetNextDatabaseByTypeCreator 0xA078 +#define sysTrapDmWriteCheck 0xA079 +#define sysTrapDmMoveOpenDBContext 0xA07A +#define sysTrapDmFindRecordByID 0xA07B +#define sysTrapDmGetAppInfoID 0xA07C +#define sysTrapDmFindSortPositionV10 0xA07D +#define sysTrapDmSet 0xA07E +#define sysTrapDmCreateDatabaseFromImage 0xA07F + + +#define sysTrapDbgSrcMessage 0xA080 +#define sysTrapDbgMessage 0xA081 +#define sysTrapDbgGetMessage 0xA082 +#define sysTrapDbgCommSettings 0xA083 + +#define sysTrapErrDisplayFileLineMsg 0xA084 +#define sysTrapErrSetJump 0xA085 +#define sysTrapErrLongJump 0xA086 +#define sysTrapErrThrow 0xA087 +#define sysTrapErrExceptionList 0xA088 + +#define sysTrapSysBroadcastActionCode 0xA089 +#define sysTrapSysUnimplemented 0xA08A +#define sysTrapSysColdBoot 0xA08B +#define sysTrapSysReset 0xA08C +#define sysTrapSysDoze 0xA08D +#define sysTrapSysAppLaunch 0xA08E +#define sysTrapSysAppStartup 0xA08F +#define sysTrapSysAppExit 0xA090 +#define sysTrapSysSetA5 0xA091 +#define sysTrapSysSetTrapAddress 0xA092 +#define sysTrapSysGetTrapAddress 0xA093 +#define sysTrapSysTranslateKernelErr 0xA094 +#define sysTrapSysSemaphoreCreate 0xA095 +#define sysTrapSysSemaphoreDelete 0xA096 +#define sysTrapSysSemaphoreWait 0xA097 +#define sysTrapSysSemaphoreSignal 0xA098 +#define sysTrapSysTimerCreate 0xA099 +#define sysTrapSysTimerWrite 0xA09A +#define sysTrapSysTaskCreate 0xA09B +#define sysTrapSysTaskDelete 0xA09C +#define sysTrapSysTaskTrigger 0xA09D +#define sysTrapSysTaskID 0xA09E +#define sysTrapSysTaskUserInfoPtr 0xA09F +#define sysTrapSysTaskDelay 0xA0A0 +#define sysTrapSysTaskSetTermProc 0xA0A1 +#define sysTrapSysUILaunch 0xA0A2 +#define sysTrapSysNewOwnerID 0xA0A3 +#define sysTrapSysSemaphoreSet 0xA0A4 +#define sysTrapSysDisableInts 0xA0A5 +#define sysTrapSysRestoreStatus 0xA0A6 +#define sysTrapSysUIAppSwitch 0xA0A7 +#define sysTrapSysCurAppInfoPV20 0xA0A8 +#define sysTrapSysHandleEvent 0xA0A9 +#define sysTrapSysInit 0xA0AA +#define sysTrapSysQSort 0xA0AB +#define sysTrapSysCurAppDatabase 0xA0AC +#define sysTrapSysFatalAlert 0xA0AD +#define sysTrapSysResSemaphoreCreate 0xA0AE +#define sysTrapSysResSemaphoreDelete 0xA0AF +#define sysTrapSysResSemaphoreReserve 0xA0B0 +#define sysTrapSysResSemaphoreRelease 0xA0B1 +#define sysTrapSysSleep 0xA0B2 +#define sysTrapSysKeyboardDialogV10 0xA0B3 +#define sysTrapSysAppLauncherDialog 0xA0B4 +#define sysTrapSysSetPerformance 0xA0B5 +#define sysTrapSysBatteryInfoV20 0xA0B6 +#define sysTrapSysLibInstall 0xA0B7 +#define sysTrapSysLibRemove 0xA0B8 +#define sysTrapSysLibTblEntry 0xA0B9 +#define sysTrapSysLibFind 0xA0BA +#define sysTrapSysBatteryDialog 0xA0BB +#define sysTrapSysCopyStringResource 0xA0BC +#define sysTrapSysKernelInfo 0xA0BD +#define sysTrapSysLaunchConsole 0xA0BE +#define sysTrapSysTimerDelete 0xA0BF +#define sysTrapSysSetAutoOffTime 0xA0C0 +#define sysTrapSysFormPointerArrayToStrings 0xA0C1 +#define sysTrapSysRandom 0xA0C2 +#define sysTrapSysTaskSwitching 0xA0C3 +#define sysTrapSysTimerRead 0xA0C4 + + +#define sysTrapStrCopy 0xA0C5 +#define sysTrapStrCat 0xA0C6 +#define sysTrapStrLen 0xA0C7 +#define sysTrapStrCompare 0xA0C8 +#define sysTrapStrIToA 0xA0C9 +#define sysTrapStrCaselessCompare 0xA0CA +#define sysTrapStrIToH 0xA0CB +#define sysTrapStrChr 0xA0CC +#define sysTrapStrStr 0xA0CD +#define sysTrapStrAToI 0xA0CE +#define sysTrapStrToLower 0xA0CF + +#define sysTrapSerReceiveISP 0xA0D0 + +#define sysTrapSlkOpen 0xA0D1 +#define sysTrapSlkClose 0xA0D2 +#define sysTrapSlkOpenSocket 0xA0D3 +#define sysTrapSlkCloseSocket 0xA0D4 +#define sysTrapSlkSocketRefNum 0xA0D5 +#define sysTrapSlkSocketSetTimeout 0xA0D6 +#define sysTrapSlkFlushSocket 0xA0D7 +#define sysTrapSlkSetSocketListener 0xA0D8 +#define sysTrapSlkSendPacket 0xA0D9 +#define sysTrapSlkReceivePacket 0xA0DA +#define sysTrapSlkSysPktDefaultResponse 0xA0DB +#define sysTrapSlkProcessRPC 0xA0DC + + +#define sysTrapConPutS 0xA0DD +#define sysTrapConGetS 0xA0DE + +#define sysTrapFplInit 0xA0DF /* Obsolete, here for compatibilty only! */ +#define sysTrapFplFree 0xA0E0 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplFToA 0xA0E1 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplAToF 0xA0E2 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplBase10Info 0xA0E3 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplLongToFloat 0xA0E4 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplFloatToLong 0xA0E5 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplFloatToULong 0xA0E6 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplMul 0xA0E7 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplAdd 0xA0E8 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplSub 0xA0E9 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplDiv 0xA0EA /* Obsolete, here for compatibilty only! */ + +#define sysTrapWinScreenInit 0xA0EB /* was sysTrapScrInit */ +#define sysTrapScrCopyRectangle 0xA0EC +#define sysTrapScrDrawChars 0xA0ED +#define sysTrapScrLineRoutine 0xA0EE +#define sysTrapScrRectangleRoutine 0xA0EF +#define sysTrapScrScreenInfo 0xA0F0 +#define sysTrapScrDrawNotify 0xA0F1 +#define sysTrapScrSendUpdateArea 0xA0F2 +#define sysTrapScrCompressScanLine 0xA0F3 +#define sysTrapScrDeCompressScanLine 0xA0F4 + + +#define sysTrapTimGetSeconds 0xA0F5 +#define sysTrapTimSetSeconds 0xA0F6 +#define sysTrapTimGetTicks 0xA0F7 +#define sysTrapTimInit 0xA0F8 +#define sysTrapTimSetAlarm 0xA0F9 +#define sysTrapTimGetAlarm 0xA0FA +#define sysTrapTimHandleInterrupt 0xA0FB +#define sysTrapTimSecondsToDateTime 0xA0FC +#define sysTrapTimDateTimeToSeconds 0xA0FD +#define sysTrapTimAdjust 0xA0FE +#define sysTrapTimSleep 0xA0FF +#define sysTrapTimWake 0xA100 + +#define sysTrapCategoryCreateListV10 0xA101 +#define sysTrapCategoryFreeListV10 0xA102 +#define sysTrapCategoryFind 0xA103 +#define sysTrapCategoryGetName 0xA104 +#define sysTrapCategoryEditV10 0xA105 +#define sysTrapCategorySelectV10 0xA106 +#define sysTrapCategoryGetNext 0xA107 +#define sysTrapCategorySetTriggerLabel 0xA108 +#define sysTrapCategoryTruncateName 0xA109 + +#define sysTrapClipboardAddItem 0xA10A +#define sysTrapClipboardCheckIfItemExist 0xA10B +#define sysTrapClipboardGetItem 0xA10C + +#define sysTrapCtlDrawControl 0xA10D +#define sysTrapCtlEraseControl 0xA10E +#define sysTrapCtlHideControl 0xA10F +#define sysTrapCtlShowControl 0xA110 +#define sysTrapCtlGetValue 0xA111 +#define sysTrapCtlSetValue 0xA112 +#define sysTrapCtlGetLabel 0xA113 +#define sysTrapCtlSetLabel 0xA114 +#define sysTrapCtlHandleEvent 0xA115 +#define sysTrapCtlHitControl 0xA116 +#define sysTrapCtlSetEnabled 0xA117 +#define sysTrapCtlSetUsable 0xA118 +#define sysTrapCtlEnabled 0xA119 + + +#define sysTrapEvtInitialize 0xA11A +#define sysTrapEvtAddEventToQueue 0xA11B +#define sysTrapEvtCopyEvent 0xA11C +#define sysTrapEvtGetEvent 0xA11D +#define sysTrapEvtGetPen 0xA11E +#define sysTrapEvtSysInit 0xA11F +#define sysTrapEvtGetSysEvent 0xA120 +#define sysTrapEvtProcessSoftKeyStroke 0xA121 +#define sysTrapEvtGetPenBtnList 0xA122 +#define sysTrapEvtSetPenQueuePtr 0xA123 +#define sysTrapEvtPenQueueSize 0xA124 +#define sysTrapEvtFlushPenQueue 0xA125 +#define sysTrapEvtEnqueuePenPoint 0xA126 +#define sysTrapEvtDequeuePenStrokeInfo 0xA127 +#define sysTrapEvtDequeuePenPoint 0xA128 +#define sysTrapEvtFlushNextPenStroke 0xA129 +#define sysTrapEvtSetKeyQueuePtr 0xA12A +#define sysTrapEvtKeyQueueSize 0xA12B +#define sysTrapEvtFlushKeyQueue 0xA12C +#define sysTrapEvtEnqueueKey 0xA12D +#define sysTrapEvtDequeueKeyEvent 0xA12E +#define sysTrapEvtWakeup 0xA12F +#define sysTrapEvtResetAutoOffTimer 0xA130 +#define sysTrapEvtKeyQueueEmpty 0xA131 +#define sysTrapEvtEnableGraffiti 0xA132 + + +#define sysTrapFldCopy 0xA133 +#define sysTrapFldCut 0xA134 +#define sysTrapFldDrawField 0xA135 +#define sysTrapFldEraseField 0xA136 +#define sysTrapFldFreeMemory 0xA137 +#define sysTrapFldGetBounds 0xA138 +#define sysTrapFldGetTextPtr 0xA139 +#define sysTrapFldGetSelection 0xA13A +#define sysTrapFldHandleEvent 0xA13B +#define sysTrapFldPaste 0xA13C +#define sysTrapFldRecalculateField 0xA13D +#define sysTrapFldSetBounds 0xA13E +#define sysTrapFldSetText 0xA13F +#define sysTrapFldGetFont 0xA140 +#define sysTrapFldSetFont 0xA141 +#define sysTrapFldSetSelection 0xA142 +#define sysTrapFldGrabFocus 0xA143 +#define sysTrapFldReleaseFocus 0xA144 +#define sysTrapFldGetInsPtPosition 0xA145 +#define sysTrapFldSetInsPtPosition 0xA146 +#define sysTrapFldSetScrollPosition 0xA147 +#define sysTrapFldGetScrollPosition 0xA148 +#define sysTrapFldGetTextHeight 0xA149 +#define sysTrapFldGetTextAllocatedSize 0xA14A +#define sysTrapFldGetTextLength 0xA14B +#define sysTrapFldScrollField 0xA14C +#define sysTrapFldScrollable 0xA14D +#define sysTrapFldGetVisibleLines 0xA14E +#define sysTrapFldGetAttributes 0xA14F +#define sysTrapFldSetAttributes 0xA150 +#define sysTrapFldSendChangeNotification 0xA151 +#define sysTrapFldCalcFieldHeight 0xA152 +#define sysTrapFldGetTextHandle 0xA153 +#define sysTrapFldCompactText 0xA154 +#define sysTrapFldDirty 0xA155 +#define sysTrapFldWordWrap 0xA156 +#define sysTrapFldSetTextAllocatedSize 0xA157 +#define sysTrapFldSetTextHandle 0xA158 +#define sysTrapFldSetTextPtr 0xA159 +#define sysTrapFldGetMaxChars 0xA15A +#define sysTrapFldSetMaxChars 0xA15B +#define sysTrapFldSetUsable 0xA15C +#define sysTrapFldInsert 0xA15D +#define sysTrapFldDelete 0xA15E +#define sysTrapFldUndo 0xA15F +#define sysTrapFldSetDirty 0xA160 +#define sysTrapFldSendHeightChangeNotification 0xA161 +#define sysTrapFldMakeFullyVisible 0xA162 + + +#define sysTrapFntGetFont 0xA163 +#define sysTrapFntSetFont 0xA164 +#define sysTrapFntGetFontPtr 0xA165 +#define sysTrapFntBaseLine 0xA166 +#define sysTrapFntCharHeight 0xA167 +#define sysTrapFntLineHeight 0xA168 +#define sysTrapFntAverageCharWidth 0xA169 +#define sysTrapFntCharWidth 0xA16A +#define sysTrapFntCharsWidth 0xA16B +#define sysTrapFntDescenderHeight 0xA16C +#define sysTrapFntCharsInWidth 0xA16D +#define sysTrapFntLineWidth 0xA16E + + +#define sysTrapFrmInitForm 0xA16F +#define sysTrapFrmDeleteForm 0xA170 +#define sysTrapFrmDrawForm 0xA171 +#define sysTrapFrmEraseForm 0xA172 +#define sysTrapFrmGetActiveForm 0xA173 +#define sysTrapFrmSetActiveForm 0xA174 +#define sysTrapFrmGetActiveFormID 0xA175 +#define sysTrapFrmGetUserModifiedState 0xA176 +#define sysTrapFrmSetNotUserModified 0xA177 +#define sysTrapFrmGetFocus 0xA178 +#define sysTrapFrmSetFocus 0xA179 +#define sysTrapFrmHandleEvent 0xA17A +#define sysTrapFrmGetFormBounds 0xA17B +#define sysTrapFrmGetWindowHandle 0xA17C +#define sysTrapFrmGetFormId 0xA17D +#define sysTrapFrmGetFormPtr 0xA17E +#define sysTrapFrmGetNumberOfObjects 0xA17F +#define sysTrapFrmGetObjectIndex 0xA180 +#define sysTrapFrmGetObjectId 0xA181 +#define sysTrapFrmGetObjectType 0xA182 +#define sysTrapFrmGetObjectPtr 0xA183 +#define sysTrapFrmHideObject 0xA184 +#define sysTrapFrmShowObject 0xA185 +#define sysTrapFrmGetObjectPosition 0xA186 +#define sysTrapFrmSetObjectPosition 0xA187 +#define sysTrapFrmGetControlValue 0xA188 +#define sysTrapFrmSetControlValue 0xA189 +#define sysTrapFrmGetControlGroupSelection 0xA18A +#define sysTrapFrmSetControlGroupSelection 0xA18B +#define sysTrapFrmCopyLabel 0xA18C +#define sysTrapFrmSetLabel 0xA18D +#define sysTrapFrmGetLabel 0xA18E +#define sysTrapFrmSetCategoryLabel 0xA18F +#define sysTrapFrmGetTitle 0xA190 +#define sysTrapFrmSetTitle 0xA191 +#define sysTrapFrmAlert 0xA192 +#define sysTrapFrmDoDialog 0xA193 +#define sysTrapFrmCustomAlert 0xA194 +#define sysTrapFrmHelp 0xA195 +#define sysTrapFrmUpdateScrollers 0xA196 +#define sysTrapFrmGetFirstForm 0xA197 +#define sysTrapFrmVisible 0xA198 +#define sysTrapFrmGetObjectBounds 0xA199 +#define sysTrapFrmCopyTitle 0xA19A +#define sysTrapFrmGotoForm 0xA19B +#define sysTrapFrmPopupForm 0xA19C +#define sysTrapFrmUpdateForm 0xA19D +#define sysTrapFrmReturnToForm 0xA19E +#define sysTrapFrmSetEventHandler 0xA19F +#define sysTrapFrmDispatchEvent 0xA1A0 +#define sysTrapFrmCloseAllForms 0xA1A1 +#define sysTrapFrmSaveAllForms 0xA1A2 +#define sysTrapFrmGetGadgetData 0xA1A3 +#define sysTrapFrmSetGadgetData 0xA1A4 +#define sysTrapFrmSetCategoryTrigger 0xA1A5 + + +#define sysTrapUIInitialize 0xA1A6 +#define sysTrapUIReset 0xA1A7 + +#define sysTrapInsPtInitialize 0xA1A8 +#define sysTrapInsPtSetLocation 0xA1A9 +#define sysTrapInsPtGetLocation 0xA1AA +#define sysTrapInsPtEnable 0xA1AB +#define sysTrapInsPtEnabled 0xA1AC +#define sysTrapInsPtSetHeight 0xA1AD +#define sysTrapInsPtGetHeight 0xA1AE +#define sysTrapInsPtCheckBlink 0xA1AF + +#define sysTrapLstSetDrawFunction 0xA1B0 +#define sysTrapLstDrawList 0xA1B1 +#define sysTrapLstEraseList 0xA1B2 +#define sysTrapLstGetSelection 0xA1B3 +#define sysTrapLstGetSelectionText 0xA1B4 +#define sysTrapLstHandleEvent 0xA1B5 +#define sysTrapLstSetHeight 0xA1B6 +#define sysTrapLstSetSelection 0xA1B7 +#define sysTrapLstSetListChoices 0xA1B8 +#define sysTrapLstMakeItemVisible 0xA1B9 +#define sysTrapLstGetNumberOfItems 0xA1BA +#define sysTrapLstPopupList 0xA1BB +#define sysTrapLstSetPosition 0xA1BC + +#define sysTrapMenuInit 0xA1BD +#define sysTrapMenuDispose 0xA1BE +#define sysTrapMenuHandleEvent 0xA1BF +#define sysTrapMenuDrawMenu 0xA1C0 +#define sysTrapMenuEraseStatus 0xA1C1 +#define sysTrapMenuGetActiveMenu 0xA1C2 +#define sysTrapMenuSetActiveMenu 0xA1C3 + + +#define sysTrapRctSetRectangle 0xA1C4 +#define sysTrapRctCopyRectangle 0xA1C5 +#define sysTrapRctInsetRectangle 0xA1C6 +#define sysTrapRctOffsetRectangle 0xA1C7 +#define sysTrapRctPtInRectangle 0xA1C8 +#define sysTrapRctGetIntersection 0xA1C9 + + +#define sysTrapTblDrawTable 0xA1CA +#define sysTrapTblEraseTable 0xA1CB +#define sysTrapTblHandleEvent 0xA1CC +#define sysTrapTblGetItemBounds 0xA1CD +#define sysTrapTblSelectItem 0xA1CE +#define sysTrapTblGetItemInt 0xA1CF +#define sysTrapTblSetItemInt 0xA1D0 +#define sysTrapTblSetItemStyle 0xA1D1 +#define sysTrapTblUnhighlightSelection 0xA1D2 +#define sysTrapTblSetRowUsable 0xA1D3 +#define sysTrapTblGetNumberOfRows 0xA1D4 +#define sysTrapTblSetCustomDrawProcedure 0xA1D5 +#define sysTrapTblSetRowSelectable 0xA1D6 +#define sysTrapTblRowSelectable 0xA1D7 +#define sysTrapTblSetLoadDataProcedure 0xA1D8 +#define sysTrapTblSetSaveDataProcedure 0xA1D9 +#define sysTrapTblGetBounds 0xA1DA +#define sysTrapTblSetRowHeight 0xA1DB +#define sysTrapTblGetColumnWidth 0xA1DC +#define sysTrapTblGetRowID 0xA1DD +#define sysTrapTblSetRowID 0xA1DE +#define sysTrapTblMarkRowInvalid 0xA1DF +#define sysTrapTblMarkTableInvalid 0xA1E0 +#define sysTrapTblGetSelection 0xA1E1 +#define sysTrapTblInsertRow 0xA1E2 +#define sysTrapTblRemoveRow 0xA1E3 +#define sysTrapTblRowInvalid 0xA1E4 +#define sysTrapTblRedrawTable 0xA1E5 +#define sysTrapTblRowUsable 0xA1E6 +#define sysTrapTblReleaseFocus 0xA1E7 +#define sysTrapTblEditing 0xA1E8 +#define sysTrapTblGetCurrentField 0xA1E9 +#define sysTrapTblSetColumnUsable 0xA1EA +#define sysTrapTblGetRowHeight 0xA1EB +#define sysTrapTblSetColumnWidth 0xA1EC +#define sysTrapTblGrabFocus 0xA1ED +#define sysTrapTblSetItemPtr 0xA1EE +#define sysTrapTblFindRowID 0xA1EF +#define sysTrapTblGetLastUsableRow 0xA1F0 +#define sysTrapTblGetColumnSpacing 0xA1F1 +#define sysTrapTblFindRowData 0xA1F2 +#define sysTrapTblGetRowData 0xA1F3 +#define sysTrapTblSetRowData 0xA1F4 +#define sysTrapTblSetColumnSpacing 0xA1F5 + + + +#define sysTrapWinCreateWindow 0xA1F6 +#define sysTrapWinCreateOffscreenWindow 0xA1F7 +#define sysTrapWinDeleteWindow 0xA1F8 +#define sysTrapWinInitializeWindow 0xA1F9 +#define sysTrapWinAddWindow 0xA1FA +#define sysTrapWinRemoveWindow 0xA1FB +#define sysTrapWinSetActiveWindow 0xA1FC +#define sysTrapWinSetDrawWindow 0xA1FD +#define sysTrapWinGetDrawWindow 0xA1FE +#define sysTrapWinGetActiveWindow 0xA1FF +#define sysTrapWinGetDisplayWindow 0xA200 +#define sysTrapWinGetFirstWindow 0xA201 +#define sysTrapWinEnableWindow 0xA202 +#define sysTrapWinDisableWindow 0xA203 +#define sysTrapWinGetWindowFrameRect 0xA204 +#define sysTrapWinDrawWindowFrame 0xA205 +#define sysTrapWinEraseWindow 0xA206 +#define sysTrapWinSaveBits 0xA207 +#define sysTrapWinRestoreBits 0xA208 +#define sysTrapWinCopyRectangle 0xA209 +#define sysTrapWinScrollRectangle 0xA20A +#define sysTrapWinGetDisplayExtent 0xA20B +#define sysTrapWinGetWindowExtent 0xA20C +#define sysTrapWinDisplayToWindowPt 0xA20D +#define sysTrapWinWindowToDisplayPt 0xA20E +#define sysTrapWinGetClip 0xA20F +#define sysTrapWinSetClip 0xA210 +#define sysTrapWinResetClip 0xA211 +#define sysTrapWinClipRectangle 0xA212 +#define sysTrapWinDrawLine 0xA213 +#define sysTrapWinDrawGrayLine 0xA214 +#define sysTrapWinEraseLine 0xA215 +#define sysTrapWinInvertLine 0xA216 +#define sysTrapWinFillLine 0xA217 +#define sysTrapWinDrawRectangle 0xA218 +#define sysTrapWinEraseRectangle 0xA219 +#define sysTrapWinInvertRectangle 0xA21A +#define sysTrapWinDrawRectangleFrame 0xA21B +#define sysTrapWinDrawGrayRectangleFrame 0xA21C +#define sysTrapWinEraseRectangleFrame 0xA21D +#define sysTrapWinInvertRectangleFrame 0xA21E +#define sysTrapWinGetFramesRectangle 0xA21F +#define sysTrapWinDrawChars 0xA220 +#define sysTrapWinEraseChars 0xA221 +#define sysTrapWinInvertChars 0xA222 +#define sysTrapWinGetPattern 0xA223 +#define sysTrapWinSetPattern 0xA224 +#define sysTrapWinSetUnderlineMode 0xA225 +#define sysTrapWinDrawBitmap 0xA226 +#define sysTrapWinModal 0xA227 +#define sysTrapWinGetWindowBounds 0xA228 +#define sysTrapWinFillRectangle 0xA229 +#define sysTrapWinDrawInvertedChars 0xA22A + + + +#define sysTrapPrefOpenPreferenceDBV10 0xA22B +#define sysTrapPrefGetPreferences 0xA22C +#define sysTrapPrefSetPreferences 0xA22D +#define sysTrapPrefGetAppPreferencesV10 0xA22E +#define sysTrapPrefSetAppPreferencesV10 0xA22F + + +#define sysTrapSndInit 0xA230 +#define sysTrapSndSetDefaultVolume 0xA231 +#define sysTrapSndGetDefaultVolume 0xA232 +#define sysTrapSndDoCmd 0xA233 +#define sysTrapSndPlaySystemSound 0xA234 + + +#define sysTrapAlmInit 0xA235 +#define sysTrapAlmCancelAll 0xA236 +#define sysTrapAlmAlarmCallback 0xA237 +#define sysTrapAlmSetAlarm 0xA238 +#define sysTrapAlmGetAlarm 0xA239 +#define sysTrapAlmDisplayAlarm 0xA23A +#define sysTrapAlmEnableNotification 0xA23B + + +#define sysTrapHwrGetRAMMapping 0xA23C +#define sysTrapHwrMemWritable 0xA23D +#define sysTrapHwrMemReadable 0xA23E +#define sysTrapHwrDoze 0xA23F +#define sysTrapHwrSleep 0xA240 +#define sysTrapHwrWake 0xA241 +#define sysTrapHwrSetSystemClock 0xA242 +#define sysTrapHwrSetCPUDutyCycle 0xA243 +#define sysTrapHwrDisplayInit 0xA244 /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDInit */ +#define sysTrapHwrDisplaySleep 0xA245 /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDSleep, */ +#define sysTrapHwrTimerInit 0xA246 +#define sysTrapHwrCursorV33 0xA247 /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapHwrBatteryLevel 0xA248 +#define sysTrapHwrDelay 0xA249 +#define sysTrapHwrEnableDataWrites 0xA24A +#define sysTrapHwrDisableDataWrites 0xA24B +#define sysTrapHwrLCDBaseAddrV33 0xA24C /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapHwrDisplayDrawBootScreen 0xA24D /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDDrawBitmap */ +#define sysTrapHwrTimerSleep 0xA24E +#define sysTrapHwrTimerWake 0xA24F +#define sysTrapHwrDisplayWake 0xA250 /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDWake */ +#define sysTrapHwrIRQ1Handler 0xA251 +#define sysTrapHwrIRQ2Handler 0xA252 +#define sysTrapHwrIRQ3Handler 0xA253 +#define sysTrapHwrIRQ4Handler 0xA254 +#define sysTrapHwrIRQ5Handler 0xA255 +#define sysTrapHwrIRQ6Handler 0xA256 +#define sysTrapHwrDockSignals 0xA257 +#define sysTrapHwrPluggedIn 0xA258 + + +#define sysTrapCrc16CalcBlock 0xA259 + + +#define sysTrapSelectDayV10 0xA25A +#define sysTrapSelectTimeV33 0xA25B + +#define sysTrapDayDrawDaySelector 0xA25C +#define sysTrapDayHandleEvent 0xA25D +#define sysTrapDayDrawDays 0xA25E +#define sysTrapDayOfWeek 0xA25F +#define sysTrapDaysInMonth 0xA260 +#define sysTrapDayOfMonth 0xA261 + +#define sysTrapDateDaysToDate 0xA262 +#define sysTrapDateToDays 0xA263 +#define sysTrapDateAdjust 0xA264 +#define sysTrapDateSecondsToDate 0xA265 +#define sysTrapDateToAscii 0xA266 +#define sysTrapDateToDOWDMFormat 0xA267 +#define sysTrapTimeToAscii 0xA268 + + +#define sysTrapFind 0xA269 +#define sysTrapFindStrInStr 0xA26A +#define sysTrapFindSaveMatch 0xA26B +#define sysTrapFindGetLineBounds 0xA26C +#define sysTrapFindDrawHeader 0xA26D + +#define sysTrapPenOpen 0xA26E +#define sysTrapPenClose 0xA26F +#define sysTrapPenGetRawPen 0xA270 +#define sysTrapPenCalibrate 0xA271 +#define sysTrapPenRawToScreen 0xA272 +#define sysTrapPenScreenToRaw 0xA273 +#define sysTrapPenResetCalibration 0xA274 +#define sysTrapPenSleep 0xA275 +#define sysTrapPenWake 0xA276 + + +#define sysTrapResLoadForm 0xA277 +#define sysTrapResLoadMenu 0xA278 + +#define sysTrapFtrInit 0xA279 +#define sysTrapFtrUnregister 0xA27A +#define sysTrapFtrGet 0xA27B +#define sysTrapFtrSet 0xA27C +#define sysTrapFtrGetByIndex 0xA27D + + + +#define sysTrapGrfInit 0xA27E +#define sysTrapGrfFree 0xA27F +#define sysTrapGrfGetState 0xA280 +#define sysTrapGrfSetState 0xA281 +#define sysTrapGrfFlushPoints 0xA282 +#define sysTrapGrfAddPoint 0xA283 +#define sysTrapGrfInitState 0xA284 +#define sysTrapGrfCleanState 0xA285 +#define sysTrapGrfMatch 0xA286 +#define sysTrapGrfGetMacro 0xA287 +#define sysTrapGrfFilterPoints 0xA288 +#define sysTrapGrfGetNumPoints 0xA289 +#define sysTrapGrfGetPoint 0xA28A +#define sysTrapGrfFindBranch 0xA28B +#define sysTrapGrfMatchGlyph 0xA28C +#define sysTrapGrfGetGlyphMapping 0xA28D +#define sysTrapGrfGetMacroName 0xA28E +#define sysTrapGrfDeleteMacro 0xA28F +#define sysTrapGrfAddMacro 0xA290 +#define sysTrapGrfGetAndExpandMacro 0xA291 +#define sysTrapGrfProcessStroke 0xA292 +#define sysTrapGrfFieldChange 0xA293 + + +#define sysTrapGetCharSortValue 0xA294 +#define sysTrapGetCharAttr 0xA295 +#define sysTrapGetCharCaselessValue 0xA296 + + +#define sysTrapPwdExists 0xA297 +#define sysTrapPwdVerify 0xA298 +#define sysTrapPwdSet 0xA299 +#define sysTrapPwdRemove 0xA29A + +#define sysTrapGsiInitialize 0xA29B +#define sysTrapGsiSetLocation 0xA29C +#define sysTrapGsiEnable 0xA29D +#define sysTrapGsiEnabled 0xA29E +#define sysTrapGsiSetShiftState 0xA29F + +#define sysTrapKeyInit 0xA2A0 +#define sysTrapKeyHandleInterrupt 0xA2A1 +#define sysTrapKeyCurrentState 0xA2A2 +#define sysTrapKeyResetDoubleTap 0xA2A3 +#define sysTrapKeyRates 0xA2A4 +#define sysTrapKeySleep 0xA2A5 +#define sysTrapKeyWake 0xA2A6 + + +#define sysTrapDlkControl 0xA2A7 /* was sysTrapCmBroadcast */ + +#define sysTrapDlkStartServer 0xA2A8 +#define sysTrapDlkGetSyncInfo 0xA2A9 +#define sysTrapDlkSetLogEntry 0xA2AA + +#define sysTrapIntlDispatch 0xA2AB /* REUSED IN v3.1 (was sysTrapPsrInit in 1.0, removed in 2.0) */ +#define sysTrapSysLibLoad 0xA2AC /* REUSED IN v2.0 (was sysTrapPsrClose) */ +#define sysTrapSndPlaySmf 0xA2AD /* REUSED IN v3.0 (was sysTrapPsrGetCommand in 1.0, removed in 2.0) */ +#define sysTrapSndCreateMidiList 0xA2AE /* REUSED IN v3.0 (was sysTrapPsrSendReply in 1.0, removed in 2.0) */ + +#define sysTrapAbtShowAbout 0xA2AF + +#define sysTrapMdmDial 0xA2B0 +#define sysTrapMdmHangUp 0xA2B1 + +#define sysTrapDmSearchRecord 0xA2B2 + +#define sysTrapSysInsertionSort 0xA2B3 +#define sysTrapDmInsertionSort 0xA2B4 + +#define sysTrapLstSetTopItem 0xA2B5 + + +// Palm OS 2.X traps Palm Pilot and 2.0 Upgrade Card + +#define sysTrapSclSetScrollBar 0xA2B6 +#define sysTrapSclDrawScrollBar 0xA2B7 +#define sysTrapSclHandleEvent 0xA2B8 + +#define sysTrapSysMailboxCreate 0xA2B9 +#define sysTrapSysMailboxDelete 0xA2BA +#define sysTrapSysMailboxFlush 0xA2BB +#define sysTrapSysMailboxSend 0xA2BC +#define sysTrapSysMailboxWait 0xA2BD + +#define sysTrapSysTaskWait 0xA2BE +#define sysTrapSysTaskWake 0xA2BF +#define sysTrapSysTaskWaitClr 0xA2C0 +#define sysTrapSysTaskSuspend 0xA2C1 +#define sysTrapSysTaskResume 0xA2C2 + +#define sysTrapCategoryCreateList 0xA2C3 +#define sysTrapCategoryFreeList 0xA2C4 +#define sysTrapCategoryEditV20 0xA2C5 +#define sysTrapCategorySelect 0xA2C6 + +#define sysTrapDmDeleteCategory 0xA2C7 + +#define sysTrapSysEvGroupCreate 0xA2C8 +#define sysTrapSysEvGroupSignal 0xA2C9 +#define sysTrapSysEvGroupRead 0xA2CA +#define sysTrapSysEvGroupWait 0xA2CB + +#define sysTrapEvtEventAvail 0xA2CC +#define sysTrapEvtSysEventAvail 0xA2CD +#define sysTrapStrNCopy 0xA2CE + +#define sysTrapKeySetMask 0xA2CF + +#define sysTrapSelectDay 0xA2D0 + +#define sysTrapPrefGetPreference 0xA2D1 +#define sysTrapPrefSetPreference 0xA2D2 +#define sysTrapPrefGetAppPreferences 0xA2D3 +#define sysTrapPrefSetAppPreferences 0xA2D4 + +#define sysTrapFrmPointInTitle 0xA2D5 + +#define sysTrapStrNCat 0xA2D6 + +#define sysTrapMemCmp 0xA2D7 + +#define sysTrapTblSetColumnEditIndicator 0xA2D8 + +#define sysTrapFntWordWrap 0xA2D9 + +#define sysTrapFldGetScrollValues 0xA2DA + +#define sysTrapSysCreateDataBaseList 0xA2DB +#define sysTrapSysCreatePanelList 0xA2DC + +#define sysTrapDlkDispatchRequest 0xA2DD + +#define sysTrapStrPrintF 0xA2DE +#define sysTrapStrVPrintF 0xA2DF + +#define sysTrapPrefOpenPreferenceDB 0xA2E0 + +#define sysTrapSysGraffitiReferenceDialog 0xA2E1 + +#define sysTrapSysKeyboardDialog 0xA2E2 + +#define sysTrapFntWordWrapReverseNLines 0xA2E3 +#define sysTrapFntGetScrollValues 0xA2E4 + +#define sysTrapTblSetRowStaticHeight 0xA2E5 +#define sysTrapTblHasScrollBar 0xA2E6 + +#define sysTrapSclGetScrollBar 0xA2E7 + +#define sysTrapFldGetNumberOfBlankLines 0xA2E8 + +#define sysTrapSysTicksPerSecond 0xA2E9 +#define sysTrapHwrBacklightV33 0xA2EA /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapDmDatabaseProtect 0xA2EB + +#define sysTrapTblSetBounds 0xA2EC + +#define sysTrapStrNCompare 0xA2ED +#define sysTrapStrNCaselessCompare 0xA2EE + +#define sysTrapPhoneNumberLookup 0xA2EF + +#define sysTrapFrmSetMenu 0xA2F0 + +#define sysTrapEncDigestMD5 0xA2F1 + +#define sysTrapDmFindSortPosition 0xA2F2 + +#define sysTrapSysBinarySearch 0xA2F3 +#define sysTrapSysErrString 0xA2F4 +#define sysTrapSysStringByIndex 0xA2F5 + +#define sysTrapEvtAddUniqueEventToQueue 0xA2F6 + +#define sysTrapStrLocalizeNumber 0xA2F7 +#define sysTrapStrDelocalizeNumber 0xA2F8 +#define sysTrapLocGetNumberSeparators 0xA2F9 + +#define sysTrapMenuSetActiveMenuRscID 0xA2FA + +#define sysTrapLstScrollList 0xA2FB + +#define sysTrapCategoryInitialize 0xA2FC + +#define sysTrapEncDigestMD4 0xA2FD +#define sysTrapEncDES 0xA2FE + +#define sysTrapLstGetVisibleItems 0xA2FF + +#define sysTrapWinSetWindowBounds 0xA300 + +#define sysTrapCategorySetName 0xA301 + +#define sysTrapFldSetInsertionPoint 0xA302 + +#define sysTrapFrmSetObjectBounds 0xA303 + +#define sysTrapWinSetColors 0xA304 + +#define sysTrapFlpDispatch 0xA305 +#define sysTrapFlpEmDispatch 0xA306 + + +// Palm OS 3.0 traps Palm III and 3.0 Upgrade Card + +#define sysTrapExgInit 0xA307 +#define sysTrapExgConnect 0xA308 +#define sysTrapExgPut 0xA309 +#define sysTrapExgGet 0xA30A +#define sysTrapExgAccept 0xA30B +#define sysTrapExgDisconnect 0xA30C +#define sysTrapExgSend 0xA30D +#define sysTrapExgReceive 0xA30E +#define sysTrapExgRegisterData 0xA30F +#define sysTrapExgNotifyReceive 0xA310 +#define sysTrapExgControl 0xA311 + +#define sysTrapPrgStartDialogV31 0xA312 /* Updated in v3.2 */ +#define sysTrapPrgStopDialog 0xA313 +#define sysTrapPrgUpdateDialog 0xA314 +#define sysTrapPrgHandleEvent 0xA315 + +#define sysTrapImcReadFieldNoSemicolon 0xA316 +#define sysTrapImcReadFieldQuotablePrintable 0xA317 +#define sysTrapImcReadPropertyParameter 0xA318 +#define sysTrapImcSkipAllPropertyParameters 0xA319 +#define sysTrapImcReadWhiteSpace 0xA31A +#define sysTrapImcWriteQuotedPrintable 0xA31B +#define sysTrapImcWriteNoSemicolon 0xA31C +#define sysTrapImcStringIsAscii 0xA31D + +#define sysTrapTblGetItemFont 0xA31E +#define sysTrapTblSetItemFont 0xA31F + +#define sysTrapFontSelect 0xA320 +#define sysTrapFntDefineFont 0xA321 + +#define sysTrapCategoryEdit 0xA322 + +#define sysTrapSysGetOSVersionString 0xA323 +#define sysTrapSysBatteryInfo 0xA324 +#define sysTrapSysUIBusy 0xA325 + +#define sysTrapWinValidateHandle 0xA326 +#define sysTrapFrmValidatePtr 0xA327 +#define sysTrapCtlValidatePointer 0xA328 +#define sysTrapWinMoveWindowAddr 0xA329 +#define sysTrapFrmAddSpaceForObject 0xA32A +#define sysTrapFrmNewForm 0xA32B +#define sysTrapCtlNewControl 0xA32C +#define sysTrapFldNewField 0xA32D +#define sysTrapLstNewList 0xA32E +#define sysTrapFrmNewLabel 0xA32F +#define sysTrapFrmNewBitmap 0xA330 +#define sysTrapFrmNewGadget 0xA331 + +#define sysTrapFileOpen 0xA332 +#define sysTrapFileClose 0xA333 +#define sysTrapFileDelete 0xA334 +#define sysTrapFileReadLow 0xA335 +#define sysTrapFileWrite 0xA336 +#define sysTrapFileSeek 0xA337 +#define sysTrapFileTell 0xA338 +#define sysTrapFileTruncate 0xA339 +#define sysTrapFileControl 0xA33A + +#define sysTrapFrmActiveState 0xA33B + +#define sysTrapSysGetAppInfo 0xA33C +#define sysTrapSysGetStackInfo 0xA33D + +#define sysTrapWinScreenMode 0xA33E /* was sysTrapScrDisplayMode */ +#define sysTrapHwrLCDGetDepthV33 0xA33F /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapHwrGetROMToken 0xA340 + +#define sysTrapDbgControl 0xA341 + +#define sysTrapExgDBRead 0xA342 +#define sysTrapExgDBWrite 0xA343 + +#define sysTrapHostControl 0xA344 /* Renamed from sysTrapSysGremlins, functionality generalized */ +#define sysTrapFrmRemoveObject 0xA345 + +#define sysTrapSysReserved1 0xA346 /* "Reserved" trap in Palm OS 3.0 and later trap table */ +#define sysTrapSysReserved2 0xA347 /* "Reserved" trap in Palm OS 3.0 and later trap table */ +#define sysTrapSysReserved3 0xA348 /* "Reserved" trap in Palm OS 3.0 and later trap table */ + +#define sysTrapOEMDispatch 0xA349 /* OEM trap in Palm OS 3.0 and later trap table (formerly sysTrapSysReserved4) */ + + +// Palm OS 3.1 traps Palm IIIx and Palm V + +#define sysTrapHwrLCDContrastV33 0xA34A /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapSysLCDContrast 0xA34B +#define sysTrapUIContrastAdjust 0xA34C /* Renamed from sysTrapContrastAdjust */ +#define sysTrapHwrDockStatus 0xA34D + +#define sysTrapFntWidthToOffset 0xA34E +#define sysTrapSelectOneTime 0xA34F +#define sysTrapWinDrawChar 0xA350 +#define sysTrapWinDrawTruncChars 0xA351 + +#define sysTrapSysNotifyInit 0xA352 /* Notification Manager traps */ +#define sysTrapSysNotifyRegister 0xA353 +#define sysTrapSysNotifyUnregister 0xA354 +#define sysTrapSysNotifyBroadcast 0xA355 +#define sysTrapSysNotifyBroadcastDeferred 0xA356 +#define sysTrapSysNotifyDatabaseAdded 0xA357 +#define sysTrapSysNotifyDatabaseRemoved 0xA358 + +#define sysTrapSysWantEvent 0xA359 + +#define sysTrapFtrPtrNew 0xA35A +#define sysTrapFtrPtrFree 0xA35B +#define sysTrapFtrPtrResize 0xA35C + +#define sysTrapSysReserved5 0xA35D /* "Reserved" trap in Palm OS 3.1 and later trap table */ + + +// Palm OS 3.2 & 3.3 traps Palm VII (3.2) and Fall '99 Palm OS Flash Update (3.3) + +#define sysTrapHwrNVPrefSet 0xA35E /* mapped to FlashParmsWrite */ +#define sysTrapHwrNVPrefGet 0xA35F /* mapped to FlashParmsRead */ +#define sysTrapFlashInit 0xA360 +#define sysTrapFlashCompress 0xA361 +#define sysTrapFlashErase 0xA362 +#define sysTrapFlashProgram 0xA363 + +#define sysTrapAlmTimeChange 0xA364 +#define sysTrapErrAlertCustom 0xA365 +#define sysTrapPrgStartDialog 0xA366 /* New version of sysTrapPrgStartDialogV31 */ + +#define sysTrapSerialDispatch 0xA367 +#define sysTrapHwrBattery 0xA368 +#define sysTrapDmGetDatabaseLockState 0xA369 + +#define sysTrapCncGetProfileList 0xA36A +#define sysTrapCncGetProfileInfo 0xA36B +#define sysTrapCncAddProfile 0xA36C +#define sysTrapCncDeleteProfile 0xA36D + +#define sysTrapSndPlaySmfResource 0xA36E + +#define sysTrapMemPtrDataStorage 0xA36F /* Never actually installed until now. */ + +#define sysTrapClipboardAppendItem 0xA370 + +#define sysTrapWiCmdV32 0xA371 /* Code moved to INetLib; trap obsolete */ + +// 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!! These are new traps for 3.5. If this file is merged +// with MAIN sources, new traps that are added for products that precede +// 3.5 MUST insert their traps BEFORE this section. + +// HAL Display-layer new traps +#define sysTrapHwrDisplayAttributes 0xA372 +#define sysTrapHwrDisplayDoze 0xA373 +#define sysTrapHwrDisplayPalette 0xA374 + +// Screen driver new traps +#define sysTrapBltFindIndexes 0xA375 +#define sysTrapBmpGetBits 0xA376 /* was BltGetBitsAddr */ +#define sysTrapBltCopyRectangle 0xA377 +#define sysTrapBltDrawChars 0xA378 +#define sysTrapBltLineRoutine 0xA379 +#define sysTrapBltRectangleRoutine 0xA37A + +// ScrUtils new traps +#define sysTrapScrCompress 0xA37B +#define sysTrapScrDecompress 0xA37C + +// System Manager new traps +#define sysTrapSysLCDBrightness 0xA37D + +// WindowColor new traps +#define sysTrapWinPaintChar 0xA37E +#define sysTrapWinPaintChars 0xA37F +#define sysTrapWinPaintBitmap 0xA380 +#define sysTrapWinGetPixel 0xA381 +#define sysTrapWinPaintPixel 0xA382 +#define sysTrapWinDrawPixel 0xA383 +#define sysTrapWinErasePixel 0xA384 +#define sysTrapWinInvertPixel 0xA385 +#define sysTrapWinPaintPixels 0xA386 +#define sysTrapWinPaintLines 0xA387 +#define sysTrapWinPaintLine 0xA388 +#define sysTrapWinPaintRectangle 0xA389 +#define sysTrapWinPaintRectangleFrame 0xA38A +#define sysTrapWinPaintPolygon 0xA38B +#define sysTrapWinDrawPolygon 0xA38C +#define sysTrapWinErasePolygon 0xA38D +#define sysTrapWinInvertPolygon 0xA38E +#define sysTrapWinFillPolygon 0xA38F +#define sysTrapWinPaintArc 0xA390 +#define sysTrapWinDrawArc 0xA391 +#define sysTrapWinEraseArc 0xA392 +#define sysTrapWinInvertArc 0xA393 +#define sysTrapWinFillArc 0xA394 +#define sysTrapWinPushDrawState 0xA395 +#define sysTrapWinPopDrawState 0xA396 +#define sysTrapWinSetDrawMode 0xA397 +#define sysTrapWinSetForeColor 0xA398 +#define sysTrapWinSetBackColor 0xA399 +#define sysTrapWinSetTextColor 0xA39A +#define sysTrapWinGetPatternType 0xA39B +#define sysTrapWinSetPatternType 0xA39C +#define sysTrapWinPalette 0xA39D +#define sysTrapWinRGBToIndex 0xA39E +#define sysTrapWinIndexToRGB 0xA39F +#define sysTrapWinScreenLock 0xA3A0 +#define sysTrapWinScreenUnlock 0xA3A1 +#define sysTrapWinGetBitmap 0xA3A2 + +// UIColor new traps +#define sysTrapUIColorInit 0xA3A3 +#define sysTrapUIColorGetTableEntryIndex 0xA3A4 +#define sysTrapUIColorGetTableEntryRGB 0xA3A5 +#define sysTrapUIColorSetTableEntry 0xA3A6 +#define sysTrapUIColorPushTable 0xA3A7 +#define sysTrapUIColorPopTable 0xA3A8 + +// misc cleanup and API additions + +#define sysTrapCtlNewGraphicControl 0xA3A9 + +#define sysTrapTblGetItemPtr 0xA3AA + +#define sysTrapUIBrightnessAdjust 0xA3AB +#define sysTrapUIPickColor 0xA3AC + +#define sysTrapEvtSetAutoOffTimer 0xA3AD + +// Misc int'l/overlay support. +#define sysTrapTsmDispatch 0xA3AE +#define sysTrapOmDispatch 0xA3AF +#define sysTrapDmOpenDBNoOverlay 0xA3B0 +#define sysTrapDmOpenDBWithLocale 0xA3B1 +#define sysTrapResLoadConstant 0xA3B2 + +// new boot-time SmallROM HAL additions +#define sysTrapHwrPreDebugInit 0xA3B3 +#define sysTrapHwrResetNMI 0xA3B4 +#define sysTrapHwrResetPWM 0xA3B5 + +#define sysTrapKeyBootKeys 0xA3B6 + +#define sysTrapDbgSerDrvOpen 0xA3B7 +#define sysTrapDbgSerDrvClose 0xA3B8 +#define sysTrapDbgSerDrvControl 0xA3B9 +#define sysTrapDbgSerDrvStatus 0xA3BA +#define sysTrapDbgSerDrvWriteChar 0xA3BB +#define sysTrapDbgSerDrvReadChar 0xA3BC + +// new boot-time BigROM HAL additions +#define sysTrapHwrPostDebugInit 0xA3BD +#define sysTrapHwrIdentifyFeatures 0xA3BE +#define sysTrapHwrModelSpecificInit 0xA3BF +#define sysTrapHwrModelInitStage2 0xA3C0 +#define sysTrapHwrInterruptsInit 0xA3C1 + +#define sysTrapHwrSoundOn 0xA3C2 +#define sysTrapHwrSoundOff 0xA3C3 + +// Kernel clock tick routine +#define sysTrapSysKernelClockTick 0xA3C4 + +// MenuEraseMenu is exposed as of PalmOS 3.5, but there are +// no public interfaces for it yet. Perhaps in a later release. +#define sysTrapMenuEraseMenu 0xA3C5 + +#define sysTrapSelectTime 0xA3C6 + +// Menu Command Bar traps +#define sysTrapMenuCmdBarAddButton 0xA3C7 +#define sysTrapMenuCmdBarGetButtonData 0xA3C8 +#define sysTrapMenuCmdBarDisplay 0xA3C9 + +// Silkscreen info +#define sysTrapHwrGetSilkscreenID 0xA3CA +#define sysTrapEvtGetSilkscreenAreaList 0xA3CB + +#define sysTrapSysFatalAlertInit 0xA3CC +#define sysTrapDateTemplateToAscii 0xA3CD + +// New traps dealing with masking private records +#define sysTrapSecVerifyPW 0xA3CE +#define sysTrapSecSelectViewStatus 0xA3CF +#define sysTrapTblSetColumnMasked 0xA3D0 +#define sysTrapTblSetRowMasked 0xA3D1 +#define sysTrapTblRowMasked 0xA3D2 + +// New form trap for dialogs with text entry field +#define sysTrapFrmCustomResponseAlert 0xA3D3 +#define sysTrapFrmNewGsi 0xA3D4 + +// New dynamic menu functions +#define sysTrapMenuShowItem 0xA3D5 +#define sysTrapMenuHideItem 0xA3D6 +#define sysTrapMenuAddItem 0xA3D7 + +// New form traps for "smart gadgets" +#define sysTrapFrmSetGadgetHandler 0xA3D8 + +// More new control functions +#define sysTrapCtlSetGraphics 0xA3D9 +#define sysTrapCtlGetSliderValues 0xA3DA +#define sysTrapCtlSetSliderValues 0xA3DB +#define sysTrapCtlNewSliderControl 0xA3DC + +// Bitmap manager functions +#define sysTrapBmpCreate 0xA3DD +#define sysTrapBmpDelete 0xA3DE +#define sysTrapBmpCompress 0xA3DF +// sysTrapBmpGetBits defined in Screen driver traps +#define sysTrapBmpGetColortable 0xA3E0 +#define sysTrapBmpSize 0xA3E1 +#define sysTrapBmpBitsSize 0xA3E2 +#define sysTrapBmpColortableSize 0xA3E3 +// extra window namager +#define sysTrapWinCreateBitmapWindow 0xA3E4 +// Ask for a null event sooner (replaces a macro which Poser hated) +#define sysTrapEvtSetNullEventTick 0xA3E5 + +// Exchange manager call to allow apps to select destination categories +#define sysTrapExgDoDialog 0xA3E6 + +// this call will remove temporary UI like popup lists +#define sysTrapSysUICleanup 0xA3E7 + +// 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!!!!!!!!! +#define sysTrapLastTrapNumber 0xA3E8 + +#else + +typedef enum { + sysTrapMemInit = sysTrapBase, + sysTrapMemInitHeapTable, + sysTrapMemStoreInit, + sysTrapMemCardFormat, + sysTrapMemCardInfo, + sysTrapMemStoreInfo, + sysTrapMemStoreSetInfo, + sysTrapMemNumHeaps, + sysTrapMemNumRAMHeaps, + sysTrapMemHeapID, + sysTrapMemHeapPtr, + sysTrapMemHeapFreeBytes, + sysTrapMemHeapSize, + sysTrapMemHeapFlags, + sysTrapMemHeapCompact, + sysTrapMemHeapInit, + sysTrapMemHeapFreeByOwnerID, + sysTrapMemChunkNew, + sysTrapMemChunkFree, + sysTrapMemPtrNew, + sysTrapMemPtrRecoverHandle, + sysTrapMemPtrFlags, + sysTrapMemPtrSize, + sysTrapMemPtrOwner, + sysTrapMemPtrHeapID, + sysTrapMemPtrCardNo, + sysTrapMemPtrToLocalID, + sysTrapMemPtrSetOwner, + sysTrapMemPtrResize, + sysTrapMemPtrResetLock, + sysTrapMemHandleNew, + sysTrapMemHandleLockCount, + sysTrapMemHandleToLocalID, + sysTrapMemHandleLock, + sysTrapMemHandleUnlock, + sysTrapMemLocalIDToGlobal, + sysTrapMemLocalIDKind, + sysTrapMemLocalIDToPtr, + sysTrapMemMove, + sysTrapMemSet, + sysTrapMemStoreSearch, + sysTrapReserved6, // was sysTrapMemPtrDataStorage + sysTrapMemKernelInit, + sysTrapMemHandleFree, + sysTrapMemHandleFlags, + sysTrapMemHandleSize, + sysTrapMemHandleOwner, + sysTrapMemHandleHeapID, + sysTrapMemHandleDataStorage, + sysTrapMemHandleCardNo, + sysTrapMemHandleSetOwner, + sysTrapMemHandleResize, + sysTrapMemHandleResetLock, + sysTrapMemPtrUnlock, + sysTrapMemLocalIDToLockedPtr, + sysTrapMemSetDebugMode, + sysTrapMemHeapScramble, + sysTrapMemHeapCheck, + sysTrapMemNumCards, + sysTrapMemDebugMode, + sysTrapMemSemaphoreReserve, + sysTrapMemSemaphoreRelease, + sysTrapMemHeapDynamic, + sysTrapMemNVParams, + + + sysTrapDmInit, + sysTrapDmCreateDatabase, + sysTrapDmDeleteDatabase, + sysTrapDmNumDatabases, + sysTrapDmGetDatabase, + sysTrapDmFindDatabase, + sysTrapDmDatabaseInfo, + sysTrapDmSetDatabaseInfo, + sysTrapDmDatabaseSize, + sysTrapDmOpenDatabase, + sysTrapDmCloseDatabase, + sysTrapDmNextOpenDatabase, + sysTrapDmOpenDatabaseInfo, + sysTrapDmResetRecordStates, + sysTrapDmGetLastErr, + sysTrapDmNumRecords, + sysTrapDmRecordInfo, + sysTrapDmSetRecordInfo, + sysTrapDmAttachRecord, + sysTrapDmDetachRecord, + sysTrapDmMoveRecord, + sysTrapDmNewRecord, + sysTrapDmRemoveRecord, + sysTrapDmDeleteRecord, + sysTrapDmArchiveRecord, + sysTrapDmNewHandle, + sysTrapDmRemoveSecretRecords, + sysTrapDmQueryRecord, + sysTrapDmGetRecord, + sysTrapDmResizeRecord, + sysTrapDmReleaseRecord, + sysTrapDmGetResource, + sysTrapDmGet1Resource, + sysTrapDmReleaseResource, + sysTrapDmResizeResource, + sysTrapDmNextOpenResDatabase, + sysTrapDmFindResourceType, + sysTrapDmFindResource, + sysTrapDmSearchResource, + sysTrapDmNumResources, + sysTrapDmResourceInfo, + sysTrapDmSetResourceInfo, + sysTrapDmAttachResource, + sysTrapDmDetachResource, + sysTrapDmNewResource, + sysTrapDmRemoveResource, + sysTrapDmGetResourceIndex, + sysTrapDmQuickSort, + sysTrapDmQueryNextInCategory, + sysTrapDmNumRecordsInCategory, + sysTrapDmPositionInCategory, + sysTrapDmSeekRecordInCategory, + sysTrapDmMoveCategory, + sysTrapDmOpenDatabaseByTypeCreator, + sysTrapDmWrite, + sysTrapDmStrCopy, + sysTrapDmGetNextDatabaseByTypeCreator, + sysTrapDmWriteCheck, + sysTrapDmMoveOpenDBContext, + sysTrapDmFindRecordByID, + sysTrapDmGetAppInfoID, + sysTrapDmFindSortPositionV10, + sysTrapDmSet, + sysTrapDmCreateDatabaseFromImage, + + + sysTrapDbgSrcMessage, + sysTrapDbgMessage, + sysTrapDbgGetMessage, + sysTrapDbgCommSettings, + + sysTrapErrDisplayFileLineMsg, + sysTrapErrSetJump, + sysTrapErrLongJump, + sysTrapErrThrow, + sysTrapErrExceptionList, + + sysTrapSysBroadcastActionCode, + sysTrapSysUnimplemented, + sysTrapSysColdBoot, + sysTrapSysReset, + sysTrapSysDoze, + sysTrapSysAppLaunch, + sysTrapSysAppStartup, + sysTrapSysAppExit, + sysTrapSysSetA5, + sysTrapSysSetTrapAddress, + sysTrapSysGetTrapAddress, + sysTrapSysTranslateKernelErr, + sysTrapSysSemaphoreCreate, + sysTrapSysSemaphoreDelete, + sysTrapSysSemaphoreWait, + sysTrapSysSemaphoreSignal, + sysTrapSysTimerCreate, + sysTrapSysTimerWrite, + sysTrapSysTaskCreate, + sysTrapSysTaskDelete, + sysTrapSysTaskTrigger, + sysTrapSysTaskID, + sysTrapSysTaskUserInfoPtr, + sysTrapSysTaskDelay, + sysTrapSysTaskSetTermProc, + sysTrapSysUILaunch, + sysTrapSysNewOwnerID, + sysTrapSysSemaphoreSet, + sysTrapSysDisableInts, + sysTrapSysRestoreStatus, + sysTrapSysUIAppSwitch, + sysTrapSysCurAppInfoPV20, + sysTrapSysHandleEvent, + sysTrapSysInit, + sysTrapSysQSort, + sysTrapSysCurAppDatabase, + sysTrapSysFatalAlert, + sysTrapSysResSemaphoreCreate, + sysTrapSysResSemaphoreDelete, + sysTrapSysResSemaphoreReserve, + sysTrapSysResSemaphoreRelease, + sysTrapSysSleep, + sysTrapSysKeyboardDialogV10, + sysTrapSysAppLauncherDialog, + sysTrapSysSetPerformance, + sysTrapSysBatteryInfoV20, + sysTrapSysLibInstall, + sysTrapSysLibRemove, + sysTrapSysLibTblEntry, + sysTrapSysLibFind, + sysTrapSysBatteryDialog, + sysTrapSysCopyStringResource, + sysTrapSysKernelInfo, + sysTrapSysLaunchConsole, + sysTrapSysTimerDelete, + sysTrapSysSetAutoOffTime, + sysTrapSysFormPointerArrayToStrings, + sysTrapSysRandom, + sysTrapSysTaskSwitching, + sysTrapSysTimerRead, + + + sysTrapStrCopy, + sysTrapStrCat, + sysTrapStrLen, + sysTrapStrCompare, + sysTrapStrIToA, + sysTrapStrCaselessCompare, + sysTrapStrIToH, + sysTrapStrChr, + sysTrapStrStr, + sysTrapStrAToI, + sysTrapStrToLower, + + sysTrapSerReceiveISP, + + sysTrapSlkOpen, + sysTrapSlkClose, + sysTrapSlkOpenSocket, + sysTrapSlkCloseSocket, + sysTrapSlkSocketRefNum, + sysTrapSlkSocketSetTimeout, + sysTrapSlkFlushSocket, + sysTrapSlkSetSocketListener, + sysTrapSlkSendPacket, + sysTrapSlkReceivePacket, + sysTrapSlkSysPktDefaultResponse, + sysTrapSlkProcessRPC, + + + sysTrapConPutS, + sysTrapConGetS, + + sysTrapFplInit, // Obsolete, here for compatibilty only! + sysTrapFplFree, // Obsolete, here for compatibilty only! + sysTrapFplFToA, // Obsolete, here for compatibilty only! + sysTrapFplAToF, // Obsolete, here for compatibilty only! + sysTrapFplBase10Info, // Obsolete, here for compatibilty only! + sysTrapFplLongToFloat, // Obsolete, here for compatibilty only! + sysTrapFplFloatToLong, // Obsolete, here for compatibilty only! + sysTrapFplFloatToULong, // Obsolete, here for compatibilty only! + sysTrapFplMul, // Obsolete, here for compatibilty only! + sysTrapFplAdd, // Obsolete, here for compatibilty only! + sysTrapFplSub, // Obsolete, here for compatibilty only! + sysTrapFplDiv, // Obsolete, here for compatibilty only! + + sysTrapWinScreenInit, // was sysTrapScrInit + sysTrapScrCopyRectangle, + sysTrapScrDrawChars, + sysTrapScrLineRoutine, + sysTrapScrRectangleRoutine, + sysTrapScrScreenInfo, + sysTrapScrDrawNotify, + sysTrapScrSendUpdateArea, + sysTrapScrCompressScanLine, + sysTrapScrDeCompressScanLine, + + + sysTrapTimGetSeconds, + sysTrapTimSetSeconds, + sysTrapTimGetTicks, + sysTrapTimInit, + sysTrapTimSetAlarm, + sysTrapTimGetAlarm, + sysTrapTimHandleInterrupt, + sysTrapTimSecondsToDateTime, + sysTrapTimDateTimeToSeconds, + sysTrapTimAdjust, + sysTrapTimSleep, + sysTrapTimWake, + + sysTrapCategoryCreateListV10, + sysTrapCategoryFreeListV10, + sysTrapCategoryFind, + sysTrapCategoryGetName, + sysTrapCategoryEditV10, + sysTrapCategorySelectV10, + sysTrapCategoryGetNext, + sysTrapCategorySetTriggerLabel, + sysTrapCategoryTruncateName, + + sysTrapClipboardAddItem, + sysTrapClipboardCheckIfItemExist, + sysTrapClipboardGetItem, + + sysTrapCtlDrawControl, + sysTrapCtlEraseControl, + sysTrapCtlHideControl, + sysTrapCtlShowControl, + sysTrapCtlGetValue, + sysTrapCtlSetValue, + sysTrapCtlGetLabel, + sysTrapCtlSetLabel, + sysTrapCtlHandleEvent, + sysTrapCtlHitControl, + sysTrapCtlSetEnabled, + sysTrapCtlSetUsable, + sysTrapCtlEnabled, + + + sysTrapEvtInitialize, + sysTrapEvtAddEventToQueue, + sysTrapEvtCopyEvent, + sysTrapEvtGetEvent, + sysTrapEvtGetPen, + sysTrapEvtSysInit, + sysTrapEvtGetSysEvent, + sysTrapEvtProcessSoftKeyStroke, + sysTrapEvtGetPenBtnList, + sysTrapEvtSetPenQueuePtr, + sysTrapEvtPenQueueSize, + sysTrapEvtFlushPenQueue, + sysTrapEvtEnqueuePenPoint, + sysTrapEvtDequeuePenStrokeInfo, + sysTrapEvtDequeuePenPoint, + sysTrapEvtFlushNextPenStroke, + sysTrapEvtSetKeyQueuePtr, + sysTrapEvtKeyQueueSize, + sysTrapEvtFlushKeyQueue, + sysTrapEvtEnqueueKey, + sysTrapEvtDequeueKeyEvent, + sysTrapEvtWakeup, + sysTrapEvtResetAutoOffTimer, + sysTrapEvtKeyQueueEmpty, + sysTrapEvtEnableGraffiti, + + + sysTrapFldCopy, + sysTrapFldCut, + sysTrapFldDrawField, + sysTrapFldEraseField, + sysTrapFldFreeMemory, + sysTrapFldGetBounds, + sysTrapFldGetTextPtr, + sysTrapFldGetSelection, + sysTrapFldHandleEvent, + sysTrapFldPaste, + sysTrapFldRecalculateField, + sysTrapFldSetBounds, + sysTrapFldSetText, + sysTrapFldGetFont, + sysTrapFldSetFont, + sysTrapFldSetSelection, + sysTrapFldGrabFocus, + sysTrapFldReleaseFocus, + sysTrapFldGetInsPtPosition, + sysTrapFldSetInsPtPosition, + sysTrapFldSetScrollPosition, + sysTrapFldGetScrollPosition, + sysTrapFldGetTextHeight, + sysTrapFldGetTextAllocatedSize, + sysTrapFldGetTextLength, + sysTrapFldScrollField, + sysTrapFldScrollable, + sysTrapFldGetVisibleLines, + sysTrapFldGetAttributes, + sysTrapFldSetAttributes, + sysTrapFldSendChangeNotification, + sysTrapFldCalcFieldHeight, + sysTrapFldGetTextHandle, + sysTrapFldCompactText, + sysTrapFldDirty, + sysTrapFldWordWrap, + sysTrapFldSetTextAllocatedSize, + sysTrapFldSetTextHandle, + sysTrapFldSetTextPtr, + sysTrapFldGetMaxChars, + sysTrapFldSetMaxChars, + sysTrapFldSetUsable, + sysTrapFldInsert, + sysTrapFldDelete, + sysTrapFldUndo, + sysTrapFldSetDirty, + sysTrapFldSendHeightChangeNotification, + sysTrapFldMakeFullyVisible, + + + sysTrapFntGetFont, + sysTrapFntSetFont, + sysTrapFntGetFontPtr, + sysTrapFntBaseLine, + sysTrapFntCharHeight, + sysTrapFntLineHeight, + sysTrapFntAverageCharWidth, + sysTrapFntCharWidth, + sysTrapFntCharsWidth, + sysTrapFntDescenderHeight, + sysTrapFntCharsInWidth, + sysTrapFntLineWidth, + + + sysTrapFrmInitForm, + sysTrapFrmDeleteForm, + sysTrapFrmDrawForm, + sysTrapFrmEraseForm, + sysTrapFrmGetActiveForm, + sysTrapFrmSetActiveForm, + sysTrapFrmGetActiveFormID, + sysTrapFrmGetUserModifiedState, + sysTrapFrmSetNotUserModified, + sysTrapFrmGetFocus, + sysTrapFrmSetFocus, + sysTrapFrmHandleEvent, + sysTrapFrmGetFormBounds, + sysTrapFrmGetWindowHandle, + sysTrapFrmGetFormId, + sysTrapFrmGetFormPtr, + sysTrapFrmGetNumberOfObjects, + sysTrapFrmGetObjectIndex, + sysTrapFrmGetObjectId, + sysTrapFrmGetObjectType, + sysTrapFrmGetObjectPtr, + sysTrapFrmHideObject, + sysTrapFrmShowObject, + sysTrapFrmGetObjectPosition, + sysTrapFrmSetObjectPosition, + sysTrapFrmGetControlValue, + sysTrapFrmSetControlValue, + sysTrapFrmGetControlGroupSelection, + sysTrapFrmSetControlGroupSelection, + sysTrapFrmCopyLabel, + sysTrapFrmSetLabel, + sysTrapFrmGetLabel, + sysTrapFrmSetCategoryLabel, + sysTrapFrmGetTitle, + sysTrapFrmSetTitle, + sysTrapFrmAlert, + sysTrapFrmDoDialog, + sysTrapFrmCustomAlert, + sysTrapFrmHelp, + sysTrapFrmUpdateScrollers, + sysTrapFrmGetFirstForm, + sysTrapFrmVisible, + sysTrapFrmGetObjectBounds, + sysTrapFrmCopyTitle, + sysTrapFrmGotoForm, + sysTrapFrmPopupForm, + sysTrapFrmUpdateForm, + sysTrapFrmReturnToForm, + sysTrapFrmSetEventHandler, + sysTrapFrmDispatchEvent, + sysTrapFrmCloseAllForms, + sysTrapFrmSaveAllForms, + sysTrapFrmGetGadgetData, + sysTrapFrmSetGadgetData, + sysTrapFrmSetCategoryTrigger, + + + sysTrapUIInitialize, + sysTrapUIReset, + + sysTrapInsPtInitialize, + sysTrapInsPtSetLocation, + sysTrapInsPtGetLocation, + sysTrapInsPtEnable, + sysTrapInsPtEnabled, + sysTrapInsPtSetHeight, + sysTrapInsPtGetHeight, + sysTrapInsPtCheckBlink, + + sysTrapLstSetDrawFunction, + sysTrapLstDrawList, + sysTrapLstEraseList, + sysTrapLstGetSelection, + sysTrapLstGetSelectionText, + sysTrapLstHandleEvent, + sysTrapLstSetHeight, + sysTrapLstSetSelection, + sysTrapLstSetListChoices, + sysTrapLstMakeItemVisible, + sysTrapLstGetNumberOfItems, + sysTrapLstPopupList, + sysTrapLstSetPosition, + + sysTrapMenuInit, + sysTrapMenuDispose, + sysTrapMenuHandleEvent, + sysTrapMenuDrawMenu, + sysTrapMenuEraseStatus, + sysTrapMenuGetActiveMenu, + sysTrapMenuSetActiveMenu, + + + sysTrapRctSetRectangle, + sysTrapRctCopyRectangle, + sysTrapRctInsetRectangle, + sysTrapRctOffsetRectangle, + sysTrapRctPtInRectangle, + sysTrapRctGetIntersection, + + + sysTrapTblDrawTable, + sysTrapTblEraseTable, + sysTrapTblHandleEvent, + sysTrapTblGetItemBounds, + sysTrapTblSelectItem, + sysTrapTblGetItemInt, + sysTrapTblSetItemInt, + sysTrapTblSetItemStyle, + sysTrapTblUnhighlightSelection, + sysTrapTblSetRowUsable, + sysTrapTblGetNumberOfRows, + sysTrapTblSetCustomDrawProcedure, + sysTrapTblSetRowSelectable, + sysTrapTblRowSelectable, + sysTrapTblSetLoadDataProcedure, + sysTrapTblSetSaveDataProcedure, + sysTrapTblGetBounds, + sysTrapTblSetRowHeight, + sysTrapTblGetColumnWidth, + sysTrapTblGetRowID, + sysTrapTblSetRowID, + sysTrapTblMarkRowInvalid, + sysTrapTblMarkTableInvalid, + sysTrapTblGetSelection, + sysTrapTblInsertRow, + sysTrapTblRemoveRow, + sysTrapTblRowInvalid, + sysTrapTblRedrawTable, + sysTrapTblRowUsable, + sysTrapTblReleaseFocus, + sysTrapTblEditing, + sysTrapTblGetCurrentField, + sysTrapTblSetColumnUsable, + sysTrapTblGetRowHeight, + sysTrapTblSetColumnWidth, + sysTrapTblGrabFocus, + sysTrapTblSetItemPtr, + sysTrapTblFindRowID, + sysTrapTblGetLastUsableRow, + sysTrapTblGetColumnSpacing, + sysTrapTblFindRowData, + sysTrapTblGetRowData, + sysTrapTblSetRowData, + sysTrapTblSetColumnSpacing, + + + + sysTrapWinCreateWindow, + sysTrapWinCreateOffscreenWindow, + sysTrapWinDeleteWindow, + sysTrapWinInitializeWindow, + sysTrapWinAddWindow, + sysTrapWinRemoveWindow, + sysTrapWinSetActiveWindow, + sysTrapWinSetDrawWindow, + sysTrapWinGetDrawWindow, + sysTrapWinGetActiveWindow, + sysTrapWinGetDisplayWindow, + sysTrapWinGetFirstWindow, + sysTrapWinEnableWindow, + sysTrapWinDisableWindow, + sysTrapWinGetWindowFrameRect, + sysTrapWinDrawWindowFrame, + sysTrapWinEraseWindow, + sysTrapWinSaveBits, + sysTrapWinRestoreBits, + sysTrapWinCopyRectangle, + sysTrapWinScrollRectangle, + sysTrapWinGetDisplayExtent, + sysTrapWinGetWindowExtent, + sysTrapWinDisplayToWindowPt, + sysTrapWinWindowToDisplayPt, + sysTrapWinGetClip, + sysTrapWinSetClip, + sysTrapWinResetClip, + sysTrapWinClipRectangle, + sysTrapWinDrawLine, + sysTrapWinDrawGrayLine, + sysTrapWinEraseLine, + sysTrapWinInvertLine, + sysTrapWinFillLine, + sysTrapWinDrawRectangle, + sysTrapWinEraseRectangle, + sysTrapWinInvertRectangle, + sysTrapWinDrawRectangleFrame, + sysTrapWinDrawGrayRectangleFrame, + sysTrapWinEraseRectangleFrame, + sysTrapWinInvertRectangleFrame, + sysTrapWinGetFramesRectangle, + sysTrapWinDrawChars, + sysTrapWinEraseChars, + sysTrapWinInvertChars, + sysTrapWinGetPattern, + sysTrapWinSetPattern, + sysTrapWinSetUnderlineMode, + sysTrapWinDrawBitmap, + sysTrapWinModal, + sysTrapWinGetWindowBounds, + sysTrapWinFillRectangle, + sysTrapWinDrawInvertedChars, + + + + sysTrapPrefOpenPreferenceDBV10, + sysTrapPrefGetPreferences, + sysTrapPrefSetPreferences, + sysTrapPrefGetAppPreferencesV10, + sysTrapPrefSetAppPreferencesV10, + + + sysTrapSndInit, + sysTrapSndSetDefaultVolume, + sysTrapSndGetDefaultVolume, + sysTrapSndDoCmd, + sysTrapSndPlaySystemSound, + + + sysTrapAlmInit, + sysTrapAlmCancelAll, + sysTrapAlmAlarmCallback, + sysTrapAlmSetAlarm, + sysTrapAlmGetAlarm, + sysTrapAlmDisplayAlarm, + sysTrapAlmEnableNotification, + + + sysTrapHwrGetRAMMapping, + sysTrapHwrMemWritable, + sysTrapHwrMemReadable, + sysTrapHwrDoze, + sysTrapHwrSleep, + sysTrapHwrWake, + sysTrapHwrSetSystemClock, + sysTrapHwrSetCPUDutyCycle, + sysTrapHwrDisplayInit, // Before OS 3.5, this trap a.k.a. sysTrapHwrLCDInit + sysTrapHwrDisplaySleep, // Before OS 3.5, this trap a.k.a. sysTrapHwrLCDSleep, + sysTrapHwrTimerInit, + sysTrapHwrCursorV33, // This trap obsoleted for OS 3.5 and later + sysTrapHwrBatteryLevel, + sysTrapHwrDelay, + sysTrapHwrEnableDataWrites, + sysTrapHwrDisableDataWrites, + sysTrapHwrLCDBaseAddrV33, // This trap obsoleted for OS 3.5 and later + sysTrapHwrDisplayDrawBootScreen, // Before OS 3.5, this trap a.k.a. sysTrapHwrLCDDrawBitmap + sysTrapHwrTimerSleep, + sysTrapHwrTimerWake, + sysTrapHwrDisplayWake, // Before OS 3.5, this trap a.k.a. sysTrapHwrLCDWake + sysTrapHwrIRQ1Handler, + sysTrapHwrIRQ2Handler, + sysTrapHwrIRQ3Handler, + sysTrapHwrIRQ4Handler, + sysTrapHwrIRQ5Handler, + sysTrapHwrIRQ6Handler, + sysTrapHwrDockSignals, + sysTrapHwrPluggedIn, + + + sysTrapCrc16CalcBlock, + + + sysTrapSelectDayV10, + sysTrapSelectTimeV33, + + sysTrapDayDrawDaySelector, + sysTrapDayHandleEvent, + sysTrapDayDrawDays, + sysTrapDayOfWeek, + sysTrapDaysInMonth, + sysTrapDayOfMonth, + + sysTrapDateDaysToDate, + sysTrapDateToDays, + sysTrapDateAdjust, + sysTrapDateSecondsToDate, + sysTrapDateToAscii, + sysTrapDateToDOWDMFormat, + sysTrapTimeToAscii, + + + sysTrapFind, + sysTrapFindStrInStr, + sysTrapFindSaveMatch, + sysTrapFindGetLineBounds, + sysTrapFindDrawHeader, + + sysTrapPenOpen, + sysTrapPenClose, + sysTrapPenGetRawPen, + sysTrapPenCalibrate, + sysTrapPenRawToScreen, + sysTrapPenScreenToRaw, + sysTrapPenResetCalibration, + sysTrapPenSleep, + sysTrapPenWake, + + + sysTrapResLoadForm, + sysTrapResLoadMenu, + + sysTrapFtrInit, + sysTrapFtrUnregister, + sysTrapFtrGet, + sysTrapFtrSet, + sysTrapFtrGetByIndex, + + + + sysTrapGrfInit, + sysTrapGrfFree, + sysTrapGrfGetState, + sysTrapGrfSetState, + sysTrapGrfFlushPoints, + sysTrapGrfAddPoint, + sysTrapGrfInitState, + sysTrapGrfCleanState, + sysTrapGrfMatch, + sysTrapGrfGetMacro, + sysTrapGrfFilterPoints, + sysTrapGrfGetNumPoints, + sysTrapGrfGetPoint, + sysTrapGrfFindBranch, + sysTrapGrfMatchGlyph, + sysTrapGrfGetGlyphMapping, + sysTrapGrfGetMacroName, + sysTrapGrfDeleteMacro, + sysTrapGrfAddMacro, + sysTrapGrfGetAndExpandMacro, + sysTrapGrfProcessStroke, + sysTrapGrfFieldChange, + + + sysTrapGetCharSortValue, + sysTrapGetCharAttr, + sysTrapGetCharCaselessValue, + + + sysTrapPwdExists, + sysTrapPwdVerify, + sysTrapPwdSet, + sysTrapPwdRemove, + + sysTrapGsiInitialize, + sysTrapGsiSetLocation, + sysTrapGsiEnable, + sysTrapGsiEnabled, + sysTrapGsiSetShiftState, + + sysTrapKeyInit, + sysTrapKeyHandleInterrupt, + sysTrapKeyCurrentState, + sysTrapKeyResetDoubleTap, + sysTrapKeyRates, + sysTrapKeySleep, + sysTrapKeyWake, + + + sysTrapDlkControl, // was sysTrapCmBroadcast + + sysTrapDlkStartServer, + sysTrapDlkGetSyncInfo, + sysTrapDlkSetLogEntry, + + sysTrapIntlDispatch, // REUSED IN v3.1 (was sysTrapPsrInit in 1.0, removed in 2.0) + sysTrapSysLibLoad, // REUSED IN v2.0 (was sysTrapPsrClose) + sysTrapSndPlaySmf, // REUSED IN v3.0 (was sysTrapPsrGetCommand in 1.0, removed in 2.0) + sysTrapSndCreateMidiList, // REUSED IN v3.0 (was sysTrapPsrSendReply in 1.0, removed in 2.0) + + sysTrapAbtShowAbout, + + sysTrapMdmDial, + sysTrapMdmHangUp, + + sysTrapDmSearchRecord, + + sysTrapSysInsertionSort, + sysTrapDmInsertionSort, + + sysTrapLstSetTopItem, + + + // Palm OS 2.X traps Palm Pilot and 2.0 Upgrade Card + + sysTrapSclSetScrollBar, + sysTrapSclDrawScrollBar, + sysTrapSclHandleEvent, + + sysTrapSysMailboxCreate, + sysTrapSysMailboxDelete, + sysTrapSysMailboxFlush, + sysTrapSysMailboxSend, + sysTrapSysMailboxWait, + + sysTrapSysTaskWait, + sysTrapSysTaskWake, + sysTrapSysTaskWaitClr, + sysTrapSysTaskSuspend, + sysTrapSysTaskResume, + + sysTrapCategoryCreateList, + sysTrapCategoryFreeList, + sysTrapCategoryEditV20, + sysTrapCategorySelect, + + sysTrapDmDeleteCategory, + + sysTrapSysEvGroupCreate, + sysTrapSysEvGroupSignal, + sysTrapSysEvGroupRead, + sysTrapSysEvGroupWait, + + sysTrapEvtEventAvail, + sysTrapEvtSysEventAvail, + sysTrapStrNCopy, + + sysTrapKeySetMask, + + sysTrapSelectDay, + + sysTrapPrefGetPreference, + sysTrapPrefSetPreference, + sysTrapPrefGetAppPreferences, + sysTrapPrefSetAppPreferences, + + sysTrapFrmPointInTitle, + + sysTrapStrNCat, + + sysTrapMemCmp, + + sysTrapTblSetColumnEditIndicator, + + sysTrapFntWordWrap, + + sysTrapFldGetScrollValues, + + sysTrapSysCreateDataBaseList, + sysTrapSysCreatePanelList, + + sysTrapDlkDispatchRequest, + + sysTrapStrPrintF, + sysTrapStrVPrintF, + + sysTrapPrefOpenPreferenceDB, + + sysTrapSysGraffitiReferenceDialog, + + sysTrapSysKeyboardDialog, + + sysTrapFntWordWrapReverseNLines, + sysTrapFntGetScrollValues, + + sysTrapTblSetRowStaticHeight, + sysTrapTblHasScrollBar, + + sysTrapSclGetScrollBar, + + sysTrapFldGetNumberOfBlankLines, + + sysTrapSysTicksPerSecond, + sysTrapHwrBacklightV33, // This trap obsoleted for OS 3.5 and later + sysTrapDmDatabaseProtect, + + sysTrapTblSetBounds, + + sysTrapStrNCompare, + sysTrapStrNCaselessCompare, + + sysTrapPhoneNumberLookup, + + sysTrapFrmSetMenu, + + sysTrapEncDigestMD5, + + sysTrapDmFindSortPosition, + + sysTrapSysBinarySearch, + sysTrapSysErrString, + sysTrapSysStringByIndex, + + sysTrapEvtAddUniqueEventToQueue, + + sysTrapStrLocalizeNumber, + sysTrapStrDelocalizeNumber, + sysTrapLocGetNumberSeparators, + + sysTrapMenuSetActiveMenuRscID, + + sysTrapLstScrollList, + + sysTrapCategoryInitialize, + + sysTrapEncDigestMD4, + sysTrapEncDES, + + sysTrapLstGetVisibleItems, + + sysTrapWinSetWindowBounds, + + sysTrapCategorySetName, + + sysTrapFldSetInsertionPoint, + + sysTrapFrmSetObjectBounds, + + sysTrapWinSetColors, + + sysTrapFlpDispatch, + sysTrapFlpEmDispatch, + + + // Palm OS 3.0 traps Palm III and 3.0 Upgrade Card + + sysTrapExgInit, + sysTrapExgConnect, + sysTrapExgPut, + sysTrapExgGet, + sysTrapExgAccept, + sysTrapExgDisconnect, + sysTrapExgSend, + sysTrapExgReceive, + sysTrapExgRegisterData, + sysTrapExgNotifyReceive, + sysTrapExgControl, + + sysTrapPrgStartDialogV31, // Updated in v3.2 + sysTrapPrgStopDialog, + sysTrapPrgUpdateDialog, + sysTrapPrgHandleEvent, + + sysTrapImcReadFieldNoSemicolon, + sysTrapImcReadFieldQuotablePrintable, + sysTrapImcReadPropertyParameter, + sysTrapImcSkipAllPropertyParameters, + sysTrapImcReadWhiteSpace, + sysTrapImcWriteQuotedPrintable, + sysTrapImcWriteNoSemicolon, + sysTrapImcStringIsAscii, + + sysTrapTblGetItemFont, + sysTrapTblSetItemFont, + + sysTrapFontSelect, + sysTrapFntDefineFont, + + sysTrapCategoryEdit, + + sysTrapSysGetOSVersionString, + sysTrapSysBatteryInfo, + sysTrapSysUIBusy, + + sysTrapWinValidateHandle, + sysTrapFrmValidatePtr, + sysTrapCtlValidatePointer, + sysTrapWinMoveWindowAddr, + sysTrapFrmAddSpaceForObject, + sysTrapFrmNewForm, + sysTrapCtlNewControl, + sysTrapFldNewField, + sysTrapLstNewList, + sysTrapFrmNewLabel, + sysTrapFrmNewBitmap, + sysTrapFrmNewGadget, + + sysTrapFileOpen, + sysTrapFileClose, + sysTrapFileDelete, + sysTrapFileReadLow, + sysTrapFileWrite, + sysTrapFileSeek, + sysTrapFileTell, + sysTrapFileTruncate, + sysTrapFileControl, + + sysTrapFrmActiveState, + + sysTrapSysGetAppInfo, + sysTrapSysGetStackInfo, + + sysTrapWinScreenMode, // was sysTrapScrDisplayMode + sysTrapHwrLCDGetDepthV33, // This trap obsoleted for OS 3.5 and later + sysTrapHwrGetROMToken, + + sysTrapDbgControl, + + sysTrapExgDBRead, + sysTrapExgDBWrite, + + sysTrapHostControl, // Renamed from sysTrapSysGremlins, functionality generalized + sysTrapFrmRemoveObject, + + sysTrapSysReserved1, // "Reserved" trap in Palm OS 3.0 and later trap table + sysTrapSysReserved2, // "Reserved" trap in Palm OS 3.0 and later trap table + sysTrapSysReserved3, // "Reserved" trap in Palm OS 3.0 and later trap table + + sysTrapOEMDispatch, // OEM trap in Palm OS 3.0 and later trap table (formerly sysTrapSysReserved4) + + + // Palm OS 3.1 traps Palm IIIx and Palm V + + sysTrapHwrLCDContrastV33, // This trap obsoleted for OS 3.5 and later + sysTrapSysLCDContrast, + sysTrapUIContrastAdjust, // Renamed from sysTrapContrastAdjust + sysTrapHwrDockStatus, + + sysTrapFntWidthToOffset, + sysTrapSelectOneTime, + sysTrapWinDrawChar, + sysTrapWinDrawTruncChars, + + sysTrapSysNotifyInit, // Notification Manager traps + sysTrapSysNotifyRegister, + sysTrapSysNotifyUnregister, + sysTrapSysNotifyBroadcast, + sysTrapSysNotifyBroadcastDeferred, + sysTrapSysNotifyDatabaseAdded, + sysTrapSysNotifyDatabaseRemoved, + + sysTrapSysWantEvent, + + sysTrapFtrPtrNew, + sysTrapFtrPtrFree, + sysTrapFtrPtrResize, + + sysTrapSysReserved5, // "Reserved" trap in Palm OS 3.1 and later trap table + + + // Palm OS 3.2 & 3.3 traps Palm VII (3.2) and Fall '99 Palm OS Flash Update (3.3) + + sysTrapHwrNVPrefSet, // mapped to FlashParmsWrite + sysTrapHwrNVPrefGet, // mapped to FlashParmsRead + sysTrapFlashInit, + sysTrapFlashCompress, + sysTrapFlashErase, + sysTrapFlashProgram, + + sysTrapAlmTimeChange, + sysTrapErrAlertCustom, + sysTrapPrgStartDialog, // New version of sysTrapPrgStartDialogV31 + + sysTrapSerialDispatch, + sysTrapHwrBattery, + sysTrapDmGetDatabaseLockState, + + sysTrapCncGetProfileList, + sysTrapCncGetProfileInfo, + sysTrapCncAddProfile, + sysTrapCncDeleteProfile, + + sysTrapSndPlaySmfResource, + + sysTrapMemPtrDataStorage, // Never actually installed until now. + + sysTrapClipboardAppendItem, + + sysTrapWiCmdV32, // Code moved to INetLib; trap obsolete + + // 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!! These are new traps for 3.5. If this file is merged + // with MAIN sources, new traps that are added for products that precede + // 3.5 MUST insert their traps BEFORE this section. + + // HAL Display-layer new traps + sysTrapHwrDisplayAttributes, + sysTrapHwrDisplayDoze, + sysTrapHwrDisplayPalette, + + //Screen driver new traps + sysTrapBltFindIndexes, + sysTrapBmpGetBits, // was BltGetBitsAddr + sysTrapBltCopyRectangle, + sysTrapBltDrawChars, + sysTrapBltLineRoutine, + sysTrapBltRectangleRoutine, + + // ScrUtils new traps + sysTrapScrCompress, + sysTrapScrDecompress, + + // System Manager new traps + sysTrapSysLCDBrightness, + + // WindowColor new traps + sysTrapWinPaintChar, + sysTrapWinPaintChars, + sysTrapWinPaintBitmap, + sysTrapWinGetPixel, + sysTrapWinPaintPixel, + sysTrapWinDrawPixel, + sysTrapWinErasePixel, + sysTrapWinInvertPixel, + sysTrapWinPaintPixels, + sysTrapWinPaintLines, + sysTrapWinPaintLine, + sysTrapWinPaintRectangle, + sysTrapWinPaintRectangleFrame, + sysTrapWinPaintPolygon, + sysTrapWinDrawPolygon, + sysTrapWinErasePolygon, + sysTrapWinInvertPolygon, + sysTrapWinFillPolygon, + sysTrapWinPaintArc, + sysTrapWinDrawArc, + sysTrapWinEraseArc, + sysTrapWinInvertArc, + sysTrapWinFillArc, + sysTrapWinPushDrawState, + sysTrapWinPopDrawState, + sysTrapWinSetDrawMode, + sysTrapWinSetForeColor, + sysTrapWinSetBackColor, + sysTrapWinSetTextColor, + sysTrapWinGetPatternType, + sysTrapWinSetPatternType, + sysTrapWinPalette, + sysTrapWinRGBToIndex, + sysTrapWinIndexToRGB, + sysTrapWinScreenLock, + sysTrapWinScreenUnlock, + sysTrapWinGetBitmap, + + // UIColor new traps + sysTrapUIColorInit, + sysTrapUIColorGetTableEntryIndex, + sysTrapUIColorGetTableEntryRGB, + sysTrapUIColorSetTableEntry, + sysTrapUIColorPushTable, + sysTrapUIColorPopTable, + + // misc cleanup and API additions + + sysTrapCtlNewGraphicControl, + + sysTrapTblGetItemPtr, + + sysTrapUIBrightnessAdjust, + sysTrapUIPickColor, + + sysTrapEvtSetAutoOffTimer, + + // Misc int'l/overlay support. + sysTrapTsmDispatch, + sysTrapOmDispatch, + sysTrapDmOpenDBNoOverlay, + sysTrapDmOpenDBWithLocale, + sysTrapResLoadConstant, + + // new boot-time SmallROM HAL additions + sysTrapHwrPreDebugInit, + sysTrapHwrResetNMI, + sysTrapHwrResetPWM, + + sysTrapKeyBootKeys, + + sysTrapDbgSerDrvOpen, + sysTrapDbgSerDrvClose, + sysTrapDbgSerDrvControl, + sysTrapDbgSerDrvStatus, + sysTrapDbgSerDrvWriteChar, + sysTrapDbgSerDrvReadChar, + + // new boot-time BigROM HAL additions + sysTrapHwrPostDebugInit, + sysTrapHwrIdentifyFeatures, + sysTrapHwrModelSpecificInit, + sysTrapHwrModelInitStage2, + sysTrapHwrInterruptsInit, + + sysTrapHwrSoundOn, + sysTrapHwrSoundOff, + + // Kernel clock tick routine + sysTrapSysKernelClockTick, + + // MenuEraseMenu is exposed as of PalmOS 3.5, but there are + // no public interfaces for it yet. Perhaps in a later release. + sysTrapMenuEraseMenu, + + sysTrapSelectTime, + + // Menu Command Bar traps + sysTrapMenuCmdBarAddButton, + sysTrapMenuCmdBarGetButtonData, + sysTrapMenuCmdBarDisplay, + + // Silkscreen info + sysTrapHwrGetSilkscreenID, + sysTrapEvtGetSilkscreenAreaList, + + sysTrapSysFatalAlertInit, + sysTrapDateTemplateToAscii, + + // New traps dealing with masking private records + sysTrapSecVerifyPW, + sysTrapSecSelectViewStatus, + sysTrapTblSetColumnMasked, + sysTrapTblSetRowMasked, + sysTrapTblRowMasked, + + // New form trap for dialogs with text entry field + sysTrapFrmCustomResponseAlert, + sysTrapFrmNewGsi, + + // New dynamic menu functions + sysTrapMenuShowItem, + sysTrapMenuHideItem, + sysTrapMenuAddItem, + + // New form traps for "smart gadgets" + sysTrapFrmSetGadgetHandler, + + // More new control functions + sysTrapCtlSetGraphics, + sysTrapCtlGetSliderValues, + sysTrapCtlSetSliderValues, + sysTrapCtlNewSliderControl, + + // Bitmap manager functions + sysTrapBmpCreate, + sysTrapBmpDelete, + sysTrapBmpCompress, + // sysTrapBmpGetBits defined in Screen driver traps + sysTrapBmpGetColortable, + sysTrapBmpSize, + sysTrapBmpBitsSize, + sysTrapBmpColortableSize, + // extra window namager + sysTrapWinCreateBitmapWindow, + // Ask for a null event sooner (replaces a macro which Poser hated) + sysTrapEvtSetNullEventTick, + + // Exchange manager call to allow apps to select destination categories + sysTrapExgDoDialog, + + // this call will remove temporary UI like popup lists + sysTrapSysUICleanup, + + // WARNING!! LEAVE THIS AT THE END AND ALWAYS ADD NEW TRAPS TO + // THE END OF THE TRAP TABLE BUT RIGHT BEFORE THIS TRAP!!!!!!!!! + sysTrapLastTrapNumber + } SysTrapNumber; + +#endif + +#define sysNumTraps (sysTrapLastTrapNumber - sysTrapBase) + + + +#endif //__CORETRAPS_H_ + diff --git a/sdk-3.5/include/Core/Hardware/HAL.h b/sdk-3.5/include/Core/Hardware/HAL.h new file mode 100644 index 0000000..58f06d2 --- /dev/null +++ b/sdk-3.5/include/Core/Hardware/HAL.h @@ -0,0 +1,95 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: HAL.h + * + * 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 + * + *****************************************************************************/ + + +// #ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HAL_H__ +#define __HAL_H__ + +#include + + +/************************************************************************** + * HAL routine selectors + ***************************************************************************/ +/* +#define halBootBase 0 + +typedef enum { + halBootHwrPreDebugInit = halBootBase, // 0 + halBootHwrInit, // 1 + halBootHwrModelSpecificInit, // 2 + halBootHwrEnableDataWrites, // 3 + halBootHwrDisableDataWrites, // 4 + halBootHwrMemReadable, // 5 + halBootHwrMemWritable, // 6 + halBootHwrResetNMI, // 7 + halBootHwrResetPWM, // 8 + + halBootKeyBootKeys, // 9 + + halBootHwrDisplayCursor, // 10 + + halBootDrvOpen, // 11 + halBootDrvClose, // 12 + halBootDrvControl, // 13 + halBootDrvStatus, // 14 + halBootDrvWriteChar, // 15 + halBootDrvReadChar, // 16 + + halBootLastSelector + } halBootSelector; +*/ + +/************************************************************ + * New HAL function prototypes + *************************************************************/ + +#if DISABLE_HAL_TRAPS + #define HAL_CALL(trapNum) +#else + #define HAL_CALL(trapNum) \ + _HAL_API(_CALL)(_HAL_TABLE, trapNum) +#endif + +// HwrInit is passed as a parameter to InitStage1 in RomBoot.c +typedef void (*HwrInitProcPtr)(void); + + +/************************************************************************** + * Prototypes of functions used only when running on the real hardware + ***************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + // These routines are "private" prototypes for the HAL code... + + void HwrPreRAMInit(void); + + void HwrInit(void); + + +#ifdef __cplusplus +} +#endif + + +#endif //__HAL_H__ + +// #endif // NON_PORTABLE + diff --git a/sdk-3.5/include/Core/Hardware/HwrMiscFlags.h b/sdk-3.5/include/Core/Hardware/HwrMiscFlags.h new file mode 100644 index 0000000..58bea1c --- /dev/null +++ b/sdk-3.5/include/Core/Hardware/HwrMiscFlags.h @@ -0,0 +1,205 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: HwrMiscFlags.h + * + * Description: + * Bit constants for the hardware MiscFlags + * + * History: + * 10/26/99 JED Created by Jesse Donaldson, extracted from + * + *****************************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HWR_MISCFLAGS_H__ +#define __HWR_MISCFLAGS_H__ + + + +/************************************************************************** + * 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 . +// 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) +#define hwrMiscFlagHasBacklight 0x0001 // set if backlight is present +#define hwrMiscFlagHasMbdIrDA 0x0002 // set if IrDA is present (on main board) +#define hwrMiscFlagHasCardIrDA 0x0004 // set if IrDA is present (on memory card) +#define hwrMiscFlagHasBurrBrown 0x0008 // set if BurrBrown A/D is present +#define hwrMiscFlagHasJerryHW 0x0010 // set if Jerry Hardware is present +#define hwrMiscFlagNoRTCBug 0x0020 // set if using rev of DragonBall (3G or later) + // that doesn't require the RealTimeClock + // bug work-around (see TimeMgr68328.c). + // +#define hwrMiscFlagHas3vRef 0x0040 // set if switchable 3v reference is present +#define hwrMiscFlagHasAntennaSw 0x0080 // set if viewer has an antenna raised switch +#define hwrMiscFlagHasCradleDetect 0x0100 // set if we have an A/D converter on hotsync port used for ID'ing the attached device +#define hwrMiscFlagHasSWContrast 0x0200 // set if UI should support software contrast +#define hwrMiscFlagInvertLCDForBL 0x0400 // set if we need to invert LCD w/Backlight +#define hwrMiscFlagHasMiscFlagExt 0x0800 // 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... +#define hwrMiscFlagID1 0x1000 // set if ID bit keyBitHard1 was set +#define hwrMiscFlagID2 0x2000 // set if ID bit keyBitHard2 was set +#define hwrMiscFlagID3 0x4000 // set if ID bit keyBitHard3 was set +#define hwrMiscFlagID4 0x8000 // set if ID bit keyBitHard4 was set +#define hwrMiscFlagIDMask 0xF000 +#define 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 + + +// 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 for details. +// This ID is also reported when booting on PalmPilot devices (aka 2.0 hardware). +#define hwrMiscFlagIDCheckROMToken (0) // used to be hwrMiscFlagIDOther +#define 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). +#define 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. +#define hwrMiscFlagIDCheckOEMFtrs (hwrMiscFlagID2) // used to be hwrMiscFlagIDUnused2 + +// Old-style Hardware IDs for DragonBall '328 based products +#define hwrMiscFlagIDThumper (hwrMiscFlagID4 | hwrMiscFlagID2) +#define hwrMiscFlagIDJerry (hwrMiscFlagID4 | hwrMiscFlagID3) +#define hwrMiscFlagIDRocky (hwrMiscFlagID4 | hwrMiscFlagID3 | hwrMiscFlagID2) +#define hwrMiscFlagIDTouchdown (hwrMiscFlagID4 | hwrMiscFlagID3 | hwrMiscFlagID2 | hwrMiscFlagID1) + +// Old-style Hardware IDs for DragonBall 'EZ based products +#define hwrMiscFlagIDJerryEZ (hwrMiscFlagID3 | hwrMiscFlagID2) +#define hwrMiscFlagIDSumo (hwrMiscFlagID4 | hwrMiscFlagID2 | hwrMiscFlagID1) +#define hwrMiscFlagIDBrad (hwrMiscFlagID4 | hwrMiscFlagID3 | hwrMiscFlagID1) + +// Hardware SubIDs used to detect hardware type early in boot process +#define hwrMiscFlagExtSubIDBrad 0x0 +#define hwrMiscFlagExtSubIDSumo 0x2 + + +// Old-style Hardware IDs still unused +#define hwrMiscFlagIDUnused4 (hwrMiscFlagID3) +#define hwrMiscFlagIDUnused5 (hwrMiscFlagID3 | hwrMiscFlagID1) +#define hwrMiscFlagIDUnused7 (hwrMiscFlagID3 | hwrMiscFlagID2 | hwrMiscFlagID1) +#define hwrMiscFlagIDUnused8 (hwrMiscFlagID4) + + +// Bits in the low memory global GHwrMiscFlagsExt (UInt32) +#define hwrMiscFlagExtSubID1 0x00000001 // subtype ID (for feature select in device) +#define hwrMiscFlagExtSubID2 0x00000002 // subtype ID (for feature select in device) +#define hwrMiscFlagExtSubID3 0x00000004 // subtype ID (for feature select in device) +#define hwrMiscFlagExtSubIDMask 0x00000007 // sybtype ID Mask + +#define hwrMiscFlagExtHasLiIon 0x00000010 // set if we have Lithium Ion battery rechargable in the cradle +#define hwrMiscFlagExtHasRailIO 0x00000020 // set if we have Rail I/O hardware +#define hwrMiscFlagExtHasFlash 0x00000040 // set (by OS or HAL) if we have Flash ROM +#define hwrMiscFlagExtHasFParms 0x00000080 // set (by OS or HAL) if we have Flash parms area + +#define hwrMiscFlagExt115KIrOK 0x00000100 // device supports 115K IR transfers +#define hwrMiscFlagExtHasExtLCD 0x00000200 // device has external LCD controller +#define hwrMiscFlagExtHasSWBright 0x00000400 // device has software controlled brightness + + +// 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. + +#define hwrOEMCompanyIDUnspecified 0x00000000 // hwrOEMCompanyID not specified by HAL +#define hwrOEMHALIDUnspecified 0x00000000 // hwrOEMHALID not specified by HAL +#define hwrOEMDeviceIDUnspecified 0x00000000 // hwrOEMDeviceID not specified by HAL + +#define hwrOEMCompanyIDPalmPlatform 'psys' // Reference Platforms made by Palm Computing +#define hwrOEMCompanyIDPalmDevices 'palm' // Devices made by Palm Computing + +#define hwrOEMCompanyIDSymbol 'smbl' // Devices made by Symbol Technologies +#define hwrOEMCompanyIDQualcomm 'qcom' // Devices made by Qualcomm +#define hwrOEMCompanyIDTRG 'trgp' // Devices made by TRG Products +#define hwrOEMCompanyIDHandspring 'hspr' // Devices made by Handspring + +// Hardware ID's for DragonBall EZ based products +#define hwrMiscFlagIDSumo (hwrMiscFlagID4 | hwrMiscFlagID2 | hwrMiscFlagID1) +#define hwrMiscFlagIDBrad (hwrMiscFlagID4 | hwrMiscFlagID3 | 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 +#define hwrOEMHALIDEZRef 'eref' // (Mono) EZ Reference Platform (Palm Computing) +#define hwrOEMHALIDEZRefColor 'cref' // Color EZ Reference Platform (Palm Computing) + +// HALs that belong to hwrOEMCompanyIDPalmDevices +#define hwrOEMHALID328Jerry 'jery' // Pilot, PalmPilot, Palm III/VII HAL (Palm Computing) +#define hwrOEMHALIDEZSumo 'sumo' // Palm IIIx/V/Vx HAL (Palm Computing) + + +#endif //__HWR_MISCFLAGS_H__ + +#endif // NON_PORTABLE + diff --git a/sdk-3.5/include/Core/Hardware/M68KHwr.h b/sdk-3.5/include/Core/Hardware/M68KHwr.h new file mode 100644 index 0000000..b5d6f2f --- /dev/null +++ b/sdk-3.5/include/Core/Hardware/M68KHwr.h @@ -0,0 +1,114 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: M68KHwr.h + * + * Description: + * Pilot debugger remote hardware/system info + * + * History: + * 1/18/95 RM - Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __M68KHWR_H +#define __M68KHWR_H + +// Pilot common definitions +#include + + +/*********************************************************************** + * Breakpoint words we use + ***********************************************************************/ +#define m68kTrapInstr 0x4E40 +#define m68kTrapVectorMask 0x000F + +/*********************************************************************** + * 68000 Exception Vector table + ***********************************************************************/ +typedef struct M68KExcTableType { + UInt32 initStack; // initial stack pointer + UInt32 initPC; // initial PC + + UInt32 busErr; // 08 + UInt32 addressErr; // 0C + UInt32 illegalInstr; // 10 + UInt32 divideByZero; // 14 + UInt32 chk; // 18 + UInt32 trap; // 1C + UInt32 privilege; // 20 + UInt32 trace; // 24 + UInt32 aTrap; // 28 + UInt32 fTrap; // 2C + UInt32 reserved12; // 30 + UInt32 coproc; // 34 + UInt32 formatErr; // 38 + UInt32 unitializedInt; // 3C + + UInt32 reserved[8]; // 40-5C + + UInt32 spuriousInt; // 60 + UInt32 autoVec1; // 64 + UInt32 autoVec2; // 68 + UInt32 autoVec3; // 6C + UInt32 autoVec4; // 70 + UInt32 autoVec5; // 74 + UInt32 autoVec6; // 78 + UInt32 autoVec7; // 7C + + UInt32 trapN[16]; // 80 - BC + + UInt32 unassigned[16]; // C0 - FC + } M68KExcTableType; + + + +/************************************************************************************** + * 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. + * + **************************************************************************************/ +typedef struct M68KRegsType { + UInt32 d[8]; /* data registers */ + UInt32 a[7]; /* address registers */ + UInt32 usp; /* user stack pointer */ + UInt32 ssp; /* supervisor stack pointer */ + UInt32 pc; /* program counter */ + UInt16 sr; /* status register */ +} M68KRegsType; + + + + +/************************************************************************************** + * bit masks for testing M68000 status register fields + **************************************************************************************/ + +/* trace mode */ +#define m68kSrTraceMask 0x08000 +#define m68kSrTraceBit 15 + +/* supervisor state */ +#define m68kSrSupervisorMask 0x02000 + +/* interrupt mask */ +#define m68kSrInterruptMask 0x00700 +#define m68kSrInterruptOffset 8 /* offset for right-shifting interrupt mask */ + +/* condition codes */ +#define m68kSrExtendMask 0x00010 +#define m68kSrNegativeMask 0x00008 +#define m68kSrZeroMask 0x00004 +#define m68kSrOverflowMask 0x00002 +#define m68kSrCarryMask 0x00001 + + + +#endif //__M68KHWR_H + diff --git a/sdk-3.5/include/Core/System/AlarmMgr.h b/sdk-3.5/include/Core/System/AlarmMgr.h new file mode 100644 index 0000000..ba894b3 --- /dev/null +++ b/sdk-3.5/include/Core/System/AlarmMgr.h @@ -0,0 +1,267 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: AlarmMgr.h + * + * Description: + * Include file for Alarm Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *****************************************************************************/ + +#ifndef __ALARM_MGR_H__ +#define __ALARM_MGR_H__ + + +// Include elementary types +#include +#include +#include + + + + +/************************************************************ + * Alarm Manager result codes + * (almErrorClass is defined in ErrorBase) + *************************************************************/ +#define almErrMemory (almErrorClass | 1) // ran out of memory +#define almErrFull (almErrorClass | 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. +typedef struct SysAlarmTriggeredParamType { + UInt32 ref; // --> alarm reference value passed by caller; + UInt32 alarmSeconds; // --> alarm date/time in seconds since 1/1/1904; + + Boolean purgeAlarm; // <-- 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 + UInt8 padding; + } SysAlarmTriggeredParamType; + +// 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. +typedef struct SysDisplayAlarmParamType { + UInt32 ref; // alarm reference value passed by caller; + UInt32 alarmSeconds; // alarm date/time in seconds since 1/1/1904; + Boolean soundAlarm; // non-zero if alarm needs to be sounded; + UInt8 padding; + } SysDisplayAlarmParamType; + + + + +/************************************************************ + * + * + * 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. + * + *************************************************************/ +typedef enum { + almProcCmdTriggered = 0, // Alarm triggered + almProcCmdReschedule, // Reschedule (usually as a result of time change) + + // Alarm manager reserves all enums up to almProcCmdCustom + almProcCmdCustom = 0x8000 + } AlmProcCmdEnum; + +typedef void (*AlmAlarmProcPtr)(UInt16 /* AlmProcCmdEnum*/ almProcCmd, + SysAlarmTriggeredParamType *paramP); + + +#define almProcAlarmCardNo 0x8000 // passed in cardNo to AlmSetAlarm + // and AlmGetAlarm + +#define AlmSetProcAlarm(/*AlmAlarmProcPtr*/ procP, /*UInt32*/ ref, \ + /*UInt32*/alarmSeconds) \ + AlmSetAlarm(almProcAlarmCardNo, (LocalID)procP, ref, \ + alarmSeconds, true) + +#define AlmGetProcAlarm(/*AlmAlarmProcPtr*/ procP, /*UInt32 **/ refP) \ + AlmGetAlarm(almProcAlarmCardNo, (LocalID)procP, refP) \ + + + + +/******************************************************************** + * Alarm Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// 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. +// +Err AlmInit(void) + SYS_TRAP(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. +// +Err AlmSetAlarm(UInt16 cardNo, LocalID dbID, UInt32 ref, + UInt32 alarmSeconds, Boolean quiet) + SYS_TRAP(sysTrapAlmSetAlarm); + + +// AlmGetAlarm() +// +// Gets the alarm seconds for a given app. +// Zero is returned if there is no alarm setting for the app. +UInt32 AlmGetAlarm(UInt16 cardNo, LocalID dbID, UInt32 *refP) + SYS_TRAP(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. +// +void AlmEnableNotification(Boolean enable) + SYS_TRAP(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. +Boolean AlmDisplayAlarm(Boolean okToDisplay) + SYS_TRAP(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. +// +void AlmCancelAll(void) + SYS_TRAP(sysTrapAlmCancelAll); + + + +// AlmAlarmCallback() +// +// This function is called at interrupt time by the Time Manager when +// an alarm goes off. +// +void AlmAlarmCallback(void) + SYS_TRAP(sysTrapAlmAlarmCallback); + + +// AlmTimeChange() +// +// This function gets called by TimSetSeconds() and gives the alarm manager +// a chance to notify all procedure alarms of the time change. +// +void AlmTimeChange(void) + SYS_TRAP(sysTrapAlmTimeChange); + +#ifdef __cplusplus +} +#endif + + + +#endif // __ALARM_MGR_H__ + diff --git a/sdk-3.5/include/Core/System/AppLaunchCmd.h b/sdk-3.5/include/Core/System/AppLaunchCmd.h new file mode 100644 index 0000000..8c05d21 --- /dev/null +++ b/sdk-3.5/include/Core/System/AppLaunchCmd.h @@ -0,0 +1,298 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: AppLaunchCmd.h + * + * 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. + * + *****************************************************************************/ + + #ifndef __APPLAUNCHCMD_H__ + #define __APPLAUNCHCMD_H__ + +// Include elementary types +#include + + +#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. +typedef enum { + addrLookupName, + addrLookupFirstName, + addrLookupCompany, + addrLookupAddress, + addrLookupCity, + addrLookupState, + addrLookupZipCode, + addrLookupCountry, + addrLookupTitle, + addrLookupCustom1, + addrLookupCustom2, + addrLookupCustom3, + addrLookupCustom4, + addrLookupNote, // This field is assumed to be < 4K + addrLookupWork, + addrLookupHome, + addrLookupFax, + addrLookupOther, + addrLookupEmail, + addrLookupMain, + addrLookupPager, + addrLookupMobile, + addrLookupSortField, + addrLookupListPhone, + addrLookupFieldCount, // add new fields above this one + + addrLookupNoField = 0xff +} AddressLookupFields; + + +#define addrLookupStringLength 12 + +typedef struct + { + Char *title; + // Title to appear in the title bar. If NULL the default is used. + + Char *pasteButtonText; + // Text to appear in paste button. If NULL "paste" is used. + + Char lookupString[addrLookupStringLength]; + // 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. + + AddressLookupFields field1; + // 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). + + AddressLookupFields field2; + // 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. + + Boolean field2Optional; + // 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. + + Boolean userShouldInteract; + // 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; + + Char *formatStringP; + // 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. + + MemHandle resultStringH; + // If there is a format string a result string is allocated on + // the dynamic heap and it's MemHandle is returned here. + + UInt32 uniqueID; + // The unique ID of the found record or 0 if none was found. + + } AddrLookupParamsType; + +typedef AddrLookupParamsType *AddrLookupParamsPtr; + + + + +/************************************************************ + * Param Block passsed with the sysAppLaunchCmdSetActivePanel Command + *************************************************************/ + +#define prefAppLaunchCmdSetActivePanel (sysAppLaunchCmdCustomBase + 1) + // Record this panel so switching to the Prefs app + // causes this panel to execute. + +typedef struct + { + UInt32 activePanel; + // 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. + + } PrefActivePanelParamsType; + +typedef PrefActivePanelParamsType *PrefActivePanelParamsPtr; + + + +/************************************************************ + * Param Block passsed with the sysAppLaunchCmdAddRecord Command + *************************************************************/ + +//------------------------------------------------------------------- +// sysAppLaunchCmdAddRecord parameter block for the Mail application +//------------------------------------------------------------------- +// Param Block passsed with the sysAppLaunchCmdAddRecord Command + +typedef enum { mailPriorityHigh, mailPriorityNormal, mailPriorityLow } MailMsgPriorityType; + +typedef struct { + Boolean secret; + // True means that the message should be marked secret + + Boolean signature; + // True means that signature from the Mail application's preferences + // should be attached to the message. + + Boolean confirmRead; + // True means that a comfirmation should be sent when the message + // is read. + + Boolean confirmDelivery; + // True means that a comfirmation should be sent when the message + // is deliveried + + MailMsgPriorityType priority; + // high, normial, or low. + + UInt8 padding; + + Char * subject; + // Message's subject, a null-terminated string (optional). + + Char * from; + // Message's send, a null-terminated string (not currently used). + + Char * to; + // Address the the recipient, a null-terminated string (required). + + Char * cc; + // Copy Addresses, a null-terminated string (required). + + Char * bcc; + // Blind copy Addresses, a null-terminated string (required). + + Char * replyTo; + // Reply to address, a null-terminated string (required). + + Char * body; + // The text of the message, a null-terminated string (required). + +} MailAddRecordParamsType; + +typedef MailAddRecordParamsType *MailAddRecordParamsPtr; + + + +//------------------------------------------------------------------- +// sysAppLaunchCmdAddRecord parameter block for the Messaging application +//------------------------------------------------------------------- +// Param Block passsed with the sysAppLaunchCmdAddRecord Command + +//category defines +#define MsgInboxCategory 0 +#define MsgOutboxCategory 1 +#define MsgDeletedCategory 2 +#define MsgFiledCategory 3 +#define MsgDraftCategory 4 + +typedef struct + { + UInt16 category; + //is this an outgoing mesage? Or should it be put into a different category + + Boolean edit; + // True means that the message should be opened in the editor,instead of + // just dropped into the category (only applies to outBox category) + + Boolean signature; + // True means that signature from the Mail application's preferences + // should be attached to the message. + + Char * subject; + // Message's subject, a null-terminated string (optional). + + Char * from; + // Message's send, a null-terminated string (not currently used). + + Char * to; + // Address the the recipient, a null-terminated string (required). + + Char * replyTo; + // Reply to address, a null-terminated string (required). + + Char * body; + // The text of the message, a null-terminated string (required). + + } MsgAddRecordParamsType; + +typedef MsgAddRecordParamsType *MsgAddRecordParamsPtr; + + + +#endif //__APPLAUNCHCMD_H__ + diff --git a/sdk-3.5/include/Core/System/Bitmap.h b/sdk-3.5/include/Core/System/Bitmap.h new file mode 100644 index 0000000..d3e5470 --- /dev/null +++ b/sdk-3.5/include/Core/System/Bitmap.h @@ -0,0 +1,148 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Bitmap.h + * + * Description: + * This file defines bitmap structures and routines. + * + * History: + * September, 1999 Created by Bertrand Simon + * Name Date Description + * ---- ---- ----------- + * BS 9/99 Create + * jmp 12/23/99 Fix <> vs. "" problem. + * + *****************************************************************************/ + +#ifndef __BITMAP_H__ +#define __BITMAP_H__ + +#include +#include + +#include // #define ERROR_CHECK_LEVEL + + +//----------------------------------------------- +// The Bitmap Structure. +//----------------------------------------------- + +// bitmap version numbers +#define BitmapVersionZero 0 +#define BitmapVersionOne 1 +#define BitmapVersionTwo 2 + +// Compression Types for BitMap BitmapVersionTwo. +typedef enum { + BitmapCompressionTypeScanLine = 0, + BitmapCompressionTypeRLE, + + BitmapCompressionTypeNone = 0xFF +} BitmapCompressionType; + +typedef struct BitmapFlagsType { + UInt16 compressed:1; // Data format: 0=raw; 1=compressed + UInt16 hasColorTable:1; // if true, color table stored before bits[] + UInt16 hasTransparency:1; // true if transparency is used + UInt16 indirect:1; // true if bits are stored indirectly + UInt16 forScreen:1; // system use only + UInt16 reserved:11; +} BitmapFlagsType; + +// this definition correspond to the 'Tbmp' and 'tAIB' resource types +typedef struct BitmapType { + Int16 width; + Int16 height; + UInt16 rowBytes; + BitmapFlagsType flags; + UInt8 pixelSize; // bits/pixel + UInt8 version; // version of bitmap. This is vers 2 + UInt16 nextDepthOffset; // # of DWords to next BitmapType + // from beginnning of this one + UInt8 transparentIndex; // v2 only, if flags.hasTransparency is true, + // index number of transparent color + UInt8 compressionType; // v2 only, if flags.compressed is true, this is + // the type, see BitmapCompressionType + + UInt16 reserved; // for future use, must be zero! + + // [colorTableType] pixels | pixels* + // If hasColorTable != 0, we have: + // ColorTableType followed by pixels. + // If hasColorTable == 0: + // this is the start of the pixels + // if indirect != 0 bits are stored indirectly. + // the address of bits is stored here + // In some cases the ColorTableType will + // have 0 entries and be 2 bytes long. +} BitmapType; + +typedef BitmapType *BitmapPtr; + + +// This is the structure of a color table. It maps pixel values into +// RGB colors. Each element in the table corresponds to the next +// index, starting at 0. + +typedef struct RGBColorType { + UInt8 index; // index of color or best match to cur CLUT or unused. + UInt8 r; // amount of red, 0->255 + UInt8 g; // amount of green, 0->255 + UInt8 b; // amount of blue, 0->255 +} RGBColorType; + + +typedef struct ColorTableType { + // high bits (numEntries > 256) reserved + UInt16 numEntries; // number of entries in table + // RGBColorType entry[]; // array 0..numEntries-1 of colors + // starts immediately after numEntries +} ColorTableType; + + +// get start of color table entries aray given pointer to ColorTableType +#define ColorTableEntries(ctP) ((RGBColorType *)((ColorTableType *)(ctP)+1)) + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------- +// Routines relating to bitmap management +//----------------------------------------------- + +extern BitmapType *BmpCreate (Coord width, Coord height, UInt8 depth, + ColorTableType *colortableP, UInt16 *error) + SYS_TRAP(sysTrapBmpCreate); + +extern Err BmpDelete (BitmapType *bitmapP) + SYS_TRAP(sysTrapBmpDelete); + +extern Err BmpCompress(BitmapType *bitmapP, BitmapCompressionType compType ) + SYS_TRAP(sysTrapBmpCompress); + +extern void *BmpGetBits(BitmapType *bitmapP) + SYS_TRAP(sysTrapBmpGetBits); + +extern ColorTableType *BmpGetColortable(BitmapType *bitmapP) + SYS_TRAP(sysTrapBmpGetColortable); + +extern UInt16 BmpSize(BitmapType *bitmapP) + SYS_TRAP(sysTrapBmpSize); + +extern UInt16 BmpBitsSize(BitmapType *bitmapP) + SYS_TRAP(sysTrapBmpBitsSize); + +extern UInt16 BmpColortableSize(BitmapType *bitmapP) + SYS_TRAP(sysTrapBmpColortableSize); + +#ifdef __cplusplus +} +#endif + + +#endif //__BITMAP_H__ + diff --git a/sdk-3.5/include/Core/System/CMCommon.h b/sdk-3.5/include/Core/System/CMCommon.h new file mode 100644 index 0000000..fe8f570 --- /dev/null +++ b/sdk-3.5/include/Core/System/CMCommon.h @@ -0,0 +1,358 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CMCommon.h + * + * Description: + * Connection Management Protocol common definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * 11/19/96 vmk Added CM v1.1 receive timeout override extensions + * + *****************************************************************************/ + +#ifndef __CM_COMMON_H__ +#define __CM_COMMON_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Pilot common definitions + #include "PalmTypes.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Pilot common definitions + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + +/******************************************************************** + * CMP 1.0 Command Format + ********************************************************************/ + +// IT IS ANTICIPATED THAT the 1.0 PACKET FORMAT WILL BE USED TO INITIATE +// HOT SYNC "WAKE-UP" MESSAGE INDEFINITELY. BASED ON THE COMMUNICATIONS +// VERSION NUMBER PROVIDED IN THIS BASIC COMMAND STRUCTURE, FUTURE VERSIONS +// OF DESKTOP AND PILOT SOFTWARE MAY SUPPORT ADDITIONAL CONNECTION MANAGEMENT +// COMMANDS/FEATURES AS THE NEED ARISES. FOR EXAMPLE, TCP-ENABLED HOTSYNCS +// MAY PROVIDE ADDITIONAL INFORMATION, SUCH AS THE INTERNET ADDRESS OF THE +// PREFERRED HOTSYNC PC. THIS DESIGN PROVIDES FOR BACKWARD COMPATIBILITY +// WITH OLDER VERSIONS OF THE SOFTWARE. FUTURE COMMANDS WILL BE ADDED +// FOLLOWING THIS BASIC COMMAND SET. + +// The CMP packets are used for transmitting data for the Pilot CMP protocol layer. +// The structure of the CMP packet is built into the data part of the SLP packet and is, +// therefore, constrained by the SLP packet data size limitations. + + +// Packet type values used in the CMP packet body "type" field: +// +typedef enum CmpType { + cmpWakeup = 1, // CMP Wakeup packet sent from server to client + cmpInit, // CMP Init packet sent from client to server + cmpAbort, // CMP Abort packet sent from client to server + cmpExtended // For future command extensions + } CmpType; + + +// cmpInit and cmpWakeup packet body structure: +// +typedef struct CmpBodyType { + UInt8 type; // CMP packet type + + UInt8 flags; // in cmpInit packets: indicates which values were adjusted by + // the client(defined below); in cmpWakeup pakcets: null; + // in cmpAbort packets: reason for abort. + + UInt8 verMajor; // Major PAD version number + UInt8 verMinor; // Minor PAD version number + UInt16 wReserved; // RESERVED -- set to NULL!!! + //UInt32 commVersion; // in cmpWakeup: server comm software version number; + // in cmpInit: client comm version + + UInt32 baudRate; // in cmpWakeup: max server baud rate; + // in cmpInit packets: the prescribed baud rate + } CmpBodyType; + +typedef CmpBodyType* CmpBodyPtr; + +// Flags used in the packet body "flags" field of cmpInit +// packets. These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpInitFlagChangeBaudRate 0x80 // signals that the baud rate was adjusted by the client + +// CM v1.1 extensions +#define cmpInitFlagRcvTOut1Min 0x40 // instructs the Pilot to set its receive timeout to 1 minute +#define cmpInitFlagRcvTOut2Min 0x20 // instructs the Pilot to set its receive timeout to 1 minute + + +// Flags used in the packet body "flags" field of cmpAbort packets. +// These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpAbortFlagVersionError 0x80 // signals incompatible comm versions + + + +/******************************************************************** + * CMP Protocol Parameters + ********************************************************************/ + +// This transaction id is used by cmpWakeup packets. cmpInit and cmpAbort +// packets MUST use a different transaction id. +// +#define cmpWakeupTransactionID 0xFF + +// This is the baud rate at which CMP connections are initiated +// +#define cmpInitialBaudRate 9600L + +// This is the time limit for trying to initiate a connection +// +#define cmpMaxInitiateSec 20 + + +/******************************************************************** + * CMP v2.0 Extensible Command Format + ********************************************************************/ + +// THE v2.0 COMMANDS USE A MORE FLEXIBLE STRUCTURE TO ANTICIPATE DYNAMIC +// ADDITION OF NEW ARGUMENTS. THE COMMAND HEADER AND ARGUMENT IDENTIFIERS +// AND THEIR STRUCTURES WILL BE SPECIFIED IN THIS INCLUDE FILE. THE PACKAGING +// OF THE ARGUMENTS WILL BE SPECIFIED IN THE TRANSPORT IMPLEMENTATION +// WHICH PROVIDES THE UTILITY ROUTINES TO PACKAGE DYNAMIC ARGUMENTS. + +typedef struct CmpCommandHeaderType { + UInt8 hdrType; // set to cmpExtended + UInt8 cmd; // extended command/response id + UInt16 errorCode; // used in replies; set to null in commands! + UInt8 argCount; // number of arguments + UInt8 reserved1; // RESERVED - SET TO NULL! + UInt32 reserved2; // RESERVED - SET TO NULL! + } CmpCommandHeaderType; + + +// Generic command type for +typedef union CmpGenericCommandType { + UInt8 hdrType; // command header type(CmpType) + CmpBodyType body10; // v1.0 command/response body + CmpCommandHeaderType exHdr; // v2.0 extended command/response header + } CmpGenericCommandType; + +typedef CmpGenericCommandType* CmpGenericCommandPtr; + + +// cmpRespBit is used to form a response ID from a +// command ID by or'ing it with the function ID. +#define cmpRespBit 0x80 + +// cmpCmdIDMask is used to mask out the command/response ID value +#define cmpCmdIDMask 0x7f + +// Command/Response argument id's begin at this value +#define cmpFirstArgID 0x20 + + +//------------------------------------------------------------------------- +// Connection Management error codes returned in the response errorCode +// field. +//------------------------------------------------------------------------- +typedef enum CmpRespErrEnum { + cmpRespErrNone = 0, // reserve 0 for no error + cmpRespErrSystem, // general Pilot system error + cmpRespErrUnknownCmd, // unknown command ID + cmpRespErrMemory, // insufficient memory + cmpRespErrParam, // invalid parameter + + cmpRespErrLast // *KEEP THIS ENTRY LAST* + } CmpRespErrEnum; + + +//------------------------------------------------------------------------- +// Connection Management Extended Command ID's +//------------------------------------------------------------------------- +typedef enum CmpCmdEnum { + + cmpCmdReserved = 0x0F, // range reserved for internal use + + //---------------------------- + // v2.0 COMMANDS + //---------------------------- + cmpCmdXCommPrefs, // exchange communications protocol preferences + cmpCmdHShakeComplete, // hand-shake completion command + + cmpCmdLast // *KEEP THIS ENTRY LAST* + } CmpCmdEnum; + + + +//------------------------------------------------------------------------- +// v2.0 Connection Management Command/Response Structures +//------------------------------------------------------------------------- + +// CmpCommPrefsType: common data structure shared by cmpCmdXCommPrefs and +// cmpCmdHShakeComplete. In cmpCmdXCommPrefs, the data structure is used +// to exchange capabilities. In cmpCmdHShakeComplete, the structure is +// used to instruct the Pilot on which settings/features to use. Some +// fields apply to direct PAD-based connections only and should be ignored +// by other transports such as TCP. +// +typedef struct CmpCommPrefsType { + // OFFSET + UInt32 maxPktDataSize;// 0; maximum supported packet data size + UInt32 maxDataBlkSize;// 4; maximum supported data block size + UInt32 maxBaudRate; // 8; maximum supported baud rate/baud rate to use + UInt32 hwHShakeAbove; // 12; requires hardware handshake above this baud rate + UInt32 flags; // 16; flags + UInt32 version; // 20; transport version (comm version) + UInt32 reserved2; // 24; RESERVED - SET TO NULL! + UInt32 reserved3; // 28; RESERVED - SET TO NULL! + // TOTAL: 32 bytes; + } CmpCommPrefsType; + + +//-------------------------------------- +// Packet-level CRC preferences +//-------------------------------------- + +// cmpCommPrefsFlagSupportPktCRC16: if set, the transport layer is capable of +// CRC-16 protection of every data packet(v2.0 extension). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportPktCRC16 0x80000000L + +// cmpCommPrefsFlagUsePktCRC16: if set, instructs the transport layer to use +// the CRC-16 protection of every data packet(v2.0 extension). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUsePktCRC16 0x00008000L + +//-------------------------------------- +// Data offset size preferences +//-------------------------------------- + +// NOTE: +// If specifying Int16 offsets, Int16 argument wrappers will be used. +// If specifying long offsets, long argument wrappers will be used. + +// cmpCommPrefsFlagSupportShortOffsets: if set, indicates that the transport layer +// supports Int16(single-word) offsets/sizes in its data packets. The smaller +// field does not permit bigger blocks to be transmitted(v1.0-compatible). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportShortOffsets 0x40000000L + +// cmpCommPrefsFlagUseShortOffsets: if set, instructs the transport layer to use +// Int16(single-word) offsets/sizes in its data packets(v1.0-compatible). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUseShortOffsets 0x00004000L + +// cmpCommPrefsFlagSupportLongOffsets: if set, indicates that the transport layer +// supports long(double-word) offsets/sizes in its data packets. The larger +// field permits bigger blocks to be transmitted(v2.0 extension). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportLongOffsets 0x20000000L + +// cmpCommPrefsFlagUseLongOffsets: if set, instructs the transport layer to use +// long(double-word) offsets/sizes in its data packets(v2.0 extension). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUseLongOffsets 0x00002000L + + + +////////////////////////////////////////////////////////////////////////// +// cmpCmdXCommPrefs +////////////////////////////////////////////////////////////////////////// +// +// Description: +// Exchange communications preferences. +// +// Possible error codes +// cmpRespErrSystem, +// cmpRespErrMemory, +// cmpRespErrParam, + +//--------------------- +// Command arguments: +//--------------------- +enum { + cmpXCommPrefsReqArgID = cmpFirstArgID + }; + + +// cmpXCommPrefsReqArgID argument structure: +// +typedef struct CmpXCommPrefsReqType { + // OFFSET + CmpCommPrefsType prefs; // 0; CMP comm preferences + // TOTAL: 32 bytes; + } CmpXCommPrefsReqType; + + +//--------------------- +// Response arguments: +//--------------------- +enum { + cmpXCommPrefsPrefsRespArgID = cmpFirstArgID, // preferences argument + cmpXCommPrefsIPAddrRespArgID // preferred PC IP Address/host name + }; + + +// cmpXCommPrefsPrefsRespArgID argument structure: +// +typedef struct CmpXCommPrefsPrefsRespType { + // OFFSET + CmpCommPrefsType prefs; // 0; CMP comm preferences + // TOTAL: 32 bytes; + } CmpXCommPrefsPrefsRespType; + + +// cmpXCommPrefsIPAddrRespArgID argument structure: +// +typedef struct CmpXCommPrefsIPAddrRespType { + // OFFSET + UInt8 ipAddr[2]; // 0; IP address/host name string, zero-terminated + // TOTAL: variable size; + } CmpXCommPrefsIPAddrRespType; + + + +////////////////////////////////////////////////////////////////////////// +// cmpCmdHShakeComplete +////////////////////////////////////////////////////////////////////////// +// +// Description: +// Completes the Extended Connection Management hand-shake. Instructs +// the Pilot on which settings/features to use. +// +// Possible error codes +// cmpRespErrSystem, +// cmpRespErrMemory, +// cmpRespErrParam + +//--------------------- +// Command arguments: +//--------------------- +enum { + cmpHShakeCompleteReqArgID = cmpFirstArgID + }; + + +// cmpHShakeCompleteReqArgID argument structure: +// +typedef struct CmpHShakeCompleteReqType { + // OFFSET + CmpCommPrefsType final; // 0; final settings/features to use + // TOTAL: 32 bytes; + } CmpHShakeCompleteReqType; + + +//--------------------- +// Response arguments: +//--------------------- + +// No response arguments; the response consists of the command header only + + + +#endif // __CM_COMMON_H__ + diff --git a/sdk-3.5/include/Core/System/CMLConst.h b/sdk-3.5/include/Core/System/CMLConst.h new file mode 100644 index 0000000..a3549fb --- /dev/null +++ b/sdk-3.5/include/Core/System/CMLConst.h @@ -0,0 +1,261 @@ +/****************************************************************************** + * + * Copyright (c) 1998 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CMLConst.h + * + * Description: + * CML data structures definition file. + * + *****************************************************************************/ + +#ifndef __CMLCONST_H__ +#define __CMLCONST_H__ + +#define cmlEncodingTypeStrNULL "" + +#define cmlCompressionTypeNone 0 +#define cmlCompressionTypeBitPacked 1 +#define cmlCompressionTypeLZ77 2 +#define cmlCompressionTypeMax cmlCompressionTypeLZ77 /* end of valid range */ + +#define cmlCompressionTypeDef cmlCompressionTypeBitPacked + + +#define cmlContentTypeStrTextPlain "text/plain" +#define cmlContentTypeStrTextHTML "text/html" +#define cmlContentTypeStrImageGIF "image/gif" +#define cmlContentTypeStrImageJPEG "image/jpeg" +#define cmlContentTypeStrApplicationCml "application/cml" +#define cmlContentTypeStrImagePalmOS "image/palmos" + +#define cmlContentTypeTextPlain 0 +#define cmlContentTypeTextHTML 1 +#define cmlContentTypeImageGIF 2 +#define cmlContentTypeImageJPEG 3 +#define cmlContentTypeTextCml 4 +#define cmlContentTypeImagePalmOS 5 + +// Tag sizes +#define cmlCharSize 5 +#define cmlAsciiCharSize 8 +#define cmlShortTagSize 7 +#define cmlLongTagSize 15 +#define cmlShortTagMax 127 + +// Size in bits of various Tag data types +#define cmlFlagSize 1 +#define cmlColorSize 8 +#define cmlAlignSize 2 +#define cmlAlignISize 3 +#define cmlClearSize 2 +#define cmlFormatSize 4 +#define cmlListTypeSize 3 +#define cmlImageTypeSize 1 +#define cmlLinkColorTypeSize 2 +#define cmlTextSizeSize 3 +#define cmlListItemSize 2 +#define cmlFormSize 3 +#define cmlInputTextSize 2 +#define cmlInputPasswordSize 2 +#define cmlInputRadioSize 4 +#define cmlInputCheckBoxSize 4 +#define cmlInputSubmitSize 2 +#define cmlInputResetSize 1 +#define cmlInputHiddenSize 2 +#define cmlInputTextAreaSize 1 +#define cmlSelectSize 2 +#define cmlSelectItemCustomSize 2 +#define cmlDatePickerSize 1 +#define cmlTimePickerSize 1 +#define cmlTableSize 7 +#define cmlTableCellSize 7 +#define cmlHyperlinkSize 10 +#define cmlHorizontalRuleSize 5 + +// Flag values +#define cmlFlagHRCustom 0x01 +#define cmlFlagHRAlign 0x06 +#define cmlFlagHRNoShade 0x08 +#define cmlFlagHRIsPercent 0x10 + +#define cmlFlagListModType 0x01 +#define cmlFlagListModValue 0x02 + +#define cmlFlagLinkIsButton 0x01 +#define cmlFlagLinkHasTitle 0x02 +#define cmlFlagLinkInternal 0x04 +#define cmlFlagLinkIsFragment 0x08 +#define cmlFlagLinkIsSecure 0x10 +#define cmlFlagLinkHasHref 0x20 +#define cmlFlagLinkIsSameDoc 0x40 +#define cmlFlagLinkIsFakeRemote 0x80 +#define cmlFlagLinkIsLocalRef 0x100 +#define cmlFlagLinkIsBinary 0x200 + +#define cmlFlagFormIsStandalone 0x01 +#define cmlFlagFormIsSecure 0x02 +#define cmlFlagFormIsLocalAction 0x04 + +#define cmlFlagInputHasName 0x01 +#define cmlFlagInputHasValue 0x02 +#define cmlFlagInputChecked 0x04 +#define cmlFlagInputHasText 0x08 +#define cmlFlagInputMultiple 0x02 +#define cmlFlagInputSelected 0x01 + +#define cmlFlagImageEmbedded 0x01 +#define cmlFlagImageHasAlign 0x02 +#define cmlFlagImageHasBorder 0x04 +#define cmlFlagImageHasHSpace 0x08 +#define cmlFlagImageHasVSpace 0x10 +#define cmlFlagImageHasSrc 0x20 +#define cmlFlagImageHasAlt 0x40 +#define cmlFlagImageLocalPQA 0x80 +#define cmlFlagImageLocalPQF cmlFlagImageLocalPQA /* old name; deprecated... */ + +#define cmlFlagTableHasAlign 0x01 +#define cmlFlagTableHasWidth 0x02 +#define cmlFlagTableHasBorder 0x04 +#define cmlFlagTableHasCellSpacing 0x08 +#define cmlFlagTableHasCellPadding 0x10 +#define cmlFlagTableHasKeepRow 0x20 +#define cmlFlagTableHasKeepCol 0x40 + +#define cmlFlagCellHasHAlign 0x01 +#define cmlFlagCellHasVAlign 0x02 +#define cmlFlagCellHasColSpan 0x04 +#define cmlFlagCellHasRowSpan 0x08 +#define cmlFlagCellHasHeight 0x10 +#define cmlFlagCellHasWidth 0x20 +#define cmlFlagCellNoWrap 0x40 + +enum CMLTag +{ + cmlTagAnchor, + cmlTagBGColor, + cmlTagTextColor, + cmlTagLinkColor, + cmlTagTextSize, + cmlTagTextBold, + cmlTagTextItalic, + cmlTagTextUnderline, + cmlTagParagraphAlign, // 0x08 + cmlTagHorizontalRule, + cmlTagH1, + cmlTagH2, + cmlTagH3, + cmlTagH4, + cmlTagH5, + cmlTagH6, + cmlTagBlockQuote, // 0x10 + cmlTagHyperlink, + cmlTagAddress, + cmlTagTextStrike, + cmlTagTextMono, + cmlTagTextSub, + cmlTagTextSup, + cmlTagClear, + cmlTagHistoryListText, // 0x18 + cmlTagIsIndex, + cmlTagListOrdered, + cmlTagListUnordered, + cmlTagListDefinition, + cmlTagListItemCustom, + cmlTagListItemNormal, + cmlTagListItemTerm, + cmlTagListItemDefinition, // 0x20 + cmlTagForm, + cmlTagInputTextLine, + cmlTagInputPassword, + cmlTagInputRadio, + cmlTagInputCheckBox, + cmlTagInputSubmit, + cmlTagInputReset, + cmlTagInputHidden, // 0x28 + cmlTagInputTextArea, + cmlTagSelect, + cmlTagSelectItemNormal, + cmlTagSelectItemCustom, + cmlTagInputDatePicker, + cmlTagInputTimePicker, + cmlTagTable, + cmlTagTableRow, // 0x30 + cmlTagCaption, + cmlTagTableData, + cmlTagTableHeader, + cmlTagImage, // 0x34 + + + // Special CML cmlTags. + cmlTag8BitEncoding = 0x70, + cmlTagCMLEnd, + + // cmlTags not passed to output + cmlTagTextFont = 0x100, + cmlTagBody, + cmlTagBase, + cmlTagTextBaseFont, + cmlTagListItem, + cmlTagInput, + cmlTagSelectItem, + cmlTagMeta, + cmlTagLastInList // Not used as a tag; marks the end of the enum. +}; + +#define cmlMaxTag cmlTagLastInList +#define cmlTagNull cmlTagLastInList + //Used internally by CmlEncoder; not sent. + +// CML 5 Bit character equates +typedef enum { + cmlCharEnd, + cmlCharStart, + cmlCharEsc, + cmlCharFormFeed, + cmlCharLineBreak, + cmlCharSpace, + + // the lower case letters 'a' - 'z' follow.... + cmlCharA + + } CMLCharEnum; + +// Regular Ascii characters +#define cmlAsciiCR 0x0D +#define cmlAsciiLineFeed 0x0A +#define cmlAsciiFormFeed 0x0C +#define cmlAsciiSpace 0x20 + + +// List types for ordered and unordered lists +typedef enum { + cmlListTDisc, cmlListTSquare, cmlListTCircle, + cmlListT1, cmlListTa, cmlListTA, cmlListTi, cmlListTI + } CmlListEnum; + +// Align types +typedef enum { + cmlAlignLeft, cmlAlignCenter, cmlAlignRight, cmlAlignNone + } CmlAlignEnum; + +typedef enum { + cmlVAlignTop, cmlVAlignCenter, cmlVAlignBottom, cmlVAlignNone + } CmlVAlignEnum; + +typedef enum { + cmlIAlignLeft, cmlIAlignCenter, cmlIAlignRight, cmlIAlignTop, + cmlIAlignMiddle, cmlIAlignBottom, cmlIAlignNone + } CmlIAlignEnum; + +typedef enum { + cmlClearLeft, cmlClearAll, cmlClearRight, cmlClearLine + } CmlClearEnum; + +typedef enum { + cmlLinkColor, cmlLinkColorVisited, cmlLinkColorActive + } CmlLinkColorEnum; + +#endif //__CMLCONST_H__ + diff --git a/sdk-3.5/include/Core/System/CTP.h b/sdk-3.5/include/Core/System/CTP.h new file mode 100644 index 0000000..1a415e0 --- /dev/null +++ b/sdk-3.5/include/Core/System/CTP.h @@ -0,0 +1,295 @@ +/****************************************************************************** + * + * Copyright (c) 1997-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CTP.h + * + * Description: + * Header for the CTP Proxy service component of Elaine. + * + * History: + * 6/24/97 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef _CTP_H_ +#define _CTP_H_ + + + +//########################################################## +// CTP Commands +// This is the CTP command UIntV which is sent in every +// CTP Request in the common area (CTPReqCommon) +//########################################################## +typedef enum { + ctpCmdReqURL = 0, // request URL + ctpCmdReqMail = 1, // request mail + ctpCmdEcho = 2, + ctpCmdMsgGen = 3, + ctpCmdDiscard = 4 + } CTPCmdEnum; + + +//########################################################## +// CTP Content Conversion Types +// The requestor can pass one of these constants in the +// ctpExtConvertTo extension in order to specify the +// the type of content conversion desired. +// If the extension is missing, then ctpConvCML is assumed. +//########################################################## +typedef enum { + ctpConvCML = 0, // CML + ctpConvCML8Bit = 1, // CML in 8-bit debug form + ctpConvCMLLZ77 = 2, // CML with LZSS + ctpConvNone = 3 // Return in native web format. + // When this is specified, then the response + // will include the ctpRspExtContentType + // and ctpRspExtContentEncoding extensions + } CTPConvEnum; + + +// default CTP header request values +#define ctpHeaderVersion 0 // current version of CTP header +#define ctpConvAlgorithm ctpConvCML // encoding type +#define ctpContentVersion 0x8001 // encoding version (must be kept up to date!!!) +#define ctpMaxResponseSize 1024 // max response size +#define ctpContentWidth 160 // displayable width + +//########################################################## +// CTP Request Extensions +// These are the defined extension IDs that can appear +// in the extensions area of a CTP request +//########################################################## + +// Extensions defined for the ctpCmdReqMail command.... +typedef enum { + ctpExtIncHTTPResponse = 1, // include HTTP response header in data + // only applicable if ctpExtConvertTo + // is set to ctpConvNone + + ctpExtNetID = 128, // Followed by length byte of 4 and + // 4 byte networkID.. + // Must be specified when using TCP + // because tunneler is not used. + + ctpExtUserID = 129, // Followed by length byte of 4 and + // 4 byte userID. + // Must be specified when using TCP + // because Mobitex MAN# is not available + + ctpExtUserPW = 130, // Followed by length byte of 16 and + // 128 bit (16 byte) MD5 hashed password. + // Must be specified when using TCP + // because Mobitex MAN# is not available + + ctpExtUserName = 131, // Followed by length byte and + // ascii user name string. + // This or ctpExtUserID must be specified + // when using TCP because Mobitex MAN# + // is not available + + ctpExtServer = 132, // Followed by a length byte of 1 and + // 8 bits (1 byte) of server behavior + // flags. + + ctpExtConvertTo = 133, // Followed by length byte of 1 and + // a 1 byte conversion identifier + // ctpConvXXX. If not present then + // ctpConvCML is assumed. + + ctpExtLocale = 134 // Followed by length byte of 3; + // 1 byte Country as defined by CountryType in Preferences.h + // 1 byte Language as defined by LanguageType in Preferences.h + // 1 byte CharsetID as defined by CharEncodingType in TextMgr.h + // Extension must not be sent if Local = + // ( cUnitedStates, lEnglish, charEncodingPalmLatin ) + + } CTPReqExtEnum; + + + +//########################################################## +// CTP Response Extensions +// These are the defined extension IDs that can appear +// in the extensions area of a CTP response +//########################################################## +// Extensions defined for the ctpCmdReqURL response +typedef enum { + ctpExtContentType = 128, // Followed by length byte of 'len' and + // a 'len' byte string containing the + // MIME type of the content. This extension + // is only returned when the request has + // a ctpReqExtConverTo value of ctpConvNone + + ctpExtContentEncoding = 129, // Followed by length byte of 'len' and + // a 'len' byte string containing the + // encoding type ("x-gzip, "compress", "lz77", + // etc.) + // This extension is only returned when the + // request has a ctpReqExtConverTo value of + // ctpConvNone + + ctpExtUncompressSize = 130, // Followed by length byte of 4 and + // a UInt32 containing the uncompressed + // size of the content. Currently only + // sent when the requested content conversion + // type is ctpConvCMLLZSS + + ctpExtUntruncatedSize = 131, // Followed by length byte of 4 and + // a UInt32 containing the untruncated + // size of the content. Currently only + // sent when the CTP result is ctpWarnTruncated + + ctpExtContentVersion = 132 // Followed by length byte of 2 + // and 2 byte desired version number of content + + + } CTPRspExtURLEnum; + + + + +//########################################################## +// CTP Network IDs. +// These are used along with the userID to identify a user's +// mailbox account. All mailboxes created for the Mobitex +// network with have a network ID of 0. The network ID +// is passed along with the userID to the mail proxy. +// For wireless networks, the tunneler fills in the network +// ID into the ?? field of the tunneled IP packets. For wireline +// access, the client must include the network ID in the extensions +// field of the CTP mail request. +//########################################################## +typedef enum { + ctpNetIDMobitex = 0, + ctpNetIDUnknown = 0xFFFF + } CTPNetIDEnum; + + +//########################################################## +// CTP Schemes +// This is the scheme encoding which is used as a field +// in the document address portion in a URL request +//########################################################## +typedef enum { + ctpSchemeHTTP = 0, // http:// + ctpSchemeHTTPS = 1, // https:// + ctpSchemeFTP = 2, // ftp:// + ctpSchemeEmpty = 7 + } CTPSchemeEnum; + + + + +//########################################################## +// CTP Errors +// These are the possible error codes returned in a CTP response +//########################################################## +typedef enum { + ctpErrNone = 0, + ctpErrMalformedRequest, // malformed CTP-layer request from + // client + // Optional Data: + // UInt32 ctpErr + // Char errMsg[] + // + ctpErrUnknownCmd, // unsupported CTP command + // no extra data + // + ctpErrProxy, // content or other err specific to + // a Palm Proxy Server + // (ie, messaging or clipping proxy) + // Data: + // UInt32 proxyErr + // Char errMsg[] + // + ctpErrServer, // err on WEB Server + // Data: + // UInt32 serverErr + // Char errMsg[] + // + ctpErrSecSeqNumberBad, // encrypted request had an + // invalid sequence number + // no extra data + // + ctpErrSecPublicKeyBad, // encrypted request is using an + // invalid server public key + // Data: + // UInt8 newPubKey[] + // + // GT, 01-04-99. + ctpErrMsgProxy, // messaging proxy specific error + // Data: + // UInt32 proxyErr + // Char errMsg[] + // + ctpWarnTruncated = 0x8000 // response is truncated + } CTPErrEnum; + + +// NOTE: +// ctpErrMalformedRequest is an error at the outer CTP +// layer of the protocol - i.e. the outer wrapper around either a Web or Mail +// request. Errors at this level are very basic, akin to errors at the IP layer +// over TCP/IP networks. This kind of error is discovered before Elaine even +// knows if it's a web or mail request. + +// The ctpErrProxy errors are errors discovered in the "insides" of a CTP request, +// akin to having bad data in an FTP request for example. These aren't +// discovered until the CTP request wrapper has been stripped off and the guts +// of the request have been passed to the portion of Elaine that handles web +// or mail requests specifically. + + + +//===================================================== +// Functions +//==================================================== +#ifdef __cplusplus +extern "C" { +#endif + +// +// NOTE: The following routines are no longer "public" system calls. +// They are now static private functions in :Libraries:INet:Src:INetLibWebCTP.c +// that can be included into another source file if needed. +// The only place they are used is in the INetLib and some test code. +// +// UInt32 PrvCTPURLEncode(Char * urlP, UInt8 * dstP, UInt32 * dstBitOffsetP, +// UInt32 dstBitLen); + +// UInt32 PrvCTPURLDecode(UInt8 * srcP, UInt32 * srcBitOffsetP, +// Char * urlP, UInt32 urlBufSize); + +// Convert a base26 ascii string as used in a CTP URL into an +// integer. Return's 0 if no error, updates *strPP to point +// to next character past base26 ascii string. +// UInt32 PrvCTPBase26AToI(Char ** strPP, UInt32 * intP); + + +// MACRO: CtpMaxEncodedURLSize(UInt32 srcByteCount) +// +// Given a source URL size, including terminating zero-byte, returns +// the buffer size (in bytes) that is required to hold the encoded URL; +// +// This value is arrived at as follows: We use the 5-bit encoding with every +// byte escaped as the limit; this consists of 3 scheme bits, 1 encoding bit +// and the string characters where each character is preceded with a 5-bit escape, +// and the terminating zero-byte; plus, we add 10 bytes as a fudge factor for good +// measure. (in this model, every string byte has 5/8ths byte overhead; we +// increase this to 6/8 to get a total of 1 6/8 or 7/4 result bytes for every +// source byte) +// +// *IMPORTANT* if the encoding method changes, this macro will need to be updated. +// +#define CtpMaxEncodedURLSize(srcByteCount) (1 + (srcByteCount * 7 / 4) + 10) + + +#ifdef __cplusplus +} +#endif + +#endif /* _CTP_H_ */ + diff --git a/sdk-3.5/include/Core/System/CharAttr.h b/sdk-3.5/include/Core/System/CharAttr.h new file mode 100644 index 0000000..87a7243 --- /dev/null +++ b/sdk-3.5/include/Core/System/CharAttr.h @@ -0,0 +1,128 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CharAttr.h + * + * Description: + * This file defines character classification and character + * conversion macros + * + * History: + * April 21, 1995 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __CHARATTR_H__ +#define __CHARATTR_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + +// Remember that sizeof(0x0D) == 2 because 0x0D is treated like an int. The +// same is true of sizeof('a'), sizeof('\0'), and sizeof(chrNull). For this +// reason it's safest to use the sizeOf7BitChar macro to document buffer size +// and string length calcs. Note that this can only be used with low-ascii +// characters, as anything else might be the high byte of a double-byte char. + +#define sizeOf7BitChar(c) 1 + +#ifdef NON_INTERNATIONAL +#define sizeofchar(c) sizeof((char) (c)) +#define lastAsciiChr 0x00FF +#else +#define sizeofchar(c) _Obsolete__use_sizeOf7BitChar +#define lastAsciiChr _Obsolete__lastAsciiChr_does_not_work_for_Japanese +#endif + +// Character attribute code bits. + +#define _XA 0x0200 // extra alphabetic +#define _XS 0x0100 // extra space +#define _BB 0x0080 // BEL, BS, etc. +#define _CN 0x0040 // CR, FF, HT, NL, VT +#define _DI 0x0020 // '0'-'9' +#define _LO 0x0010 // 'a'-'z' and lowercase extended chars. +#define _PU 0x0008 // punctuation +#define _SP 0x0004 // space +#define _UP 0x0002 // 'A'-'Z' and uppercase extended chars. +#define _XD 0x0001 // '0'-'9', 'A'-'F', 'a'-'f' + + +// These macros have all been deprecated and replaced by corresponding TxtCharXXXX +// macros found in TextMgr.h. The main problem is that these all assume 8-bit character +// codes, and thus won't work with Shift JIS and other multi-byte encodings. + +// Character classification macros. + +#ifdef NON_INTERNATIONAL +#define IsAscii(c) (c <= 255) +#define IsAlNum(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_UP|_XA)) +#define IsAlpha(attr,c) (attr[(UInt8)(c)] & (_LO|_UP|_XA)) +#define IsCntrl(attr,c) (attr[(UInt8)(c)] & (_BB|_CN)) +#define IsDigit(attr,c) (attr[(UInt8)(c)] & _DI) +#define IsGraph(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_PU|_UP|_XA)) +#define IsLower(attr,c) (attr[(UInt8)(c)] & _LO) +#define IsPrint(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_PU|_SP|_UP|_XA)) +#define IsPunct(attr,c) (attr[(UInt8)(c)] & _PU) +#define IsSpace(attr,c) (attr[(UInt8)(c)] & (_CN|_SP|_XS)) +#define IsUpper(attr,c) (attr[(UInt8)(c)] & _UP) +#define IsHex(attr,c) (attr[(UInt8)(c)] & _XD) +#define IsDelim(attr,c) (attr[(UInt8)(c)] & _SP|_PU) +#else +#define IsAscii(c) _Obsolete__use_TxtCharIsValid +#define IsAlNum(attr,c) _Obsolete__use_TxtCharIsAlNum +#define IsAlpha(attr,c) _Obsolete__use_TxtCharIsAlpha +#define IsCntrl(attr,c) _Obsolete__use_TxtCharIsCntrl +#define IsDigit(attr,c) _Obsolete__use_TxtCharIsDigit +#define IsGraph(attr,c) _Obsolete__use_TxtCharIsGraph +#define IsLower(attr,c) _Obsolete__use_TxtCharIsLower +#define IsPrint(attr,c) _Obsolete__use_TxtCharIsPrint +#define IsPunct(attr,c) _Obsolete__use_TxtCharIsPunct +#define IsSpace(attr,c) _Obsolete__use_TxtCharIsSpace +#define IsUpper(attr,c) _Obsolete__use_TxtCharIsUpper +#define IsHex(attr,c) _Obsolete__use_TxtCharIsHex +#define IsDelim(attr,c) _Obsolete__use_TxtCharIsDelim +#endif + +// This macro is deprecated because it relies on character code ranges, versus checking +// to ensure that the keydown event has the command bit set in the modifiers field. Use +// the TxtCharIsHardKey macro found in TextMgr.h. + +#ifdef NON_INTERNATIONAL +#define ChrIsHardKey(c) ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr)) +#else +#define ChrIsHardKey(c) _Obsolete__use_TxtCharIsHardKey +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// In 3.1 and later versions of Palm OS, these routines have all been replaced by new +// Text Manager routines found in TextMgr.h + +#ifdef NON_INTERNATIONAL +const UInt16 *GetCharAttr (void) + SYS_TRAP(sysTrapGetCharAttr); + +const UInt8 *GetCharSortValue (void) + SYS_TRAP(sysTrapGetCharSortValue); + +const UInt8 *GetCharCaselessValue (void) + SYS_TRAP(sysTrapGetCharCaselessValue); +#else +#define GetCharAttr() _Obsolete__use_TxtCharIs_macros +#define GetCharSortValue() _Obsolete__use_TxtCompare +#define GetCharCaselessValue() _Obsolete__use_TxtCaselessCompare +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* __CHARATTR_H__ */ + diff --git a/sdk-3.5/include/Core/System/CharLatin.h b/sdk-3.5/include/Core/System/CharLatin.h new file mode 100644 index 0000000..e553515 --- /dev/null +++ b/sdk-3.5/include/Core/System/CharLatin.h @@ -0,0 +1,342 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CharLatin.h + * + * Description: + * This file defines the characters found in the Palm OS Latin + * character encoding, which is based on the Microsoft code page + * 1252 character encoding (Microsoft extension to ISO 8859-1 + * character encoding). + * + * History: + * March 5th, 1998 Created by Ken Krugler + * + *****************************************************************************/ + +#ifdef NON_INTERNATIONAL + +#ifndef __CHARLATIN_H__ +#define __CHARLATIN_H__ + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Characters found in Chars.h are guaranteed to exist in the regular +// (stdFont, boldFont, largeFont, largeBoldFont) fonts on the device, +// even if the character encoding supported by the device is not Latin. + +// The characters listed below are those from the Palm OS Latin character +// encoding which are not part of every possible character encoding that +// will be supported by the Palm OS, and thus should ONLY be used when +// you have first verified that the device's character encoding is +// +// Characters that are part of code page 1252, but not guaranteed +// to exist in every possible PalmOS encoding. These names are based on +// the Unicode 2.0 standard. + +#define chrReverseSolidus 0x005C // Is yen char in Japanese fonts. + +#define chrEuroSign 0x0080 // Was numeric space (valid thru 3.2) +// Undefined 0x0081 +#define chrSingleLow9QuotationMark 0x0082 +#define chrSmall_F_Hook 0x0083 +#define chrDoubleLow9QuotationMark 0x0084 +#define chrHorizontalEllipsis 0x0085 // Also at 0x18 in 3.1 and later roms. +#define chrDagger 0x0086 +#define chrDoubleDagger 0x0087 +#define chrModifierCircumflexAccent 0x0088 +#define chrPerMilleSign 0x0089 +#define chrCapital_S_Caron 0x008A +#define chrSingleLeftPointingAngleQuotationMark 0x008B +#define chrCapital_OE 0x008C +// Undefined 0x008D // Was diamondChr (valid thru 3.0) +// Undefined 0x008E // Was clubChr (valid thru 3.0) + // Will become chrCapital_Z_Caron +// Undefined 0x008F // Was heartChr (valid thru 3.0) +// Undefined 0x0090 // Was spadeChr (valid thru 3.0) +#define chrLeftSingleQuotationMark 0x0091 +#define chrRightSingleQuotationMark 0x0092 +#define chrLeftDoubleQuotationMark 0x0093 +#define chrRightDoubleQuotationMark 0x0094 +#define chrBullet 0x0095 +#define chrEnDash 0x0096 +#define chrEmDash 0x0097 +#define chrSmallTilde 0x0098 +#define chrTradeMarkSign 0x0099 +#define chrSmall_S_Caron 0x009A +#define chrSingleRightPointingAngleQuotationMark 0x009B +#define chrSmall_OE 0x009C +// Undefined 0x009D // Was command stroke (valid thru 3.0) +// Undefined 0x009E // Was shortcut stroke (valid thru 3.0) + // Will become chrSmall_Z_Caron +#define chrCapital_Y_Diaeresis 0x009F +#define chrNoBreakSpace 0x00A0 +#define chrInvertedExclamationMark 0x00A1 +#define chrCentSign 0x00A2 +#define chrPoundSign 0x00A3 +#define chrCurrencySign 0x00A4 +#define chrYenSign 0x00A5 +#define chrBrokenBar 0x00A6 +#define chrSectionSign 0x00A7 +#define chrDiaeresis 0x00A8 +#define chrCopyrightSign 0x00A9 +#define chrFeminineOrdinalIndicator 0x00AA +#define chrLeftPointingDoubleAngleQuotationMark 0x00AB +#define chrNotSign 0x00AC +#define chrSoftHyphen 0x00AD +#define chrRegisteredSign 0x00AE +#define chrMacron 0x00AF +#define chrDegreeSign 0x00B0 +#define chrPlusMinusSign 0x00B1 +#define chrSuperscriptTwo 0x00B2 +#define chrSuperscriptThree 0x00B3 +#define chrAcuteAccent 0x00B4 +#define chrMicroSign 0x00B5 +#define chrPilcrowSign 0x00B6 +#define chrMiddleDot 0x00B7 +#define chrCedilla 0x00B8 +#define chrSuperscriptOne 0x00B9 +#define chrMasculineOrdinalIndicator 0x00BA +#define chrRightPointingDoubleAngleQuotationMark 0x00BB +#define chrVulgarFractionOneQuarter 0x00BC +#define chrVulgarFractionOneHalf 0x00BD +#define chrVulgarFractionThreeQuarters 0x00BE +#define chrInvertedQuestionMark 0x00BF +#define chrCapital_A_Grave 0x00C0 +#define chrCapital_A_Acute 0x00C1 +#define chrCapital_A_Circumflex 0x00C2 +#define chrCapital_A_Tilde 0x00C3 +#define chrCapital_A_Diaeresis 0x00C4 +#define chrCapital_A_RingAbove 0x00C5 +#define chrCapital_AE 0x00C6 +#define chrCapital_C_Cedilla 0x00C7 +#define chrCapital_E_Grave 0x00C8 +#define chrCapital_E_Acute 0x00C9 +#define chrCapital_E_Circumflex 0x00CA +#define chrCapital_E_Diaeresis 0x00CB +#define chrCapital_I_Grave 0x00CC +#define chrCapital_I_Acute 0x00CD +#define chrCapital_I_Circumflex 0x00CE +#define chrCapital_I_Diaeresis 0x00CF +#define chrCapital_Eth 0x00D0 +#define chrCapital_N_Tilde 0x00D1 +#define chrCapital_O_Grave 0x00D2 +#define chrCapital_O_Acute 0x00D3 +#define chrCapital_O_Circumflex 0x00D4 +#define chrCapital_O_Tilde 0x00D5 +#define chrCapital_O_Diaeresis 0x00D6 +#define chrMultiplicationSign 0x00D7 +#define chrCapital_O_Stroke 0x00D8 +#define chrCapital_U_Grave 0x00D9 +#define chrCapital_U_Acute 0x00DA +#define chrCapital_U_Circumflex 0x00DB +#define chrCapital_U_Diaeresis 0x00DC +#define chrCapital_Y_Acute 0x00DD +#define chrCapital_Thorn 0x00DE +#define chrSmall_SharpS 0x00DF +#define chrSmall_A_Grave 0x00E0 +#define chrSmall_A_Acute 0x00E1 +#define chrSmall_A_Circumflex 0x00E2 +#define chrSmall_A_Tilde 0x00E3 +#define chrSmall_A_Diaeresis 0x00E4 +#define chrSmall_A_RingAbove 0x00E5 +#define chrSmall_AE 0x00E6 +#define chrSmall_C_Cedilla 0x00E7 +#define chrSmall_E_Grave 0x00E8 +#define chrSmall_E_Acute 0x00E9 +#define chrSmall_E_Circumflex 0x00EA +#define chrSmall_E_Diaeresis 0x00EB +#define chrSmall_I_Grave 0x00EC +#define chrSmall_I_Acute 0x00ED +#define chrSmall_I_Circumflex 0x00EE +#define chrSmall_I_Diaeresis 0x00EF +#define chrSmall_Eth 0x00F0 +#define chrSmall_N_Tilde 0x00F1 +#define chrSmall_O_Grave 0x00F2 +#define chrSmall_O_Acute 0x00F3 +#define chrSmall_O_Circumflex 0x00F4 +#define chrSmall_O_Tilde 0x00F5 +#define chrSmall_O_Diaeresis 0x00F6 +#define chrDivisionSign 0x00F7 +#define chrSmall_O_Stroke 0x00F8 +#define chrSmall_U_Grave 0x00F9 +#define chrSmall_U_Acute 0x00FA +#define chrSmall_U_Circumflex 0x00FB +#define chrSmall_U_Diaeresis 0x00FC +#define chrSmall_Y_Acute 0x00FD +#define chrSmall_Thorn 0x00FE +#define chrSmall_Y_Diaeresis 0x00FF + +// Alternative names for some characters. + +#define chrBackslash chrReverseSolidus; +#define chrNonBreakingSpace chrNoBreakSpace; + +// Old character names. + +#define lowSingleCommaQuoteChr chrSingleLow9QuotationMark // 0x0082 +#define scriptFChr chrSmall_F_Hook // 0x0083 +#define lowDblCommaQuoteChr chrDoubleLow9QuotationMark // 0x0084 +#define daggerChr chrDagger // 0x0086 +#define dblDaggerChr chrDoubleDagger // 0x0087 +#define circumflexChr chrModifierCircumflexAccent // 0x0088 +#define perMilleChr chrPerMilleSign // 0x0089 +#define upSHacekChr chrCapital_S_Caron // 0x008A +#define leftSingleGuillemetChr chrSingleLeftPointingAngleQuotationMark // 0x008B +#define upOEChr chrCapital_OE // 0x008C +#define singleOpenCommaQuoteChr chrLeftSingleQuotationMark // 0x0091 +#define singleCloseCommaQuoteChr chrRightSingleQuotationMark // 0x0092 +#define dblOpenCommaQuoteChr chrLeftDoubleQuotationMark // 0x0093 +#define dblCloseCommaQuoteChr chrRightDoubleQuotationMark // 0x0094 +#define bulletChr chrBullet // 0x0095 +#define enDashChr chrEnDash // 0x0096 +#define emDashChr chrEmDash // 0x0097 +#define spacingTildeChr chrSmallTilde // 0x0098 +#define trademarkChr chrTradeMarkSign // 0x0099 +#define lowSHacekChr chrSmall_S_Caron // 0x009A +#define rightSingleGuillemetChr chrSingleRightPointingAngleQuotationMark // 0x009B +#define lowOEChr chrSmall_OE // 0x009C +#define upYDiaeresisChr chrCapital_Y_Diaeresis // 0x009F +#define nonBreakSpaceChr chrNoBreakSpace // 0x00A0 +#define invertedExclamationChr chrInvertedExclamationMark // 0x00A1 +#define centChr chrCentSign // 0x00A2 +#define poundChr chrPoundSign // 0x00A3 +#define currencyChr chrCurrencySign // 0x00A4 +#define yenChr chrYenSign // 0x00A5 +#define brokenVertBarChr chrBrokenBar // 0x00A6 +#define sectionChr chrSectionSign // 0x00A7 +#define spacingDiaeresisChr chrDiaeresis // 0x00A8 +#define copyrightChr chrCopyrightSign // 0x00A9 +#define feminineOrdinalChr chrFeminineOrdinalIndicator // 0x00AA +#define leftGuillemetChr chrLeftPointingDoubleAngleQuotationMark // 0x00AB +#define notChr chrNotSign // 0x00AC +#define softHyphenChr chrSoftHyphen // 0x00AD +#define registeredChr chrRegisteredSign // 0x00AE +#define spacingMacronChr chrMacron // 0x00AF +#define degreeChr chrDegreeSign // 0x00B0 +#define plusMinusChr chrPlusMinusSign // 0x00B1 +#define superscript2Chr chrSuperscriptTwo // 0x00B2 +#define superscript3Chr chrSuperscriptThree // 0x00B3 +#define spacingAcuteChr chrAcuteAccent // 0x00B4 +#define microChr chrMicroSign // 0x00B5 +#define paragraphChr chrPilcrowSign // 0x00B6 +#define middleDotChr chrMiddleDot // 0x00B7 +#define spacingCedillaChr chrCedilla // 0x00B8 +#define superscript1Chr chrSuperscriptOne // 0x00B9 +#define masculineOrdinalChr chrMasculineOrdinalIndicator // 0x00BA +#define rightGuillemetChr chrRightPointingDoubleAngleQuotationMark // 0x00BB +#define fractOneQuarterChr chrVulgarFractionOneQuarter // 0x00BC +#define fractOneHalfChr chrVulgarFractionOneHalf // 0x00BD +#define fractThreeQuartersChr chrVulgarFractionThreeQuarters // 0x00BE +#define invertedQuestionChr chrInvertedQuestionMark // 0x00BF +#define upAGraveChr chrCapital_A_Grave // 0x00C0 +#define upAAcuteChr chrCapital_A_Acute // 0x00C1 +#define upACircumflexChr chrCapital_A_Circumflex // 0x00C2 +#define upATildeChr chrCapital_A_Tilde // 0x00C3 +#define upADiaeresisChr chrCapital_A_Diaeresis // 0x00C4 +#define upARingChr chrCapital_A_RingAbove // 0x00C5 +#define upAEChr chrCapital_AE // 0x00C6 +#define upCCedillaChr chrCapital_C_Cedilla // 0x00C7 +#define upEGraveChr chrCapital_E_Grave // 0x00C8 +#define upEAcuteChr chrCapital_E_Acute // 0x00C9 +#define upECircumflexChr chrCapital_E_Circumflex // 0x00CA +#define upEDiaeresisChr chrCapital_E_Diaeresis // 0x00CB +#define upIGraveChr chrCapital_I_Grave // 0x00CC +#define upIAcuteChr chrCapital_I_Acute // 0x00CD +#define upICircumflexChr chrCapital_I_Circumflex // 0x00CE +#define upIDiaeresisChr chrCapital_I_Diaeresis // 0x00CF +#define upEthChr chrCapital_Eth // 0x00D0 +#define upNTildeChr chrCapital_N_Tilde // 0x00D1 +#define upOGraveChr chrCapital_O_Grave // 0x00D2 +#define upOAcuteChr chrCapital_O_Acute // 0x00D3 +#define upOCircumflexChr chrCapital_O_Circumflex // 0x00D4 +#define upOTildeChr chrCapital_O_Tilde // 0x00D5 +#define upODiaeresisChr chrCapital_O_Diaeresis // 0x00D6 +#define multiplyChr chrMultiplicationSign // 0x00D7 +#define upOSlashChr chrCapital_O_Stroke // 0x00D8 +#define upUGraveChr chrCapital_U_Grave // 0x00D9 +#define upUAcuteChr chrCapital_U_Acute // 0x00DA +#define upUCircumflexChr chrCapital_U_Circumflex // 0x00DB +#define upUDiaeresisChr chrCapital_U_Diaeresis // 0x00DC +#define upYAcuteChr chrCapital_Y_Acute // 0x00DD +#define upThorn chrCapital_Thorn // 0x00DE +#define lowSharpSChr chrSmall_SharpS // 0x00DF +#define lowAGraveChr chrSmall_A_Grave // 0x00E0 +#define lowAAcuteChr chrSmall_A_Acute // 0x00E1 +#define lowACircumflexChr chrSmall_A_Circumflex // 0x00E2 +#define lowATildeChr chrSmall_A_Tilde // 0x00E3 +#define lowADiaeresisChr chrSmall_A_Diaeresis // 0x00E4 +#define lowARingChr chrSmall_A_RingAbove // 0x00E5 +#define lowAEChr chrSmall_AE // 0x00E6 +#define lowCCedillaChr chrSmall_C_Cedilla // 0x00E7 +#define lowEGraveChr chrSmall_E_Grave // 0x00E8 +#define lowEAcuteChr chrSmall_E_Acute // 0x00E9 +#define lowECircumflexChr chrSmall_E_Circumflex // 0x00EA +#define lowEDiaeresisChr chrSmall_E_Diaeresis // 0x00EB +#define lowIGraveChr chrSmall_I_Grave // 0x00EC +#define lowIAcuteChr chrSmall_I_Acute // 0x00ED +#define lowICircumflexChr chrSmall_I_Circumflex // 0x00EE +#define lowIDiaeresisChr chrSmall_I_Diaeresis // 0x00EF +#define lowEthChr chrSmall_Eth // 0x00F0 +#define lowNTildeChr chrSmall_N_Tilde // 0x00F1 +#define lowOGraveChr chrSmall_O_Grave // 0x00F2 +#define lowOAcuteChr chrSmall_O_Acute // 0x00F3 +#define lowOCircumflexChr chrSmall_O_Circumflex // 0x00F4 +#define lowOTildeChr chrSmall_O_Tilde // 0x00F5 +#define lowODiaeresisChr chrSmall_O_Diaeresis // 0x00F6 +#define divideChr chrDivisionSign // 0x00F7 +#define lowOSlashChr chrSmall_O_Stroke // 0x00F8 +#define lowUGraveChr chrSmall_U_Grave // 0x00F9 +#define lowUAcuteChr chrSmall_U_Acute // 0x00FA +#define lowUCircumflexChr chrSmall_U_Circumflex // 0x00FB +#define lowUDiaeresisChr chrSmall_U_Diaeresis // 0x00FC +#define lowYAcuteChr chrSmall_Y_Acute // 0x00FD +#define lowThorn chrSmall_Thorn // 0x00FE +#define lowYDiaeresisChr chrSmall_Y_Diaeresis // 0x00FF + +// The horizEllipsisChr (0x85) still exists in the font, but (in 3.1 and later roms) +// has been duplicated at location 0x18, so that it will be available with all future +// character encodings. If you are running on pre-3.1 roms, then you should use the +// chrHorizontalEllipsis character constant name (0x85), otherwise use chrEllipsis (0x18). +// The ChrHorizEllipsis macro in Chars.h can be used to determine the correct character code. + +#define horizEllipsisChr _Obsolete__use_ChrHorizEllipsis_macro + +// The following characters were moved in the four standard fonts with the +// 3.1 release of PalmOS; they still exist in their old positions in the +// font, but eventually will be removed: +// +// Old character name Old position New character name New position +// +// numericSpaceChr 0x80 chrNumericSpace 0x19 +// commandStrokeChr 0x9D chrCommandStroke 0x16 +// shortcutStrokeChr 0x9E chrShortcutStroke 0x17 + +#define numericSpaceChrV30 0x80 // ** COPIED TO 0x19; will be removed ** +#define commandStrokeChrV30 0x9D // ** COPIED TO 0x16; will be removed ** +#define shortcutStrokeChrV30 0x9E // ** COPIED TO 0x17; will be removed ** + +#define numericSpaceChr _Obsolete__use_ChrNumericSpace_macro +#define commandStrokeChr _Obsolete__use_commandStrokeChrV30_or_chrCommandStroke +#define shortcutStrokeChr _Obsolete__use_shortcutStrokeChrV30_or_chrShortcutStroke + +// The following characters were removed from the four standard fonts and +// placed in the 9pt symbol font (see Chars.h). +// +// diamondChr 0x8D +// clubChr 0x8E +// heartChr 0x8F +// spadeChr 0x90 + +#define diamondChrV30 0x8D // As of PalmOS v3.2, these characters are +#define clubChrV30 0x8E // now available in the Symbol-9 font. They +#define heartChrV30 0x8F // still appear in the regular fonts for now, +#define spadeChrV30 0x90 // but they WILL be removed in a future release. + +#endif // __CHARLATIN_H__ +#endif // NON_INTERNATIONAL + diff --git a/sdk-3.5/include/Core/System/CharShiftJIS.h b/sdk-3.5/include/Core/System/CharShiftJIS.h new file mode 100644 index 0000000..e4675b7 --- /dev/null +++ b/sdk-3.5/include/Core/System/CharShiftJIS.h @@ -0,0 +1,845 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CharShiftJIS.h + * + * Description: + * Header file for Shift-JIS (code page 932) Japanese character + * encoding. These are based on Windows-J implementation of the + * Shift-JIS standard. + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 12 Mar 98 kwk New today. + * 06 Apr 98 kwk Reverted back to #define instead of const values. + * 07 Apr 98 kwk Added TxtCharIsHiragana & TxtCharIsKatakana macros. + * 09 Apr 98 kwk Made this entire file conditional on NON_INTERNATIONAL. + * 15 Apr 98 kwk Filled out full set of character names (from Unicode + * 2.0 standard). + * 17 Apr 98 kwk Resolved duplicated names (thanks Microsoft). + * 28 May 98 kwk Put in horizEllipsisChr & numericSpaceChr. + * 29 Jun 98 kwk Changed name from CharCP932.h to CharShiftJIS.h. + * 15 Aug 98 CSS Reworked the extended character attribute #defines so + * we've now got a MicroSoft bit and a bunch of field + * values specifying kana, romaji, kanji, greek, etc. + * that don't overlap with the standard attributes. + * CSS Recoded the TxtCharIsHiragana/Katakana macros to + * AND with class mask and compare with class. + * 23 Aug 98 kwk Added charXClassKanaSound. + * + *****************************************************************************/ + +#ifdef NON_INTERNATIONAL + +#ifndef __CHARSHIFTJIS_H__ +#define __CHARSHIFTJIS_H__ + +/*********************************************************************** + * Public macros + ***********************************************************************/ + +#define TxtCharIsHiragana(ch) ( (TxtCharXAttr(ch) & charXClassMask) \ + == charXClassHiragana) +#define TxtCharIsKatakana(ch) ( (TxtCharXAttr(ch) & charXClassMask) \ + == charXClassKatakana) + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Transliteration operations that are not universal, but can be applied +// to Japanese text. + +#define translitOpFullToHalfKatakana (translitOpCustomBase+0) +#define translitOpHalfToFullKatakana (translitOpCustomBase+1) +#define translitOpFullToHalfRomaji (translitOpCustomBase+2) +#define translitOpHalfToFullRomaji (translitOpCustomBase+3) +#define translitOpKatakanaToHiragana (translitOpCustomBase+4) +#define translitOpHiraganaToKatakana (translitOpCustomBase+5) +#define translitOpCombineSoundMark (translitOpCustomBase+6) +#define translitOpDivideSoundMark (translitOpCustomBase+7) +#define translitOpRomajiToHiragana (translitOpCustomBase+8) +#define translitOpHiraganaToRomaji (translitOpCustomBase+9) + +// Extended character attributes for the Shift-JIS (CP932) code page. +// Note that these attributes have to be on an encoding basis, since +// they're shared across all languages which use this encoding. For +// Japanese there's only one language, so we're OK to encode wrapping +// info here, which is often language-dependent. + +#define charXAttrMask 0x00ff +#define charXAttrFollowing 0x0001 +#define charXAttrLeading 0x0002 +#define charXAttrBreak 0x0004 +#define charXAttrMicroSoft 0x0008 + +#define charXClassMask 0x0f00 +#define charXClassRomaji 0x0100 +#define charXClassHiragana 0x0200 +#define charXClassKatakana 0x0300 +#define charXClassKanaSound 0x0400 +#define charXClassGreek 0x0500 +#define charXClassCyrillic 0x0600 +#define charXClassKanjiL1 0x0700 +#define charXClassKanjiL2 0x0800 +#define charXClassKanjiOther 0x0900 +#define charXClassOther 0x0a00 +#define charXClassUndefined 0x0b00 + +// Some ShiftJIS-specific combinations. Every byte in a stream of +// ShiftJIS data must be either a single byte, a single/low byte, +// or a high/low byte. + +#define byteAttrSingleLow (byteAttrSingle | byteAttrLast) +#define byteAttrHighLow (byteAttrFirst | byteAttrLast) + +#define kFirstHighByte 0x81 +#define kFirstLowByte 0x40 + +// Character codes that are specific to Shift JIS. These names +// are generated from the Unicode 2.0 data files. + +#define chrYenSign 0x005c + +#define chrFirstSJISDoubleByte 0x8140 + +#define chrHalfwidthIdeographicFullStop 0x00A1 +#define chrHalfwidthLeftCornerBracket 0x00A2 +#define chrHalfwidthRightCornerBracket 0x00A3 +#define chrHalfwidthIdeographicComma 0x00A4 +#define chrHalfwidthKatakanaMiddleDot 0x00A5 +#define chrHalfwidthKatakana_WO 0x00A6 +#define chrHalfwidthKatakanaSmall_A 0x00A7 +#define chrHalfwidthKatakanaSmall_I 0x00A8 +#define chrHalfwidthKatakanaSmall_U 0x00A9 +#define chrHalfwidthKatakanaSmall_E 0x00AA +#define chrHalfwidthKatakanaSmall_O 0x00AB +#define chrHalfwidthKatakanaSmall_YA 0x00AC +#define chrHalfwidthKatakanaSmall_YU 0x00AD +#define chrHalfwidthKatakanaSmall_YO 0x00AE +#define chrHalfwidthKatakanaSmall_TU 0x00AF +#define chrHalfwidthKatakanaHiraganaProlongedSoundMark 0x00B0 +#define chrHalfwidthKatakana_A 0x00B1 +#define chrHalfwidthKatakana_I 0x00B2 +#define chrHalfwidthKatakana_U 0x00B3 +#define chrHalfwidthKatakana_E 0x00B4 +#define chrHalfwidthKatakana_O 0x00B5 +#define chrHalfwidthKatakana_KA 0x00B6 +#define chrHalfwidthKatakana_KI 0x00B7 +#define chrHalfwidthKatakana_KU 0x00B8 +#define chrHalfwidthKatakana_KE 0x00B9 +#define chrHalfwidthKatakana_KO 0x00BA +#define chrHalfwidthKatakana_SA 0x00BB +#define chrHalfwidthKatakana_SI 0x00BC +#define chrHalfwidthKatakana_SU 0x00BD +#define chrHalfwidthKatakana_SE 0x00BE +#define chrHalfwidthKatakana_SO 0x00BF +#define chrHalfwidthKatakana_TA 0x00C0 +#define chrHalfwidthKatakana_TI 0x00C1 +#define chrHalfwidthKatakana_TU 0x00C2 +#define chrHalfwidthKatakana_TE 0x00C3 +#define chrHalfwidthKatakana_TO 0x00C4 +#define chrHalfwidthKatakana_NA 0x00C5 +#define chrHalfwidthKatakana_NI 0x00C6 +#define chrHalfwidthKatakana_NU 0x00C7 +#define chrHalfwidthKatakana_NE 0x00C8 +#define chrHalfwidthKatakana_NO 0x00C9 +#define chrHalfwidthKatakana_HA 0x00CA +#define chrHalfwidthKatakana_HI 0x00CB +#define chrHalfwidthKatakana_HU 0x00CC +#define chrHalfwidthKatakana_HE 0x00CD +#define chrHalfwidthKatakana_HO 0x00CE +#define chrHalfwidthKatakana_MA 0x00CF +#define chrHalfwidthKatakana_MI 0x00D0 +#define chrHalfwidthKatakana_MU 0x00D1 +#define chrHalfwidthKatakana_ME 0x00D2 +#define chrHalfwidthKatakana_MO 0x00D3 +#define chrHalfwidthKatakana_YA 0x00D4 +#define chrHalfwidthKatakana_YU 0x00D5 +#define chrHalfwidthKatakana_YO 0x00D6 +#define chrHalfwidthKatakana_RA 0x00D7 +#define chrHalfwidthKatakana_RI 0x00D8 +#define chrHalfwidthKatakana_RU 0x00D9 +#define chrHalfwidthKatakana_RE 0x00DA +#define chrHalfwidthKatakana_RO 0x00DB +#define chrHalfwidthKatakana_WA 0x00DC +#define chrHalfwidthKatakana_N 0x00DD +#define chrHalfwidthKatakanaVoicedSoundMark 0x00DE +#define chrHalfwidthKatakanaSemiVoicedSoundMark 0x00DF + +#define chrIdeographicSpace 0x8140 +#define chrIdeographicComma 0x8141 +#define chrIdeographicFullStop 0x8142 +#define chrFullwidthComma 0x8143 +#define chrFullwidthFullStop 0x8144 +#define chrKatakanaMiddleDot 0x8145 +#define chrFullwidthColon 0x8146 +#define chrFullwidthSemicolon 0x8147 +#define chrFullwidthQuestionMark 0x8148 +#define chrFullwidthExclamationMark 0x8149 +#define chrKatakanaHiraganaVoicedSoundMark 0x814A +#define chrKatakanaHiraganaSemiVoicedSoundMark 0x814B +#define chrAcuteAccent 0x814C +#define chrFullwidthGraveAccent 0x814D +#define chrDiaeresis 0x814E +#define chrFullwidthCircumflexAccent 0x814F +#define chrFullwidthMacron 0x8150 +#define chrFullwidthLowLine 0x8151 +#define chrKatakanaIterationMark 0x8152 +#define chrKatakanaVoicedIterationMark 0x8153 +#define chrHiraganaIterationMark 0x8154 +#define chrHiraganaVoicedIterationMark 0x8155 +#define chrDittoMark 0x8156 +#define chrIdeographicIterationMark 0x8158 +#define chrIdeographicClosingMark 0x8159 +#define chrIdeographicNumberZero 0x815A +#define chrKatakanaHiraganaProlongedSoundMark 0x815B +#define chrHorizontalBar 0x815C +#define chrHyphen 0x815D +#define chrFullwidthSolidus 0x815E +#define chrFullwidthReverseSolidus 0x815F +#define chrFullwidthTilde 0x8160 +#define chrParallelTo 0x8161 +#define chrFullwidthVerticalLine 0x8162 +#define chrFullwidthHorizontalEllipsis 0x8163 +#define chrTwoDotLeader 0x8164 +#define chrLeftSingleQuotationMark 0x8165 +#define chrRightSingleQuotationMark 0x8166 +#define chrLeftDoubleQuotationMark 0x8167 +#define chrRightDoubleQuotationMark 0x8168 +#define chrFullwidthLeftParenthesis 0x8169 +#define chrFullwidthRightParenthesis 0x816A +#define chrLeftTortoiseShellBracket 0x816B +#define chrRightTortoiseShellBracket 0x816C +#define chrFullwidthLeftSquareBracket 0x816D +#define chrFullwidthRightSquareBracket 0x816E +#define chrFullwidthLeftCurlyBracket 0x816F +#define chrFullwidthRightCurlyBracket 0x8170 +#define chrLeftAngleBracket 0x8171 +#define chrRightAngleBracket 0x8172 +#define chrLeftDoubleAngleBracket 0x8173 +#define chrRightDoubleAngleBracket 0x8174 +#define chrLeftCornerBracket 0x8175 +#define chrRightCornerBracket 0x8176 +#define chrLeftWhiteCornerBracket 0x8177 +#define chrRightWhiteCornerBracket 0x8178 +#define chrLeftBlackLenticularBracket 0x8179 +#define chrRightBlackLenticularBracket 0x817A +#define chrFullwidthPlusSign 0x817B +#define chrFullwidthHyphenMinus 0x817C +#define chrPlusMinusSign 0x817D +#define chrMultiplicationSign 0x817E +#define chrDivisionSign 0x8180 +#define chrFullwidthEqualsSign 0x8181 +#define chrNotEqualTo 0x8182 +#define chrFullwidthLessThanSign 0x8183 +#define chrFullwidthGreaterThanSign 0x8184 +#define chrLessThanOverEqualTo 0x8185 +#define chrGreaterThanOverEqualTo 0x8186 +#define chrInfinity 0x8187 +#define chrTherefore 0x8188 +#define chrMaleSign 0x8189 +#define chrFemaleSign 0x818A +#define chrDegreeSign 0x818B +#define chrPrime 0x818C +#define chrDoublePrime 0x818D +#define chrDegreeCelsius 0x818E +#define chrFullwidthYenSign 0x818F +#define chrFullwidthDollarSign 0x8190 +#define chrFullwidthCentSign 0x8191 +#define chrFullwidthPoundSign 0x8192 +#define chrFullwidthPercentSign 0x8193 +#define chrFullwidthNumberSign 0x8194 +#define chrFullwidthAmpersand 0x8195 +#define chrFullwidthAsterisk 0x8196 +#define chrFullwidthCommercialAt 0x8197 +#define chrSectionSign 0x8198 +#define chrWhiteStar 0x8199 +#define chrBlackStar 0x819A +#define chrWhiteCircle 0x819B +#define chrBlackCircle 0x819C +#define chrBullseye 0x819D +#define chrWhiteDiamond 0x819E +#define chrBlackDiamond 0x819F +#define chrWhiteSquare 0x81A0 +#define chrBlackSquare 0x81A1 +#define chrWhiteUpPointingTriangle 0x81A2 +#define chrBlackUpPointingTriangle 0x81A3 +#define chrWhiteDownPointingTriangle 0x81A4 +#define chrBlackDownPointingTriangle 0x81A5 +#define chrReferenceMark 0x81A6 +#define chrPostalMark 0x81A7 +#define chrRightwardsArrow 0x81A8 +#define chrLeftwardsArrow 0x81A9 +#define chrUpwardsArrow 0x81AA +#define chrDownwardsArrow 0x81AB +#define chrGetaMark 0x81AC +#define chrElementOf 0x81B8 +#define chrContainsAsMember 0x81B9 +#define chrSubsetOfOrEqualTo 0x81BA +#define chrSupersetOfOrEqualTo 0x81BB +#define chrSubsetOf 0x81BC +#define chrSupersetOf 0x81BD +#define chrUnion 0x81BE +#define chrIntersection 0x81BF +#define chrLogicalAnd 0x81C8 +#define chrLogicalOr 0x81C9 +#define chrFullwidthNotSign 0x81CA +#define chrRightwardsDoubleArrow 0x81CB +#define chrLeftRightDoubleArrow 0x81CC +#define chrForAll 0x81CD +#define chrThereExists 0x81CE +#define chrAngle 0x81DA +#define chrUpTack 0x81DB +#define chrArc 0x81DC +#define chrPartialDifferential 0x81DD +#define chrNabla 0x81DE +#define chrIdenticalTo 0x81DF +#define chrApproximatelyEqualToOrTheImageOf 0x81E0 +#define chrMuchLessThan 0x81E1 +#define chrMuchGreaterThan 0x81E2 +#define chrSquareRoot 0x81E3 +#define chrReversedTilde 0x81E4 +#define chrProportionalTo 0x81E5 +#define chrBecause 0x81E6 +#define chrIntegral 0x81E7 +#define chrDoubleIntegral 0x81E8 +#define chrAngstromSign 0x81F0 +#define chrPerMilleSign 0x81F1 +#define chrMusicSharpSign 0x81F2 +#define chrMusicFlatSign 0x81F3 +#define chrEighthNote 0x81F4 +#define chrDagger 0x81F5 +#define chrDoubleDagger 0x81F6 +#define chrPilcrowSign 0x81F7 +#define chrLargeCircle 0x81FC + +#define chrFullwidthDigitZero 0x824F +#define chrFullwidthDigitOne 0x8250 +#define chrFullwidthDigitTwo 0x8251 +#define chrFullwidthDigitThree 0x8252 +#define chrFullwidthDigitFour 0x8253 +#define chrFullwidthDigitFive 0x8254 +#define chrFullwidthDigitSix 0x8255 +#define chrFullwidthDigitSeven 0x8256 +#define chrFullwidthDigitEight 0x8257 +#define chrFullwidthDigitNine 0x8258 +#define chrFullwidthCapital_A 0x8260 +#define chrFullwidthCapital_B 0x8261 +#define chrFullwidthCapital_C 0x8262 +#define chrFullwidthCapital_D 0x8263 +#define chrFullwidthCapital_E 0x8264 +#define chrFullwidthCapital_F 0x8265 +#define chrFullwidthCapital_G 0x8266 +#define chrFullwidthCapital_H 0x8267 +#define chrFullwidthCapital_I 0x8268 +#define chrFullwidthCapital_J 0x8269 +#define chrFullwidthCapital_K 0x826A +#define chrFullwidthCapital_L 0x826B +#define chrFullwidthCapital_M 0x826C +#define chrFullwidthCapital_N 0x826D +#define chrFullwidthCapital_O 0x826E +#define chrFullwidthCapital_P 0x826F +#define chrFullwidthCapital_Q 0x8270 +#define chrFullwidthCapital_R 0x8271 +#define chrFullwidthCapital_S 0x8272 +#define chrFullwidthCapital_T 0x8273 +#define chrFullwidthCapital_U 0x8274 +#define chrFullwidthCapital_V 0x8275 +#define chrFullwidthCapital_W 0x8276 +#define chrFullwidthCapital_X 0x8277 +#define chrFullwidthCapital_Y 0x8278 +#define chrFullwidthCapital_Z 0x8279 +#define chrFullwidthSmall_A 0x8281 +#define chrFullwidthSmall_B 0x8282 +#define chrFullwidthSmall_C 0x8283 +#define chrFullwidthSmall_D 0x8284 +#define chrFullwidthSmall_E 0x8285 +#define chrFullwidthSmall_F 0x8286 +#define chrFullwidthSmall_G 0x8287 +#define chrFullwidthSmall_H 0x8288 +#define chrFullwidthSmall_I 0x8289 +#define chrFullwidthSmall_J 0x828A +#define chrFullwidthSmall_K 0x828B +#define chrFullwidthSmall_L 0x828C +#define chrFullwidthSmall_M 0x828D +#define chrFullwidthSmall_N 0x828E +#define chrFullwidthSmall_O 0x828F +#define chrFullwidthSmall_P 0x8290 +#define chrFullwidthSmall_Q 0x8291 +#define chrFullwidthSmall_R 0x8292 +#define chrFullwidthSmall_S 0x8293 +#define chrFullwidthSmall_T 0x8294 +#define chrFullwidthSmall_U 0x8295 +#define chrFullwidthSmall_V 0x8296 +#define chrFullwidthSmall_W 0x8297 +#define chrFullwidthSmall_X 0x8298 +#define chrFullwidthSmall_Y 0x8299 +#define chrFullwidthSmall_Z 0x829A + +#define chrHiraganaSmall_A 0x829F +#define chrHiragana_A 0x82A0 +#define chrHiraganaSmall_I 0x82A1 +#define chrHiragana_I 0x82A2 +#define chrHiraganaSmall_U 0x82A3 +#define chrHiragana_U 0x82A4 +#define chrHiraganaSmall_E 0x82A5 +#define chrHiragana_E 0x82A6 +#define chrHiraganaSmall_O 0x82A7 +#define chrHiragana_O 0x82A8 +#define chrHiragana_KA 0x82A9 +#define chrHiragana_GA 0x82AA +#define chrHiragana_KI 0x82AB +#define chrHiragana_GI 0x82AC +#define chrHiragana_KU 0x82AD +#define chrHiragana_GU 0x82AE +#define chrHiragana_KE 0x82AF +#define chrHiragana_GE 0x82B0 +#define chrHiragana_KO 0x82B1 +#define chrHiragana_GO 0x82B2 +#define chrHiragana_SA 0x82B3 +#define chrHiragana_ZA 0x82B4 +#define chrHiragana_SI 0x82B5 +#define chrHiragana_ZI 0x82B6 +#define chrHiragana_SU 0x82B7 +#define chrHiragana_ZU 0x82B8 +#define chrHiragana_SE 0x82B9 +#define chrHiragana_ZE 0x82BA +#define chrHiragana_SO 0x82BB +#define chrHiragana_ZO 0x82BC +#define chrHiragana_TA 0x82BD +#define chrHiragana_DA 0x82BE +#define chrHiragana_TI 0x82BF +#define chrHiragana_DI 0x82C0 +#define chrHiraganaSmall_TU 0x82C1 +#define chrHiragana_TU 0x82C2 +#define chrHiragana_DU 0x82C3 +#define chrHiragana_TE 0x82C4 +#define chrHiragana_DE 0x82C5 +#define chrHiragana_TO 0x82C6 +#define chrHiragana_DO 0x82C7 +#define chrHiragana_NA 0x82C8 +#define chrHiragana_NI 0x82C9 +#define chrHiragana_NU 0x82CA +#define chrHiragana_NE 0x82CB +#define chrHiragana_NO 0x82CC +#define chrHiragana_HA 0x82CD +#define chrHiragana_BA 0x82CE +#define chrHiragana_PA 0x82CF +#define chrHiragana_HI 0x82D0 +#define chrHiragana_BI 0x82D1 +#define chrHiragana_PI 0x82D2 +#define chrHiragana_HU 0x82D3 +#define chrHiragana_BU 0x82D4 +#define chrHiragana_PU 0x82D5 +#define chrHiragana_HE 0x82D6 +#define chrHiragana_BE 0x82D7 +#define chrHiragana_PE 0x82D8 +#define chrHiragana_HO 0x82D9 +#define chrHiragana_BO 0x82DA +#define chrHiragana_PO 0x82DB +#define chrHiragana_MA 0x82DC +#define chrHiragana_MI 0x82DD +#define chrHiragana_MU 0x82DE +#define chrHiragana_ME 0x82DF +#define chrHiragana_MO 0x82E0 +#define chrHiraganaSmall_YA 0x82E1 +#define chrHiragana_YA 0x82E2 +#define chrHiraganaSmall_YU 0x82E3 +#define chrHiragana_YU 0x82E4 +#define chrHiraganaSmall_YO 0x82E5 +#define chrHiragana_YO 0x82E6 +#define chrHiragana_RA 0x82E7 +#define chrHiragana_RI 0x82E8 +#define chrHiragana_RU 0x82E9 +#define chrHiragana_RE 0x82EA +#define chrHiragana_RO 0x82EB +#define chrHiraganaSmall_WA 0x82EC +#define chrHiragana_WA 0x82ED +#define chrHiragana_WI 0x82EE +#define chrHiragana_WE 0x82EF +#define chrHiragana_WO 0x82F0 +#define chrHiragana_N 0x82F1 + +#define chrKatakanaSmall_A 0x8340 +#define chrKatakana_A 0x8341 +#define chrKatakanaSmall_I 0x8342 +#define chrKatakana_I 0x8343 +#define chrKatakanaSmall_U 0x8344 +#define chrKatakana_U 0x8345 +#define chrKatakanaSmall_E 0x8346 +#define chrKatakana_E 0x8347 +#define chrKatakanaSmall_O 0x8348 +#define chrKatakana_O 0x8349 +#define chrKatakana_KA 0x834A +#define chrKatakana_GA 0x834B +#define chrKatakana_KI 0x834C +#define chrKatakana_GI 0x834D +#define chrKatakana_KU 0x834E +#define chrKatakana_GU 0x834F +#define chrKatakana_KE 0x8350 +#define chrKatakana_GE 0x8351 +#define chrKatakana_KO 0x8352 +#define chrKatakana_GO 0x8353 +#define chrKatakana_SA 0x8354 +#define chrKatakana_ZA 0x8355 +#define chrKatakana_SI 0x8356 +#define chrKatakana_ZI 0x8357 +#define chrKatakana_SU 0x8358 +#define chrKatakana_ZU 0x8359 +#define chrKatakana_SE 0x835A +#define chrKatakana_ZE 0x835B +#define chrKatakana_SO 0x835C +#define chrKatakana_ZO 0x835D +#define chrKatakana_TA 0x835E +#define chrKatakana_DA 0x835F +#define chrKatakana_TI 0x8360 +#define chrKatakana_DI 0x8361 +#define chrKatakanaSmall_TU 0x8362 +#define chrKatakana_TU 0x8363 +#define chrKatakana_DU 0x8364 +#define chrKatakana_TE 0x8365 +#define chrKatakana_DE 0x8366 +#define chrKatakana_TO 0x8367 +#define chrKatakana_DO 0x8368 +#define chrKatakana_NA 0x8369 +#define chrKatakana_NI 0x836A +#define chrKatakana_NU 0x836B +#define chrKatakana_NE 0x836C +#define chrKatakana_NO 0x836D +#define chrKatakana_HA 0x836E +#define chrKatakana_BA 0x836F +#define chrKatakana_PA 0x8370 +#define chrKatakana_HI 0x8371 +#define chrKatakana_BI 0x8372 +#define chrKatakana_PI 0x8373 +#define chrKatakana_HU 0x8374 +#define chrKatakana_BU 0x8375 +#define chrKatakana_PU 0x8376 +#define chrKatakana_HE 0x8377 +#define chrKatakana_BE 0x8378 +#define chrKatakana_PE 0x8379 +#define chrKatakana_HO 0x837A +#define chrKatakana_BO 0x837B +#define chrKatakana_PO 0x837C +#define chrKatakana_MA 0x837D +#define chrKatakana_MI 0x837E +#define chrKatakana_MU 0x8380 +#define chrKatakana_ME 0x8381 +#define chrKatakana_MO 0x8382 +#define chrKatakanaSmall_YA 0x8383 +#define chrKatakana_YA 0x8384 +#define chrKatakanaSmall_YU 0x8385 +#define chrKatakana_YU 0x8386 +#define chrKatakanaSmall_YO 0x8387 +#define chrKatakana_YO 0x8388 +#define chrKatakana_RA 0x8389 +#define chrKatakana_RI 0x838A +#define chrKatakana_RU 0x838B +#define chrKatakana_RE 0x838C +#define chrKatakana_RO 0x838D +#define chrKatakanaSmall_WA 0x838E +#define chrKatakana_WA 0x838F +#define chrKatakana_WI 0x8390 +#define chrKatakana_WE 0x8391 +#define chrKatakana_WO 0x8392 +#define chrKatakana_N 0x8393 +#define chrKatakana_VU 0x8394 +#define chrKatakanaSmall_KA 0x8395 +#define chrKatakanaSmall_KE 0x8396 + +#define chrGreekCapitalAlpha 0x839F +#define chrGreekCapitalBeta 0x83A0 +#define chrGreekCapitalGamma 0x83A1 +#define chrGreekCapitalDelta 0x83A2 +#define chrGreekCapitalEpsilon 0x83A3 +#define chrGreekCapitalZeta 0x83A4 +#define chrGreekCapitalEta 0x83A5 +#define chrGreekCapitalTheta 0x83A6 +#define chrGreekCapitalIota 0x83A7 +#define chrGreekCapitalKappa 0x83A8 +#define chrGreekCapitalLamda 0x83A9 +#define chrGreekCapitalMu 0x83AA +#define chrGreekCapitalNu 0x83AB +#define chrGreekCapitalXi 0x83AC +#define chrGreekCapitalOmicron 0x83AD +#define chrGreekCapitalPi 0x83AE +#define chrGreekCapitalRho 0x83AF +#define chrGreekCapitalSigma 0x83B0 +#define chrGreekCapitalTau 0x83B1 +#define chrGreekCapitalUpsilon 0x83B2 +#define chrGreekCapitalPhi 0x83B3 +#define chrGreekCapitalChi 0x83B4 +#define chrGreekCapitalPsi 0x83B5 +#define chrGreekCapitalOmega 0x83B6 +#define chrGreekSmallAlpha 0x83BF +#define chrGreekSmallBeta 0x83C0 +#define chrGreekSmallGamma 0x83C1 +#define chrGreekSmallDelta 0x83C2 +#define chrGreekSmallEpsilon 0x83C3 +#define chrGreekSmallZeta 0x83C4 +#define chrGreekSmallEta 0x83C5 +#define chrGreekSmallTheta 0x83C6 +#define chrGreekSmallIota 0x83C7 +#define chrGreekSmallKappa 0x83C8 +#define chrGreekSmallLamda 0x83C9 +#define chrGreekSmallMu 0x83CA +#define chrGreekSmallNu 0x83CB +#define chrGreekSmallXi 0x83CC +#define chrGreekSmallOmicron 0x83CD +#define chrGreekSmallPi 0x83CE +#define chrGreekSmallRho 0x83CF +#define chrGreekSmallSigma 0x83D0 +#define chrGreekSmallTau 0x83D1 +#define chrGreekSmallUpsilon 0x83D2 +#define chrGreekSmallPhi 0x83D3 +#define chrGreekSmallChi 0x83D4 +#define chrGreekSmallPsi 0x83D5 +#define chrGreekSmallOmega 0x83D6 + +#define chrCyrillicCapital_A 0x8440 +#define chrCyrillicCapital_BE 0x8441 +#define chrCyrillicCapital_VE 0x8442 +#define chrCyrillicCapital_GHE 0x8443 +#define chrCyrillicCapital_DE 0x8444 +#define chrCyrillicCapital_IE 0x8445 +#define chrCyrillicCapital_IO 0x8446 +#define chrCyrillicCapital_ZHE 0x8447 +#define chrCyrillicCapital_ZE 0x8448 +#define chrCyrillicCapital_I 0x8449 +#define chrCyrillicCapitalShort_I 0x844A +#define chrCyrillicCapital_KA 0x844B +#define chrCyrillicCapital_EL 0x844C +#define chrCyrillicCapital_EM 0x844D +#define chrCyrillicCapital_EN 0x844E +#define chrCyrillicCapital_O 0x844F +#define chrCyrillicCapital_PE 0x8450 +#define chrCyrillicCapital_ER 0x8451 +#define chrCyrillicCapital_ES 0x8452 +#define chrCyrillicCapital_TE 0x8453 +#define chrCyrillicCapital_U 0x8454 +#define chrCyrillicCapital_EF 0x8455 +#define chrCyrillicCapital_HA 0x8456 +#define chrCyrillicCapital_TSE 0x8457 +#define chrCyrillicCapital_CHE 0x8458 +#define chrCyrillicCapital_SHA 0x8459 +#define chrCyrillicCapital_SHCHA 0x845A +#define chrCyrillicCapitalHardSign 0x845B +#define chrCyrillicCapital_YERU 0x845C +#define chrCyrillicCapitalSoftSign 0x845D +#define chrCyrillicCapital_E 0x845E +#define chrCyrillicCapital_YU 0x845F +#define chrCyrillicCapital_YA 0x8460 +#define chrCyrillicSmall_A 0x8470 +#define chrCyrillicSmall_BE 0x8471 +#define chrCyrillicSmall_VE 0x8472 +#define chrCyrillicSmall_GHE 0x8473 +#define chrCyrillicSmall_DE 0x8474 +#define chrCyrillicSmall_IE 0x8475 +#define chrCyrillicSmall_IO 0x8476 +#define chrCyrillicSmall_ZHE 0x8477 +#define chrCyrillicSmall_ZE 0x8478 +#define chrCyrillicSmall_I 0x8479 +#define chrCyrillicSmallShort_I 0x847A +#define chrCyrillicSmall_KA 0x847B +#define chrCyrillicSmall_EL 0x847C +#define chrCyrillicSmall_EM 0x847D +#define chrCyrillicSmall_EN 0x847E +#define chrCyrillicSmall_O 0x8480 +#define chrCyrillicSmall_PE 0x8481 +#define chrCyrillicSmall_ER 0x8482 +#define chrCyrillicSmall_ES 0x8483 +#define chrCyrillicSmall_TE 0x8484 +#define chrCyrillicSmall_U 0x8485 +#define chrCyrillicSmall_EF 0x8486 +#define chrCyrillicSmall_HA 0x8487 +#define chrCyrillicSmall_TSE 0x8488 +#define chrCyrillicSmall_CHE 0x8489 +#define chrCyrillicSmall_SHA 0x848A +#define chrCyrillicSmall_SHCHA 0x848B +#define chrCyrillicSmallHardSign 0x848C +#define chrCyrillicSmall_YERU 0x848D +#define chrCyrillicSmallSoftSign 0x848E +#define chrCyrillicSmall_E 0x848F +#define chrCyrillicSmall_YU 0x8490 +#define chrCyrillicSmall_YA 0x8491 + +#define chrBoxDrawingsLightHorizontal 0x849F +#define chrBoxDrawingsLightVertical 0x84A0 +#define chrBoxDrawingsLightDownAndRight 0x84A1 +#define chrBoxDrawingsLightDownAndLeft 0x84A2 +#define chrBoxDrawingsLightUpAndLeft 0x84A3 +#define chrBoxDrawingsLightUpAndRight 0x84A4 +#define chrBoxDrawingsLightVerticalAndRight 0x84A5 +#define chrBoxDrawingsLightDownAndHorizontal 0x84A6 +#define chrBoxDrawingsLightVerticalAndLeft 0x84A7 +#define chrBoxDrawingsLightUpAndHorizontal 0x84A8 +#define chrBoxDrawingsLightVerticalAndHorizontal 0x84A9 +#define chrBoxDrawingsHeavyHorizontal 0x84AA +#define chrBoxDrawingsHeavyVertical 0x84AB +#define chrBoxDrawingsHeavyDownAndRight 0x84AC +#define chrBoxDrawingsHeavyDownAndLeft 0x84AD +#define chrBoxDrawingsHeavyUpAndLeft 0x84AE +#define chrBoxDrawingsHeavyUpAndRight 0x84AF +#define chrBoxDrawingsHeavyVerticalAndRight 0x84B0 +#define chrBoxDrawingsHeavyDownAndHorizontal 0x84B1 +#define chrBoxDrawingsHeavyVerticalAndLeft 0x84B2 +#define chrBoxDrawingsHeavyUpAndHorizontal 0x84B3 +#define chrBoxDrawingsHeavyVerticalAndHorizontal 0x84B4 +#define chrBoxDrawingsVerticalHeavyAndRightLight 0x84B5 +#define chrBoxDrawingsDownLightAndHorizontalHeavy 0x84B6 +#define chrBoxDrawingsVerticalHeavyAndLeftLight 0x84B7 +#define chrBoxDrawingsUpLightAndHorizontalHeavy 0x84B8 +#define chrBoxDrawingsVerticalLightAndHorizontalHeavy 0x84B9 +#define chrBoxDrawingsVerticalLightAndRightHeavy 0x84BA +#define chrBoxDrawingsDownHeavyAndHorizontalLight 0x84BB +#define chrBoxDrawingsVerticalLightAndLeftHeavy 0x84BC +#define chrBoxDrawingsUpHeavyAndHorizontalLight 0x84BD +#define chrBoxDrawingsVerticalHeavyAndHorizontalLight 0x84BE + +#define chrCircledDigitOne 0x8740 +#define chrCircledDigitTwo 0x8741 +#define chrCircledDigitThree 0x8742 +#define chrCircledDigitFour 0x8743 +#define chrCircledDigitFive 0x8744 +#define chrCircledDigitSix 0x8745 +#define chrCircledDigitSeven 0x8746 +#define chrCircledDigitEight 0x8747 +#define chrCircledDigitNine 0x8748 +#define chrCircledNumberTen 0x8749 +#define chrCircledNumberEleven 0x874A +#define chrCircledNumberTwelve 0x874B +#define chrCircledNumberThirteen 0x874C +#define chrCircledNumberFourteen 0x874D +#define chrCircledNumberFifteen 0x874E +#define chrCircledNumberSixteen 0x874F +#define chrCircledNumberSeventeen 0x8750 +#define chrCircledNumberEighteen 0x8751 +#define chrCircledNumberNineteen 0x8752 +#define chrCircledNumberTwenty 0x8753 +#define chrRomanNumeralOne 0x8754 +#define chrRomanNumeralTwo 0x8755 +#define chrRomanNumeralThree 0x8756 +#define chrRomanNumeralFour 0x8757 +#define chrRomanNumeralFive 0x8758 +#define chrRomanNumeralSix 0x8759 +#define chrRomanNumeralSeven 0x875A +#define chrRomanNumeralEight 0x875B +#define chrRomanNumeralNine 0x875C +#define chrRomanNumeralTen 0x875D +#define chrSquareMiri 0x875F +#define chrSquareKiro 0x8760 +#define chrSquareSenti 0x8761 +#define chrSquareMeetoru 0x8762 +#define chrSquareGuramu 0x8763 +#define chrSquareTon 0x8764 +#define chrSquareAaru 0x8765 +#define chrSquareHekutaaru 0x8766 +#define chrSquareRittoru 0x8767 +#define chrSquareWatto 0x8768 +#define chrSquareKarorii 0x8769 +#define chrSquareDoru 0x876A +#define chrSquareSento 0x876B +#define chrSquarePaasento 0x876C +#define chrSquareMiribaaru 0x876D +#define chrSquarePeezi 0x876E +#define chrSquareMm 0x876F +#define chrSquareCm 0x8770 +#define chrSquareKm 0x8771 +#define chrSquareMg 0x8772 +#define chrSquareKg 0x8773 +#define chrSquareCc 0x8774 +#define chrSquareMSquared 0x8775 +#define chrSquareEraNameHeisei 0x877E +#define chrReversedDoublePrimeQuotationMark 0x8780 +#define chrLowDoublePrimeQuotationMark 0x8781 +#define chrNumeroSign 0x8782 +#define chrSquareKk 0x8783 +#define chrTelephoneSign 0x8784 +#define chrCircledIdeographHigh 0x8785 +#define chrCircledIdeographCentre 0x8786 +#define chrCircledIdeographLow 0x8787 +#define chrCircledIdeographLeft 0x8788 +#define chrCircledIdeographRight 0x8789 +#define chrParenthesizedIdeographStock 0x878A +#define chrParenthesizedIdeographHave 0x878B +#define chrParenthesizedIdeographRepresent 0x878C +#define chrSquareEraNameMeizi 0x878D +#define chrSquareEraNameTaisyou 0x878E +#define chrSquareEraNameSyouwa 0x878F +#define chrApproximatelyEqualToOrTheImageOfDup 0x8790 // Same as 0x81E0 +#define chrIdenticalToDup 0x8791 // Same as 0x81DF +#define chrIntegralDup 0x8792 // Same as 0x81E7 +#define chrContourIntegral 0x8793 +#define chrNArySummation 0x8794 +#define chrSquareRootDup 0x8795 // Same as 0x81E3 +#define chrUpTackDup 0x8796 // Same as 0x81DB +#define chrAngleDup 0x8797 // Same as 0x81DA +#define chrRightAngle 0x8798 +#define chrRightTriangle 0x8799 +#define chrBecauseDup 0x879A // Same as 0x81E6 +#define chrIntersectionDup 0x879B // Same as 0x81BF +#define chrUnionDup 0x879C // Same as 0x81BE + +#define chrSmallRomanNumeralOne 0xEEEF +#define chrSmallRomanNumeralTwo 0xEEF0 +#define chrSmallRomanNumeralThree 0xEEF1 +#define chrSmallRomanNumeralFour 0xEEF2 +#define chrSmallRomanNumeralFive 0xEEF3 +#define chrSmallRomanNumeralSix 0xEEF4 +#define chrSmallRomanNumeralSeven 0xEEF5 +#define chrSmallRomanNumeralEight 0xEEF6 +#define chrSmallRomanNumeralNine 0xEEF7 +#define chrSmallRomanNumeralTen 0xEEF8 +#define chrFullwidthNotSignDup 0xEEF9 // Same as 0x81CA +#define chrFullwidthBrokenBar 0xEEFA +#define chrFullwidthApostrophe 0xEEFB +#define chrFullwidthQuotationMark 0xEEFC + +#define chrSmallRomanNumeralOneDup 0xFA40 // Same as 0xEEEF +#define chrSmallRomanNumeralTwoDup 0xFA41 // Same as 0xEEF0 +#define chrSmallRomanNumeralThreeDup 0xFA42 // Same as 0xEEF1 +#define chrSmallRomanNumeralFourDup 0xFA43 // Same as 0xEEF2 +#define chrSmallRomanNumeralFiveDup 0xFA44 // Same as 0xEEF3 +#define chrSmallRomanNumeralSixDup 0xFA45 // Same as 0xEEF4 +#define chrSmallRomanNumeralSevenDup 0xFA46 // Same as 0xEEF5 +#define chrSmallRomanNumeralEightDup 0xFA47 // Same as 0xEEF6 +#define chrSmallRomanNumeralNineDup 0xFA48 // Same as 0xEEF7 +#define chrSmallRomanNumeralTenDup 0xFA49 // Same as 0xEEF8 +#define chrRomanNumeralOneDup 0xFA4A // Same as 0x8754 +#define chrRomanNumeralTwoDup 0xFA4B // Same as 0x8755 +#define chrRomanNumeralThreeDup 0xFA4C // Same as 0x8756 +#define chrRomanNumeralFourDup 0xFA4D // Same as 0x8757 +#define chrRomanNumeralFiveDup 0xFA4E // Same as 0x8758 +#define chrRomanNumeralSixDup 0xFA4F // Same as 0x8759 +#define chrRomanNumeralSevenDup 0xFA50 // Same as 0x875A +#define chrRomanNumeralEightDup 0xFA51 // Same as 0x875B +#define chrRomanNumeralNineDup 0xFA52 // Same as 0x875C +#define chrRomanNumeralTenDup 0xFA53 // Same as 0x875D +#define chrFullwidthNotSignDup2 0xFA54 // Same as 0xEEF9 & 0x81CA +#define chrFullwidthBrokenBarDup 0xFA55 // Same as 0xEEFA +#define chrFullwidthApostropheDup 0xFA56 // Same as 0xEEFB +#define chrFullwidthQuotationMarkDup 0xFA57 // Same as 0xEEFC +#define chrParenthesizedIdeographStockDup 0xFA58 // Same as 0x878A +#define chrNumeroSignDup 0xFA59 // Same as 0x8782 +#define chrTelephoneSignDup 0xFA5A // Same as 0x8784 +#define chrBecauseDup2 0xFA5B // Same as 0x81E6 & 0x879A + +#define chrLastSJISDoubleByte 0xFCFC + +// Alternative character names. + +#define chrChouon chrKatakanaHiraganaProlongedSoundMark + +// Old character names. + +#define yenChr chrYenSign + +#endif // __CHARSHIFTJIS_H__ + +#endif // NON_INTERNATIONAL + diff --git a/sdk-3.5/include/Core/System/Chars.h b/sdk-3.5/include/Core/System/Chars.h new file mode 100644 index 0000000..ebeeacf --- /dev/null +++ b/sdk-3.5/include/Core/System/Chars.h @@ -0,0 +1,412 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Chars.h + * + * Description: + * This file defines the characters in fonts. + * + * History: + * November 3, 1994 Created by Roger Flores + * 11/03/94 rsf Created by Roger Flores. + * 04/21/99 JFS Added list of virtual command key ranges reserved + * for use by licensees. + * 09/13/99 kwk Added vchrTsmMode. + * 10/28/99 kwk Defined vchrPageUp and vchrPageDown. + * + *****************************************************************************/ + +#ifndef __CHARS_H__ +#define __CHARS_H__ + +// Standard Unicode 2.0 names for the ascii characters. These exist in +// all of the text fonts, no matter what character encoding is being +// used by PalmOS. + +#define chrNull 0x0000 +#define chrStartOfHeading 0x0001 +#define chrStartOfText 0x0002 +#define chrEndOfText 0x0003 +#define chrEndOfTransmission 0x0004 +#define chrEnquiry 0x0005 +#define chrAcknowledge 0x0006 +#define chrBell 0x0007 +#define chrBackspace 0x0008 +#define chrHorizontalTabulation 0x0009 +#define chrLineFeed 0x000A +#define chrVerticalTabulation 0x000B +#define chrFormFeed 0x000C +#define chrCarriageReturn 0x000D +#define chrShiftOut 0x000E +#define chrShiftIn 0x000F +#define chrDataLinkEscape 0x0010 +#define chrDeviceControlOne 0x0011 +#define chrDeviceControlTwo 0x0012 +#define chrDeviceControlThree 0x0013 +#define chrDeviceControlFour 0x0014 +#define chrNegativeAcknowledge 0x0015 +#define chrSynchronousIdle 0x0016 +#define chrEndOfTransmissionBlock 0x0017 +#define chrCancel 0x0018 +#define chrEndOfMedium 0x0019 +#define chrSubstitute 0x001A +#define chrEscape 0x001B +#define chrFileSeparator 0x001C +#define chrGroupSeparator 0x001D +#define chrRecordSeparator 0x001E +#define chrUnitSeparator 0x001F +#define chrSpace 0x0020 +#define chrExclamationMark 0x0021 +#define chrQuotationMark 0x0022 +#define chrNumberSign 0x0023 +#define chrDollarSign 0x0024 +#define chrPercentSign 0x0025 +#define chrAmpersand 0x0026 +#define chrApostrophe 0x0027 +#define chrLeftParenthesis 0x0028 +#define chrRightParenthesis 0x0029 +#define chrAsterisk 0x002A +#define chrPlusSign 0x002B +#define chrComma 0x002C +#define chrHyphenMinus 0x002D +#define chrFullStop 0x002E +#define chrSolidus 0x002F +#define chrDigitZero 0x0030 +#define chrDigitOne 0x0031 +#define chrDigitTwo 0x0032 +#define chrDigitThree 0x0033 +#define chrDigitFour 0x0034 +#define chrDigitFive 0x0035 +#define chrDigitSix 0x0036 +#define chrDigitSeven 0x0037 +#define chrDigitEight 0x0038 +#define chrDigitNine 0x0039 +#define chrColon 0x003A +#define chrSemicolon 0x003B +#define chrLessThanSign 0x003C +#define chrEqualsSign 0x003D +#define chrGreaterThanSign 0x003E +#define chrQuestionMark 0x003F +#define chrCommercialAt 0x0040 +#define chrCapital_A 0x0041 +#define chrCapital_B 0x0042 +#define chrCapital_C 0x0043 +#define chrCapital_D 0x0044 +#define chrCapital_E 0x0045 +#define chrCapital_F 0x0046 +#define chrCapital_G 0x0047 +#define chrCapital_H 0x0048 +#define chrCapital_I 0x0049 +#define chrCapital_J 0x004A +#define chrCapital_K 0x004B +#define chrCapital_L 0x004C +#define chrCapital_M 0x004D +#define chrCapital_N 0x004E +#define chrCapital_O 0x004F +#define chrCapital_P 0x0050 +#define chrCapital_Q 0x0051 +#define chrCapital_R 0x0052 +#define chrCapital_S 0x0053 +#define chrCapital_T 0x0054 +#define chrCapital_U 0x0055 +#define chrCapital_V 0x0056 +#define chrCapital_W 0x0057 +#define chrCapital_X 0x0058 +#define chrCapital_Y 0x0059 +#define chrCapital_Z 0x005A +#define chrLeftSquareBracket 0x005B +// #define chrReverseSolidus 0x005C (not in Japanese fonts) +#define chrRightSquareBracket 0x005D +#define chrCircumflexAccent 0x005E +#define chrLowLine 0x005F +#define chrGraveAccent 0x0060 +#define chrSmall_A 0x0061 +#define chrSmall_B 0x0062 +#define chrSmall_C 0x0063 +#define chrSmall_D 0x0064 +#define chrSmall_E 0x0065 +#define chrSmall_F 0x0066 +#define chrSmall_G 0x0067 +#define chrSmall_H 0x0068 +#define chrSmall_I 0x0069 +#define chrSmall_J 0x006A +#define chrSmall_K 0x006B +#define chrSmall_L 0x006C +#define chrSmall_M 0x006D +#define chrSmall_N 0x006E +#define chrSmall_O 0x006F +#define chrSmall_P 0x0070 +#define chrSmall_Q 0x0071 +#define chrSmall_R 0x0072 +#define chrSmall_S 0x0073 +#define chrSmall_T 0x0074 +#define chrSmall_U 0x0075 +#define chrSmall_V 0x0076 +#define chrSmall_W 0x0077 +#define chrSmall_X 0x0078 +#define chrSmall_Y 0x0079 +#define chrSmall_Z 0x007A +#define chrLeftCurlyBracket 0x007B +#define chrVerticalLine 0x007C +#define chrRightCurlyBracket 0x007D +#define chrTilde 0x007E +#define chrDelete 0x007F + + +// Special meanings given to characters by the PalmOS +#define vchrPageUp chrVerticalTabulation // 0x000B +#define vchrPageDown chrFormFeed // 0x000C +#define chrOtaSecure chrDeviceControlFour // 0x0014 +#define chrOta chrNegativeAcknowledge // 0x0015 +#define chrCommandStroke chrSynchronousIdle // 0x0016 +#define chrShortcutStroke chrEndOfTransmissionBlock // 0x0017 +#define chrEllipsis chrCancel // 0x0018 +#define chrNumericSpace chrEndOfMedium // 0x0019 +#define chrLeftArrow chrFileSeparator // 0x001C +#define chrRightArrow chrGroupSeparator // 0x001D +#define chrUpArrow chrRecordSeparator // 0x001E +#define chrDownArrow chrUnitSeparator // 0x001F + + +// The following are key codes used for virtual events, like +// low battery warnings, etc. These keyboard events MUST +// have the commandKeyMask bit set in the modifiers in order +// to be recognized. +#define vchrLowBattery 0x0101 // Display low battery dialog +#define vchrEnterDebugger 0x0102 // Enter Debugger +#define vchrNextField 0x0103 // Go to next field in form +#define vchrStartConsole 0x0104 // Startup console task +#define vchrMenu 0x0105 // Ctl-A +#define vchrCommand 0x0106 // Ctl-C +#define vchrConfirm 0x0107 // Ctl-D +#define vchrLaunch 0x0108 // Ctl-E +#define vchrKeyboard 0x0109 // Ctl-F popup the keyboard in appropriate mode +#define vchrFind 0x010A +#define vchrCalc 0x010B +#define vchrPrevField 0x010C +#define vchrAlarm 0x010D // sent before displaying an alarm +#define vchrRonamatic 0x010E // stroke from graffiti area to top half of screen +#define vchrGraffitiReference 0x010F // popup the Graffiti reference +#define vchrKeyboardAlpha 0x0110 // popup the keyboard in alpha mode +#define vchrKeyboardNumeric 0x0111 // popup the keyboard in number mode +#define vchrLock 0x0112 // switch to the Security app and lock the device +#define vchrBacklight 0x0113 // toggle state of backlight +#define vchrAutoOff 0x0114 // power off due to inactivity timer +// Added for PalmOS 3.0 +#define vchrExgTest 0x0115 // put exchange Manager into test mode (&.t) +#define vchrSendData 0x0116 // Send data if possible +#define vchrIrReceive 0x0117 // Initiate an Ir receive manually (&.i) +// Added for PalmOS 3.1 +#define vchrTsm1 0x0118 // Text Services silk-screen button +#define vchrTsm2 0x0119 // Text Services silk-screen button +#define vchrTsm3 0x011A // Text Services silk-screen button +#define vchrTsm4 0x011B // Text Services silk-screen button +// Added for PalmOS 3.2 +#define vchrRadioCoverageOK 0x011C // Radio coverage check successful +#define vchrRadioCoverageFail 0x011D // Radio coverage check failure +#define vchrPowerOff 0x011E // Posted after autoOffChr or hardPowerChr + // to put system to sleep with SysSleep. +// Added for PalmOS 3.5 +#define vchrResumeSleep 0x011F // Posted by NotifyMgr clients after they + // have deferred a sleep request in order + // to resume it. +#define vchrLateWakeup 0x0120 // Posted by the system after waking up + // to broadcast a late wakeup notification. + // FOR SYSTEM USE ONLY +#define vchrTsmMode 0x0121 // Posted by TSM to trigger mode change. +#define vchrBrightness 0x0122 // Activates brightness adjust dialog +#define vchrContrast 0x0123 // Activates contrast adjust dialog +#define vchrExgIntData 0x01FF // Exchange Manager wakeup event + +// The application launching buttons generate the following +// key codes and will also set the commandKeyMask bit in the +// modifiers field +#define vchrHardKeyMin 0x0200 +#define vchrHardKeyMax 0x02FF // 256 hard keys + +#define vchrHard1 0x0204 +#define vchrHard2 0x0205 +#define vchrHard3 0x0206 +#define vchrHard4 0x0207 +#define vchrHardPower 0x0208 +#define vchrHardCradle 0x0209 // Button on cradle pressed +#define vchrHardCradle2 0x020A // Button on cradle pressed and hwrDockInGeneric1 + // input on dock asserted (low). +#define vchrHardContrast 0x020B // Sumo's Contrast button +#define vchrHardAntenna 0x020C // Eleven's Antenna switch +#define vchrHardBrightness 0x020D // Hypothetical Brightness button + + + +// The following keycode RANGES are reserved for use by licensees. +// All have the commandKeyMask bit set in the event's modifiers field. +// Note that ranges include the Min and Max values themselves (i.e. key +// codes >= min and <= max are assigned to the following licensees). +// +// Qualcomm +#define vchrThumperMin 0x0300 +#define vchrThumperMax 0x03FF // 256 command keys + +// Motorola +#define vchrCessnaMin 0x14CD +#define vchrCessnaMax 0x14CD // 1 command key + +// TRG +#define vchrCFlashMin 0x1500 +#define vchrCFlashMax 0x150F // 16 command keys + +// Symbol +#define vchrSPTMin 0x15A0 +#define vchrSPTMax 0x15AF // 16 command keys + +// Handspring +#define vchrSlinkyMin 0x1600 +#define vchrSlinkyMax 0x16FF // 256 command keys + + + +// Old names for some of the characters. +#define nullChr chrNull // 0x0000 +#define backspaceChr chrBackspace // 0x0008 +#define tabChr chrHorizontalTabulation // 0x0009 +#define linefeedChr chrLineFeed // 0x000A +#define pageUpChr vchrPageUp // 0x000B +#define chrPageUp vchrPageUp // 0x000B +#define pageDownChr vchrPageDown // 0x000C +#define chrPageDown vchrPageDown // 0x000C +#define crChr chrCarriageReturn // 0x000D +#define returnChr chrCarriageReturn // 0x000D +#define otaSecureChr chrOtaSecure // 0x0014 +#define otaChr chrOta // 0x0015 + +#define escapeChr chrEscape // 0x001B +#define leftArrowChr chrLeftArrow // 0x001C +#define rightArrowChr chrRightArrow // 0x001D +#define upArrowChr chrUpArrow // 0x001E +#define downArrowChr chrDownArrow // 0x001F +#define spaceChr chrSpace // 0x0020 +#define quoteChr chrQuotationMark // 0x0022 '"' +#define commaChr chrComma // 0x002C ',' +#define periodChr chrFullStop // 0x002E '.' +#define colonChr chrColon // 0x003A ':' +#define lowBatteryChr vchrLowBattery // 0x0101 +#define enterDebuggerChr vchrEnterDebugger // 0x0102 +#define nextFieldChr vchrNextField // 0x0103 +#define startConsoleChr vchrStartConsole // 0x0104 +#define menuChr vchrMenu // 0x0105 +#define commandChr vchrCommand // 0x0106 +#define confirmChr vchrConfirm // 0x0107 +#define launchChr vchrLaunch // 0x0108 +#define keyboardChr vchrKeyboard // 0x0109 +#define findChr vchrFind // 0x010A +#define calcChr vchrCalc // 0x010B +#define prevFieldChr vchrPrevField // 0x010C +#define alarmChr vchrAlarm // 0x010D +#define ronamaticChr vchrRonamatic // 0x010E +#define graffitiReferenceChr vchrGraffitiReference // 0x010F +#define keyboardAlphaChr vchrKeyboardAlpha // 0x0110 +#define keyboardNumericChr vchrKeyboardNumeric // 0x0111 +#define lockChr vchrLock // 0x0112 +#define backlightChr vchrBacklight // 0x0113 +#define autoOffChr vchrAutoOff // 0x0114 +#define exgTestChr vchrExgTest // 0x0115 +#define sendDataChr vchrSendData // 0x0116 +#define irReceiveChr vchrIrReceive // 0x0117 +#define radioCoverageOKChr vchrRadioCoverageOK // 0x011C +#define radioCoverageFailChr vchrRadioCoverageFail // 0x011D +#define powerOffChr vchrPowerOff // 0x011E +#define resumeSleepChr vchrResumeSleep // 0x011F +#define lateWakeupChr vchrLateWakeup // 0x0120 +#define brightnessChr vchrBrightness // 0x0121 +#define contrastChr vchrContrast // 0x0122 +#define hardKeyMin vchrHardKeyMin // 0x0200 +#define hardKeyMax vchrHardKeyMax // 0x02FF +#define hard1Chr vchrHard1 // 0x0204 +#define hard2Chr vchrHard2 // 0x0205 +#define hard3Chr vchrHard3 // 0x0206 +#define hard4Chr vchrHard4 // 0x0207 +#define hardPowerChr vchrHardPower // 0x0208 +#define hardCradleChr vchrHardCradle // 0x0209 +#define hardCradle2Chr vchrHardCradle2 // 0x020A +#define hardContrastChr vchrHardContrast // 0x020B +#define hardAntennaChr vchrHardAntenna // 0x020C +#define hardBrightnessChr vchrHardBrightness // 0x020D + +// Macros to determine correct character code to use for drawing numeric space +// and horizontal ellipsis. + +#define ChrNumericSpace(chP) \ + do { \ + UInt32 attribute; \ + if ((FtrGet(sysFtrCreator, sysFtrNumROMVersion, &attribute) == 0) \ + && (attribute >= sysMakeROMVersion(3, 1, 0, 0, 0))) { \ + *(chP) = chrNumericSpace; \ + } else { \ + *(chP) = 0x80; \ + } \ + } while (0) + +#define ChrHorizEllipsis(chP) \ + do { \ + UInt32 attribute; \ + if ((FtrGet(sysFtrCreator, sysFtrNumROMVersion, &attribute) == 0) \ + && (attribute >= sysMakeROMVersion(3, 1, 0, 0, 0))) { \ + *(chP) = chrEllipsis; \ + } else { \ + *(chP) = 0x85; \ + } \ + } while (0) + +// Characters in the 9 point symbol font. Resource ID 9003 +enum symbolChars { + symbolLeftArrow = 3, + symbolRightArrow, + symbolUpArrow, + symbolDownArrow, + symbolSmallDownArrow, + symbolSmallUpArrow, + symbolMemo = 9, + symbolHelp, + symbolNote, + symbolNoteSelected, + symbolCapsLock, + symbolNumLock, + symbolShiftUpper, + symbolShiftPunc, + symbolShiftExt, + symbolShiftNone, + symbolNoTime, + symbolAlarm, + symbolRepeat, + symbolCheckMark, + // These next four characters were moved from the 0x8D..0x90 + // range in the main fonts to the 9pt Symbol font in PalmOS 3.1 + symbolDiamondChr, + symbolClubChr, + symbolHeartChr, + symbolSpadeChr + }; + +// Character in the 7 point symbol font. Resource ID 9005 +enum symbol7Chars { + symbol7ScrollUp = 1, + symbol7ScrollDown, + symbol7ScrollUpDisabled, + symbol7ScrollDownDisabled + }; + +// Characters in the 11 point symbol font. Resource ID 9004 +enum symbol11Chars { + symbolCheckboxOff = 0, + symbolCheckboxOn, + symbol11LeftArrow, + symbol11RightArrow, + symbol11LeftArrowDisabled, // New for Palm OS v3.2 + symbol11RightArrowDisabled // New for Palm OS v3.2 + }; + + +#endif // __CHARS_H__ + diff --git a/sdk-3.5/include/Core/System/ConnectionMgr.h b/sdk-3.5/include/Core/System/ConnectionMgr.h new file mode 100644 index 0000000..cc8e6b1 --- /dev/null +++ b/sdk-3.5/include/Core/System/ConnectionMgr.h @@ -0,0 +1,177 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ConnectionMgr.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __CONNECTIONMGR_H__ +#define __CONNECTIONMGR_H__ + + +// Include elementary types +#include +#include + +//Maximum size for a Connection Profile Name +#define cncProfileNameSize 22 + + +//Error Codes +#define cncErrAddProfileFailed (cncErrorClass | 1) // Add profile attempt failed +#define cncErrProfileListFull (cncErrorClass | 2) // Add attempt failed because the + // profile list is full. +#define cncErrGetProfileFailed (cncErrorClass | 3) // Get profile attempt failed +#define cncErrConDBNotFound (cncErrorClass | 4) // Connection database not found +#define cncErrGetProfileListFailed (cncErrorClass | 5) // Could not get profile list +#define cncErrProfileReadOnly (cncErrorClass | 6) // The profile can not be altered +#define cncErrProfileNotFound (cncErrorClass | 7) // The profile could not be found + +#ifdef __cplusplus +extern "C" { +#endif + +/*********************************************************************** + * + * FUNCTION: CncGetProfileList + * + * DESCRIPTION: Retrieves a list of available profile names and loads the + * list into a list structure. The calling function may specify the visible + * items or may specify the visible items to be NULL which will display all + * items. The last item on the list will be -Current- which represents the + * currently selected profile in the Connection Panel. + * + * PARAMETERS: nameList A pointer to a list of CharPtrs. This will + * hold the names of the connection profiles. The + * calling application can pass this pointer to + * LstSetListChoices to load the list. Note that + * the Connection Manager will allocate the memory + * but the calling application is responsible for + * deallocation. + * count The number of items contained in the list is returned + * here. + * + * RETURNED: Error codes + * + * REVISION HISTORY: + * Name Date Description + * ---- ---- ----------- + * ADH 8/19/98 Initial Revision + * ADH 8/28/98 Changed Parameter list + * + ***********************************************************************/ +Err CncGetProfileList(Char *** nameListP, UInt16 *count) + SYS_TRAP(sysTrapCncGetProfileList); + + +/*********************************************************************** + * + * FUNCTION: CncGetProfileInfo + * + * DESCRIPTION: Retrieves the data for a specified profile. The name of a + * specific profile may be passed in. Fields that the calling app is not + * interested in may be set to NULL. Passing in a NULL to the name parameter + * will cause the Connection Manager to return the currently selected profile + * from the Connection Panel. Passing in -Current- to the name field will + * return the current profile. + * + * PARAMETERS: name The name of the profile that is to be returned. + * Passing in NULL or the string "-Current-" will return + * the currently selected profile from the Connection + * Panel. + * port The port identifier + * baud The baud rate + * volume The volume of the device (only applicable to modems) + * handShake Flow of Control + * initString The modem initialization string (only applicable to + * modems) + * resetString Used to configure a modem for use in different countries + * isModem Boolean (True = Modem, False = Serial) + * isPulse Boolean (True = Pulse Dial, False = TouchTone) + * + * RETURNED: Error codes + * + * REVISION HISTORY: + * Name Date Description + * ---- ---- ----------- + * ADH 8/19/98 Initial Revision + * + ***********************************************************************/ +Err CncGetProfileInfo(Char *name, UInt32 *port, UInt32 *baud, UInt16 *volume, + UInt16 *handShake, Char *initString, Char *resetString, + Boolean *isModem, Boolean *isPulse) + SYS_TRAP(sysTrapCncGetProfileInfo); + + +/*********************************************************************** + * + * FUNCTION: CncAddProfile + * + * DESCRIPTION: Adds a profile to the Connection Panel database. + * + * PARAMETERS: name The name of the profile that is to be added to the + * database. Note that the name may be changed while + * it is being added. All profiles must have unique + * names. + * port The port identifier + * baud The baud rate + * volume The volume of the device (only applicable to modems, + * set to 0 for direct) + * handShake Flow of Control (0 = Automatic, 1 = On, 2 = Off) + * initString The modem initialization string (only applicable to + * modems.) + * resetString Used to configure a modem for use in different countries + * isModem Boolean (True = Modem, False = Serial) + * isPulse Boolean (True = Pulse Dial, False = TouchTone) + * + * RETURNED: Error codes + * + * REVISION HISTORY: + * Name Date Description + * ---- ---- ----------- + * ADH 8/19/98 Initial Revision + * + ***********************************************************************/ +Err CncAddProfile(Char *name, UInt32 port, UInt32 baud, UInt16 volume, + UInt16 handShake, Char *initString, Char *resetString, Boolean isModem, + Boolean isPulse) + SYS_TRAP(sysTrapCncAddProfile); + + +/*********************************************************************** + * + * FUNCTION: CncDeleteProfile + * + * DESCRIPTION: Deletes a profile from the Connection Panel database. + * + * PARAMETERS: name The name of the profile that is to be deleted. + * Note that default databases can not be deleted. + * + * RETURNED: Error codes + * + * REVISION HISTORY: + * Name Date Description + * ---- ---- ----------- + * ADH 8/19/98 Initial Revision + * + ***********************************************************************/ +Err CncDeleteProfile(Char *name) + SYS_TRAP(sysTrapCncDeleteProfile); + + +#ifdef __cplusplus +} +#endif + +#endif // __CONNECTIONMGR_H__ + diff --git a/sdk-3.5/include/Core/System/ConsoleMgr.h b/sdk-3.5/include/Core/System/ConsoleMgr.h new file mode 100644 index 0000000..55ade09 --- /dev/null +++ b/sdk-3.5/include/Core/System/ConsoleMgr.h @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ConsoleMgr.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __CONSOLEMGR_H__ +#define __CONSOLEMGR_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +/******************************************************************** + * Console Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err ConPutS(Char *message) + SYS_TRAP(sysTrapConPutS); + +Err ConGetS(Char *message, Int32 timeout) + SYS_TRAP(sysTrapConGetS); + + +#ifdef __cplusplus +} +#endif + + + + +#endif // __CONSOLEMGR_H__ + diff --git a/sdk-3.5/include/Core/System/Crc.h b/sdk-3.5/include/Core/System/Crc.h new file mode 100644 index 0000000..38f8178 --- /dev/null +++ b/sdk-3.5/include/Core/System/Crc.h @@ -0,0 +1,64 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Crc.h + * + * Description: + * This is the header file for the CRC calculation routines for Pilot. + * + * History: + * May 10, 1995 Created by Vitaly Kruglikov + * 05/10/95 vmk Created by Vitaly Kruglikov. + * 09/10/99 kwk Crc16CalcBlock takes a const void *. + * + *****************************************************************************/ + +#ifndef __CRC_H__ +#define __CRC_H__ + + +// Include elementary types +#include +#include + + + + +/******************************************************************** + * CRC Calculation Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + + +// Crc16CalcBlock() +// +// Calculate the 16-bit CRC of a data block using the table lookup method. +// +UInt16 Crc16CalcBlock(const void *bufP, UInt16 count, UInt16 crc) + SYS_TRAP(sysTrapCrc16CalcBlock); + +UInt16 Crc16CalcBigBlock(void *bufP, UInt32 count, UInt16 crc); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __CRC_H__ + diff --git a/sdk-3.5/include/Core/System/DLCommon.h b/sdk-3.5/include/Core/System/DLCommon.h new file mode 100644 index 0000000..dd61e5a --- /dev/null +++ b/sdk-3.5/include/Core/System/DLCommon.h @@ -0,0 +1,2434 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: DLCommon.h + * + * Description: + * Desktop Link Protocol(DLP) function id's, parameters, and frame + * structures. + * + * History: + * 6/7/95 vmk Created by Vitaly Marty Kruglikov + * 6/15/95 vmk Changed dlp/Read/Write/UserID to dlp/Read/Write/UserInfo and + * added the last sync PC id field to their arguments at Laura's request. + * 6/15/95 vmk Added option to dlpDeleteRecord to delete all records in DB. + * + *****************************************************************************/ + +#ifndef __DLCOMMON_H__ +#define __DLCOMMON_H__ + +#include + +/************************************************************ + * DesktopLink function codes + *************************************************************/ + +// DlpFuncID -- function id's used in request blocks sent to +// the DesktopLink application on Pilot. The width of the function +// id base is 7 bits. The high order bit(the 8th bit) is used to +// distinguish requests from their responses -- it is cleared in request +// blocks and is set in response blocks (i.e., the response to a particular +// command will have the same function code base as the command and the +// high order bit set). See dlpFuncRespFlag defined below. +// +typedef enum DlpFuncID { + + dlpReservedFunc = 0x0F, // range reserved for internal use + + // DLP 1.0 FUNCTIONS START HERE (PalmOS v1.0) + dlpReadUserInfo, + + dlpWriteUserInfo, + + dlpReadSysInfo, + + dlpGetSysDateTime, + + dlpSetSysDateTime, + + dlpReadStorageInfo, + + dlpReadDBList, + + dlpOpenDB, + + dlpCreateDB, + + dlpCloseDB, + + dlpDeleteDB, + + dlpReadAppBlock, + + dlpWriteAppBlock, + + dlpReadSortBlock, + + dlpWriteSortBlock, + + dlpReadNextModifiedRec, + + dlpReadRecord, + + dlpWriteRecord, + + dlpDeleteRecord, + + dlpReadResource, + + dlpWriteResource, + + dlpDeleteResource, + + dlpCleanUpDatabase, + + dlpResetSyncFlags, + + dlpCallApplication, + + dlpResetSystem, + + dlpAddSyncLogEntry, + + dlpReadOpenDBInfo, + + dlpMoveCategory, + + dlpProcessRPC, // remote procedure calls interface + + dlpOpenConduit, // this command is sent before each conduit is opened + + dlpEndOfSync, // ends the sync session + + dlpResetRecordIndex, // resets "modified record" index + + dlpReadRecordIDList, // LAST 1.0 FUNCTION + + + // DLP 1.1 FUNCTIONS ADDED HERE (PalmOS v2.0 Personal, and Professional) + dlpReadNextRecInCategory, // iterate through all records in category + + dlpReadNextModifiedRecInCategory, // iterate through modified records in category + + dlpReadAppPreference, // read application preference + + dlpWriteAppPreference, // write application preference + + dlpReadNetSyncInfo, // read Network HotSync settings + + dlpWriteNetSyncInfo, // write Network HotSync settings + + dlpReadFeature, // read a feature from Feature Manager + + + // DLP 1.2 FUNCTIONS ADDED HERE (PalmOS v3.0) + dlpFindDB, // find a database given creator and type, or name, or + // get info on currently-open db + dlpSetDBInfo, // change database information (name, attributes, version, + // creation, modification, backup dates, type and creator + + + + + dlpLastFunc // ***ALWAYS KEEP LAST*** + + } DlpFuncID; + +#define dlpLastPilotV10FuncID dlpReadRecordIDList + + +// Desktop Link function error codes returned in the response errorCode +// field. +typedef enum DlpRespErrorCode { + dlpRespErrNone = 0, // reserve 0 for no error + dlpRespErrSystem, // general Pilot system error + dlpRespErrIllegalReq, // unknown function ID + dlpRespErrMemory, // insufficient dynamic heap memory + dlpRespErrParam, // invalid parameter + dlpRespErrNotFound, // database, record, or resource not found + dlpRespErrNoneOpen, // there are no open databases + dlpRespErrDatabaseOpen, // database is open by someone else + dlpRespErrTooManyOpenDatabases, // there are too many open databases + dlpRespErrAlreadyExists, // DB already exists + dlpRespErrCantOpen, // couldn't open DB + dlpRespErrRecordDeleted, // record is deleted + dlpRespErrRecordBusy, // record is in use by someone else + dlpRespErrNotSupported, // the requested operation is not supported + // on the given database type(record or resource) + dlpRespErrUnused1, // was dlpRespErrROMBased + dlpRespErrReadOnly, // caller does not have write access(or DB is in ROM) + dlpRespErrNotEnoughSpace, // not enough space in data store for record/resource/etc. + dlpRespErrLimitExceeded, // size limit exceeded + dlpRespErrCancelSync, // cancel the sync + + dlpRespErrBadWrapper, // bad arg wrapper(for debugging) + dlpRespErrArgMissing, // required arg not found(for debugging) + dlpRespErrArgSize, // invalid argument size + + dlpRespErrLastReserved = 127 // last error code reserved for Palm + // *KEEP THIS ENTRY LAST* + } DlpRespErrorCode; + + +// Database flags +// NOTE: THESE *MUST* MATCH THE TOUCHDOWN DB ATTRIBUTES(AT LEAST IN THE FIRST VERSION). +// ANY CHANGES MUST BE REFLECTED IN "READ DB LIST" AND +#define dlpDBFlagResDB 0x0001 // resource DB if set; record DB if cleared + +#define dlpDBFlagReadOnly 0x0002 // DB is read only if set; read/write if cleared + +#define dlpDBFlagAppInfoDirty 0x0004 // Set if Application Info block is dirty + // Optionally supported by an App's conduit + +#define dlpDBFlagBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. + +#define dlpDBFlagOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK + // for it to install a newer version of this database + // with a different name if the current database is + // open. This mechanism is used to update the + // Graffiti Shortcuts database, for example. + +#define dlpDBFlagResetAfterInstall 0x0020 // Device requires a reset after this database is + // installed. + +#define dlpDBFlagCopyPrevention 0x0040 // This database should not be copied to + // another deviced. + +#define dlpDBFlagOpen 0x8000 // DB is open + + + + +// Database record attributes +#define dlpRecAttrDeleted 0x80 // delete this record next sync +#define dlpRecAttrDirty 0x40 // archive this record next sync +#define dlpRecAttrBusy 0x20 // record currently in use +#define dlpRecAttrSecret 0x10 // "secret" record - password protected +#define dlpRecAttrArchived 0x08 // archived record + + +// Date/time will be described in the following format +// yr(2 bytes), mo(1 byte, 1-12), dy(1 byte, 1-31), +// hr(1 byte, 0-23), min(1 byte, 0-59), sec(1 byte, 0-59), +// unused(1 byte). + +typedef struct DlpDateTimeType { // OFFSET + UInt16 year; // 0; year (high, low) + UInt8 month; // 2; month: 1-12 + UInt8 day; // 3; day: 1-31 + UInt8 hour; // 4; hour: 0-23 + UInt8 minute; // 5; minute: 0-59 + UInt8 second; // 6; second: 0-59 + UInt8 unused; // 7; unused -- set to null! + } DlpDateTimeType; // TOTAL: 8 bytes + + +// Version structure +typedef struct DlpVersionType { + // OFFSET + UInt16 wMajor; // 0; major version number (0 = ignore) + UInt16 wMinor; // 2; minor version number + // TOTAL: 4 bytes + } DlpVersionType; + + +/************************************************************ + * Request and Response headers. + * + * Each DLP request and response data block begins with the + * corresponding header structure which identifies the function + * id, argument count, and error code(responses only). + *************************************************************/ + +// Request header: +// +typedef struct DlpReqHeaderType { + // OFFSET + UInt8 id; // 0; request function ID + UInt8 argc; // 2; count of args that follow this header + // TOTAL: 2 bytes + } DlpReqHeaderType; + +typedef DlpReqHeaderType* DlpReqHeaderPtr; + +typedef struct DlpReqType { + // OFFSET + DlpReqHeaderType header; // 0; request header + // FIXED SIZE: 2 bytes + UInt8 args[2]; // 2; request arguments -- var size + } DlpReqType; + +typedef DlpReqType* DlpReqPtr; + +// Response header: +// +typedef struct DlpRespHeaderType { + // OFFSET + UInt8 id; // 0; response function ID + UInt8 argc; // 1; count of arguments that follow this header + UInt16 errorCode; // 2; error code + // TOTAL: 4 bytes + } DlpRespHeaderType; + +typedef DlpRespHeaderType* DlpRespHeaderPtr; + +typedef struct DlpRespType { + // OFFSET + DlpRespHeaderType header; // 0; response header + // FIXED SIZE: 4 bytes + UInt8 args[2]; // 4; response arguments -- var size + } DlpRespType; + +typedef DlpRespType* DlpRespPtr; + + +// Generic request/response body type(for utility routines) +// +typedef union DlpGenericBodyType { + UInt8 id; // request/response id + DlpReqType req; // request body + DlpRespType resp; // response body + } DlpGenericBodyType; + +typedef DlpGenericBodyType* DlpGenericBodyPtr; + + +// dlpFuncRespFlag is used to form a function response ID from a +// function ID by or'ing it with the function ID. For example: if +// dlpFuncDeleteResource is the request ID, the correct response ID +// must be (dlpFuncDeleteResource | dlpFuncRespFlag). +// +#define dlpFuncRespFlag 0x80 + +// dlpFuncIDMask is used to mask out the function ID value +#define dlpFuncIDMask 0x7f + +// dlpFirstArgID is the value of the first argument ID to be defined for +// functions. Values below it are reserved. +// +#define dlpFirstArgID 0x20 + + +/************************************************************ + * + * Argument headers used to "wrap" request and response arguments + * + * IMPORTANT: ARGUMENT WRAPPERS IN REQUESTS AND RESPONSES MUST + * ALWAYS START ON AN EVEN-BYTE BOUNDARY. The server + * implementation expects this to be the case. + * + *************************************************************/ + +// dlpSmallArgFlag is used to identify "small" argument wrappers by +// or'ing it with the argument id in argument header. +// +#define dlpSmallArgFlag 0x080 + +// dlpShortArgIDMask is used to mask out the argument id value +// +#define dlpShortArgIDMask 0x7F + + +// dlpLongArgFlag is used to identify "long" argument wrappers by +// or'ing it with the argument id in argument header. +// +#define dlpLongArgFlag 0xC000 + +// dlpLongArgIDMask is used to mask out the argument id value +// +#define dlpLongArgIDMask 0x3FFF + + +//------------------------------------------------------------------------- +// Int16 argument wrappers (v1.0-compatible) +//------------------------------------------------------------------------- + +// Maximum Int16 argument size which can be "wrapped" +#define dlpMaxTinyArgSize 0x000000FFL +#define dlpMaxSmallArgSize 0x0000FFFFL +#define dlpMaxShortArgSize dlpMaxSmallArgSize + + + +// Tiny argument header for data sizes up to 255 bytes(optimization) +// +typedef struct DlpTinyArgWrapperType { + // OFFSET + UInt8 bID; // 0; argument ID + UInt8 bSize; // 1; argument size (does NOT include this arg header) + // TOTAL: 2 bytes + } DlpTinyArgWrapperType; + +typedef struct DlpTinyArgType { + DlpTinyArgWrapperType wrapper; // 0; argument header + UInt8 data[2]; // 2; argument data -- var size + } DlpTinyArgType; + + +// Small argument header for data sizes above 255 bytes(*may also be used for +// smaller arguments when convenient*) +// +typedef struct DlpSmallArgWrapperType { + // OFFSET + UInt8 bID; // 0; argument ID + UInt8 unused; // 1; unused(for alignment) -- set to null! + UInt16 wSize; // 2; argument size (does NOT include this arg header) + // TOTAL: 4 bytes + } DlpSmallArgWrapperType; + +typedef struct DlpSmallArgType { + DlpSmallArgWrapperType wrapper; // 0; argument header + UInt8 data[2]; // 4; argument data -- var size + } DlpSmallArgType; + +// Unions of Int16 argument types +typedef union DlpShortArgWrapperType { + UInt8 bID; // arg id + DlpTinyArgWrapperType tiny; // "tiny" arg wrapper + DlpSmallArgWrapperType small; // "tiny" arg wrapper + } DlpShortArgWrapperType; +typedef DlpShortArgWrapperType* DlpShortArgWrapperPtr; + +typedef union DlpShortArgType { + UInt8 bID; // arg id + DlpTinyArgType tiny; // "tiny" arg + DlpSmallArgType small; // "small" arg + } DlpShortArgType; + +typedef DlpShortArgType* DlpShortArgPtr; + + + +//------------------------------------------------------------------------- +// Int32 argument wrapper (v2.0 extension) +//------------------------------------------------------------------------- +// NOTE: Pilot v2.0 will implement the capability to parse long arguments +// but will not originate them. This will assure backwards compatibility with +// the 1.0 desktop as well as compatibility with the future version of the +// desktop software which may originate the "long" argument wrappers. +// +// Int32 argument wrappers are identified by the dlpLongArgFlag bits set +// in the argument id field. + +// Maximum long argument size which can be "wrapped" +#define dlpMaxLongArgSize 0xFFFFFFFFL + +typedef struct DlpLongArgWrapperType { + // OFFSET + UInt16 wID; // 0; argument ID + UInt32 dwSize; // 2; argument size (does NOT include this arg header) + // TOTAL: 6 bytes + } DlpLongArgWrapperType; +typedef DlpLongArgWrapperType* DlpLongArgWrapperPtr; + +typedef struct DlpLongArgType { + // OFFSET + DlpLongArgWrapperType wrapper; // 0; argument header + UInt8 data[2]; // 6; argument data -- var size + } DlpLongArgType; +typedef DlpLongArgType* DlpLongArgPtr; + + +//------------------------------------------------------------------------- +// Unions of all argument and wrapper types +//------------------------------------------------------------------------- + +// Union of all argument wrapper types +typedef union DlpGenericArgWrapperType { + DlpShortArgWrapperType shortWrap; // "Int16" arg wrapper(tiny and small) + DlpLongArgWrapperType longWrap; // "long" arg wrapper + } DlpGenericArgWrapperType; +typedef DlpGenericArgWrapperType* DlpGenericArgWrapperPtr; + + +// Union of all argument types +typedef union DlpGenericArgType { + DlpShortArgType shortArg; // "Int16" arg(tiny and small) + DlpLongArgType longArg; // "long" arg + } DlpGenericArgType; +typedef DlpGenericArgType* DlpGenericArgPtr; + + +/******************************************************************** + * Desktop Link Protocol Parameters + ********************************************************************/ + +// dlpCmdTimeoutSec -- this is the number of seconds to wait for a command +// to begin coming in before timing out +// +#define dlpCmdTimeoutSec 30 + + + +/************************************************************ + * DLP function argument structures + *************************************************************/ + + +////////////////////////////////////////////////////////////////////////// +// dlpReadUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: none +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadUserInfoRespArgID dlpFirstArgID + +typedef struct DlpReadUserInfoRespHdrType { + // OFFSET + UInt32 userID; // 0; user ID number (0 if none) + UInt32 viewerID; // 4; id assigned to viewer by the desktop + UInt32 lastSyncPC; // 8; last sync PC id (0 if none) + DlpDateTimeType succSyncDate; // 12; last successful sync (year = 0 if none) + DlpDateTimeType lastSyncDate; // 20; last sync date(year = 0 if none) + UInt8 userNameLen; // 28; length of user name field, + // including null (0 = no user name) + UInt8 passwordLen; // 29; length of encrypted password + // (0 = no password set) + // TOTAL: 30 bytes + } DlpReadUserInfoRespHdrType; + +typedef struct DlpReadUserInfoRespType { + // OFFSET + DlpReadUserInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 30 bytes + UInt8 nameAndPassword[2]; // 30; user name -- var size + // User name begins at the nameAndPassword field and is null-terminated. + // The encrypted password follows the user name and is NOT null-terminated. + // The encrypted password may contain any byte values(0-255). + } DlpReadUserInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// user id (4 bytes) +// last sync PC id(4 bytes) +// user name +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpWriteUserInfoReqArgID dlpFirstArgID + +#define dlpMaxUserNameSize 41 // max user name size, including null byte + +typedef struct DlpWriteUserInfoReqHdrType { + // OFFSET + UInt32 userID; // 0; user ID number + UInt32 viewerID; // 4; id assigned to viewer by the desktop + UInt32 lastSyncPC; // 8; last sync PC id + DlpDateTimeType lastSyncDate; // 12; last sync date(year = 0 if none) + UInt8 modFlags; // 20; flags indicating which values are being + // modified; see the dlpUserInfoMod... + // flags defined below + UInt8 userNameLen; // 21; user name length, including null + // TOTAL: 22 bytes + } DlpWriteUserInfoReqHdrType; + +// Flags indicating which values are being changed by the dlpWriteUserInfo +// request. These flags are used in the modFlags field of DlpWriteUserInfoReqHdrType. +// These flags are additive. +// +#define dlpUserInfoModUserID 0x80 // changing the user id +#define dlpUserInfoModSyncPC 0x40 // changing the last sync PC id +#define dlpUserInfoModSyncDate 0x20 // changing sync date +#define dlpUserInfoModName 0x10 // changing user name +#define dlpUserInfoModViewerID 0x08 // changing the viewer id + +typedef struct DlpWriteUserInfoReqType { + // OFFSET + DlpWriteUserInfoReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 22 bytes + UInt8 userName[2]; // 22; user name -- var size + // User name begins at the userName field and is null-terminated. + } DlpWriteUserInfoReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSysInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem +// + +// Request argument structure: +// +// none. DLP v1.0 and v1.1 + +enum { + // NEW FOR DLP v1.2: + dlpReadSysInfoReqArgID = dlpFirstArgID + }; + + +// dlpReadSysInfoReqArgID request arg structure +// +typedef struct DlpReadSysInfoReqType { + // OFFSET + DlpVersionType dlpVer; // 0; DLP version of the caller + // TOTAL: 4 bytes + } DlpReadSysInfoReqType; + + +// Response argument structure: +// +// Both response arguments are returned in one reply +enum { + dlpReadSysInfoRespArgID = dlpFirstArgID, + + // NEW FOR DLP v1.2: + dlpReadSysInfoVerRespArgID + }; + +// dlpReadSysInfoRespArgID response arg structure: +// +typedef struct DlpReadSysInfoRespType { + // OFFSET + UInt32 romSWVersion; // 0; ROM-based sys software version + UInt32 localizationID;// 4; localization ID + UInt8 unused; // 8; unused(for alignment) -- set to null! + UInt8 prodIDSize; // 9; size of productID/model field + UInt32 prodID; // 10; product id (was variable size) + // TOTAL: 14 bytes + } DlpReadSysInfoRespType; + + +// dlpReadSysInfoVerRespArgID response arg structure: +// +typedef struct DlpReadSysInfoVerRespType { + // OFFSET + DlpVersionType dlpVer; // 0; DLP version of the device + DlpVersionType compVer; // 4; product compatibility version of the device + UInt32 dwMaxRecSize; // 8; maximum record/resource size that may be allocated on + // the device given that sufficient free memory exists + // (0xFFFFFFFF = up to available memory) + // TOTAL: 12 bytes + } DlpReadSysInfoVerRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpGetSysDateTime +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes: none + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpGetSysDateTimeRespArgID dlpFirstArgID + +typedef struct DlpGetSysDateTimeRespType { + // OFFSET + DlpDateTimeType dateTime; // 0; system date/time + // TOTAL: 8 bytes + } DlpGetSysDateTimeRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpSetSysDateTime +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// new system date/time +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrParam + +// Request argument structure: +// +#define dlpSetSysDateTimeReqArgID dlpFirstArgID + +typedef struct DlpSetSysDateTimeReqType { + // OFFSET + DlpDateTimeType dateTime; // 0; new system date/time + // TOTAL: 8 bytes + } DlpSetSysDateTimeReqType; + +typedef DlpSetSysDateTimeReqType* DlpSetSysDateTimeReqPtr; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadStorageInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +enum { + dlpReadStorageInfoReqArgID = dlpFirstArgID + }; + +typedef struct DlpReadStorInfoReqType { + // OFFSET + UInt8 startCardNo; // 0; card number to start at + // (0 = first) + UInt8 unused; // 1; unused -- set to null! + // TOTAL: 2 bytes + } DlpReadStorInfoReqType; + + +// Response argument structure: +// +enum { + dlpReadStorageInfoRespArgID = dlpFirstArgID, + dlpReadStorageInfoExRespArgID // v1.1 extension + }; + +// +// dlpReadStorageInfoRespArgID: +// + +// Card info structure of variable size +typedef struct DlpCardInfoHdrType { + // OFFSET + UInt8 totalSize; // 0; total size of this card info + // *ROUNDED UP TO EVEN SIZE* + UInt8 cardNo; // 1; card number + UInt16 cardVersion; // 2; card version + DlpDateTimeType crDate; // 4; creation date/time + UInt32 romSize; // 12; ROM size + UInt32 ramSize; // 16; RAM size + UInt32 freeRam; // 20; total free data store RAM - Fixed in DLP v1.2 to exclude + // dynamic heap RAM + UInt8 cardNameSize; // 24; size of card name string + UInt8 manufNameSize; // 25; size of manuf. name string + // TOTAL: 26 bytes; + } DlpCardInfoHdrType; + +typedef struct DlpCardInfoType { + // OFFSET + DlpCardInfoHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 26 bytes; + UInt8 cardNameAndManuf[2]; + // 26; card name and manuf. text -- var size + // Card name is the cardNameSize bytes of text at cardNameAndManuf, + // followed immediately by manufNameSize bytes of manufacturer name. + } DlpCardInfoType; + + +typedef struct DlpReadStorInfoRespHdrType { + // OFFSET + UInt8 lastCardNo; // 0; card number of last card retrieved + UInt8 more; // 1; non-zero if there are more cards + UInt8 unused; // 2; unused -- set to null! + UInt8 actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadStorInfoRespHdrType; + +typedef struct DlpReadStorInfoRespType { + // OFFSET + DlpReadStorInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpCardInfoType cardInfo[1]; // 4; actCount of card info structures -- var size + } DlpReadStorInfoRespType; + + +// +// EXTENDED ARGUMENTS(DL v1.1): dlpReadStorageInfoExRespArgID +// +typedef struct DlpReadStorInfoExRespType { + // OFFSET + UInt16 romDBCount; // 0; ROM database count + UInt16 ramDBCount; // 2; RAM database count + UInt32 dwReserved1; // 4; RESERVED -- SET TO NULL! + UInt32 dwReserved2; // 8; RESERVED -- SET TO NULL! + UInt32 dwReserved3; // 12; RESERVED -- SET TO NULL! + UInt32 dwReserved4; // 16; RESERVED -- SET TO NULL! + // TOTAL: 20 bytes + } DlpReadStorInfoExRespType; + + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadDBList +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +#define dlpReadDBListReqArgID dlpFirstArgID + +typedef struct DlpReadDBListReqType { + // OFFSET + UInt8 srchFlags; // 0; search flags + UInt8 cardNo; // 1; card number -- 0-based + UInt16 startIndex; // 2; DB index to start at + // (0 = from beginning) + // TOTAL: 4 bytes + } DlpReadDBListReqType; + +#define dlpReadDBListFlagRAM 0x80 // Search for RAM-based +#define dlpReadDBListFlagROM 0x40 // Search for ROM-based +#define dlpReadDBListFlagMultiple 0x20 // OK to return multiple entries (DEFINED FOR DLP v1.2) + + +// Response argument structure: +// +#define dlpReadDBListRespArgID dlpFirstArgID + +// Database info structure of variable size +typedef struct DlpDBInfoHdrType { + // OFFSET + UInt8 totalSize; // 0; total size of the DB info (DlpDBInfoHdrType + name) + // *ROUNDED UP TO EVEN SIZE* + UInt8 miscFlags; // 1; dlpDbInfoMiscFlag... flags(v1.1) -- set all unused bits to null! + UInt16 dbFlags; // 2; DB flags: dlpDBFlagReadOnly, + // dlpDBFlagResDB, dlpDBFlagAppInfoDirty, dlpDBFlagOpen, + // dlpDBFlagBackup, etc; + UInt32 type; // 4; database type + UInt32 creator; // 8; database creator + UInt16 version; // 12; database version + UInt32 modNum; // 14; modification number + DlpDateTimeType crDate; // 18; creation date + DlpDateTimeType modDate; // 26; latest modification date + DlpDateTimeType backupDate; // 34; latest backup date + UInt16 dbIndex; // 42; DB index (or dlpDbInfoUnknownDbIndex for dlpFindDB) + // TOTAL: 44 bytes; + } DlpDBInfoHdrType; + +// Flags for the miscFlags field of DlpDBInfoHdrType +#define dlpDbInfoMiscFlagExcludeFromSync 0x80 // DEFINED FOR DLP v1.1 +#define dlpDbInfoMiscFlagRamBased 0x40 // DEFINED FOR DLP v1.2 + +// Unknown index value for the dbIndex field of DlpDBInfoHdrType +#define dlpDbInfoUnknownDbIndex 0xFFFF + + +typedef struct DlpDBInfoType { + // OFFSET + DlpDBInfoHdrType header; // 0; fixed-size header + // FIXED SIZE: 44 bytes; + UInt8 name[2]; // 44; databse name text -- var size and + // null-terminated + } DlpDBInfoType; + + +typedef struct DlpReadDBListRespHdrType { + // OFFSET + UInt16 lastIndex; // 0; DB index of last entry retrieved + UInt8 flags; // 2; flags: dlpReadDBListRespFlagMore + UInt8 actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadDBListRespHdrType; + +// dlpReadDBListRespFlagMore flag: if set, indicates that there are more +// databases to list -- this enables the server to send the listing +// incrementally, reducing server memory requirements if necessary +#define dlpReadDBListRespFlagMore 0x80 + +typedef struct DlpReadDBListRespType { + // OFFSET + DlpReadDBListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpDBInfoType dbInfo[1]; // 4; actCount of DB info structures -- var size + } DlpReadDBListRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrTooManyOpenDatabases +// dlpRespErrCantOpen + +// Request argument structure: +// +#define dlpOpenDBReqArgID dlpFirstArgID + +typedef struct DlpOpenDBReqHdrType { + // OFFSET + UInt8 cardNo; // 0; memory module number + UInt8 mode; // 1; open mode + // TOTAL: 2 bytes; + } DlpOpenDBReqHdrType; + +#define dlpOpenDBModeRead 0x80 +#define dlpOpenDBModeWrite 0x40 +#define dlpOpenDBModeExclusive 0x20 +#define dlpOpenDBModeShowSecret 0x10 + + +typedef struct DlpOpenDBReqType { + // OFFSET + DlpOpenDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 name[2]; // 2; databse name text -- var size + // zero-terminated + } DlpOpenDBReqType; + +typedef DlpOpenDBReqType* DlpOpenDBReqPtr; + + +// Response argument structure: +// +#define dlpOpenDBRespArgID dlpFirstArgID +// +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCreateDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrAlreadyExists, +// dlpRespErrCantOpen, +// dlpRespErrNotEnoughSpace, +// dlpRespErrTooManyOpenDatabases + +// Request argument structure: +// +#define dlpCreateDBReqArgID dlpFirstArgID + +typedef struct DlpCreateDBReqHdrType { + // OFFSET + UInt32 creator; // 0; DB creator + UInt32 type; // 4; DB type + UInt8 cardNo; // 8; memory module number + UInt8 unused; // 9; unused -- set to null + UInt16 dbFlags; // 10; allowed flags: dlpDBFlagResDB, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall + UInt16 version; // 12; DB version # + // TOTAL: 14 bytes; + } DlpCreateDBReqHdrType; + +typedef struct DlpCreateDBReqType { + // OFFSET + DlpCreateDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + UInt8 name[2]; // 14; DB name text -- var size + // zero-terminated + } DlpCreateDBReqType; + +typedef DlpCreateDBReqType* DlpCreateDBReqPtr; + + +// Response argument structure: +// +#define dlpCreateDBRespArgID dlpFirstArgID + +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCloseDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrParam, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNoneOpen + +// Request argument structure: +// +typedef enum { + dlpCloseDBReqArgID = dlpFirstArgID, // close a specific database + dlpCloseDBAllReqArgID, // close all databases + dlpCloseDBExReqArgID // close a specific db and update backup + // and/or modification dates (PalmOS v3.0) + } DlpCloseDBReqArgID; + +// Argument structure to close a specific database(dlpCloseDBDBIDReqArgID): +// +// The request argument is the 1-byte database ID returned in open/create +// DB responses. +typedef UInt8 DlpCloseDBReqType; + +// Argument structure to close all databases(dlpCloseDBReqAllArgID): +// +// This request argument contains no data + + +// Request type for dlpCloseDBExReqArgID (PalmOS v3.0): +typedef struct DlpCloseDBExReqType { + // OFFSET + UInt8 dbID; // 0; database id to close + UInt8 bOptFlags; // 1; bitfield of dlpCloseDBExOptFlag... flags + // TOTAL: 2 bytes + } DlpCloseDBExReqType; + +// Option flags +#define dlpCloseDBExOptFlagUpdateBackupDate 0x80 // Update the backup date after closing +#define dlpCloseDBExOptFlagUpdateModDate 0x40 // Update the modification date after closing + + +#define dlpCloseDBExOptAllFlags (dlpCloseDBExOptFlagUpdateBackupDate | dlpCloseDBExOptFlagUpdateModDate) + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrCantOpen, +// dlpRespErrDatabaseOpen + +// Request argument structure: +// +#define dlpDeleteDBReqArgID dlpFirstArgID + +typedef struct DlpDeleteDBReqHdrType { + // OFFSET + UInt8 cardNo; // 0; memory module number + UInt8 unused; // 1; unused -- set to null! + // TOTAL: 2 bytes; + } DlpDeleteDBReqHdrType; + + +typedef struct DlpDeleteDBReqType { + // OFFSET + DlpDeleteDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 name[2]; // 2; databse name text -- var size + // zero-terminated + } DlpDeleteDBReqType; + +typedef DlpDeleteDBReqType* DlpDeleteDBReqPtr; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadOpenDBInfo +////////////////////////////////////////////////////////////////////////// +// Get information on an open database +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadOpenDBInfoArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +#define dlpReadOpenDBInfoRespArgID dlpFirstArgID + + +typedef struct DlpReadOpenDBInfoRespType { + // OFFSET + UInt16 numRec; // 0; number of records or resources + // TOTAL: 2 bytes + } DlpReadOpenDBInfoRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpMoveCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam +// dlpRespErrNotSupported +// dlpRespErrReadOnly + +// Request argument structure: +// +#define dlpMoveCategoryReqArgID dlpFirstArgID + +typedef struct DlpMoveCategoryReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 fromCategory; // 1; id of the "from" category + UInt8 toCategory; // 2; id of the "to" category + UInt8 unused; // 3; unused -- set to null! + // TOTAL: 4 bytes; + } DlpMoveCategoryReqType; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadBlockReqArgID dlpFirstArgID + +typedef struct DlpReadBlockReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt16 offset; // 2; offset into the block + UInt16 numBytes; // 4; number of bytes to read starting + // at offset(-1 = to the end) + // TOTAL: 6 bytes; + } DlpReadBlockReqType; + + +// Response argument structure: +// +#define dlpReadBlockRespArgID dlpFirstArgID + +typedef struct DlpReadBlockRespHdrType { + // OFFSET + UInt16 blockSize; // 0; actual block size -- may be greater + // than the amount of data returned + // TOTAL: 2 bytes + } DlpReadBlockRespHdrType; + +typedef struct DlpReadBlockRespType { + // OFFSET + DlpReadBlockRespHdrType // + header; // 0; fixed size header + // FIXED SIZE: 2 bytes + UInt8 data[2]; // 2; block data -- var size + } DlpReadBlockRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly +// dlpRespErrNotEnoughSpace +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteBlockReqArgID dlpFirstArgID + +typedef struct DlpWriteBlockReqHdrType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt16 blockSize; // 2; total block size(0 = free existing block) + // TOTAL: 4 bytes; + } DlpWriteBlockReqHdrType; + + +typedef struct DlpWriteBlockReqType { + // OFFSET + DlpWriteBlockReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes; + UInt8 data[2]; // 4; block data -- var size + } DlpWriteBlockReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpReadAppBlock + + +// Response argument structure: +// +// see dlpReadAppBlock + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpWriteAppBlock + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextModifiedRec +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadRecord +// + +// Request argument structure: +// +#define dlpReadNextModRecReqArgID dlpFirstArgID +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// Response argument id = dlpReadRecordRespArgID + +// Response argument structure = DlpReadRecordRespType + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetRecordIndex +////////////////////////////////////////////////////////////////////////// +// Resets the "next modified record" index to the beginning +// +// Possible error codes +// dlpRespErrParam +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetRecordIndexReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrRecordBusy, +// dlpRespErrNoneOpen + +typedef enum { + dlpReadRecordIdArgID = dlpFirstArgID, + dlpReadRecordIndexArgID + } DlpReadRecordReqArgID; + +// dlpReadRecordIdArgID request argument structure: +// +typedef struct DlpReadRecordByIDReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt32 recordID; // 2; unique record id + UInt16 offset; // 6; offset into the record + UInt16 numBytes; // 8; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 10 bytes; + } DlpReadRecordByIDReqType; + +// dlpReadRecordIndexArgID request argument structure: +// +typedef struct DlpReadRecordByIndexReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt16 index; // 2; record index + UInt16 offset; // 4; offset into the record + UInt16 numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadRecordByIndexReqType; + + +// Response argument structure: +// +#define dlpReadRecordRespArgID dlpFirstArgID + +typedef struct DlpReadRecordRespHdrType { + // OFFSET + UInt32 recordID; // 0; unique record id + UInt16 index; // 4; record index + UInt16 recSize; // 6; total record size in bytes + UInt8 attributes; // 8; record attributes + UInt8 category; // 9; record category index + // TOTAL: 10 bytes; + } DlpReadRecordRespHdrType; + +typedef struct DlpReadRecordRespType { + // OFFSET + DlpReadRecordRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + UInt8 data[2]; // 8; record data -- var size + } DlpReadRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecordIDList +////////////////////////////////////////////////////////////////////////// +// Returns a list of unique record id's. May need to call more than once +// to get the entire list. dlpRespErrNotFound is returned when "start" +// is out of bounds +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrNoneOpen + +#define dlpReadRecordIDListReqArgID dlpFirstArgID + +// dlpReadRecordIDListReqArgID request argument structure: +// +typedef struct DlpReadRecordIDListReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 flags; // 1; request flags + UInt16 start; // 2; starting record index (0-based) + UInt16 maxEntries; // 4; maximum number of entries, or + // 0xFFFF to return as many as possible + // TOTAL: 6 bytes; + } DlpReadRecordIDListReqType; + +// dlpReadRecordIDListFlagSortDB: if set, DL Server will call the creator +// application to resort the database before returning the list. +#define dlpReadRecordIDListFlagSortDB 0x80 + + +// Response argument structure: +// +#define dlpReadRecordIDListRespArgID dlpFirstArgID + +typedef struct DlpReadRecordIDListRespHdrType { + // OFFSET + UInt16 numEntries; // 0; number of entries returned + // TOTAL: 2 bytes; + } DlpReadRecordIDListRespHdrType; + +typedef struct DlpReadRecordIDListRespType { + // OFFSET + DlpReadRecordIDListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt32 recID[1]; // 8; list of record id's -- var size + } DlpReadRecordIDListRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotEnoughSpace +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteRecordReqArgID dlpFirstArgID + +// dlpWriteRecordReqArgID -- required +typedef struct DlpWriteRecordReqHdrType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 flags; // 1; set unused bits to null! + UInt32 recordID; // 2; unique record id or null + UInt8 attributes; // 6; record attributes -- only + // dlpRecAttrSecret is allowed here + // v1.1 extension: + // dlpRecAttrDeleted, dlpRecAttrArchived and + // dlpRecAttrDirty are also allowed. + UInt8 category; // 7; record category + // TOTAL: 8 bytes; + } DlpWriteRecordReqHdrType; + +#define dlpWriteRecordReqFlagDataIncluded 0x80 // original implementer of destop software always + // set this bit. Define it here for compatibility + +typedef struct DlpWriteRecordReqType { + // OFFSET + DlpWriteRecordReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + UInt8 data[2]; // 8; record data -- var size + } DlpWriteRecordReqType; + + +// Response argument structure: +// +#define dlpWriteRecordRespArgID dlpFirstArgID + +typedef struct DlpWriteRecordRespType { + // OFFSET + UInt32 recordID; // 0; record ID + // TOTAL: 4 bytes + } DlpWriteRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen +// + +// Request argument structure: +// +#define dlpDeleteRecordReqArgID dlpFirstArgID + +// Argument structure to delete by record ID(dlpDeleteRecordReqIDArgID): +typedef struct DlpDeleteRecordReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 flags; // 1; flags (dlpDeleteRecFlagDeleteAll) + UInt32 recordID; // 2; unique record id (see flags) + // TOTAL: 6 bytes; + } DlpDeleteRecordReqType; + +// dlpDeleteRecFlagDeleteAll: if this flag is set, the reocordID field +// is ignored and all database records will be deleted +#define dlpDeleteRecFlagDeleteAll 0x80 + +// dlpDeleteRecFlagByCategory: if this flag is set, the least significant byte +// of the reocordID field contains the category id of records to be deleted (PalmOS 2.0) +#define dlpDeleteRecFlagByCategory 0x40 + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +typedef enum { + dlpReadResourceIndexArgID = dlpFirstArgID, + dlpReadResourceTypeArgID + } DlpReadResourceReqArgID; + +// dlpReadResourceIndexArgID request argument structure: +// +typedef struct DlpReadResourceByIndexReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt16 index; // 2; resource index + UInt16 offset; // 4; offset into the resource + UInt16 numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadResourceByIndexReqType; + +// dlpReadResourceTypeArgID request argument structure: +// +typedef struct DlpReadResourceByTypeReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt32 type; // 2; resource type + UInt16 id; // 6; resource id + UInt16 offset; // 8; offset into the resource + UInt16 numBytes; // 10; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 12 bytes; + } DlpReadResourceByTypeReqType; + + +// Response argument structure: +// +#define dlpReadResourceRespArgID dlpFirstArgID + +typedef struct DlpReadResourceRespHdrType { + // OFFSET + UInt32 type; // 0; resource type + UInt16 id; // 4; resource id + UInt16 index; // 6; resource index + UInt16 resSize; // 8; total resource size in bytes + // TOTAL: 10 bytes; + } DlpReadResourceRespHdrType; + +typedef struct DlpReadResourceRespType { + // OFFSET + DlpReadResourceRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes; + UInt8 resData[2]; // 6; resource data -- var size + } DlpReadResourceRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteResourceReqArgID dlpFirstArgID + +typedef struct DlpWriteResourceReqHdrType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; inused -- set to null! + UInt32 type; // 2; resource type + UInt16 id; // 6; resource id + UInt16 resSize; // 8; total resource size + // TOTAL: 10 bytes; + } DlpWriteResourceReqHdrType; + +typedef struct DlpWriteResourceReqType { + // OFFSET + DlpWriteResourceReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 10 bytes; + UInt8 data[2]; // 10; resource data -- var size + } DlpWriteResourceReqType; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpDeleteResourceReqArgID dlpFirstArgID + +typedef struct DlpDeleteResourceReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 flags; // 1; flags (dlpDeleteResFlagDeleteAll) + UInt32 type; // 2; resource type + UInt16 id; // 6; resource id + // TOTAL: 8 bytes; + } DlpDeleteResourceReqType; + +// dlpDeleteResFlagDeleteAll: if set, all resources in the db will be deleted +#define dlpDeleteResFlagDeleteAll 0x80 + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCleanUpDatabase +////////////////////////////////////////////////////////////////////////// +// Deletes all records which are marked as archived or deleted in the +// record database +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly, +// dlpRespErrNotSupported +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpCleanUpDatabaseReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSyncFlags +////////////////////////////////////////////////////////////////////////// +// For record databases, reset all dirty flags. +// For both record and resource databases, set the last sync time to NOW +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam +// dlpRespErrReadOnly, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetSyncFlagsReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCallApplication +////////////////////////////////////////////////////////////////////////// +// Call an application entry point via an action code +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound + +// Request argument structure: +// +enum { + dlpCallApplicationReqArgIDV10 = dlpFirstArgID, // req id for Pilot v1.0 + dlpCallAppReqArgID // req id for Pilot v2.0 and later + }; + +// dlpCallApplicationReqArgIDV10: +typedef struct DlpCallApplicationReqHdrTypeV10 { + // OFFSET + UInt32 creator; // 0; app DB creator id + UInt16 action; // 4; action code + UInt16 paramSize; // 6; custom param size + // TOTAL: 8 bytes + } DlpCallApplicationReqHdrTypeV10; + +typedef struct DlpCallApplicationReqTypeV10 { + // OFFSET + DlpCallApplicationReqHdrTypeV10 // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes + UInt8 paramData[2]; // 8; custom param data -- var size + } DlpCallApplicationReqTypeV10; + + +// dlpCallAppReqArgID (Pilot v2.0): +typedef struct DlpCallAppReqHdrType { + // OFFSET + UInt32 creator; // 0; DB creator id of target executable + UInt32 type; // 4; DB type id of target executable + UInt16 action; // 8; action code + UInt32 dwParamSize; // 10; custom param size in number of bytes + UInt32 dwReserved1; // 14; RESERVED -- set to NULL!!! + UInt32 dwReserved2; // 18; RESERVED -- set to NULL!!! + // TOTAL: 22 bytes + } DlpCallAppReqHdrType; + +typedef struct DlpCallAppReqType { + // OFFSET + DlpCallAppReqHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 22 bytes + UInt8 paramData[2]; // 22; custom param data -- var size + } DlpCallAppReqType; + + + +// Response argument structure: +// +enum { + dlpCallApplicationRespArgIDV10 = dlpFirstArgID, // resp id for Pilot v1.0 + dlpCallAppRespArgID // resp id for Pilot v2.0 and later + }; + +// dlpCallApplicationRespArgIDV10: +typedef struct DlpCallApplicationRespHdrTypeV10 { + // OFFSET + UInt16 action; // 0; action code which was called + UInt16 resultCode; // 2; result error code returned by action + UInt16 resultSize; // 4; custom result data size + // TOTAL: 6 bytes + } DlpCallApplicationRespHdrTypeV10; + +typedef struct DlpCallApplicationRespTypeV10 { + // OFFSET + DlpCallApplicationRespHdrTypeV10 // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes + UInt8 resultData[2]; // 6; custom result data -- var size + } DlpCallApplicationRespTypeV10; + +// dlpCallAppRespArgID: +typedef struct DlpCallAppRespHdrType { + // OFFSET + UInt32 dwResultCode; // 0; result error code returned by handler + UInt32 dwResultSize; // 4; custom result data size + UInt32 dwReserved1; // 8; RESERVED -- SET TO NULL!!! + UInt32 dwReserved2; // 12; RESERVED -- SET TO NULL!!! + // TOTAL: 16 bytes + } DlpCallAppRespHdrType; + +typedef struct DlpCallAppRespType { + // OFFSET + DlpCallAppRespHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 16 bytes + UInt8 resultData[2]; // 16; custom result data -- var size + } DlpCallAppRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSystem +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpAddSyncLogEntry +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrLimitExceeded, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpAddSyncLogEntryReqArgID dlpFirstArgID + +typedef struct DlpAddSyncLogEntryReqType { + // OFFSET + UInt8 text[2]; // 0; entry text -- var size and + // null-terminated + } DlpAddSyncLogEntryReqType; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpProcessRPC +////////////////////////////////////////////////////////////////////////// +// Remote Procedure Call interface +// +// Request arguments: +// RPC command block +// +// Response arguments: +// RPC reply block +// +// Possible error codes +// 0 on success; otherwise error code from the TouchDown +// RPC executor +// +// NOTE: this is a low-level system command which does not use arg wrappers. + +// Request argument structure: +// +// Block of RPC command data (no arg wrapper) + +// Response argument structure: +// +// Block of RPC reply data of same length as command block(no arg wrapper) + + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenConduit +////////////////////////////////////////////////////////////////////////// +// This command is sent before each conduit is opened by the desktop. +// If the viewer has a cancel pending, it will return dlpRespErrCancelSync +// in the response header's errorCode field. +// +// Request arguments: none. +// +// Response arguments: none. +// +// Possible error codes +// dlpRespErrCancelSync + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpEndOfSync +////////////////////////////////////////////////////////////////////////// +// This command is sent by the desktop to end the sync. +// +// Request arguments: termination code: 0 = normal termination; +// otherwise the client is aborting the sync +// +// Possible error codes +// 0 + +// Request argument structure: +// +#define dlpEndOfSyncReqArgID dlpFirstArgID + +typedef enum DlpSyncTermCode { + dlpTermCodeNormal = 0, // normal termination + dlpTermCodeOutOfMemory, // termination due to low memory on TD + dlpTermCodeUserCan, // user cancelled from desktop + dlpTermCodeOther, // catch-all abnormal termination code + dlpTermCodeIncompatibleProducts // incompatibility between desktop and handheld hotsync products + } DlpSyncTermCode; + + +typedef struct DlpEndOfSyncReqType { + // OFFSET + UInt16 termCode; // 0; termination code + // TOTAL: 2 bytes + } DlpEndOfSyncReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextRecInCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadRecord + +#define dlpReadNextRecInCategoryReqArgID dlpFirstArgID + +// dlpReadNextRecInCategoryReqArgID request argument structure: +// +typedef struct DlpReadNextRecInCategoryReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 category; // 1; category id + // TOTAL: 2 bytes; + } DlpReadNextRecInCategoryReqType; + + +// Response argument structure: +// +// Response argument id = dlpReadRecordRespArgID + +// Response argument structure = DlpReadRecordRespType + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextModifiedRecInCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadNextRecInCategory + +// Request argument structure: +// +// same as dlpReadNextRecInCategory + +// Response argument structure: +// +// same as dlpReadNextRecInCategory + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadAppPreference +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound, + +#define dlpReadAppPreferenceReqArgID dlpFirstArgID + +// dlpReadAppPreferenceReqArgID request argument structure: +// +typedef struct DlpReadAppPreferenceReqType { + // OFFSET + UInt32 creator; // 0; application creator type + UInt16 id; // 4; preference id + UInt16 reqBytes; // 6; max. number of preference bytes requested; + // pass 0xFFFF for actual size + UInt8 flags; // 8; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db + UInt8 unused; // 9; reserved/padding -- set to NUL! + // TOTAL: 10 bytes; + } DlpReadAppPreferenceReqType; + +#define dlpReadAppPrefActualSize 0xFFFF +#define dlpAppPrefReqFlagBackedUp 0x80 + +// Response argument structure: +// +#define dlpReadAppPreferenceRespArgID dlpFirstArgID + +typedef struct DlpReadAppPreferenceRespHdrType { + // OFFSET + UInt16 version; // 0; version number of the application + UInt16 actualSize; // 2; actual preference data size + UInt16 retBytes; // 4; number of preference bytes returned + // TOTAL: 6 bytes + } DlpReadAppPreferenceRespHdrType; + +typedef struct DlpReadAppPreferenceRespType { + // OFFSET + DlpReadAppPreferenceRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes + UInt8 data[2]; // 6; custom result data -- var size + } DlpReadAppPreferenceRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteAppPreference +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotEnoughSpace + +// Request argument structure: +// +#define dlpWriteAppPreferenceReqArgID dlpFirstArgID + +typedef struct DlpWriteAppPreferenceReqHdrType { + // OFFSET + UInt32 creator; // 0; application creator type + UInt16 id; // 4; preference id + UInt16 version; // 6; version number of the application + UInt16 prefSize; // 8; preference size(in number of bytes) + UInt8 flags; // 10; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db + UInt8 unused; // 11; reserved/padding -- set to NUL! + // TOTAL: 12 bytes; + } DlpWriteAppPreferenceReqHdrType; + +typedef struct DlpWriteAppPreferenceReqType { + // OFFSET + DlpWriteAppPreferenceReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + UInt8 data[2]; // 12; record data -- var size + } DlpWriteAppPreferenceReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNetSyncInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: none +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadNetSyncInfoRespArgID dlpFirstArgID + +typedef struct DlpReadNetSyncInfoRespHdrType { + // OFFSET + UInt8 lanSyncOn; // 0; non-zero if Lan Sync is enabled + UInt8 bReserved1; // 1; reserved -- SET TO NULL! + UInt32 dwReserved1; // 2; reserved -- SET TO NULL! + UInt32 dwReserved2; // 6; reserved -- SET TO NULL! + UInt32 dwReserved3; // 10; reserved -- SET TO NULL! + UInt32 dwReserved4; // 14; reserved -- SET TO NULL! + UInt16 syncPCNameSize;// 18; length of sync PC host name, + // including null (0 = no host name) + UInt16 syncPCAddrSize;// 20; length of sync PC address, + // including null (0 = no address) + UInt16 syncPCMaskSize;// 22; length of sync PC subnet mask, + // including null (0 = no mask) + // TOTAL: 24 bytes + } DlpReadNetSyncInfoRespHdrType; + +typedef struct DlpReadNetSyncInfoRespType { + // OFFSET + DlpReadNetSyncInfoRespHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 24 bytes + UInt8 syncAddr[2]; // 24; sync IP address/host name -- var size, + // null-terminated + } DlpReadNetSyncInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteNetSyncInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpWriteNetSyncInfoReqArgID dlpFirstArgID + +#define dlpMaxHostAddrLength 255 // maximum PC host name length, not including NULL + +typedef struct DlpWriteNetSyncInfoReqHdrType { + // OFFSET + UInt8 modFlags; // 0; flags indicating which values are being + // modified; see the dlpNetSyncInfoMod... + // flags defined below + UInt8 lanSyncOn; // 1; non-zero if Lan Sync is enabled + UInt32 dwReserved1; // 2; reserved -- SET TO NULL! + UInt32 dwReserved2; // 6; reserved -- SET TO NULL! + UInt32 dwReserved3; // 10; reserved -- SET TO NULL! + UInt32 dwReserved4; // 14; reserved -- SET TO NULL! + UInt16 syncPCNameSize;// 18; length of sync PC host name, + // including null (0 = no address/host name) + UInt16 syncPCAddrSize;// 20; length of sync PC address, + // including null (0 = no address) + UInt16 syncPCMaskSize;// 22; length of sync PC subnet mask, + // including null (0 = no mask) + // TOTAL: 24 bytes + } DlpWriteNetSyncInfoReqHdrType; + +// Flags indicating which values are being changed by the dlpWriteNetSyncInfo +// request. These flags are used in the modFlags field of DlpWriteNetSyncInfoReqHdrType. +// These flags are additive. +// +#define dlpNetSyncInfoModLanSyncOn 0x80 // changing the "lan sync on" setting +#define dlpNetSyncInfoModSyncPCName 0x40 // changing the sync PC host name +#define dlpNetSyncInfoModSyncPCAddr 0x20 // changing the sync PC address +#define dlpNetSyncInfoModSyncPCMask 0x10 // changing the sync PC subnet mask + +typedef struct DlpWriteNetSyncInfoReqType { + // OFFSET + DlpWriteNetSyncInfoReqHdrType + hdr; // 0; fixed-size header + // FIXED SIZE: 24 bytes + UInt8 syncAddr[2]; // 24; sync IP address/host name -- var size, + // null-terminated + } DlpWriteNetSyncInfoReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadFeature +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotFound, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadFeatureReqArgID dlpFirstArgID + +typedef struct DlpReadFeatureReqType { + // OFFSET + UInt32 dwFtrCreator; // 0; feature creator + UInt16 wFtrNum; // 4; feature number + // TOTAL: 6 bytes + } DlpReadFeatureReqType; + + +// Response argument structure: +// +#define dlpReadFeatureRespArgID dlpFirstArgID + +typedef struct DlpReadFeatureRespType { + // OFFSET + UInt32 dwFeature; // 0; feature value + // TOTAL: 4 bytes + } DlpReadFeatureRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpFindDB +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotFound, +// dlpRespErrParam + +// Request argument structure: +// + +// dlpFindDBByNameReqArgID, dlpFindDBByTypeCreatorReqArgID and dlpFindDBByOpenHandleReqArgID +// are mutually exclusive +enum { + dlpFindDBByNameReqArgID = dlpFirstArgID, // req id for card + name based search + dlpFindDBByOpenHandleReqArgID, // req id for search given an open db handle + dlpFindDBByTypeCreatorReqArgID // req id for type + creator based iterative search + }; + +// Option flags +#define dlpFindDBOptFlagGetAttributes 0x80 // get database attributes -- this is + // an option to allow find operations to skip + // returning this data as a performance optimization + +#define dlpFindDBOptFlagGetSize 0x40 // get record count and data size also -- this is + // an option because the operation can take a long + // time, which we would rather avoid if it is not needed + +#define dlpFindDBOptFlagGetMaxRecSize 0x20 // get max rec/resource size -- this is + // an option because the operation can take a long + // time, which we would rather avoid if it is not needed + // (dlpFindDBOptFlagGetMaxRecSize is only supported for + // dlpFindDBByOpenHandleReqArgID) + +// Request type for dlpdlpFindDBByNameReqArgID: +typedef struct DlpFindDBByNameReqHdrType { + // OFFSET + UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags + UInt8 bCardNo; // 2; card number to search + // TOTAL: 4 bytes + } DlpFindDBByNameReqHdrType; + +typedef struct DlpFindDBByNameReqType { + // OFFSET + DlpFindDBByNameReqHdrType // + header; // 0; fixed size header + // FIXED SIZE: 4 bytes + UInt8 name[2]; // variable size -- zero-terminated database name string + } DlpFindDBByNameReqType; + + +// Request type for dlpFindDBByOpenHandleReqArgID: +typedef struct DlpFindDBByOpenHandleReqType { + // OFFSET + UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags + UInt8 bDbID; // 1; database id returned by dlpOpenDB or dlpCreateDB + // TOTAL: 2 bytes + } DlpFindDBByOpenHandleReqType; + + +// Request type for dlpFindDBByTypeCreatorReqArgID: +typedef struct DlpFindDBByTypeCreatorReqType { + // OFFSET + UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags + UInt8 bSrchFlags; // 1; bitfield of dlpFindDBSrchFlag... flags + UInt32 dwType; // 2; db type id (zero = wildcard) + UInt32 dwCreator; // 6; db creator id (zero = wildcard) + // TOTAL: 10 bytes + } DlpFindDBByTypeCreatorReqType; + +#define dlpFindDBSrchFlagNewSearch 0x80 // set to beging a new search +#define dlpFindDBSrchFlagOnlyLatest 0x40 // set to search for the latest version + + + +// Response argument structures for dlpFindDBByNameReqArgID, dlpFindDBByOpenHandleReqArgID and +// dlpFindDBByTypeCreatorReqArgID (if found): +// +enum { + dlpFindDBBasicRespArgID = dlpFirstArgID, // resp arg id for basic info + // (if dlpFindDBOptFlagGetAttributes is set) + dlpFindDBSizeRespArgID // resp arg id for size info + // (if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize + // are set) + }; + + +// dlpFindDBBasicRespArgID (returned only if dlpFindDBOptFlagGetAttributes is set): + +typedef struct DlpFindDBBasicRespHdrType { + // OFFSET + UInt8 bCardNo; // 0; card number of database + UInt8 bReserved; // 1; RESERVED -- SET TO NULL + UInt32 dwLocalID; // 2; local id of the database (for internal use) + UInt32 dwOpenRef; // 6; db open ref of the database if it is currently opened + // by the caller; zero otherwise (for internal use) can + // change after read record list + DlpDBInfoHdrType info; //10; database info (creator, type, flags, etc.) MUST BE LAST FIELD + // TOTAL: 54 bytes + } DlpFindDBBasicRespHdrType; + +typedef struct DlpFindDBBasicRespType { + // OFFSET + DlpFindDBBasicRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 54 bytes + UInt8 name[2]; // variable size -- zero-terminated database name string + } DlpFindDBBasicRespType; + + + +// dlpFindDBSizeRespArgID (returned only if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize is set): + +typedef struct DlpFindDBSizeRespType { + // OFFSET + + // Returned if dlpFindDBOptFlagGetSize is set for all queries: + // (otherwise, fields are set to zero) + UInt32 dwNumRecords; // 0; record/resource count + UInt32 dwTotalBytes; // 4; total bytes used by db + UInt32 dwDataBytes; // 8; bytes used for data + + // Returned if dlpFindDBOptFlagGetSize is set for dlpFindDBByOpenHandleReqArgID only: + // (otherwise, fields are set to zero) + UInt32 dwAppBlkSize; //12; size of app info block size (for + // dlpFindDBByOpenHandleReqArgID only) + UInt32 dwSortBlkSize; //16; size of sort info block size(for + // dlpFindDBByOpenHandleReqArgID only) + // + // Returned if dlpFindDBOptFlagGetMaxRecSize is set for dlpFindDBByOpenHandleReqArgID only: + // (otherwise, field is set to zero) + UInt32 dwMaxRecSize; //20; size of largest record or resource in the database (for + // dlpFindDBByOpenHandleReqArgID + dlpFindDBOptFlagGetMaxRecSize only) + // TOTAL: 24 bytes + } DlpFindDBSizeRespType; + + + + +////////////////////////////////////////////////////////////////////////// +// dlpSetDBInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotEnoughSpace +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// + +enum { + dlpSetDBInfoReqArgID = dlpFirstArgID + }; + + +typedef struct DlpSetDBInfoReqHdrType { + // OFFSET + UInt8 dbID; // 0; database id returned by dlpOpenDB or dlpCreateDB + UInt8 bReserved; // 1; RESERVED -- SET TO NULL + UInt16 wClrDbFlags; // 2; flags to clear; allowed DB flags: dlpDBFlagAppInfoDirty, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention; + // 0 = don't change + UInt16 wSetDbFlags; // 4; flags to set; allowed DB flags: dlpDBFlagAppInfoDirty, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention; + // 0 = don't change + UInt16 wDbVersion; // 6; database version; dlpSetDBInfoNoVerChange = don't change + DlpDateTimeType crDate; // 8; creation date; zero year = don't change + DlpDateTimeType modDate; //16; modification date; zero year = don't change + DlpDateTimeType bckUpDate; //24; backup date; zero year = don't change + UInt32 dwType; //32; database type id; zero = don't change + UInt32 dwCreator; //36; database creator id; zero = don't change + // TOTAL: 40 bytes + } DlpSetDBInfoReqHdrType; + +#define dlpSetDBInfoNoVerChange 0xFFFF + +typedef struct DlpSetDBInfoReqType { + // OFFSET + DlpSetDBInfoReqHdrType // + header; // 0; fixed size header + // FIXED SIZE: 40 bytes + UInt8 name[2]; // variable size -- zero-terminated database name string + } DlpSetDBInfoReqType; + + +// Response argument structure: +// +// none. + + + +/************************************************************ + * Macros + *************************************************************/ + + +#endif // __DLCOMMON_H__ + diff --git a/sdk-3.5/include/Core/System/DLServer.h b/sdk-3.5/include/Core/System/DLServer.h new file mode 100644 index 0000000..c8062e8 --- /dev/null +++ b/sdk-3.5/include/Core/System/DLServer.h @@ -0,0 +1,412 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: DLServer.h + * + * Description: + * Desktop Link Protocol(DLP) Server implementation definitions. + * + * History: + * vmk 7/12/95 Created by Vitaly Marty Kruglikov + * vmk 7/12/96 Converted to HTAL architecture + * jmp 12/23/99 Fix <> vs. "" problem. + * + *****************************************************************************/ + +#ifndef __DL_SERVER_H__ +#define __DL_SERVER_H__ + +// Pilot common definitions +#include +#include // for DmOpenRef + +#include + + +/************************************************************ + * DLK result codes + * (dlkErrorClass is defined in SystemMgr.h) + *************************************************************/ +#pragma mark *Error Codes* + +#define dlkErrParam (dlkErrorClass | 1) // invalid parameter +#define dlkErrMemory (dlkErrorClass | 2) // memory allocation error +#define dlkErrNoSession (dlkErrorClass | 3) // could not establish a session + +#define dlkErrSizeErr (dlkErrorClass | 4) // reply length was too big + +#define dlkErrLostConnection (dlkErrorClass | 5) // lost connection +#define dlkErrInterrupted (dlkErrorClass | 6) // sync was interrupted (see sync state) +#define dlkErrUserCan (dlkErrorClass | 7) // cancelled by user + + + +/******************************************************************** + * Desktop Link system preferences resource for user info + * id = sysResIDDlkUserInfo, defined in SystemResources.h + ********************************************************************/ +#pragma mark *User Info Preference* + +#define dlkMaxUserNameLength 40 +#define dlkUserNameBufSize (dlkMaxUserNameLength + 1) + +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define dlkMaxLogSize (20 * 1024) +#else +#define dlkMaxLogSize (2 * 1024) +#endif + +typedef enum DlkSyncStateType { + dlkSyncStateNeverSynced = 0, // never synced + dlkSyncStateInProgress, // sync is in progress + dlkSyncStateLostConnection, // connection lost during sync + dlkSyncStateLocalCan, // cancelled by local user on handheld + dlkSyncStateRemoteCan, // cancelled by user from desktop + dlkSyncStateLowMemoryOnTD, // sync ended due to low memory on handheld + dlkSyncStateAborted, // sync was aborted for some other reason + dlkSyncStateCompleted, // sync completed normally + + // Added in PalmOS v3.0: + dlkSyncStateIncompatibleProducts // sync ended because desktop HotSync product + // is incompatible with this version + // of the handheld HotSync + } DlkSyncStateType; + +#define dlkUserInfoPrefVersion 0x0102 // current user info pref version: 1.2 + +typedef struct DlkUserInfoHdrType { + UInt16 version; // pref version number + UInt32 userID; // user id + UInt32 viewerID; // id assigned to viewer by the desktop + UInt32 lastSyncPC; // last sync PC id + UInt32 succSyncDate; // last successful sync date + UInt32 lastSyncDate; // last sync date + DlkSyncStateType lastSyncState; // last sync status + UInt8 reserved1; // Explicitly account for 16-bit alignment padding + UInt16 lanSyncEnabled;// if non-zero, LAN Sync is enabled + UInt32 hsTcpPortNum; // TCP/IP port number of Desktop HotSync + UInt32 dwReserved1; // RESERVED -- set to NULL! + UInt32 dwReserved2; // RESERVED -- set to NULL! + UInt8 userNameLen; // length of name field(including null) + UInt8 reserved2; // Explicitly account for 16-bit alignment padding + UInt16 syncLogLen; // length of sync log(including null) + } DlkUserInfoHdrType; + +typedef struct DlkUserInfoType { + DlkUserInfoHdrType header; // fixed size header + Char nameAndLog[2]; // user name, followed by sync log; + // both null-terminated(for debugging) + } DlkUserInfoType; + +typedef DlkUserInfoType* DlkUserInfoPtr; // user info pointer + + +/******************************************************************** + * Desktop Link system preferences resource for the Conduit Filter Table + * id = sysResIDDlkCondFilterTab, defined in SystemResources.h + ********************************************************************/ +#pragma mark *Conduit Filter Preference* + +// +// Table for specifying conduits to "filter out" during HotSync +// + +// This table consists of DlkCondFilterTableHdrType header followed by a +// variable number of DlkCondFilterEntryType entries + +typedef struct DlkCondFilterTableHdrType { + UInt16 entryCount; + } DlkCondFilterTableHdrType; +typedef DlkCondFilterTableHdrType* DlkCondFilterTableHdrPtr; + +typedef struct DlkCondFilterEntryType { + UInt32 creator; + UInt32 type; + } DlkCondFilterEntryType; +typedef DlkCondFilterEntryType* DlkCondFilterEntryPtr; + +typedef struct DlkCondFilterTableType { + DlkCondFilterTableHdrType + hdr; // table header + DlkCondFilterEntryType + entry[1]; // variable number of entries + } DlkCondFilterTableType; +typedef DlkCondFilterTableType* DlkCondFilterTablePtr; + + + +/******************************************************************** + * DLK Session Structures + ********************************************************************/ +#pragma mark *Session Structures* + + +// DesktopLink event notification callback. If non-zero is returned, +// sync will be cancelled as soon as a safe point is reached. +typedef enum { + dlkEventOpeningConduit = 1, // conduit is being opened -- paramP + // is null; + + dlkEventDatabaseOpened, // client has opened a database -- paramP + // points to DlkEventDatabaseOpenedType; + + dlkEventCleaningUp, // last stage of sync -- cleaning up (notifying apps, etc) -- + // paramP is null + + dlkEventSystemResetRequested // system reset was requested by the desktop client + // (the normal action is to delay the reset until + // end of sync) -- paramP is null + } DlkEventType; + +// Prototype for the event notification callback +typedef Int16 (*DlkEventProcPtr)(UInt32 eventRef, DlkEventType dlkEvent, + void * paramP); + +// Parameter structure for dlkEventDatabaseOpened +// Added new fields for Pilot v2.0 vmk 12/24/96 +typedef struct DlkEventDatabaseOpenedType { + DmOpenRef dbR; // open database ref (v2.0) + Char * dbNameP; // database name + UInt32 dbType; // databse type (v2.0) + UInt32 dbCreator; // database creator + } DlkEventDatabaseOpenedType; + + +// Prototype for the "user cancel" check callback function +typedef Int16 (*DlkUserCanProcPtr)(UInt32 canRef); + + +// +// List of modified database creators maintained by DLP Server +// +typedef struct DlkDBCreatorList { + UInt16 count; // number of entries in the list + MemHandle listH; // chunk MemHandle of the creators list + } DlkDBCreatorList; + + +// +// Desktop Link Server state flags +// +#define dlkStateFlagVerExchanged 0x8000 +#define dlkStateFlagSyncDateSet 0x4000 + +// +// DLP Server session information +// +typedef struct DlkServerSessionType { + UInt16 htalLibRefNum; // HTAL library reference number - the library has a live connection + UInt32 maxHtalXferSize; // Maximum transfer block size + + // Information supplied by user + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + UInt32 eventRef; // user reference value for event proc + DlkUserCanProcPtr canProcP; // ptr to user-cancel function + UInt32 canRef; // parameter for canProcP() + MemHandle condFilterH; // MemHandle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none + + // Current database information + UInt8 dlkDBID; // Desktop Link database MemHandle of the open database + UInt8 reserved1; + DmOpenRef dbR; // TouchDown database access pointer -- if null, no current db + UInt16 cardNo; // memory module number + UInt32 dbCreator; // creator id + Char dbName[dmDBNameLength]; // DB name + UInt16 dbOpenMode; // database open mode + Boolean created; // true if the current db was created + Boolean isResDB; // set to true if resource database + Boolean ramBased; // true if the db is in RAM storage + Boolean readOnly; // true if the db is read-only + LocalID dbLocalID; // TouchDown LocalID of the database + UInt32 initialModNum; // initial DB modification number + UInt32 curRecIndex; // current record index for enumeration functions + // (0=beginning) + + // List of modified database creators maintained by DLP Server + DlkDBCreatorList creatorList; + + // Session status information + DlkSyncStateType syncState; // current sync state; + + Boolean complete; // set to true when completion request + // has been received + + Boolean conduitOpened; // set to true after the first coduit + // is opened by remote + + Boolean logCleared; // set to true after sync log has been + // cleared during the current session; + // The log will be cleared before any new entries are added or at + // the end of sync in case no new entries were added. + // (we do not clear the log at the beginning of sync in case the + // user cancels during the "identifying user" phase; in this + // event, the spec calls for preserving the original log) + + Boolean resetPending; // set to true if system reset is pending; + // the reset will be carried out at end + // of sync + + // Current request information + Boolean gotCommand; // set to true when got a request + UInt8 cmdTID; // current transaction ID + UInt8 reserved2; + UInt16 cmdLen; // size of data in request buffer + void * cmdP; // pointer to command + MemHandle cmdH; // MemHandle of command buffer + + // Fields added in PalmOS v3.0 + UInt16 wStateFlags; // bitfield of dlkStateFlag... bits + DmSearchStateType dbSearchState; // database search state for iterative + // searches using DmGetNextDatabaseByTypeCreator + } DlkServerSessionType; + +typedef DlkServerSessionType* DlkServerSessionPtr; + + +/******************************************************************** + * DLK Function Parameter Structures + ********************************************************************/ +#pragma mark *Function Parameter Structures* + +// +// Parameter passed to DlkControl() +// +typedef enum DlkCtlEnum { + dlkCtlFirst = 0, // reserve 0 + + // + // Pilot v2.0 control codes: + // + dlkCtlGetPCHostName, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0) + // param2P = ptr to buffer size(UInt16); + // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostName, // param1P = ptr to host name(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted) + + dlkCtlGetCondFilterTable, // param1P = ptr to destination buffer for filter table, or NULL if *param2 is 0 + // param2P = on entry, ptr to size of buffer(UInt16) (the size may be 0) + // on return, size, in bytes, of the actual filter table + + dlkCtlSetCondFilterTable, // param1P = ptr to to conduit filter table, or NULL if *param2 is 0 + // param2P = ptr to size of filter table(UInt16) (if size is 0, the current table will be deleted) + + dlkCtlGetLANSync, // param1P = ptr to store for the LANSync setting(UInt16): 0 = off, otherwise on + // param2P = not used, set to NULL + + dlkCtlSetLANSync, // param1P = ptr to the LANSync setting(UInt16): 0 = off, otherwise on + // param2P = not used, set to NULL + + dlkCtlGetHSTCPPort, // param1P = ptr to store for the Desktop HotSync TCP/IP port number(UInt32) -- zero if not set + // param2P = not used, set to NULL + + dlkCtlSetHSTCPPort, // param1P = ptr to the Desktop HotSync TCP/IP port number(UInt32) + // param2P = not used, set to NULL + + dlkCtlSendCallAppReply, // param1P = ptr to DlkCallAppReplyParamType structure + // param2P = not used, set to NULL + // + // RETURNS: send error code; use this error code + // as return value from the action code handler + + + dlkCtlGetPCHostAddr, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0) + // param2P = ptr to buffer size(UInt16); + // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostAddr, // param1P = ptr to host address string(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted) + + + dlkCtlGetPCHostMask, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0) + // param2P = ptr to buffer size(UInt16); + // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostMask, // param1P = ptr to subnet mask string(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted) + + + dlkCtlLAST // *KEEP THIS ENTRY LAST* + +} DlkCtlEnum; + + +// +// Parameter passed to DlkStartServer() +// +typedef struct DlkServerParamType { + UInt16 htalLibRefNum; // HTAL library reference number - the library has a live connection + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + UInt32 eventRef; // user reference value for event proc + UInt32 reserved1; // reserved - set to NULL + UInt32 reserved2; // reserved - set to NULL + MemHandle condFilterH; // MemHandle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none + } DlkServerParamType; + +typedef DlkServerParamType* DlkServerParamPtr; + + + +// +// Parameter passed with DlkControl()'s dlkCtlSendCallAppReply code +// +typedef struct DlkCallAppReplyParamType { + UInt16 pbSize; // size of this parameter block (set to sizeof(DlkCallAppReplyParamType)) + UInt32 dwResultCode; // result code to be returned to remote caller + void * resultP; // ptr to result data + UInt32 dwResultSize; // size of reply data in number of bytes + void * dlRefP; // DesktopLink reference pointer from + // SysAppLaunchCmdHandleSyncCallAppType + UInt32 dwReserved1; // RESERVED -- set to null!!! + } DlkCallAppReplyParamType; + + +/******************************************************************** + * DesktopLink Server Routines + ********************************************************************/ +#pragma mark *Function Prototypes* + +#ifdef __cplusplus +extern "C" { +#endif + +// +// SERVER API +// + +// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam, +// * dlkErrNoSession, dlkErrLostConnection, dlkErrMemory, +// * dlkErrUserCan +extern Err DlkStartServer(DlkServerParamPtr paramP) + SYS_TRAP(sysTrapDlkStartServer); + +extern Err DlkGetSyncInfo(UInt32 * succSyncDateP, UInt32 * lastSyncDateP, + DlkSyncStateType* syncStateP, Char * nameBufP, + Char * logBufP, Int32 * logLenP) + SYS_TRAP(sysTrapDlkGetSyncInfo); + +extern void DlkSetLogEntry(const Char * textP, Int16 textLen, Boolean append) + SYS_TRAP(sysTrapDlkSetLogEntry); + +// Dispatch a DesktopLink request (exposed for patching) +extern Err DlkDispatchRequest(DlkServerSessionPtr sessP) + SYS_TRAP(sysTrapDlkDispatchRequest); + +extern Err DlkControl(DlkCtlEnum op, void * param1P, void * param2P) + SYS_TRAP(sysTrapDlkControl); + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * DLK Macros + ********************************************************************/ + + + +#endif // __DL_SERVER_H__ + diff --git a/sdk-3.5/include/Core/System/DataMgr.h b/sdk-3.5/include/Core/System/DataMgr.h new file mode 100644 index 0000000..65ddec3 --- /dev/null +++ b/sdk-3.5/include/Core/System/DataMgr.h @@ -0,0 +1,539 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: DataMgr.h + * + * Description: + * Header for the Data Manager + * + * History: + * 11/14/94 RM - Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __DATAMGR_H__ +#define __DATAMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. +#include // Error numbers + +// Other headers we depend on +#include + + +typedef UInt32 DmResType; +typedef UInt16 DmResID; + +/************************************************************ + * Category equates + *************************************************************/ +#define dmRecAttrCategoryMask 0x0F // mask for category # +#define dmRecNumCategories 16 // number of categories +#define dmCategoryLength 16 // 15 chars + 1 null terminator + +#define dmAllCategories 0xff +#define dmUnfiledCategory 0 + +#define dmMaxRecordIndex 0xffff + + + +// Record Attributes +// +// *** IMPORTANT: +// *** +// *** Any changes to record attributes must be reflected in dmAllRecAttrs and dmSysOnlyRecAttrs *** +// *** +// *** Only one nibble is available for record attributes +// +// *** ANY CHANGES MADE TO THESE ATTRIBUTES MUST BE REFLECTED IN DESKTOP LINK +// *** SERVER CODE (DLCommon.h, DLServer.c) +#define dmRecAttrDelete 0x80 // delete this record next sync +#define dmRecAttrDirty 0x40 // archive this record next sync +#define dmRecAttrBusy 0x20 // record currently in use +#define dmRecAttrSecret 0x10 // "secret" record - password protected + + +// All record atributes (for error-checking) +#define dmAllRecAttrs ( dmRecAttrDelete | \ + dmRecAttrDirty | \ + dmRecAttrBusy | \ + dmRecAttrSecret ) + +// Record attributes which only the system is allowed to change (for error-checking) +#define dmSysOnlyRecAttrs ( dmRecAttrBusy ) + + +/************************************************************ + * Database Header equates + *************************************************************/ +#define dmDBNameLength 32 // 31 chars + 1 null terminator + +// Attributes of a Database +// +// *** IMPORTANT: +// *** +// *** Any changes to database attributes must be reflected in dmAllHdrAttrs and dmSysOnlyHdrAttrs *** +// *** +#define dmHdrAttrResDB 0x0001 // Resource database +#define dmHdrAttrReadOnly 0x0002 // Read Only database +#define dmHdrAttrAppInfoDirty 0x0004 // Set if Application Info block is dirty + // Optionally supported by an App's conduit +#define dmHdrAttrBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. +#define dmHdrAttrOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK + // for it to install a newer version of this database + // with a different name if the current database is + // open. This mechanism is used to update the + // Graffiti Shortcuts database, for example. +#define dmHdrAttrResetAfterInstall 0x0020 // Device requires a reset after this database is + // installed. +#define dmHdrAttrCopyPrevention 0x0040 // This database should not be copied to + +#define dmHdrAttrStream 0x0080 // This database is used for file stream implementation. +#define dmHdrAttrHidden 0x0100 // This database should generally be hidden from view + // used to hide some apps from the main view of the + // launcher for example. + // For data (non-resource) databases, this hides the record + // count within the launcher info screen. +#define dmHdrAttrLaunchableData 0x0200 // This data database (not applicable for executables) + // can be "launched" by passing it's name to it's owner + // app ('appl' database with same creator) using + // the sysAppLaunchCmdOpenNamedDB action code. + +#define dmHdrAttrOpen 0x8000 // Database not closed properly + + +// All database atributes (for error-checking) +#define dmAllHdrAttrs ( dmHdrAttrResDB | \ + dmHdrAttrReadOnly | \ + dmHdrAttrAppInfoDirty | \ + dmHdrAttrBackup | \ + dmHdrAttrOKToInstallNewer | \ + dmHdrAttrResetAfterInstall | \ + dmHdrAttrCopyPrevention | \ + dmHdrAttrStream | \ + dmHdrAttrOpen ) + +// Database attributes which only the system is allowed to change (for error-checking) +#define dmSysOnlyHdrAttrs ( dmHdrAttrResDB | \ + dmHdrAttrOpen ) + + +/************************************************************ + * Unique ID equates + *************************************************************/ +#define dmRecordIDReservedRange 1 // The range of upper bits in the database's + // uniqueIDSeed from 0 to this number are + // reserved and not randomly picked when a + // database is created. +#define dmDefaultRecordsID 0 // Records in a default database are copied + // with their uniqueIDSeeds set in this range. +#define dmUnusedRecordID 0 // Record ID not allowed on the device + + +/************************************************************ + * Mode flags passed to DmOpenDatabase + *************************************************************/ +#define dmModeReadOnly 0x0001 // read access +#define dmModeWrite 0x0002 // write access +#define dmModeReadWrite 0x0003 // read & write access +#define dmModeLeaveOpen 0x0004 // leave open when app quits +#define dmModeExclusive 0x0008 // don't let anyone else open it +#define dmModeShowSecret 0x0010 // force show of secret records + +// Generic type used to represent an open Database +typedef void * DmOpenRef; + + +/************************************************************ + * Structure passed to DmGetNextDatabaseByTypeCreator and used + * to cache search information between multiple searches. + *************************************************************/ +typedef struct { + UInt32 info[8]; + } DmSearchStateType; +typedef DmSearchStateType* DmSearchStatePtr; + + + +/************************************************************ + * Structures used by the sorting routines + *************************************************************/ +typedef struct { + UInt8 attributes; // record attributes; + UInt8 uniqueID[3]; // unique ID of record + } SortRecordInfoType; + +typedef SortRecordInfoType *SortRecordInfoPtr; + +typedef Int16 DmComparF (void *, void *, Int16 other, SortRecordInfoPtr, + SortRecordInfoPtr, MemHandle appInfoH); + + + +/************************************************************ + * Database manager error codes + * the constant dmErrorClass is defined in ErrorBase.h + *************************************************************/ +#define dmErrMemError (dmErrorClass | 1) +#define dmErrIndexOutOfRange (dmErrorClass | 2) +#define dmErrInvalidParam (dmErrorClass | 3) +#define dmErrReadOnly (dmErrorClass | 4) +#define dmErrDatabaseOpen (dmErrorClass | 5) +#define dmErrCantOpen (dmErrorClass | 6) +#define dmErrCantFind (dmErrorClass | 7) +#define dmErrRecordInWrongCard (dmErrorClass | 8) +#define dmErrCorruptDatabase (dmErrorClass | 9) +#define dmErrRecordDeleted (dmErrorClass | 10) +#define dmErrRecordArchived (dmErrorClass | 11) +#define dmErrNotRecordDB (dmErrorClass | 12) +#define dmErrNotResourceDB (dmErrorClass | 13) +#define dmErrROMBased (dmErrorClass | 14) +#define dmErrRecordBusy (dmErrorClass | 15) +#define dmErrResourceNotFound (dmErrorClass | 16) +#define dmErrNoOpenDatabase (dmErrorClass | 17) +#define dmErrInvalidCategory (dmErrorClass | 18) +#define dmErrNotValidRecord (dmErrorClass | 19) +#define dmErrWriteOutOfBounds (dmErrorClass | 20) +#define dmErrSeekFailed (dmErrorClass | 21) +#define dmErrAlreadyOpenForWrites (dmErrorClass | 22) +#define dmErrOpenedByAnotherTask (dmErrorClass | 23) +#define dmErrUniqueIDNotFound (dmErrorClass | 24) +#define dmErrAlreadyExists (dmErrorClass | 25) +#define dmErrInvalidDatabaseName (dmErrorClass | 26) +#define dmErrDatabaseProtected (dmErrorClass | 27) +#define dmErrDatabaseNotProtected (dmErrorClass | 28) + +/************************************************************ + * Values for the direction parameter of DmSeekRecordInCategory + *************************************************************/ +#define dmSeekForward 1 +#define dmSeekBackward -1 + + +/************************************************************ + * Data Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initialization +Err DmInit(void) + SYS_TRAP(sysTrapDmInit); + + +// Directory Lists +Err DmCreateDatabase(UInt16 cardNo, const Char *nameP, + UInt32 creator, UInt32 type, Boolean resDB) + SYS_TRAP(sysTrapDmCreateDatabase); + +Err DmCreateDatabaseFromImage(MemPtr bufferP) + SYS_TRAP(sysTrapDmCreateDatabaseFromImage); + + +Err DmDeleteDatabase(UInt16 cardNo, LocalID dbID) + SYS_TRAP(sysTrapDmDeleteDatabase); + +UInt16 DmNumDatabases(UInt16 cardNo) + SYS_TRAP(sysTrapDmNumDatabases); + +LocalID DmGetDatabase(UInt16 cardNo, UInt16 index) + SYS_TRAP(sysTrapDmGetDatabase); + +LocalID DmFindDatabase(UInt16 cardNo, const Char *nameP) + SYS_TRAP(sysTrapDmFindDatabase); + +Err DmGetNextDatabaseByTypeCreator(Boolean newSearch, DmSearchStatePtr stateInfoP, + UInt32 type, UInt32 creator, Boolean onlyLatestVers, + UInt16 *cardNoP, LocalID *dbIDP) + SYS_TRAP(sysTrapDmGetNextDatabaseByTypeCreator); + + +// Database info +Err DmDatabaseInfo(UInt16 cardNo, LocalID dbID, Char *nameP, + UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, + UInt32 * modDateP, UInt32 *bckUpDateP, + UInt32 * modNumP, LocalID *appInfoIDP, + LocalID *sortInfoIDP, UInt32 *typeP, + UInt32 *creatorP) + SYS_TRAP(sysTrapDmDatabaseInfo); + +Err DmSetDatabaseInfo(UInt16 cardNo, LocalID dbID, const Char *nameP, + UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, + UInt32 * modDateP, UInt32 *bckUpDateP, + UInt32 * modNumP, LocalID *appInfoIDP, + LocalID *sortInfoIDP, UInt32 *typeP, + UInt32 *creatorP) + SYS_TRAP(sysTrapDmSetDatabaseInfo); + +Err DmDatabaseSize(UInt16 cardNo, LocalID dbID, UInt32 *numRecordsP, + UInt32 * totalBytesP, UInt32 *dataBytesP) + SYS_TRAP(sysTrapDmDatabaseSize); + + +// This routine can be used to prevent a database from being deleted (by passing +// true for 'protect'). It will increment the protect count if 'protect' is true +// and decrement it if 'protect' is false. This is used by code that wants to +// keep a particular record or resource in a database locked down but doesn't +// want to keep the database open. This information is keep in the dynamic heap so +// all databases are "unprotected" at system reset. +Err DmDatabaseProtect(UInt16 cardNo, LocalID dbID, Boolean protect) + SYS_TRAP(sysTrapDmDatabaseProtect); + + +// Open/close Databases +DmOpenRef DmOpenDatabase(UInt16 cardNo, LocalID dbID, UInt16 mode) + SYS_TRAP(sysTrapDmOpenDatabase); + +DmOpenRef DmOpenDatabaseByTypeCreator(UInt32 type, UInt32 creator, UInt16 mode) + SYS_TRAP(sysTrapDmOpenDatabaseByTypeCreator); + +DmOpenRef DmOpenDBNoOverlay(UInt16 cardNo, LocalID dbID, UInt16 mode) + SYS_TRAP(sysTrapDmOpenDBNoOverlay); + +Err DmCloseDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmCloseDatabase); + + +// Info on open databases +DmOpenRef DmNextOpenDatabase(DmOpenRef currentP) + SYS_TRAP(sysTrapDmNextOpenDatabase); + +Err DmOpenDatabaseInfo(DmOpenRef dbP, LocalID *dbIDP, + UInt16 *openCountP, UInt16 *modeP, UInt16 *cardNoP, + Boolean *resDBP) + SYS_TRAP(sysTrapDmOpenDatabaseInfo); + +LocalID DmGetAppInfoID (DmOpenRef dbP) + SYS_TRAP(sysTrapDmGetAppInfoID); + +void DmGetDatabaseLockState(DmOpenRef dbR, UInt8 *highest, UInt32 *count, UInt32 *busy) + SYS_TRAP(sysTrapDmGetDatabaseLockState); + +// Utility to unlock all records and clear busy bits +Err DmResetRecordStates(DmOpenRef dbP) + SYS_TRAP(sysTrapDmResetRecordStates); + + +// Error Query +Err DmGetLastErr(void) + SYS_TRAP(sysTrapDmGetLastErr); + + +//------------------------------------------------------------ +// Record based access routines +//------------------------------------------------------------ + +// Record Info +UInt16 DmNumRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumRecords); + +UInt16 DmNumRecordsInCategory(DmOpenRef dbP, UInt16 category) + SYS_TRAP(sysTrapDmNumRecordsInCategory); + +Err DmRecordInfo(DmOpenRef dbP, UInt16 index, + UInt16 *attrP, UInt32 *uniqueIDP, LocalID *chunkIDP) + SYS_TRAP(sysTrapDmRecordInfo); + +Err DmSetRecordInfo(DmOpenRef dbP, UInt16 index, + UInt16 *attrP, UInt32 *uniqueIDP) + SYS_TRAP(sysTrapDmSetRecordInfo); + + + +// Record attaching and detaching +Err DmAttachRecord(DmOpenRef dbP, UInt16 *atP, + MemHandle newH, MemHandle *oldHP) + SYS_TRAP(sysTrapDmAttachRecord); + +Err DmDetachRecord(DmOpenRef dbP, UInt16 index, + MemHandle *oldHP) + SYS_TRAP(sysTrapDmDetachRecord); + +Err DmMoveRecord(DmOpenRef dbP, UInt16 from, UInt16 to) + SYS_TRAP(sysTrapDmMoveRecord); + + + +// Record creation and deletion +MemHandle DmNewRecord(DmOpenRef dbP, UInt16 *atP, UInt32 size) + SYS_TRAP(sysTrapDmNewRecord); + +Err DmRemoveRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmRemoveRecord); + +Err DmDeleteRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmDeleteRecord); + +Err DmArchiveRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmArchiveRecord); + +MemHandle DmNewHandle(DmOpenRef dbP, UInt32 size) + SYS_TRAP(sysTrapDmNewHandle); + +Err DmRemoveSecretRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmRemoveSecretRecords); + + +// Record viewing manipulation +Err DmFindRecordByID(DmOpenRef dbP, UInt32 uniqueID, UInt16 *indexP) + SYS_TRAP(sysTrapDmFindRecordByID); + +MemHandle DmQueryRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmQueryRecord); + +MemHandle DmGetRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmGetRecord); + +MemHandle DmQueryNextInCategory(DmOpenRef dbP, UInt16 *indexP, UInt16 category) + SYS_TRAP(sysTrapDmQueryNextInCategory); + +UInt16 DmPositionInCategory (DmOpenRef dbP, UInt16 index, UInt16 category) + SYS_TRAP(sysTrapDmPositionInCategory); + +Err DmSeekRecordInCategory (DmOpenRef dbP, UInt16 *indexP, UInt16 offset, + Int16 direction, UInt16 category) + SYS_TRAP(sysTrapDmSeekRecordInCategory); + + +MemHandle DmResizeRecord(DmOpenRef dbP, UInt16 index, UInt32 newSize) + SYS_TRAP(sysTrapDmResizeRecord); + +Err DmReleaseRecord(DmOpenRef dbP, UInt16 index, Boolean dirty) + SYS_TRAP(sysTrapDmReleaseRecord); + +UInt16 DmSearchRecord(MemHandle recH, DmOpenRef *dbPP) + SYS_TRAP(sysTrapDmSearchRecord); + + +// Category manipulation +Err DmMoveCategory (DmOpenRef dbP, UInt16 toCategory, UInt16 fromCategory, Boolean dirty) + SYS_TRAP(sysTrapDmMoveCategory); + +Err DmDeleteCategory (DmOpenRef dbR, UInt16 categoryNum) + SYS_TRAP(sysTrapDmDeleteCategory); + + +// Validation for writing +Err DmWriteCheck(void *recordP, UInt32 offset, UInt32 bytes) + SYS_TRAP(sysTrapDmWriteCheck); + +// Writing +Err DmWrite(void *recordP, UInt32 offset, const void *srcP, UInt32 bytes) + SYS_TRAP(sysTrapDmWrite); + +Err DmStrCopy(void *recordP, UInt32 offset, const Char *srcP) + SYS_TRAP(sysTrapDmStrCopy); + +Err DmSet(void *recordP, UInt32 offset, UInt32 bytes, UInt8 value) + SYS_TRAP(sysTrapDmSet); + + + + +//------------------------------------------------------------ +// Resource based access routines +//------------------------------------------------------------ + +// High level access routines +MemHandle DmGetResource(DmResType type, DmResID resID) + SYS_TRAP(sysTrapDmGetResource); + +MemHandle DmGet1Resource(DmResType type, DmResID resID) + SYS_TRAP(sysTrapDmGet1Resource); + +Err DmReleaseResource(MemHandle resourceH) + SYS_TRAP(sysTrapDmReleaseResource); + +MemHandle DmResizeResource(MemHandle resourceH, UInt32 newSize) + SYS_TRAP(sysTrapDmResizeResource); + + +// Searching resource databases +DmOpenRef DmNextOpenResDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNextOpenResDatabase); + +UInt16 DmFindResourceType(DmOpenRef dbP, DmResType resType, UInt16 typeIndex) + SYS_TRAP(sysTrapDmFindResourceType); + +UInt16 DmFindResource(DmOpenRef dbP, DmResType resType, DmResID resID, + MemHandle resH) + SYS_TRAP(sysTrapDmFindResource); + +UInt16 DmSearchResource(DmResType resType, DmResID resID, + MemHandle resH, DmOpenRef *dbPP) + SYS_TRAP(sysTrapDmSearchResource); + + +// Resource Info +UInt16 DmNumResources(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumResources); + +Err DmResourceInfo(DmOpenRef dbP, UInt16 index, + DmResType *resTypeP, DmResID *resIDP, + LocalID *chunkLocalIDP) + SYS_TRAP(sysTrapDmResourceInfo); + +Err DmSetResourceInfo(DmOpenRef dbP, UInt16 index, + DmResType *resTypeP, DmResID *resIDP) + SYS_TRAP(sysTrapDmSetResourceInfo); + + + +// Resource attaching and detaching +Err DmAttachResource(DmOpenRef dbP, MemHandle newH, + DmResType resType, DmResID resID) + SYS_TRAP(sysTrapDmAttachResource); + +Err DmDetachResource(DmOpenRef dbP, UInt16 index, + MemHandle *oldHP) + SYS_TRAP(sysTrapDmDetachResource); + + + +// Resource creation and deletion +MemHandle DmNewResource(DmOpenRef dbP, DmResType resType, DmResID resID, + UInt32 size) + SYS_TRAP(sysTrapDmNewResource); + +Err DmRemoveResource(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmRemoveResource); + + + +// Resource manipulation +MemHandle DmGetResourceIndex(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmGetResourceIndex); + + + +// Record sorting +Err DmQuickSort(DmOpenRef dbP, DmComparF *compar, Int16 other) + SYS_TRAP(sysTrapDmQuickSort); + +Err DmInsertionSort (DmOpenRef dbR, DmComparF *compar, Int16 other) + SYS_TRAP(sysTrapDmInsertionSort); + +UInt16 DmFindSortPosition(DmOpenRef dbP, void *newRecord, + SortRecordInfoPtr newRecordInfo, DmComparF *compar, Int16 other) + SYS_TRAP(sysTrapDmFindSortPosition); + +UInt16 DmFindSortPositionV10(DmOpenRef dbP, void *newRecord, + DmComparF *compar, Int16 other) + SYS_TRAP(sysTrapDmFindSortPositionV10); + +#ifdef __cplusplus +} +#endif + +#endif // __DATAMGR_H__ + diff --git a/sdk-3.5/include/Core/System/DateTime.h b/sdk-3.5/include/Core/System/DateTime.h new file mode 100644 index 0000000..1a0385e --- /dev/null +++ b/sdk-3.5/include/Core/System/DateTime.h @@ -0,0 +1,282 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: DateTime.h + * + * Description: + * Date and Time calculations + * + * History: + * 1/19/95 rsf - Created by Roger Flores + * 7/15/99 rsf - moved some types in from Preferences.h + * 12/23/99 jmp - eliminated bogus maxTime definition + * + *****************************************************************************/ + +#ifndef __DATETIME_H__ +#define __DATETIME_H__ + +#include + +typedef enum + { + tfColon, + tfColonAMPM, // 1:00 pm + tfColon24h, // 13:00 + tfDot, + tfDotAMPM, // 1.00 pm + tfDot24h, // 13.00 + tfHoursAMPM, // 1 pm + tfHours24h, // 13 + tfComma24h // 13,00 + } TimeFormatType; + + +typedef enum { + dsNone, // Daylight Savings Time not observed + dsUSA, // United States Daylight Savings Time + dsAustralia, // Australian Daylight Savings Time + dsWesternEuropean, // Western European Daylight Savings Time + dsMiddleEuropean, // Middle European Daylight Savings Time + dsEasternEuropean, // Eastern European Daylight Savings Time + dsGreatBritain, // Great Britain and Eire Daylight Savings Time + dsRumania, // Rumanian Daylight Savings Time + dsTurkey, // Turkish Daylight Savings Time + dsAustraliaShifted // Australian Daylight Savings Time with shift in 1986 + } DaylightSavingsTypes; + + +// pass a TimeFormatType +#define Use24HourFormat(t) ((t) == tfColon24h || (t) == tfDot24h || (t) == tfHours24h || (t) == tfComma24h) +#define TimeSeparator(t) ((Char) ( t <= tfColon24h ? ':' : (t <= tfDot24h ? '.' : ','))) + + +typedef enum { + dfMDYWithSlashes, // 12/31/95 + dfDMYWithSlashes, // 31/12/95 + dfDMYWithDots, // 31.12.95 + dfDMYWithDashes, // 31-12-95 + dfYMDWithSlashes, // 95/12/31 + dfYMDWithDots, // 95.12.31 + dfYMDWithDashes, // 95-12-31 + + dfMDYLongWithComma, // Dec 31, 1995 + dfDMYLong, // 31 Dec 1995 + dfDMYLongWithDot, // 31. Dec 1995 + dfDMYLongNoDay, // Dec 1995 + dfDMYLongWithComma, // 31 Dec, 1995 + dfYMDLongWithDot, // 1995.12.31 + dfYMDLongWithSpace, // 1995 Dec 31 + + dfMYMed, // Dec '95 + dfMYMedNoPost // Dec 95 (added for French 2.0 ROM) + } DateFormatType; + +typedef struct { + Int16 second; + Int16 minute; + Int16 hour; + Int16 day; + Int16 month; + Int16 year; + Int16 weekDay; // Days since Sunday (0 to 6) + } DateTimeType; + +typedef DateTimeType *DateTimePtr; + + +// This is the time format. Times are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + UInt8 hours; + UInt8 minutes; +} TimeType; + +typedef TimeType *TimePtr; + +#define noTime -1 // The entire TimeType is -1 if there isn't a time. + + +// This is the date format. Dates are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + UInt16 year :7; // years since 1904 (MAC format) + UInt16 month :4; + UInt16 day :5; +} DateType; + +typedef DateType *DatePtr; + + +/************************************************************ + * Date Time Constants + *************************************************************/ + +// Maximum lengths of strings return by the date and time formating +// routine DateToAscii and TimeToAscii. +#define timeStringLength 9 +#define dateStringLength 9 +#define longDateStrLength 15 +#define dowDateStringLength 19 +#define dowLongDateStrLength 25 + + +#define firstYear 1904 +#define numberOfYears 128 +#define lastYear (firstYear + numberOfYears - 1) + + + +// Constants for time calculations +// Could change these from xIny to yPerX +#define secondsInSeconds 1 +#define minutesInSeconds 60 +#define hoursInMinutes 60 +#define hoursInSeconds (hoursInMinutes * minutesInSeconds) +#define hoursPerDay 24 +//#define daysInSeconds ((Int32)(hoursPerDay) * ((Int32)hoursInSeconds)) +#define daysInSeconds (0x15180) // cc bug + +#define daysInWeek 7 +#define daysInYear 365 +#define daysInLeapYear 366 +#define daysInFourYears (daysInLeapYear + 3 * daysInYear) + +#define monthsInYear 12 + +#define maxDays ((UInt32) numberOfYears / 4 * daysInFourYears - 1) +#define maxSeconds ((UInt32) maxDays * daysInSeconds) + +// Values returned by DayOfWeek routine. +#define sunday 0 +#define monday 1 +#define tuesday 2 +#define wednesday 3 +#define thursday 4 +#define friday 5 +#define saturday 6 + +// Months of the year +#define january 1 +#define february 2 +#define march 3 +#define april 4 +#define may 5 +#define june 6 +#define july 7 +#define august 8 +#define september 9 +#define october 10 +#define november 11 +#define december 12 + + +// Values returned by DoyOfMonth routine. +typedef enum { + dom1stSun, dom1stMon, dom1stTue, dom1stWen, dom1stThu, dom1stFri, dom1stSat, + dom2ndSun, dom2ndMon, dom2ndTue, dom2ndWen, dom2ndThu, dom2ndFri, dom2ndSat, + dom3rdSun, dom3rdMon, dom3rdTue, dom3rdWen, dom3rdThu, dom3rdFri, dom3rdSat, + dom4thSun, dom4thMon, dom4thTue, dom4thWen, dom4thThu, dom4thFri, dom4thSat, + domLastSun, domLastMon, domLastTue, domLastWen, domLastThu, domLastFri, + domLastSat + } DayOfWeekType; + +// Values used by DateTemplateToAscii routine. +#define dateTemplateChar chrCircumflexAccent + +enum { + dateTemplateDayNum = '0', + dateTemplateDOWName, + dateTemplateMonthName, + dateTemplateMonthNum, + dateTemplateYearNum +}; + +#define dateTemplateShortModifier 's' +#define dateTemplateRegularModifier 'r' +#define dateTemplateLongModifier 'l' +#define dateTemplateLeadZeroModifier 'z' + +//************************************************************ +//* Date and Time macros +//*********************************************************** + +// Convert a date in a DateType structure to an UInt16. + #define DateToInt(date) (*(UInt16 *) &date) + + +// Convert a date in a DateType structure to a signed int. + #define TimeToInt(time) (*(Int16 *) &time) + + + +//************************************************************ +//* Date Time procedures +//************************************************************ +#ifdef __cplusplus +extern "C" { +#endif + + +void TimSecondsToDateTime(UInt32 seconds, DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimSecondsToDateTime); + +UInt32 TimDateTimeToSeconds(DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimDateTimeToSeconds); + +void TimAdjust(DateTimePtr dateTimeP, Int32 adjustment) + SYS_TRAP(sysTrapTimAdjust); + +void TimeToAscii(UInt8 hours, UInt8 minutes, TimeFormatType timeFormat, + Char *pString) + SYS_TRAP(sysTrapTimeToAscii); + + + +Int16 DaysInMonth(Int16 month, Int16 year) + SYS_TRAP(sysTrapDaysInMonth); + +Int16 DayOfWeek (Int16 month, Int16 day, Int16 year) + SYS_TRAP(sysTrapDayOfWeek); + +Int16 DayOfMonth (Int16 month, Int16 day, Int16 year) + SYS_TRAP(sysTrapDayOfMonth); + + + +// Date routines. +void DateSecondsToDate (UInt32 seconds, DatePtr date) + SYS_TRAP(sysTrapDateSecondsToDate); + +void DateDaysToDate (UInt32 days, DatePtr date) + SYS_TRAP(sysTrapDateDaysToDate); + +UInt32 DateToDays (DateType date) + SYS_TRAP(sysTrapDateToDays); + +void DateAdjust (DatePtr dateP, Int32 adjustment) + SYS_TRAP(sysTrapDateAdjust); + +void DateToAscii(UInt8 months, UInt8 days, UInt16 years, + DateFormatType dateFormat, Char *pString) + SYS_TRAP(sysTrapDateToAscii); + +void DateToDOWDMFormat(UInt8 months, UInt8 days, UInt16 years, + DateFormatType dateFormat, Char *pString) + SYS_TRAP(sysTrapDateToDOWDMFormat); + +UInt16 DateTemplateToAscii(const Char *templateP, UInt8 months, + UInt8 days, UInt16 years, Char *stringP, Int16 stringLen) + SYS_TRAP(sysTrapDateTemplateToAscii); + +#ifdef __cplusplus +} +#endif + + +#endif //__DATETIME_H__ + diff --git a/sdk-3.5/include/Core/System/DebugMgr.h b/sdk-3.5/include/Core/System/DebugMgr.h new file mode 100644 index 0000000..afa7a2b --- /dev/null +++ b/sdk-3.5/include/Core/System/DebugMgr.h @@ -0,0 +1,181 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: DebugMgr.h + * + * Description: + * Debugging functions + * + * History: + * 11/03/94 RM - Created by Ron Marianetti + * + * 2/1/98 vmk - Defined DbgControl + * + *****************************************************************************/ + +#ifndef __DEBUGMGR_H__ +#define __DEBUGMGR_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +// +// Constants and structures used in conjunction with DbgControl +// +#define dbgCtlNotHandled false // debug control operation was not handled +#define dbgCtlHandled true // debug control operation was handled + +#define dbgCtlAllHandlersID 0 // indiacates that the operation is to be handled + // by all handlers + +#define dbgCtlHandlerNameLen 31 // maximum handler name length, not including null +#define dbgCtlHandlerVerLen 15 // maximum handler version string length, not including null + +#define dbgCtlFirstCustomOp 0x8000 // debug handlers begin numbering their op[erations] + // with this number; the system reserves all operation + // number values below this one +// Typed of the DbgControl function +typedef Boolean DbgControlFuncType(UInt32 handlerID, UInt16 op, void *paramP, UInt32 *dwParamP); + +typedef struct DbgCtlHandlerInfoType { + DbgControlFuncType* handlerFuncP; // MemPtr to handler's DbgControl function + UInt32 version; // numeric version number (hander-defined) + Boolean enabled; // true if handler is enabled; false if not + Char name[dbgCtlHandlerNameLen+1]; // null-terminated handler name + Char ver[dbgCtlHandlerVerLen+1]; // null-terminated handler version string + UInt8 reserved1; + UInt32 dwReserved; // RESERVED -- CALLER MUST INITIALIZE TO ZERO! + } DbgCtlHandlerInfoType; + +typedef void DbgCtlEnumCallbackFunc(void *callbackDataP, UInt32 handlerID, DbgControlFuncType* handlerFuncP); + +typedef struct DbgCtlEnumInfoType { + DbgCtlEnumCallbackFunc* enumFuncP; + void * callbackDataP; + } DbgCtlEnumInfoType; + +// System-defined debug control operations +enum { + + dbgCtlOpEnumHandlers = 1, // handlerID = dbgCtlAllHandlersID (applies to all handlers) + // paramP = MemPtr to DbgCtlEnumInfoType + // returns dbgCtlHandled if handled + + dbgCtlOpGetHandlerInfo, // handlerID = desired handler creator + // paramP = MemPtr to DbgCtlHandlerInfoType + // returns dbgCtlHandled if handled + + dbgCtlOpEnableHandler, // handlerID = desired handler creator or dbgCtlAllHandlersID + // returns dbgCtlHandled if handled + + dbgCtlOpDisableHandler, // handlerID = desired handler creator or dbgCtlAllHandlersID + // returns dbgCtlHandled if handled + + dbgCtlOpGetEnabledStatus, // handlerID = desired handler creator + // dwParamP = MemPtr to UInt32 type variable to be filled in with + // enabled status: non-zero = enabled, zero = disabled + // returns dbgCtlHandled if handled + + dbgCtlOpGetVersion, // handlerID = desired handler creator + // dwParamP = MemPtr to UInt32 type variable to be filled in with + // handler-specific version number + // returns dbgCtlHandled if handled + + + dbgCtlOpLAST + }; + + +#ifdef __GNUC__ + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) + #define _DEBUGGER_TRAP __attribute__ ((__callseq__ ("trap #8"))) + #else + #define _DEBUGGER_TRAP + #endif +#elif defined (__MWERKS__) /* The equivalent in CodeWarrior syntax */ + #define _DEBUGGER_TRAP = 0x4E40 + 8 +#endif + + +/************************************************************ + * Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Int32 DbgInit(MemPtr spaceP, MemPtr dispatchTableP[], Boolean openComm); + +void DbgSrcBreak(void) +#if USE_TRAPS + /* Use a trap instruction unless we're a simulator or we've explicitly + set USE_TRAPS to 0. */ + _DEBUGGER_TRAP +#endif + ; + +void DbgSrcMessage(Char *debugStr) + SYS_TRAP(sysTrapDbgSrcMessage); + + +// Debug control function for implementing debug tracing, etc. via debug handlers. +// The default implementation does nothing, leaving the real work up to "debug handlers". +// Debug handlers will be implemented as system extensions. As they are loaded, extensions +// will override this function call (DbgControl) and chain to those handlers loaded before +// them. When a debug control call is made by the client, a handler id of the handler that +// implements the functionality will be passed in as the first parameter. The handler id is +// the unique creator id of the handler. When a handler is called, it will first examine +// the handler ID -- if it matches its own, the handler will execute the command and return; +// if the handler id does not match, the handler must pass the call down the chain and return +// the value from that call. The operation to be performed is indicated by the parameter "op". +// op is specific to each handler this means that the same op values may be used by different +// handlers, since handler id's are unique. op values defined by handlers must begin at +// dbgCtlFirstCustomOp. Handler ID of dbgCtlAllHandlersID applies to all handlers. When the +// handler id of zero is passed, each handler is responsible for executing the requested action +// and passing the call down the chain. The last two parameters are defined by each handler +// for its own operations. +//typedef Boolean DbgControlFuncType(UInt32 handlerID, UInt16 op, void *paramP, UInt32 *dwParamP); +extern DbgControlFuncType DbgControl + SYS_TRAP(sysTrapDbgControl); + +void DbgBreak(void) +#if EMULATION_LEVEL == EMULATION_NONE + /* Use a trap instruction unless we're a simulator (i.e., even if we've + explicitly set USE_TRAPS to 0). In particular the SmallROM compiles + with USE_TRAPS set to 0 and needs the DbgBreak to resolve as a trap + instruction. */ + _DEBUGGER_TRAP +#endif + ; + +void DbgMessage(const Char *aStr) + SYS_TRAP(sysTrapDbgMessage); + +Char * DbgGetMessage(UInt8 *bufferP, Int32 timeout) + SYS_TRAP(sysTrapDbgGetMessage); + +Err DbgCommSettings(UInt32 *baudP, UInt32 *flagsP) + SYS_TRAP(sysTrapDbgCommSettings); + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ + +// This is an optimization for assembly code on the device. +#if EMULATION_LEVEL == EMULATION_NONE +#define _DbgBreak \ + DC.W m68kTrapInstr+sysDbgTrapNum //lint !e773 +#endif + + +#endif // __DEBUGMGR_H__ + diff --git a/sdk-3.5/include/Core/System/EmuStubs.h b/sdk-3.5/include/Core/System/EmuStubs.h new file mode 100644 index 0000000..b3b9aff --- /dev/null +++ b/sdk-3.5/include/Core/System/EmuStubs.h @@ -0,0 +1,152 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1998 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: EmuStubs.h + * + * Description: + * Stub routines used only when emulating. + * + * Note: All of these routines must be declared using generic + * C types so that this header file can be included in both + * Pilot source code and Mac or PC source code. + * + * The module that contains these routines "MacStubs.c" or + * "PCStubs.c" is the glue between the Pilot routines and the OS and + * does not include any Pilot headers. + * + * History: + * 11/03/94 RM - Created by Ron Marianetti + * 08/05/98 dia - Added function to check whether gremlins is on. + * 10/26/98 vsm - Changed return type of StubProcessMacEvents. + * + *****************************************************************************/ + +#ifndef __EMUSTUBS_H__ +#define __EMUSTUBS_H__ + +#include + +typedef enum + { + emuSendNoEvent, + emuSendNilEvent, + emuSendPenOrKeyEvent + } StubNilEventIsPendingResults; + +/************************************************************ + * Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Screen Driver Stubs +void StubDrawNotify(void* srcWinP, short scrRowBytes, short scrDepth, + short fromX, short fromY, short width, short height); + +// Console stubs +int StubConPutS(char* cstring); +int StubConGetS(char* cstring); + +// Debugger Stubs +void StubDbgSrcBreak(void); +void StubDbgSrcMessage(char* debugStr); +void StubDbgBreak(void); +void StubDbgMessage(char* aStr); + +// Time Manager Stubs +unsigned long StubTimGetTicks(void); +unsigned long StubTimGetSeconds(void); +void StubTimSetSeconds(unsigned long seconds); + + +// Event Manager Stubs +long StubProcessMacEvents(long timeout); +void StubEnqueuePenPosition(void); +void StubFlushEvents (void); + +// Gremlin Utility Functions +unsigned char StubGremlinsIsOn(void); + + + +// Emulator Stubs +StubNilEventIsPendingResults StubNilEventIsPending(); + + +// Error Manager stubs +void StubErrDisplayFileLineMsg(const char * const filename, + unsigned int lineNo, const char * const msg); + + +// Sound Manager stubs +#define stubSndErrBadParam -1 +#define stubSndErrBadChannel -2 + +#define stubSndCmdFreqDurationAmp 1 // param1 = freq in hz, param2 = duration in millisec, + // param3 = relative amplitidue 0-64; +#define stubSndCmdNoteOn 2 // param1 = MIDI key # (0-127), + // param2 = 0, + // param3 = key velocity (0-127) +#define stubSndCmdQuiet 3 // param1-3 = 0; + +#define stubSndCmdMakeGlobalChannel 4 + +#define stubSndCmdFreeGlobalChannel 5 + +#define stubSndCmdFrqOn 6 // param1 = freq in hz, + // param2 = 0, + // param3 = relative amplitidue 0-64; + +short StubSndCommand(void* channelP, unsigned short defAmp, + unsigned short cmd, unsigned long param1, + unsigned short param2, unsigned short param3, + char noWait); + + +// Alarm Manager stubs +short StubAlmSetAlarm(unsigned long alarmType, + long (*callback)(), unsigned long alarmTime); +unsigned long StubAlmGetAlarm(unsigned long alarmType); +void StubAlmDisplayAlarm(void); + + +// Emulator Utility Functions +void StubEventTrace(void *eventP); // Pilot Emulator Event Trace call + +// Resource Utility Functions +void** StubGet1Resource(unsigned long resType, int resID); + +// Graphics Utility functions. +void StubInitCTable(void* cTableP, unsigned int depth); + +// Utility functions +unsigned int StubRandom(void); + +// File System functions +short CreateMacOutputFile(char* name, unsigned long fileType, + unsigned long fileCreator); + + +// Key Manager stubs +unsigned long StubKeyCurrentState(void); + +#define stubKeyBitPower 0x0001 +#define stubKeyBitPageUp 0x0002 +#define stubKeyBitPageDown 0x0004 +#define stubKeyBitHard1 0x0008 +#define stubKeyBitHard2 0x0010 +#define stubKeyBitHard3 0x0020 +#define stubKeyBitHard4 0x0040 + +char StubCancelKey(void); + +#ifdef __cplusplus +} +#endif + + +#endif // __EMUSTUBS_H__ + diff --git a/sdk-3.5/include/Core/System/Encrypt.h b/sdk-3.5/include/Core/System/Encrypt.h new file mode 100644 index 0000000..462b3cf --- /dev/null +++ b/sdk-3.5/include/Core/System/Encrypt.h @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Encrypt.h + * + * Description: + * Equates for encryption/digestion routines in pilot + * + * History: + * 7/31/96 RM - Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __ENCRYPT_H__ +#define __ENCRYPT_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Perform reversible encryption or decryption of 8 byte string in +// srcP using 8 byte key keyP. Place 8 byte result in dstP. +Err EncDES(UInt8 *srcP, UInt8 *keyP, UInt8 *dstP, Boolean encrypt) + SYS_TRAP(sysTrapEncDES); + + +// Digest a string of bytes and produce a 128 bit result using +// the MD4 algorithm. +Err EncDigestMD4(UInt8 *strP, UInt16 strLen, UInt8 digestP[16]) + SYS_TRAP(sysTrapEncDigestMD4); + + +// Digest a string of bytes and produce a 128 bit result using +// the MD5 algorithm. +Err EncDigestMD5(UInt8 *strP, UInt16 strLen, UInt8 digestP[16]) + SYS_TRAP(sysTrapEncDigestMD5); + + + +#ifdef __cplusplus +} +#endif + + + +#endif //__ENCRYPT_H__ + diff --git a/sdk-3.5/include/Core/System/ErrorBase.h b/sdk-3.5/include/Core/System/ErrorBase.h new file mode 100644 index 0000000..c3df94b --- /dev/null +++ b/sdk-3.5/include/Core/System/ErrorBase.h @@ -0,0 +1,281 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ErrorBase.h + * + * Description: + * Include file for Error Management + * + * History: + * 10/25/94 RM Created by Ron Marianetti + * 10/09/98 Bob Fill in all macros, fix defns w/ do{}while(0) + * 08/05/99 kwk Added menuErrorClass from Gavin's Menu.c + * + *----------------------------------------------------------------------- + * Exception Handling + * + * This unit implements an exception handling mechanism that is similar + * to "real" C++ Exceptions. Our Exceptions are untyped, and there + * must be one and only one Catch block for each Try block. + * + * Try/Catch Syntax: + * + * ErrTry { + * // Do something which may fail. + * // Call ErrThrow() to signal failure and force jump + * // to the following Catch block. + * } + * + * ErrCatch(inErr) { + * // Recover or cleanup after a failure in the above Try block. + * // "inErr" is an ExceptionCode identifying the reason + * // for the failure. + * + * // You may call Throw() if you want to jump out to + * // the next Catch block. + * + * // The code in this Catch block does not execute if + * // the above Try block completes without a Throw. + * + * } ErrEndCatch + * + * You must structure your code exactly as above. You can't have a + * ErrTry { } without a ErrCatch { } ErrEndCatch, or vice versa. + * + * + * ErrThrow + * + * To signal failure, call ErrThrow() from within a Try block. The + * Throw can occur anywhere in the Try block, even within functions + * called from the Try block. A ErrThrow() will jump execution to the + * start of the nearest Catch block, even across function calls. + * Destructors for stack-based objects which go out of scope as + * a result of the ErrThrow() are called. + * + * You can call ErrThrow() from within a Catch block to "rethrow" + * the exception to the next nearest Catch block. + * + * + * Exception Codes + * + * An ExceptionCode is a 32-bit number. You will normally use + * Pilot error codes, which are 16-bit numbers. This allows + * plently of room for defining codes for your own kinds of errors. + * + * + * Limitations + * + * Try/Catch and Throw are based on setjmp/longjmp. At the + * beginning of a Try block, setjmp saves the machine registers. + * Throw calls longjmp, which restores the registers and jumps + * to the beginning of the Catch block. Therefore, any changes + * in the Try block to variables stored in registers will not + * be retained when entering the Catch block. + * + * The solution is to declare variables that you want to use + * in both the Try and Catch blocks as "volatile". For example: + * + * volatile long x = 1; // Declare volatile local variable + * ErrTry { + * x = 100; // Set local variable in Try + * ErrThrow(-1); + * } + * + * ErrCatch(inErr) { + * if (x > 1) { // Use local variable in Catch + * SysBeep(1); + * } + * } ErrEndCatch + * + *****************************************************************************/ + +#ifndef __ERRORBASE_H__ +#define __ERRORBASE_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +#if EMULATION_LEVEL != EMULATION_NONE +#include +#endif + +// Max message length supported by ErrCustomAlert +#define errMaxMsgLength 511 + + +/************************************************************ + * Error Classes for each manager + *************************************************************/ +#define errNone 0x0000 // No error + +#define memErrorClass 0x0100 // Memory Manager +#define dmErrorClass 0x0200 // Data Manager +#define serErrorClass 0x0300 // Serial Manager +#define slkErrorClass 0x0400 // Serial Link Manager +#define sysErrorClass 0x0500 // System Manager +#define fplErrorClass 0x0600 // Floating Point Library +#define flpErrorClass 0x0680 // New Floating Point Library +#define evtErrorClass 0x0700 // System Event Manager +#define sndErrorClass 0x0800 // Sound Manager +#define almErrorClass 0x0900 // Alarm Manager +#define timErrorClass 0x0A00 // Time Manager +#define penErrorClass 0x0B00 // Pen Manager +#define ftrErrorClass 0x0C00 // Feature Manager +#define cmpErrorClass 0x0D00 // Connection Manager (HotSync) +#define dlkErrorClass 0x0E00 // Desktop Link Manager +#define padErrorClass 0x0F00 // PAD Manager +#define grfErrorClass 0x1000 // Graffiti Manager +#define mdmErrorClass 0x1100 // Modem Manager +#define netErrorClass 0x1200 // Net Library +#define htalErrorClass 0x1300 // HTAL Library +#define inetErrorClass 0x1400 // INet Library +#define exgErrorClass 0x1500 // Exg Manager +#define fileErrorClass 0x1600 // File Stream Manager +#define rfutErrorClass 0x1700 // RFUT Library +#define txtErrorClass 0x1800 // Text Manager +#define tsmErrorClass 0x1900 // Text Services Library +#define webErrorClass 0x1A00 // Web Library +#define secErrorClass 0x1B00 // Security Library +#define emuErrorClass 0x1C00 // Emulator Control Manager +#define flshErrorClass 0x1D00 // Flash Manager +#define pwrErrorClass 0x1E00 // Power Manager +#define cncErrorClass 0x1F00 // Connection Manager (Serial Communication) +#define actvErrorClass 0x2000 // Activation application +#define radioErrorClass 0x2100 // Radio Manager (Library) +#define dispErrorClass 0x2200 // Display Driver Errors. +#define bltErrorClass 0x2300 // Blitter Driver Errors. +#define winErrorClass 0x2400 // Window manager. +#define omErrorClass 0x2500 // Overlay Manager +#define menuErrorClass 0x2600 // Menu Manager + +#define oemErrorClass 0x7000 // OEM/Licensee errors (0x7000-0x7EFF shared among ALL partners) +#define errInfoClass 0x7F00 // special class shows information w/o error code +#define appErrorClass 0x8000 // Application-defined errors + + + +/******************************************************************** + * Try / Catch / Throw support + * + * --------------------------------------------------------------------- + * Exception Handler structure + * + * An ErrExceptionType object is created for each ErrTry & ErrCatch block. + * At any point in the program, there is a linked list of + * ErrExceptionType objects. GErrFirstException points to the + * most recently entered block. A ErrExceptionType blocks stores + * information about the state of the machine (register values) + * at the start of the Try block + ********************************************************************/ + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrJumpBuf jmp_buf +#else + typedef long* ErrJumpBuf[12]; // D3-D7,PC,A2-A7 +#endif + +// Structure used to store Try state. +typedef struct ErrExceptionType { + struct ErrExceptionType* nextP; // next exception type + ErrJumpBuf state; // setjmp/longjmp storage + Int32 err; // Error code + } ErrExceptionType; +typedef ErrExceptionType *ErrExceptionPtr; + + +// Try & Catch macros +#define ErrTry \ + { \ + ErrExceptionType _TryObject; \ + _TryObject.err = 0; \ + _TryObject.nextP = (ErrExceptionPtr)*ErrExceptionList(); \ + *ErrExceptionList() = (MemPtr)&_TryObject; \ + if (ErrSetJump(_TryObject.state) == 0) { + + +// NOTE: All variables referenced in and after the ErrCatch must +// be declared volatile. Here's how for variables and pointers: +// volatile UInt16 oldMode; +// ShlDBHdrTablePtr volatile hdrTabP = nil; +// If you have many local variables after the ErrCatch you may +// opt to put the ErrTry and ErrCatch in a separate enclosing function. +#define ErrCatch(theErr) \ + *ErrExceptionList() = (MemPtr)_TryObject.nextP; \ + } \ + else { \ + Int32 theErr = _TryObject.err; \ + *ErrExceptionList() = (MemPtr)_TryObject.nextP; + + +#define ErrEndCatch \ + } \ + } + + + +/******************************************************************** + * Error Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrSetJump(buf) setjmp(buf) + #define ErrLongJump(buf,res) longjmp(buf,res) + +#else + Int16 ErrSetJump(ErrJumpBuf buf) + SYS_TRAP(sysTrapErrSetJump); + + void ErrLongJump(ErrJumpBuf buf, Int16 result) + SYS_TRAP(sysTrapErrLongJump); +#endif + +MemPtr* ErrExceptionList(void) + SYS_TRAP(sysTrapErrExceptionList); + +void ErrThrow(Int32 err) + SYS_TRAP(sysTrapErrThrow); + +void ErrDisplayFileLineMsg(const Char * const filename, UInt16 lineNo, + const Char * const msg) + SYS_TRAP(sysTrapErrDisplayFileLineMsg); + + +//--------------------------------------------------------------------- +// 2/25/98 - New routine for PalmOS >3.0 to display a UI alert for +// run-time errors. This is most likely to be used by network applications +// that are likely to encounter run-time errors like can't find the server, +// network down, etc. etc. +// +// This routine will lookup the text associated with 'errCode' and display +// it in an alert. If errMsgP is not NULL, then that text will be used +// instead of the associated 'errCode' text. If 'preMsgP' or 'postMsgP' +// is not null, then that text will be pre-pended or post-pended +// respectively. +// +// Apps that don't use the extra parameters may want to just use the +// macro below 'ErrAlert' +//--------------------------------------------------------------------- +UInt16 ErrAlertCustom(Err errCode, Char *errMsgP, Char *preMsgP, + Char * postMsgP) + SYS_TRAP(sysTrapErrAlertCustom); + +#define ErrAlert(err) ErrAlertCustom(err, 0, 0, 0) + + + +#ifdef __cplusplus +} +#endif + + + + +#endif // __ERRORBASE_H__ + diff --git a/sdk-3.5/include/Core/System/ErrorMgr.h b/sdk-3.5/include/Core/System/ErrorMgr.h new file mode 100644 index 0000000..c35e038 --- /dev/null +++ b/sdk-3.5/include/Core/System/ErrorMgr.h @@ -0,0 +1,96 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ErrorMgr.h + * + * 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. + * + *****************************************************************************/ + +#ifndef __ERRORMGR_H__ +#define __ERRORMGR_H__ + +#include // Invariant error management stuff + +#include // #define ERROR_CHECK_LEVEL + +//------------------------------------------------------------ +// Full Error Checking +//------------------------------------------------------------ +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + +#define ErrFatalDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + +#define ErrFatalDisplayIf(condition, msg) \ + do {if (condition) ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg);} while (0) + +#define ErrNonFatalDisplayIf(condition, msg) \ + do {if (condition) ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg);} while (0) + +#define ErrNonFatalDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + + + + +//------------------------------------------------------------ +// Fatal Error Checking Only +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_PARTIAL + +#define ErrFatalDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + +#define ErrFatalDisplayIf(condition, msg) \ + do {if (condition) ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg);} while (0) + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplay(msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + + + +//------------------------------------------------------------ +// No Error Checking +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_NONE + +#define ErrFatalDisplay(msg) + +#define ErrFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplay(msg) + +#define ErrDisplay(msg) + + +//------------------------------------------------------------ +// Not Defined... +//------------------------------------------------------------ +#else +#error ERROR: the compiler define 'ERROR_CHECK_LEVEL' must be defined! + +#endif // ERROR_CHECK_LEVEL + + +#endif // __ERRORMGR_H__ + diff --git a/sdk-3.5/include/Core/System/ExgLib.h b/sdk-3.5/include/Core/System/ExgLib.h new file mode 100644 index 0000000..a7b526e --- /dev/null +++ b/sdk-3.5/include/Core/System/ExgLib.h @@ -0,0 +1,143 @@ +/****************************************************************************** + * + * Copyright (c) 1997-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ExgLib.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __EXGLIB_H__ +#define __EXGLIB_H__ + +#include +#include +#include + +// special exchange mgr event key +#define exgIntDataChr 0x01ff + +//----------------------------------------------------------------------------- +// 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!!! +//----------------------------------------------------------------------------- + +#ifdef __GNUC__ + +#define exgLibTrapHandleEvent (sysLibTrapCustom) +#define exgLibTrapConnect (sysLibTrapCustom+1) +#define exgLibTrapAccept (sysLibTrapCustom+2) +#define exgLibTrapDisconnect (sysLibTrapCustom+3) +#define exgLibTrapPut (sysLibTrapCustom+4) +#define exgLibTrapGet (sysLibTrapCustom+5) +#define exgLibTrapSend (sysLibTrapCustom+6) +#define exgLibTrapReceive (sysLibTrapCustom+7) +#define exgLibTrapControl (sysLibTrapCustom+8) +#define exgLibReserved1 (sysLibTrapCustom+9) +#define exgLibTrapLast (sysLibTrapCustom+10) + +#else + +#pragma mark Traps +typedef enum { + exgLibTrapHandleEvent = sysLibTrapCustom, + exgLibTrapConnect, + exgLibTrapAccept, + exgLibTrapDisconnect, + exgLibTrapPut, + exgLibTrapGet, + exgLibTrapSend, + exgLibTrapReceive, + exgLibTrapControl, + exgLibReserved1, + exgLibTrapLast + } ExgLibTrapNumberEnum; + +#endif + + +/************************************************************ + * Net Library procedures. + *************************************************************/ +#pragma mark Functions +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +// Open the library - enable server for receiving data. +Err ExgLibOpen (UInt16 libRefnum) + SYS_TRAP(sysLibTrapOpen); + +Err ExgLibClose (UInt16 libRefnum) + SYS_TRAP(sysLibTrapClose); + +Err ExgLibSleep (UInt16 libRefnum) + SYS_TRAP(sysLibTrapSleep); + +Err ExgLibWake (UInt16 libRefnum) + SYS_TRAP(sysLibTrapWake); + +// MemHandle events that this library needs. This will be called by +// sysHandle event when certain low level events are triggered. +Err ExgLibHandleEvent(UInt16 libRefnum,void *eventP) + SYS_TRAP(exgLibTrapHandleEvent); + +// Establish a new connection +Err ExgLibConnect(UInt16 libRefNum,ExgSocketPtr exgSocketP) + SYS_TRAP(exgLibTrapConnect); + +// Accept a connection request from remote end +Err ExgLibAccept(UInt16 libRefnum,ExgSocketPtr exgSocketP) + SYS_TRAP(exgLibTrapAccept); + +// Disconnect +Err ExgLibDisconnect(UInt16 libRefnum,ExgSocketPtr exgSocketP,Err error) + SYS_TRAP(exgLibTrapDisconnect); + +// Initiate a Put command. This passes the name and other information about +// an object to be sent +Err ExgLibPut(UInt16 libRefnum,ExgSocketPtr exgSocketP) + SYS_TRAP(exgLibTrapPut); + +// Initiate a Get command. This requests an object from the remote end. +Err ExgLibGet(UInt16 libRefNum,ExgSocketPtr exgSocketP) + SYS_TRAP(exgLibTrapGet); + +// Send data to remote end - called after a Put command +UInt32 ExgLibSend(UInt16 libRefNum, ExgSocketPtr exgSocketP, const void * const bufP, const UInt32 bufLen, Err *errP) + SYS_TRAP(exgLibTrapSend); + +// Receive data from remote end -- called after Accept +UInt32 ExgLibReceive(UInt16 libRefNum, ExgSocketPtr exgSocketP, void *bufP, const UInt32 bufSize, Err *errP) + SYS_TRAP(exgLibTrapReceive); + +// Send various option commands to the Exg library +Err ExgLibControl(UInt16 libRefNum, UInt16 op, void *valueP, UInt16 *valueLenP) + SYS_TRAP(exgLibTrapControl); + + +#ifdef __cplusplus +} +#endif + +#endif // __EXGLIB_H__ + diff --git a/sdk-3.5/include/Core/System/ExgMgr.h b/sdk-3.5/include/Core/System/ExgMgr.h new file mode 100644 index 0000000..c2e1c53 --- /dev/null +++ b/sdk-3.5/include/Core/System/ExgMgr.h @@ -0,0 +1,181 @@ +/****************************************************************************** + * + * Copyright (c) 1997-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ExgMgr.h + * + * Description: + * Include file for Exg system functions + * + * History: + * 5/23/97 Created by Gavin Peacock + * + *****************************************************************************/ + +#ifndef __EXGMGR_H__ +#define __EXGMGR_H__ + +#include +#include + +#include +#include + +#define exgMemError (exgErrorClass | 1) +#define exgErrStackInit (exgErrorClass | 2) // stack could not initialize +#define exgErrUserCancel (exgErrorClass | 3) +#define exgErrNoReceiver (exgErrorClass | 4) // receiver device not found +#define exgErrNoKnownTarget (exgErrorClass | 5) // can't find a target app +#define exgErrTargetMissing (exgErrorClass | 6) // target app is known but missing +#define exgErrNotAllowed (exgErrorClass | 7) // operation not allowed +#define exgErrBadData (exgErrorClass | 8) // internal data was not valid +#define exgErrAppError (exgErrorClass | 9) // generic application error +#define exgErrUnknown (exgErrorClass | 10) // unknown general error +#define exgErrDeviceFull (exgErrorClass | 11) // device is full +#define exgErrDisconnected (exgErrorClass | 12) // link disconnected +#define exgErrNotFound (exgErrorClass | 13) // requested object not found +#define exgErrBadParam (exgErrorClass | 14) // bad parameter to call +#define exgErrNotSupported (exgErrorClass | 15) // operation not supported by this library +#define exgErrDeviceBusy (exgErrorClass | 16) // device is busy +#define exgErrBadLibrary (exgErrorClass | 17) // bad or missing ExgLibrary + + +typedef struct { + UInt16 dbCardNo; // card number of the database + LocalID dbID; // LocalID of the database + UInt16 recordNum; // index of record that contain a match + UInt32 uniqueID; // postion in record of the match. + UInt32 matchCustom; // application specific info +} ExgGoToType; + +typedef ExgGoToType *ExgGoToPtr; + + +typedef struct ExgSocketType { + UInt16 libraryRef; // identifies the Exg library in use + UInt32 socketRef; // used by Exg library to identify this connection + UInt32 target; // Creator ID of application this is sent to + UInt32 count; // # of objects in this connection (usually 1) + UInt32 length; // # total byte count for all objects being sent (optional) + UInt32 time; // last modified time of object (optional) + UInt32 appData; // application specific info + UInt32 goToCreator; // creator ID of app to launch with goto after receive + ExgGoToType goToParams; // If launchCreator then this contains goto find info + 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 + Char *description; // text description of object (for user) + Char *type; // Mime type of object (optional) + Char *name; // name of object, generally a file name (optional) +} ExgSocketType; +typedef ExgSocketType *ExgSocketPtr; + + +// structures used for sysAppLaunchCmdExgAskUser launch code parameter +// default is exgAskDialog (ask user with dialog... +typedef enum { exgAskDialog,exgAskOk,exgAskCancel } ExgAskResultType; + +typedef struct { + ExgSocketPtr socketP; + ExgAskResultType result; // what to do with dialog + UInt8 reserved; +} ExgAskParamType; +typedef ExgAskParamType *ExgAskParamPtr; + +// Optional parameter structure used with ExgDoDialog for category control +typedef struct { + UInt16 version; // version of this structure (should be zero) + DmOpenRef db; // open database ref (for category information) + UInt16 categoryIndex; // index of selected category +} ExgDialogInfoType; + + +#define exgSeparatorChar '\t' // char used to separate multiple registry entries + +#define exgRegLibraryID 0xfffc // library register thier presence +#define exgRegExtensionID 0xfffd // filename extenstion registry +#define exgRegTypeID 0xfffe // MIME type registry + +#define exgDataPrefVersion 0 +#define exgMaxTitleLen 20 // max size for title from exgLibCtlGetTitle + +#define exgLibCtlGetTitle 1 // get title for Exg dialogs +#define exgLibCtlSpecificOp 0x8000 // start of range for library specific control codes + + +typedef Err (*ExgDBReadProcPtr) + (void *dataP, UInt32 *sizeP, void *userDataP); + +typedef Boolean (*ExgDBDeleteProcPtr) + (const char *nameP, UInt16 version, UInt16 cardNo, + LocalID dbID, void *userDataP); + +typedef Err (*ExgDBWriteProcPtr) + (const void *dataP, UInt32 *sizeP, void *userDataP); + +#ifdef __cplusplus +extern "C" { +#endif + +Err ExgInit(void) + SYS_TRAP(sysTrapExgInit); + +Err ExgConnect(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgConnect); + +Err ExgPut(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgPut); + +Err ExgGet(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgGet); + +Err ExgAccept(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgAccept); + +Err ExgDisconnect(ExgSocketPtr socketP,Err error) + SYS_TRAP(sysTrapExgDisconnect); + +UInt32 ExgSend(ExgSocketPtr socketP, const void * const bufP, const UInt32 bufLen, Err *err) + SYS_TRAP(sysTrapExgSend); + +UInt32 ExgReceive(ExgSocketPtr socketP, void *bufP, const UInt32 bufLen, Err *err) + SYS_TRAP(sysTrapExgReceive); + +Err ExgRegisterData(const UInt32 creatorID, const UInt16 id, const Char * const dataTypesP) + SYS_TRAP(sysTrapExgRegisterData); + +Err ExgNotifyReceive(ExgSocketPtr socketP) + SYS_TRAP(sysTrapExgNotifyReceive); + + +Err ExgDBRead( + ExgDBReadProcPtr readProcP, + ExgDBDeleteProcPtr deleteProcP, + void* userDataP, + LocalID* dbIDP, + UInt16 cardNo, + Boolean* needResetP, + Boolean keepDates) + SYS_TRAP(sysTrapExgDBRead); + +Err ExgDBWrite( + ExgDBWriteProcPtr writeProcP, + void* userDataP, + const char* nameP, + LocalID dbID, + UInt16 cardNo) + SYS_TRAP(sysTrapExgDBWrite); + + +Boolean ExgDoDialog(ExgSocketPtr socketP, ExgDialogInfoType *infoP, Err *errP) + SYS_TRAP(sysTrapExgDoDialog); + +#ifdef __cplusplus +} +#endif + +#endif // __EXGMGR_H__ + diff --git a/sdk-3.5/include/Core/System/FeatureMgr.h b/sdk-3.5/include/Core/System/FeatureMgr.h new file mode 100644 index 0000000..6bf6bab --- /dev/null +++ b/sdk-3.5/include/Core/System/FeatureMgr.h @@ -0,0 +1,88 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: FeatureMgr.h + * + * Description: + * Header for the Feature Manager + * + * History: + * 11/14/94 RM - Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __FEATUREMGR_H__ +#define __FEATUREMGR_H__ + + +#include +#include +#include + + + +/************************************************************ + * Feature manager error codes + * the constant ftrErrorClass is defined in ErrorBase.h + *************************************************************/ +#define ftrErrInvalidParam (ftrErrorClass | 1) +#define ftrErrNoSuchFeature (ftrErrorClass | 2) +#define ftrErrAlreadyExists (ftrErrorClass | 3) +#define ftrErrROMBased (ftrErrorClass | 4) +#define ftrErrInternalErr (ftrErrorClass | 5) + + +/************************************************************ + * Feature Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Init the feature Manager +Err FtrInit(void) + SYS_TRAP(sysTrapFtrInit); + + +// Get a feature +Err FtrGet(UInt32 creator, UInt16 featureNum, UInt32 *valueP) + SYS_TRAP(sysTrapFtrGet); + +// Set/Create a feature. +Err FtrSet(UInt32 creator, UInt16 featureNum, UInt32 newValue) + SYS_TRAP(sysTrapFtrSet); + +// Unregister a feature +Err FtrUnregister(UInt32 creator, UInt16 featureNum) + SYS_TRAP(sysTrapFtrUnregister); + +// Get a feature by index +Err FtrGetByIndex(UInt16 index, Boolean romTable, + UInt32 *creatorP, UInt16 *numP, UInt32 *valueP) + SYS_TRAP(sysTrapFtrGetByIndex); + +// Get temporary space from storage heap +Err FtrPtrNew(UInt32 creator, UInt16 featureNum, UInt32 size, + void **newPtrP) + SYS_TRAP(sysTrapFtrPtrNew); + +// Release temporary space to storage heap +Err FtrPtrFree(UInt32 creator, UInt16 featureNum) + SYS_TRAP(sysTrapFtrPtrFree); + + +// Resize block of temporary storage +Err FtrPtrResize(UInt32 creator, UInt16 featureNum, UInt32 newSize, + void **newPtrP) + SYS_TRAP(sysTrapFtrPtrResize); + + +#ifdef __cplusplus +} +#endif + +#endif // __FEATUREMGR_H__ + diff --git a/sdk-3.5/include/Core/System/FileStream.h b/sdk-3.5/include/Core/System/FileStream.h new file mode 100644 index 0000000..ba903da --- /dev/null +++ b/sdk-3.5/include/Core/System/FileStream.h @@ -0,0 +1,341 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: FileStream.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __FILESTREAM_H__ +#define __FILESTREAM_H__ + +#include +#include +#include + +/************************************************************ + * File Stream error codes + * the constant dmErrorClass is defined in ErrorBase.h + *************************************************************/ + +#define fileErrMemError (fileErrorClass | 1) // out of memory error +#define fileErrInvalidParam (fileErrorClass | 2) // invalid parameter value passed +#define fileErrCorruptFile (fileErrorClass | 3) // the file is corrupted/invalid/not a stream file +#define fileErrNotFound (fileErrorClass | 4) // couldn't find the file +#define fileErrTypeCreatorMismatch (fileErrorClass | 5) // file's type and creator didn't match those expected +#define fileErrReplaceError (fileErrorClass | 6) // couldn't replace an existing file +#define fileErrCreateError (fileErrorClass | 7) // couldn't create a new file +#define fileErrOpenError (fileErrorClass | 8) // generic open error +#define fileErrInUse (fileErrorClass | 9) // file couldn't be opened or deleted because it is in use +#define fileErrReadOnly (fileErrorClass | 10)// couldn't open in write mode because db is read-only +#define fileErrInvalidDescriptor (fileErrorClass | 11)// invalid file descriptor (FileHandle) +#define fileErrCloseError (fileErrorClass | 12)// error closing the database +#define fileErrOutOfBounds (fileErrorClass | 13)// attempted operation went out of bounds of the file +#define fileErrPermissionDenied (fileErrorClass | 14)// couldn't write to a file open for read-only access +#define fileErrIOError (fileErrorClass | 15)// general I/O error +#define fileErrEOF (fileErrorClass | 16)// end-of-file error +#define fileErrNotStream (fileErrorClass | 17)// attempted to open a file that is not a stream + + + +/************************************************************ + * File Stream handle type + *************************************************************/ +typedef MemHandle FileHand; + +#define fileNullHandle ((FileHand)0) + + +/************************************************************ + * Mode flags passed to FileOpen + *************************************************************/ + +// fileModeReadOnly, fileModeReadWrite, fileModeUpdate, and fileModeAppend are mutually exclusive - only +// pass one of them to FileOpen! +#define fileModeReadOnly (0x80000000UL) // open for read access +#define fileModeReadWrite (0x40000000UL) // create for read/write access, discarding previous if any */ +#define fileModeUpdate (0x20000000UL) // open/create for read/write, preserving previous if any +#define fileModeAppend (0x10000000UL) // open/create for read/write, always writing at the end + +#define fileModeLeaveOpen (0x08000000UL) // leave open when app quits +#define fileModeExclusive (0x04000000UL) // don't let anyone else open it +#define fileModeAnyTypeCreator (0x02000000UL) // if set, skip type/creator validation when + // opening or replacing an existing file + +#define fileModeTemporary (0x01000000UL) // 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) + +#define fileModeDontOverwrite (0x00800000UL) // if set, will prevent fileModeReadWrite from discarding an existing file + // with the same name; may only be specified together with fileModeReadWrite + +// For debugging/validation +#define fileModeAllFlags ( fileModeReadOnly | \ + fileModeReadWrite | \ + fileModeUpdate | \ + fileModeAppend | \ + fileModeLeaveOpen | \ + fileModeExclusive | \ + fileModeAnyTypeCreator | \ + fileModeTemporary | \ + fileModeDontOverwrite ) + +/************************************************************ + * Origin passed to FileSetPos + *************************************************************/ +typedef enum FileOriginEnum { + + fileOriginBeginning = 1, // from the beginning (first data byte of file) + fileOriginCurrent, // from the current position + fileOriginEnd // from the end of file (one position beyond last data byte) + + } FileOriginEnum; + + + +/************************************************************ + * Operation passed to FileControl + *************************************************************/ +typedef enum FileOpEnum { + fileOpNone = 0, // no-op + + fileOpDestructiveReadMode, // 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, // 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, // 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, // 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, // 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, // 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, // 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, // flush any cached data to storage + // ARGUMENTS: + // stream = open stream handle + // valueP = NULL + // valueLenP = NULL + // RETURNS: + // zero on success; fileErr... on error; + + + + + fileOpLAST // ***ADD NEW OPERATIONS BEFORE THIS ENTRY*** + // *** AND ALWAYS AFTER EXISTING ENTRIES *** + // *** FOR BACKWARD COMPATIBILITY *** + } FileOpEnum; + + +/************************************************************ + * File Stream procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Open/create a file stream (name must all be valid -- non-null, non-empty) +// (errP is optional - set to NULL to ignore) +extern FileHand FileOpen(UInt16 cardNo, Char * nameP, UInt32 type, UInt32 creator, + UInt32 openMode, Err *errP) + SYS_TRAP(sysTrapFileOpen); + +// Close the file stream +extern Err FileClose(FileHand stream) + SYS_TRAP(sysTrapFileClose); + +// Delete a file +extern Err FileDelete(UInt16 cardNo, Char *nameP) + SYS_TRAP(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 + * + ***********************************************************************/ +#define FileRead(stream, bufP, objSize, numObj, errP) \ + FileReadLow((stream), (bufP), 0/*offset*/, false/*dataStoreBased*/, \ + (objSize), (numObj), (errP)) + + +/*********************************************************************** + * + * 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 + * + ***********************************************************************/ +#define FileDmRead(stream, startOfDmChunkP, destOffset, objSize, numObj, errP) \ + FileReadLow((stream), (startOfDmChunkP), (destOffset), true/*dataStoreBased*/, \ + (objSize), (numObj), (errP)) + + +// 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) +extern Int32 FileReadLow(FileHand stream, void *baseP, Int32 offset, Boolean dataStoreBased, Int32 objSize, + Int32 numObj, Err *errP) + SYS_TRAP(sysTrapFileReadLow); + +// Write data to a file stream +// (errP is optional - set to NULL to ignore) +extern Int32 FileWrite(FileHand stream, void *dataP, Int32 objSize, + Int32 numObj, Err *errP) + SYS_TRAP(sysTrapFileWrite); + +// Set position within a file stream +extern Err FileSeek(FileHand stream, Int32 offset, FileOriginEnum origin) + SYS_TRAP(sysTrapFileSeek); + +#define FileRewind(__stream__) \ + (FileClearerr((__stream__)), FileSeek((__stream__), 0, fileOriginBeginning)) + +// Get current position and filesize +// (fileSizeP and errP are optional - set to NULL to ignore) +extern Int32 FileTell(FileHand stream, Int32 *fileSizeP, Err *errP) + SYS_TRAP(sysTrapFileTell); + +// Truncate a file +extern Err FileTruncate(FileHand stream, Int32 newSize) + SYS_TRAP(sysTrapFileTruncate); + +// Returns the error code from the last operation on this file stream; +// if resetLastError is non-zero, resets the error status +extern Err FileControl(FileOpEnum op, FileHand stream, void *valueP, Int32 *valueLenP) + SYS_TRAP(sysTrapFileControl); + +#define FileEOF(__stream__) \ + (FileControl(fileOpGetEOFStatus, (__stream__), NULL, NULL) == fileErrEOF) + +#define FileError(__stream__) \ + FileControl(fileOpGetIOErrorStatus, (__stream__), NULL, NULL) + +#define FileClearerr(__stream__) \ + FileControl(fileOpClearError, (__stream__), NULL, NULL) + +#define FileGetLastError(__stream__) \ + FileControl(fileOpGetLastError, (__stream__), NULL, NULL) + + +#define FileFlush(__stream__) \ + FileControl(fileOpFlush, (__stream__), NULL, NULL) + + + +#ifdef __cplusplus +} +#endif + + +#endif // #ifndef __FILESTREAM_H__ + diff --git a/sdk-3.5/include/Core/System/FloatMgr.h b/sdk-3.5/include/Core/System/FloatMgr.h new file mode 100644 index 0000000..e97cc18 --- /dev/null +++ b/sdk-3.5/include/Core/System/FloatMgr.h @@ -0,0 +1,575 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: FloatMgr.h + * + * 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. + * + *****************************************************************************/ + +#ifndef __FLOATMGR_H__ +#define __FLOATMGR_H__ + +#if defined(__MC68K__) +#if __option(IEEEdoubles) == off +//#error "IEEEdoubles ('8-UInt8 Doubles' option in the 68K Processor preference panel) MUST be on!!" +#pragma IEEEdoubles on // force 8-byte doubles for our initialization!! +#endif +#endif + + +#ifndef _DONT_USE_FP_TRAPS_ +#if EMULATION_LEVEL != EMULATION_NONE +#define _DONT_USE_FP_TRAPS_ 1 // always direct link to FP for emulator builds +#endif +#endif + + +#include +#include + +/************************************************************************ + * 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 + ***********************************************************************/ + +#define flpVersion 0x02008000 // first version of NewFloatMgr (PalmOS 2.0) + +/* + * These constants are passed to and received from the _fp_round routine. + */ + +#define flpToNearest 0 +#define flpTowardZero 1 +#define flpUpward 3 +#define flpDownward 2 +#define flpModeMask 0x00000030 +#define 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. + */ + +#define flpInvalid 0x00008000 +#define flpOverflow 0x00004000 +#define flpUnderflow 0x00002000 +#define flpDivByZero 0x00001000 +#define flpInexact 0x00000800 + +/* + * These constants are returned by _d_cmp, _d_cmpe, _f_cmp, and _f_cmpe: + */ + +#define flpEqual 0 +#define flpLess 1 +#define flpGreater 2 +#define flpUnordered 3 + + +/************************************************************************ + * New Floating point manager types (private) + ***********************************************************************/ +typedef struct { + Int32 high; + Int32 low; +} _sfpe_64_bits; // for internal use only + +typedef _sfpe_64_bits sfpe_long_long; // for internal use only +typedef _sfpe_64_bits sfpe_unsigned_long_long; // for internal use only + + +/************************************************************************ + * New Floating point manager types (public) + ***********************************************************************/ +typedef Int32 FlpFloat; +typedef _sfpe_64_bits FlpDouble; +typedef _sfpe_64_bits FlpLongDouble; + +/* +* 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. +*/ + +typedef struct { + UInt32 sign : 1; + Int32 exp : 11; + UInt32 manH : 20; + UInt32 manL; +} FlpDoubleBits; // for accessing specific fields + +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 + *******************************************************************/ +#define flpErrOutOfRange (flpErrorClass | 1) + + +/************************************************************ + * New Floating point manager trap macros + *************************************************************/ + +#if _DONT_USE_FP_TRAPS_ + +#define FLOAT_TRAP(floatSelectorNum) +#define FLOAT_EM_TRAP(floatSelectorNum) + +#else + +#define FLOAT_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapFlpDispatch, sel) + +#define FLOAT_EM_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapFlpEmDispatch, sel) + +#endif + +/************************************************************ + * New Floating point manager selectors + *************************************************************/ + +#ifdef __GNUC__ + +// The order of these #defines *MUST* match the +// sysFloatSelector table in NewFloatDispatch.c +#define sysFloatBase10Info 0 +#define sysFloatFToA 1 +#define sysFloatAToF 2 +#define sysFloatCorrectedAdd 3 +#define sysFloatCorrectedSub 4 +#define sysFloatVersion 5 + +// used by NewFloatDispatch.c +#define flpMaxFloatSelector sysFloatVersion + +#else + +typedef enum { // The order of this enum *MUST* match the + // sysFloatSelector table in NewFloatDispatch.c + sysFloatBase10Info = 0, // 0 + sysFloatFToA, // 1 + sysFloatAToF, // 2 + sysFloatCorrectedAdd, // 3 + sysFloatCorrectedSub, // 4 + sysFloatVersion, // 5 + + flpMaxFloatSelector = sysFloatVersion // used by NewFloatDispatch.c +} sysFloatSelector; + +#endif + +#ifdef __GNUC__ + +// The order of these #defines *MUST* match the +// corresponding table in NewFloatDispatch.c +#define sysFloatEm_fp_round 0 +#define sysFloatEm_fp_get_fpscr 1 +#define sysFloatEm_fp_set_fpscr 2 + +#define sysFloatEm_f_utof 3 +#define sysFloatEm_f_itof 4 +#define sysFloatEm_f_ulltof 5 +#define sysFloatEm_f_lltof 6 + +#define sysFloatEm_d_utod 7 +#define sysFloatEm_d_itod 8 +#define sysFloatEm_d_ulltod 9 +#define sysFloatEm_d_lltod 10 + +#define sysFloatEm_f_ftod 11 +#define sysFloatEm_d_dtof 12 +#define sysFloatEm_f_ftoq 13 +#define sysFloatEm_f_qtof 14 +#define sysFloatEm_d_dtoq 15 +#define sysFloatEm_d_qtod 16 + +#define sysFloatEm_f_ftou 17 +#define sysFloatEm_f_ftoi 18 +#define sysFloatEm_f_ftoull 19 +#define sysFloatEm_f_ftoll 20 + +#define sysFloatEm_d_dtou 21 +#define sysFloatEm_d_dtoi 22 +#define sysFloatEm_d_dtoull 23 +#define sysFloatEm_d_dtoll 24 + +#define sysFloatEm_f_cmp 25 +#define sysFloatEm_f_cmpe 26 +#define sysFloatEm_f_feq 27 +#define sysFloatEm_f_fne 28 +#define sysFloatEm_f_flt 29 +#define sysFloatEm_f_fle 30 +#define sysFloatEm_f_fgt 31 +#define sysFloatEm_f_fge 32 +#define sysFloatEm_f_fun 33 +#define sysFloatEm_f_for 34 + +#define sysFloatEm_d_cmp 35 +#define sysFloatEm_d_cmpe 36 +#define sysFloatEm_d_feq 37 +#define sysFloatEm_d_fne 38 +#define sysFloatEm_d_flt 39 +#define sysFloatEm_d_fle 40 +#define sysFloatEm_d_fgt 41 +#define sysFloatEm_d_fge 42 +#define sysFloatEm_d_fun 43 +#define sysFloatEm_d_for 44 + +#define sysFloatEm_f_neg 45 +#define sysFloatEm_f_add 46 +#define sysFloatEm_f_mul 47 +#define sysFloatEm_f_sub 48 +#define sysFloatEm_f_div 49 + +#define sysFloatEm_d_neg 50 +#define sysFloatEm_d_add 51 +#define sysFloatEm_d_mul 52 +#define sysFloatEm_d_sub 53 +#define sysFloatEm_d_div 54 + +#else + +typedef enum { // The order of this enum *MUST* match the + // sysFloatSelector table in NewFloatDispatch.c + sysFloatEm_fp_round = 0,// 0 + sysFloatEm_fp_get_fpscr,// 1 + sysFloatEm_fp_set_fpscr,// 2 + + sysFloatEm_f_utof, // 3 + sysFloatEm_f_itof, // 4 + sysFloatEm_f_ulltof, // 5 + sysFloatEm_f_lltof, // 6 + + sysFloatEm_d_utod, // 7 + sysFloatEm_d_itod, // 8 + sysFloatEm_d_ulltod, // 9 + sysFloatEm_d_lltod, // 10 + + sysFloatEm_f_ftod, // 11 + sysFloatEm_d_dtof, // 12 + sysFloatEm_f_ftoq, // 13 + sysFloatEm_f_qtof, // 14 + sysFloatEm_d_dtoq, // 15 + sysFloatEm_d_qtod, // 16 + + sysFloatEm_f_ftou, // 17 + sysFloatEm_f_ftoi, // 18 + sysFloatEm_f_ftoull, // 19 + sysFloatEm_f_ftoll, // 20 + + sysFloatEm_d_dtou, // 21 + sysFloatEm_d_dtoi, // 22 + sysFloatEm_d_dtoull, // 23 + sysFloatEm_d_dtoll, // 24 + + sysFloatEm_f_cmp, // 25 + sysFloatEm_f_cmpe, // 26 + sysFloatEm_f_feq, // 27 + sysFloatEm_f_fne, // 28 + sysFloatEm_f_flt, // 29 + sysFloatEm_f_fle, // 30 + sysFloatEm_f_fgt, // 31 + sysFloatEm_f_fge, // 32 + sysFloatEm_f_fun, // 33 + sysFloatEm_f_for, // 34 + + sysFloatEm_d_cmp, // 35 + sysFloatEm_d_cmpe, // 36 + sysFloatEm_d_feq, // 37 + sysFloatEm_d_fne, // 38 + sysFloatEm_d_flt, // 39 + sysFloatEm_d_fle, // 40 + sysFloatEm_d_fgt, // 41 + sysFloatEm_d_fge, // 42 + sysFloatEm_d_fun, // 43 + sysFloatEm_d_for, // 44 + + sysFloatEm_f_neg, // 45 + sysFloatEm_f_add, // 46 + sysFloatEm_f_mul, // 47 + sysFloatEm_f_sub, // 48 + sysFloatEm_f_div, // 49 + + sysFloatEm_d_neg, // 50 + sysFloatEm_d_add, // 51 + sysFloatEm_d_mul, // 52 + sysFloatEm_d_sub, // 53 + sysFloatEm_d_div // 54 +} sysFloatEmSelector; + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************ + * 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. +Err FlpBase10Info(FlpDouble a, UInt32 *mantissaP, Int16 *exponentP, Int16 *signP) + FLOAT_TRAP(sysFloatBase10Info); + +Err FlpFToA(FlpDouble a, Char *s) + FLOAT_TRAP(sysFloatFToA); + +FlpDouble FlpAToF(Char *s) + FLOAT_TRAP(sysFloatAToF); + +FlpDouble FlpCorrectedAdd(FlpDouble firstOperand, FlpDouble secondOperand, Int16 howAccurate) + FLOAT_TRAP(sysFloatCorrectedAdd); + +FlpDouble FlpCorrectedSub(FlpDouble firstOperand, FlpDouble secondOperand, Int16 howAccurate) + FLOAT_TRAP(sysFloatCorrectedSub); + +UInt32 FlpVersion(void) + FLOAT_TRAP(sysFloatVersion); + +void FlpSelectorErrPrv (UInt16 flpSelector) + ; // 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 + */ + +Int32 _fp_round(Int32) FLOAT_EM_TRAP(sysFloatEm_fp_round); + +/* + * Constants passed to _fp_set_fpscr and received from _fp_get_fpscr are: + * flpInvalid, flpOverflow, flpUnderflow, flpDivByZero, or flpInexact + */ + +Int32 _fp_get_fpscr(void) FLOAT_EM_TRAP(sysFloatEm_fp_get_fpscr); +void _fp_set_fpscr(Int32) FLOAT_EM_TRAP(sysFloatEm_fp_set_fpscr); + + +/* + * 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 + */ + +FlpFloat _f_utof(UInt32) FLOAT_EM_TRAP(sysFloatEm_f_utof); +FlpFloat _f_itof(Int32) FLOAT_EM_TRAP(sysFloatEm_f_itof); +FlpFloat _f_ulltof(sfpe_unsigned_long_long) FLOAT_EM_TRAP(sysFloatEm_f_ulltof); +FlpFloat _f_lltof(sfpe_long_long) FLOAT_EM_TRAP(sysFloatEm_f_lltof); + +FlpDouble _d_utod(UInt32) FLOAT_EM_TRAP(sysFloatEm_d_utod); +FlpDouble _d_itod(Int32) FLOAT_EM_TRAP(sysFloatEm_d_itod); +FlpDouble _d_ulltod(sfpe_unsigned_long_long) FLOAT_EM_TRAP(sysFloatEm_d_ulltod); +FlpDouble _d_lltod(sfpe_long_long) FLOAT_EM_TRAP(sysFloatEm_d_lltod); + + +FlpDouble _f_ftod(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftod); +FlpFloat _d_dtof(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtof); + +FlpLongDouble _f_ftoq(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoq); +FlpFloat _f_qtof(const FlpLongDouble *) FLOAT_EM_TRAP(sysFloatEm_f_qtof); + +FlpLongDouble _d_dtoq(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoq); +FlpDouble _d_qtod(const FlpLongDouble *) FLOAT_EM_TRAP(sysFloatEm_d_qtod); + + +UInt32 _f_ftou(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftou); +Int32 _f_ftoi(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoi); + +sfpe_unsigned_long_long _f_ftoull(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoull); +sfpe_long_long _f_ftoll(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoll); + +UInt32 _d_dtou(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtou); +Int32 _d_dtoi(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoi); + +sfpe_unsigned_long_long _d_dtoull(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoull); +sfpe_long_long _d_dtoll(FlpDouble) FLOAT_EM_TRAP(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) + */ + +Int32 _f_cmp(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_cmp); +Int32 _f_cmpe(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_cmpe); +Int32 _f_feq(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_feq); +Int32 _f_fne(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fne); +Int32 _f_flt(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_flt); +Int32 _f_fle(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fle); +Int32 _f_fgt(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fgt); +Int32 _f_fge(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fge); +Int32 _f_fun(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fun); +Int32 _f_for(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_for); + +Int32 _d_cmp(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_cmp); +Int32 _d_cmpe(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_cmpe); +Int32 _d_feq(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_feq); +Int32 _d_fne(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fne); +Int32 _d_flt(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_flt); +Int32 _d_fle(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fle); +Int32 _d_fgt(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fgt); +Int32 _d_fge(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fge); +Int32 _d_fun(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fun); +Int32 _d_for(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_for); + + +FlpFloat _f_neg(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_neg); +FlpFloat _f_add(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_add); +FlpFloat _f_mul(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_mul); +FlpFloat _f_sub(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_sub); +FlpFloat _f_div(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_div); + +FlpDouble _d_neg(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_neg); +FlpDouble _d_add(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_add); +FlpDouble _d_mul(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_mul); +FlpDouble _d_sub(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_sub); +FlpDouble _d_div(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_div); + + +#ifdef __cplusplus +} +#endif + + +#endif + diff --git a/sdk-3.5/include/Core/System/Font.h b/sdk-3.5/include/Core/System/Font.h new file mode 100644 index 0000000..e1c4672 --- /dev/null +++ b/sdk-3.5/include/Core/System/Font.h @@ -0,0 +1,149 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Font.h + * + * Description: + * This file defines font structures and routines. + * + * History: + * September 13, 1994 Created by Art Lamb + * 05/05/98 art Add structures for font mapping table. + * 07/03/98 kwk Added FntWidthToOffset. + * 10/23/98 kwk Changed fontMapTable to 0xC000 (was 0xFFFF). + * 10/20/99 kwk Moved private values to FontPrv.h + * + *****************************************************************************/ + +#ifndef __FONT_H__ +#define __FONT_H__ + +#include +#include + +// Pixel width of tab stops in fields +#define fntTabChrWidth 20 + +// Width of character missing from font. +#define fntMissingChar -1 + +typedef struct { + Int8 offset; + Int8 width; +} FontCharInfoType, * FontCharInfoPtr; + +typedef struct { + Int16 fontType; // font type + Int16 firstChar; // ASCII code of first character + Int16 lastChar; // ASCII code of last character + Int16 maxWidth; // maximum character width + Int16 kernMax; // negative of maximum character kern + Int16 nDescent; // negative of descent + Int16 fRectWidth; // width of font rectangle + Int16 fRectHeight; // height of font rectangle + Int16 owTLoc; // offset to offset/width table + Int16 ascent; // ascent + Int16 descent; // descent + Int16 leading; // leading + Int16 rowWords; // row width of bit image / 2 +} FontType; + +typedef FontType *FontPtr; + +typedef FontPtr *FontTablePtr; + +enum fontID { + stdFont = 0x00, // Small font used for the user's writing. Shows a good amount + boldFont, // Small font. Bold for easier reading. Used often for ui. + largeFont, // Larger font for easier reading. Shows a lot less. + symbolFont, // Various ui images like check boxes and arrows + symbol11Font, // Larger various ui images + symbol7Font, // Smaller various ui images + ledFont, // Calculator specific font + largeBoldFont, // A thicker version of the large font. More readable. + fntAppFontCustomBase = 0x80 // First available application-defined font ID +}; + +typedef enum fontID FontID; + +#define checkboxFont symbol11Font + +#define FntIsAppDefined(fnt) (fnt >= fntAppFontCustomBase) + + + +//-------------------------------------------------------------------- +// +// Font Function +// +//-------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +FontID FntGetFont (void) + SYS_TRAP(sysTrapFntGetFont); + +FontID FntSetFont (FontID font) + SYS_TRAP(sysTrapFntSetFont); + +FontPtr FntGetFontPtr (void) + SYS_TRAP(sysTrapFntGetFontPtr); + +Int16 FntBaseLine (void) + SYS_TRAP(sysTrapFntBaseLine); + +Int16 FntCharHeight (void) + SYS_TRAP(sysTrapFntCharHeight); + +Int16 FntLineHeight (void) + SYS_TRAP(sysTrapFntLineHeight); + +Int16 FntAverageCharWidth (void) + SYS_TRAP(sysTrapFntAverageCharWidth); + +Int16 FntCharWidth (Char ch) + SYS_TRAP(sysTrapFntCharWidth); + +Int16 FntCharsWidth (Char const *chars, Int16 len) + SYS_TRAP(sysTrapFntCharsWidth); + +Int16 FntWidthToOffset (Char const *pChars, UInt16 length, + Int16 pixelWidth, Boolean *leadingEdge, Int16 *truncWidth) + SYS_TRAP(sysTrapFntWidthToOffset); + +void FntCharsInWidth (Char const *string, + Int16 *stringWidthP, Int16 *stringLengthP, + Boolean *fitWithinWidth) + SYS_TRAP(sysTrapFntCharsInWidth); + +Int16 FntDescenderHeight (void) + SYS_TRAP(sysTrapFntDescenderHeight); + +Int16 FntLineWidth (Char const *pChars, UInt16 length) + SYS_TRAP(sysTrapFntLineWidth); + +UInt16 FntWordWrap (Char const *chars, UInt16 maxWidth) + SYS_TRAP(sysTrapFntWordWrap); + +void FntWordWrapReverseNLines (Char const *const chars, + UInt16 maxWidth, UInt16 *linesToScrollP, UInt16 *scrollPosP) + SYS_TRAP(sysTrapFntWordWrapReverseNLines); + +void FntGetScrollValues (Char const *chars, UInt16 width, + UInt16 scrollPos, UInt16 *linesP, UInt16 *topLine) + SYS_TRAP(sysTrapFntGetScrollValues); + +Err FntDefineFont (FontID font, FontPtr fontP) + SYS_TRAP(sysTrapFntDefineFont); + +#ifdef __cplusplus +} +#endif + + +#endif // __FONT_H__ + diff --git a/sdk-3.5/include/Core/System/Graffiti.h b/sdk-3.5/include/Core/System/Graffiti.h new file mode 100644 index 0000000..742eb8e --- /dev/null +++ b/sdk-3.5/include/Core/System/Graffiti.h @@ -0,0 +1,211 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Graffiti.h + * + * Description: + * Header for the Graffiti interface + * + * History: + * 6/30 RM - Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __GRAFFITI_H__ +#define __GRAFFITI_H__ + +#include +#include +#include + +#define grfNoShortCut 0xffff // Index which isn't a shortcut + +/*------------------------------------------------------------------------------ + * Match info structure. Returned by GrfMatch and GrfMatchGlyph + *-----------------------------------------------------------------------------*/ +typedef struct { + UInt8 glyphID; /* glyph ID of this match */ + UInt8 unCertainty; /* unCertainty of this match (0 most certain) */ + } GrfMatchType; + + +#define grfMaxMatches 4 +typedef struct { + UInt16 numMatches; /* number of matches returned in this structure */ + GrfMatchType match[grfMaxMatches]; + } GrfMatchInfoType; +typedef GrfMatchInfoType* GrfMatchInfoPtr; + +#define grfNameLength 8 // eight letters possible (don't forget CR) +//#define grfTextLength 56 // Use + + +//---------------------------------------------------------------------------- +// 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 +#define grfVirtualSequence 0x01 + +// In dictionary to tell us about temp shift state changes. +#define grfShiftSequence 0x02 + +// In dictionary/macros to hide special features +#define grfSpecialSequence 0x03 + +// Char indicating a seqeunce of characters to expand. +#define grfExpansionSequence '@' + +// Chars indicating what to expand into +#define expandDateChar 'D' +#define expandTimeChar 'T' +#define expandStampChar 'S' // This follows 'D' or 'T' for the sake + // of the mnemonic name. + +#define shortcutBinaryDataFlag 0x01 + + +// Determine if a string has a sequence +#define HasVirtualSequence(s) (s[0] == grfVirtualSequence) +#define HasSpecialSequence(s) (s[0] == grfSpecialSequence) +#define HasExpansionSequence(s) (s[0] == grfExpansionSequence) + + + +/*------------------------------------------------------------------------------ + * Temp shift states, returned by GrfGetState + *-----------------------------------------------------------------------------*/ +#define grfTempShiftPunctuation 1 +#define grfTempShiftExtended 2 +#define grfTempShiftUpper 3 +#define grfTempShiftLower 4 + + + +/************************************************************ + * Graffiti result codes + *************************************************************/ +#define grfErrBadParam (grfErrorClass | 1) +#define grfErrPointBufferFull (grfErrorClass | 2) +#define grfErrNoGlyphTable (grfErrorClass | 3) +#define grfErrNoDictionary (grfErrorClass | 4) +#define grfErrNoMapping (grfErrorClass | 5) +#define grfErrMacroNotFound (grfErrorClass | 6) +#define grfErrDepthTooDeep (grfErrorClass | 7) +#define grfErrMacroPtrTooSmall (grfErrorClass | 8) +#define grfErrNoMacros (grfErrorClass | 9) + +#define grfErrMacroIncomplete (grfErrorClass | 129) // (grfWarningOffset+1) +#define grfErrBranchNotFound (grfErrorClass | 130) // (grfWarningOffset+2) + + +/************************************************************ + * Graffiti interface procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err GrfInit (void) + SYS_TRAP(sysTrapGrfInit); + +Err GrfFree (void) + SYS_TRAP(sysTrapGrfFree); + +Err GrfProcessStroke(PointType *startPtP, PointType *endPtP, + Boolean upShift) + SYS_TRAP(sysTrapGrfProcessStroke); + +Err GrfFieldChange(Boolean resetState, UInt16 *characterToDelete) + SYS_TRAP(sysTrapGrfFieldChange); + +Err GrfGetState(Boolean *capsLockP, Boolean *numLockP, + UInt16 *tempShiftP, Boolean *autoShiftedP) + SYS_TRAP(sysTrapGrfGetState); + +Err GrfSetState(Boolean capsLock, Boolean numLock, + Boolean upperShift) + SYS_TRAP(sysTrapGrfSetState); + + +//----------------------------------------------------------------- +// Mid Level Calls +//------------------------------------------------------------------ + +Err GrfFlushPoints (void) + SYS_TRAP(sysTrapGrfFlushPoints); + +Err GrfAddPoint (PointType *pt) + SYS_TRAP(sysTrapGrfAddPoint); + +Err GrfInitState(void) + SYS_TRAP(sysTrapGrfInitState); + +Err GrfCleanState(void) + SYS_TRAP(sysTrapGrfCleanState); + +Err GrfMatch (UInt16 *flagsP, void *dataPtrP, UInt16 *dataLenP, + UInt16 *uncertainLenP, GrfMatchInfoPtr matchInfoP) + SYS_TRAP(sysTrapGrfMatch); + +Err GrfGetMacro(Char *nameP, UInt8 *macroDataP, + UInt16 *dataLenP) + SYS_TRAP(sysTrapGrfGetMacro); + +Err GrfGetAndExpandMacro(Char *nameP, UInt8 *macroDataP, + UInt16 *dataLenP) + SYS_TRAP(sysTrapGrfGetAndExpandMacro); + + +//----------------------------------------------------------------- +// Low Level Calls +//------------------------------------------------------------------ +Err GrfFilterPoints (void) + SYS_TRAP(sysTrapGrfFilterPoints); + +Err GrfGetNumPoints(UInt16 *numPtsP) + SYS_TRAP(sysTrapGrfGetNumPoints); + +Err GrfGetPoint(UInt16 index, PointType *pointP) + SYS_TRAP(sysTrapGrfGetPoint); + +Err GrfFindBranch(UInt16 flags) + SYS_TRAP(sysTrapGrfFindBranch); + +Err GrfMatchGlyph (GrfMatchInfoPtr matchInfoP, + Int16 maxUnCertainty, UInt16 maxMatches) + SYS_TRAP(sysTrapGrfMatchGlyph); + +Err GrfGetGlyphMapping (UInt16 glyphID, UInt16 *flagsP, + void *dataPtrP, UInt16 *dataLenP, UInt16 *uncertainLenP) + SYS_TRAP(sysTrapGrfGetGlyphMapping); + +Err GrfGetMacroName(UInt16 index, Char *nameP) + SYS_TRAP(sysTrapGrfGetMacroName); + +Err GrfDeleteMacro(UInt16 index) + SYS_TRAP(sysTrapGrfDeleteMacro); + +Err GrfAddMacro(Char *nameP, UInt8 *macroDataP, + UInt16 dataLen) + SYS_TRAP(sysTrapGrfAddMacro); + + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SYSEVTMGR_H__ + diff --git a/sdk-3.5/include/Core/System/HostControl.h b/sdk-3.5/include/Core/System/HostControl.h new file mode 100644 index 0000000..cce7820 --- /dev/null +++ b/sdk-3.5/include/Core/System/HostControl.h @@ -0,0 +1,357 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: HostControl.h + * + * History: + * August 17, 1998 Created by Roger Flores/Douglas Anderson + * + *****************************************************************************/ + +#ifndef __HOSTCONTROL_H__ +#define __HOSTCONTROL_H__ + +#include +#include + +/* + Set the base value for selectors. Note that this value MUST be + two bytes long and have the high byte be non-zero. The reason + for this has to do with the way SysGremlins was originally + declared. It took a GremlinsSelector enumerated value. Originally, + there was only one value, and it was zero. The way the 68K compiler + works, it decides that GremlinsSelectors are only one byte long, + so a call to SysGremlins would push one byte onto the stack. Because + all values on the stack need to be word-aligned, the processor + subtracts 1 from the stack before pushing on the byte. Therefore, + the stack looks like: + + previous contents + garbage byte + selector + return address + + With this setup, we have two choices: leave the selector size at + one byte and limit ourselves to 256 functions, or define the selector + to be a two byte value, with the first 256 values (all those with 0x00 + in the upper byte) to be GremlinIsOn. The latter sounds preferable, so + we start the new selectors at 0x0100. +*/ + +#define hostSelectorBase 0x0100 + +#ifdef __GNUC__ + + // Host information selectors + +#define hostSelectorGetHostVersion 0x0100 +#define hostSelectorGetHostID 0x0101 +#define hostSelectorGetHostPlatform 0x0102 +#define hostSelectorIsSelectorImplemented 0x0103 +#define hostSelectorGestalt 0x0104 +#define hostSelectorIsCallingTrap 0x0105 + + // Profiler selectors + +#define hostSelectorProfileInit 0x0200 +#define hostSelectorProfileStart 0x0201 +#define hostSelectorProfileStop 0x0202 +#define hostSelectorProfileDump 0x0203 +#define hostSelectorProfileCleanup 0x0204 + + // Std C Library wrapper selectors + +#define hostSelectorErrNo 0x0300 + +#define hostSelectorFClose 0x0301 +#define hostSelectorFEOF 0x0302 +#define hostSelectorFError 0x0303 +#define hostSelectorFFlush 0x0304 +#define hostSelectorFGetC 0x0305 +#define hostSelectorFGetPos 0x0306 +#define hostSelectorFGetS 0x0307 +#define hostSelectorFOpen 0x0308 +#define hostSelectorFPrintF 0x0309 /* Floating point not yet supported in Poser */ +#define hostSelectorFPutC 0x030A +#define hostSelectorFPutS 0x030B +#define hostSelectorFRead 0x030C +#define hostSelectorRemove 0x030D /* Not yet implemented in Poser */ +#define hostSelectorRename 0x030E /* Not yet implemented in Poser */ +#define hostSelectorFReopen 0x030F /* Not yet implemented in Poser */ +#define hostSelectorFScanF 0x0310 /* Not yet implemented */ +#define hostSelectorFSeek 0x0311 +#define hostSelectorFSetPos 0x0312 +#define hostSelectorFTell 0x0313 +#define hostSelectorFWrite 0x0314 +#define hostSelectorTmpFile 0x0315 +#define hostSelectorTmpNam 0x0316 /* Not yet implemented in Poser */ +#define hostSelectorGetEnv 0x0317 + +#define hostSelectorMalloc 0x0318 /* Not yet implemented in Poser */ +#define hostSelectorRealloc 0x0319 /* Not yet implemented in Poser */ +#define hostSelectorFree 0x031A /* Not yet implemented in Poser */ + + // Gremlin selectors + +#define hostSelectorGremlinIsRunning 0x0400 +#define hostSelectorGremlinNumber 0x0401 +#define hostSelectorGremlinCounter 0x0402 +#define hostSelectorGremlinLimit 0x0403 +//#define hostSelectorGremlinApp 0x0404 + + // Database selectors + +#define hostSelectorImportFile 0x0500 +#define hostSelectorExportFile 0x0501 + + // Preferences selectors + +#define hostSelectorSetDebugOption 0x0600 /* Not yet implemented */ +#define hostSelectorSetWindowScale 0x0601 /* Not yet implemented */ +#define hostSelectorSetWindowBackground 0x0602 /* Not yet implemented */ + + // Logging selectors + +#define hostSelectorLogFile 0x0700 +#define hostSelectorSetLogFileSize 0x0701 + +#define hostSelectorLastTrapNumber 0x0702 + +typedef UInt16 HostControlTrapNumber; + +#else + +#define hostSelectorChunk 0x0100 +#define hostSection(x) (hostSelectorBase + (hostSelectorChunk * (x))) + +typedef enum +{ + // Host information selectors + + hostSelectorGetHostVersion = hostSection(0), + hostSelectorGetHostID, + hostSelectorGetHostPlatform, + hostSelectorIsSelectorImplemented, + hostSelectorGestalt, + hostSelectorIsCallingTrap, + + // Profiler selectors + + hostSelectorProfileInit = hostSection(1), + hostSelectorProfileStart, + hostSelectorProfileStop, + hostSelectorProfileDump, + hostSelectorProfileCleanup, + + // Std C Library wrapper selectors + + hostSelectorErrNo = hostSection(2), + + hostSelectorFClose, + hostSelectorFEOF, + hostSelectorFError, + hostSelectorFFlush, + hostSelectorFGetC, + hostSelectorFGetPos, + hostSelectorFGetS, + hostSelectorFOpen, + hostSelectorFPrintF, // Floating point not yet supported in Poser + hostSelectorFPutC, + hostSelectorFPutS, + hostSelectorFRead, + hostSelectorRemove, // Not yet implemented in Poser + hostSelectorRename, // Not yet implemented in Poser + hostSelectorFReopen, // Not yet implemented in Poser + hostSelectorFScanF, // Not yet implemented + hostSelectorFSeek, + hostSelectorFSetPos, + hostSelectorFTell, + hostSelectorFWrite, + hostSelectorTmpFile, + hostSelectorTmpNam, // Not yet implemented in Poser + hostSelectorGetEnv, + + hostSelectorMalloc, // Not yet implemented in Poser + hostSelectorRealloc, // Not yet implemented in Poser + hostSelectorFree, // Not yet implemented in Poser + + // Gremlin selectors + + hostSelectorGremlinIsRunning = hostSection(3), + hostSelectorGremlinNumber, + hostSelectorGremlinCounter, + hostSelectorGremlinLimit, +// hostSelectorGremlinApp, + + // Database selectors + + hostSelectorImportFile = hostSection(4), + hostSelectorExportFile, + + // Preferences selectors + + hostSelectorSetDebugOption = hostSection(5), // Not yet implemented + hostSelectorSetWindowScale, // Not yet implemented + hostSelectorSetWindowBackground, // Not yet implemented + + // Logging selectors + + hostSelectorLogFile = hostSection(6), + hostSelectorSetLogFileSize, + + hostSelectorLastTrapNumber +} HostControlTrapNumber; + +#endif + + +typedef struct HostControlParamsType +{ + long unused; +} HostControlParamsType; + + + +typedef struct HostFILE +{ + long _field; +} HostFILE; + + + +typedef long HostBool; +typedef long HostErr; +typedef long HostID; +typedef long HostPlatform; +typedef long HostBG; + +#ifndef hostErrorClass + #define hostErrorClass 0x1C00 // Host Control Manager +#else + #if hostErrorClass != 0x1C00 + #error "You cannot change hostErrorClass without telling us." + #endif +#endif + +enum // HostErr values +{ + hostErrNone = 0, + + hostErrBase = hostErrorClass, + + hostErrUnknownGestaltSelector, + + hostErrDiskError, + + hostErrOutOfMemory, + hostErrMemReadOutOfRange, + hostErrMemWriteOutOfRange, + hostErrMemInvalidPtr, + + hostErrInvalidParameter +}; + + +enum // HostID values +{ + hostIDPalmOS, + hostIDPalmOSEmulator, // The Copilot thingy + hostIDPalmOSSimulator // The Mac libraries you link with thingy +}; + + +enum // HostPlatform values +{ + hostPlatformPalmOS, + hostPlatformWindows, + hostPlatformMacintosh, + hostPlatformUnix +}; + + +enum // HostBG values +{ + hostBGGray, + hostBGWhite +}; + +#define HOST_TRAP(selector) \ + _SYSTEM_API(_CALL_WITH_16BIT_SELECTOR)(_SYSTEM_TABLE, sysTrapHostControl, \ + selector) + +#ifdef __cplusplus +extern "C" { +#endif + + +long HostGetHostVersion (void) HOST_TRAP (hostSelectorGetHostVersion); +HostID HostGetHostID (void) HOST_TRAP (hostSelectorGetHostID); +HostPlatform HostGetHostPlatform (void) HOST_TRAP (hostSelectorGetHostPlatform); +HostBool HostIsSelectorImplemented (long selector) HOST_TRAP (hostSelectorIsSelectorImplemented); +HostErr HostGestalt (long gestSel, long* response) HOST_TRAP (hostSelectorGestalt); +HostBool HostIsCallingTrap (void) HOST_TRAP (hostSelectorIsCallingTrap); + +HostErr HostProfileInit (long maxCalls, long maxDepth) HOST_TRAP (hostSelectorProfileInit); +HostErr HostProfileStart (void) HOST_TRAP (hostSelectorProfileStart); +HostErr HostProfileStop (void) HOST_TRAP (hostSelectorProfileStop); +HostErr HostProfileDump (const char *filename) HOST_TRAP (hostSelectorProfileDump); +HostErr HostProfileCleanup (void) HOST_TRAP (hostSelectorProfileCleanup); + +long HostErrNo (void) HOST_TRAP (hostSelectorErrNo); + +long HostFClose (HostFILE* f) HOST_TRAP (hostSelectorFClose); +long HostFEOF (HostFILE* f) HOST_TRAP (hostSelectorFEOF); +long HostFError (HostFILE* f) HOST_TRAP (hostSelectorFError); +long HostFFlush (HostFILE* f) HOST_TRAP (hostSelectorFFlush); +long HostFGetC (HostFILE* f) HOST_TRAP (hostSelectorFGetC); +long HostFGetPos (HostFILE* f, long* posP) HOST_TRAP (hostSelectorFGetPos); +char* HostFGetS (char *s, long n, HostFILE* f) HOST_TRAP (hostSelectorFGetS); +HostFILE* HostFOpen (const char *name, const char *mode) HOST_TRAP (hostSelectorFOpen); +long HostFPrintF (HostFILE* f, const char *fmt, ...) HOST_TRAP (hostSelectorFPrintF); +long HostFPutC (long c, HostFILE* f) HOST_TRAP (hostSelectorFPutC); +long HostFPutS (const char *s, HostFILE* f) HOST_TRAP (hostSelectorFPutS); +long HostFRead (void *buffer, long size, long count, HostFILE* f) + HOST_TRAP (hostSelectorFRead); +long HostRemove (const char *name) HOST_TRAP (hostSelectorRemove); +long HostRename (const char *oldName, const char *newName) HOST_TRAP (hostSelectorRename); +HostFILE* HostFReopen (const char *name, const char *mode, HostFILE *f) + HOST_TRAP (hostSelectorFReopen); +long HostFScanF (HostFILE* f, const char *fmt, ...) HOST_TRAP(hostSelectorFScanF); +long HostFSeek (HostFILE* f, long offset, long origin) HOST_TRAP (hostSelectorFSeek); +long HostFSetPos (HostFILE* f, long* pos) HOST_TRAP (hostSelectorFSetPos); +long HostFTell (HostFILE* f) HOST_TRAP (hostSelectorFTell); +long HostFWrite (const void *buffer, long size, long count, HostFILE* f) + HOST_TRAP (hostSelectorFWrite); +HostFILE* HostTmpFile (void) HOST_TRAP (hostSelectorTmpFile); +char* HostTmpNam (char *name) HOST_TRAP (hostSelectorTmpNam); +char* HostGetEnv (const char *name) HOST_TRAP (hostSelectorGetEnv); + +void* HostMalloc (long size) HOST_TRAP (hostSelectorMalloc); +void* HostRealloc (void *p, long size) HOST_TRAP (hostSelectorRealloc); +void HostFree (void *p) HOST_TRAP (hostSelectorFree); + +HostBool HostGremlinIsRunning (void) HOST_TRAP (hostSelectorGremlinIsRunning); +long HostGremlinNumber (void) HOST_TRAP (hostSelectorGremlinNumber); +long HostGremlinCounter (void) HOST_TRAP (hostSelectorGremlinCounter); +long HostGremlinLimit (void) HOST_TRAP (hostSelectorGremlinLimit); + +HostErr HostImportFile (const char *fileName, long cardNum) HOST_TRAP (hostSelectorImportFile); +HostErr HostExportFile (const char *fileName, long cardNum, const char *dbName) + HOST_TRAP (hostSelectorExportFile); + +HostBool HostSetDebugOption (HostBool newSetting) HOST_TRAP (hostSelectorSetDebugOption); +long HostSetWindowScale (long newScale) HOST_TRAP (hostSelectorSetWindowScale); +HostBG HostSetWindowBackground (HostBG newBackground) HOST_TRAP (hostSelectorSetWindowBackground); + +HostFILE* HostLogFile (void) HOST_TRAP (hostSelectorLogFile); +void HostSetLogFileSize (long) HOST_TRAP (hostSelectorSetLogFileSize); + +#ifdef __cplusplus +} +#endif + + +#endif /* __HOSTCONTROL_H__ */ + diff --git a/sdk-3.5/include/Core/System/ImcUtils.h b/sdk-3.5/include/Core/System/ImcUtils.h new file mode 100644 index 0000000..08b9edc --- /dev/null +++ b/sdk-3.5/include/Core/System/ImcUtils.h @@ -0,0 +1,86 @@ +/****************************************************************************** + * + * Copyright (c) 1997-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ImcUtils.h + * + * Description: + * Routines to handle Internet Mail Consortium specs + * + * History: + * 8/6/97 roger - Created + * + *****************************************************************************/ + +#ifndef __IMCUTILS_H__ +#define __IMCUTILS_H__ + +#include +#include + +#ifndef EOF +#define EOF 0xffff +#endif + + +// Constants for some common IMC spec values. +#define parameterDelimeterChr ';' +#define valueDelimeterChr ':' +#define groupDelimeterChr '.' +#define paramaterNameDelimiterChr '=' +#define endOfLineChr 0x0D +#define imcLineSeparatorString "\015\012" +#define imcFilenameLength 32 +#define imcUnlimitedChars 0xFFFE // 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 +typedef UInt16 GetCharF (const void *); +typedef void PutStringF(void *, const Char * const stringP); + +#ifdef __cplusplus +extern "C" { +#endif + +// maxChars does NOT include trailing null, buffer may be 1 larger. +// use imcUnlimitedChars if you don't want a max. +extern Char * ImcReadFieldNoSemicolon(void *inputStream, + GetCharF inputFunc, UInt16 *c, const UInt16 maxChars) + SYS_TRAP(sysTrapImcReadFieldNoSemicolon); + +// maxChars does NOT include trailing null, buffer may be 1 larger. +// use imcUnlimitedChars if you don't want a max. +extern Char * ImcReadFieldQuotablePrintable(void *inputStream, GetCharF inputFunc, UInt16 *c, + const Char stopAt, const Boolean quotedPrintable, const UInt16 maxChars) + SYS_TRAP(sysTrapImcReadFieldQuotablePrintable); + +extern void ImcReadPropertyParameter(void *inputStream, GetCharF inputFunc, + UInt16 *cP, Char *nameP, Char *valueP) + SYS_TRAP(sysTrapImcReadPropertyParameter); + +extern void ImcSkipAllPropertyParameters(void *inputStream, GetCharF inputFunc, + UInt16 *cP, Char *identifierP, Boolean *quotedPrintableP) + SYS_TRAP(sysTrapImcSkipAllPropertyParameters); + +extern void ImcReadWhiteSpace(void *inputStream, GetCharF inputFunc, + const UInt16 *const charAttrP, UInt16 *c) + SYS_TRAP(sysTrapImcReadWhiteSpace); + +extern void ImcWriteQuotedPrintable(void *outputStream, PutStringF outputFunc, + const Char *stringP, const Boolean noSemicolons) + SYS_TRAP(sysTrapImcWriteQuotedPrintable); + +extern void ImcWriteNoSemicolon(void *outputStream, PutStringF outputFunc, + const Char * const stringP) + SYS_TRAP(sysTrapImcWriteNoSemicolon); + +extern Boolean ImcStringIsAscii(const Char * const stringP) + SYS_TRAP(sysTrapImcStringIsAscii); + +#ifdef __cplusplus +} +#endif + +#endif // _IMC_UTILS_H + diff --git a/sdk-3.5/include/Core/System/IntlMgr.h b/sdk-3.5/include/Core/System/IntlMgr.h new file mode 100644 index 0000000..a4024f6 --- /dev/null +++ b/sdk-3.5/include/Core/System/IntlMgr.h @@ -0,0 +1,149 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: IntlMgr.h + * + * Description: + * This file defines public Int'l Mgr structures and routines. + * + * History: + * 03/21/98 kwk Created by Ken Krugler. + * 10/14/98 kwk Added intlIntlGetRoutineAddress selector and + * IntlGetRoutineAddress routine declaration. + * 08/05/99 kwk Added intlIntlHandleEvent selector and the + * IntlHandleEvent routine declaration. + * 09/22/99 kwk Added intlTxtParamString selector. + * 10/20/99 kwk Moved private stuff to IntlPrv.h + * + *****************************************************************************/ + +#ifndef __INTLMGR_H__ +#define __INTLMGR_H__ + +#include +#include + +// If nobody has explicitly specified that we should or should not +// use our international trap dispatcher, set it based on the emulation +// level. + +#ifndef USE_INTL_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_INTL_TRAPS 1 + #else + #define USE_INTL_TRAPS 0 + #endif +#endif + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Bits set for the Intl Mgr feature. + +#define intlMgrExists 0x00000001 + +// International Manager trap macros. + +#if USE_INTL_TRAPS + #define INTL_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapIntlDispatch, sel) +#else + #define INTL_TRAP(intlSelectorNum) +#endif + +// Selectors for routines found in the international manager. The order +// of these selectors MUST match the jump table in IntlDispatch.c. + +#ifdef __GNUC__ + +#define intlIntlInit 0 +#define intlTxtByteAttr 1 +#define intlTxtCharAttr 2 +#define intlTxtCharXAttr 3 +#define intlTxtCharSize 4 +#define intlTxtGetPreviousChar 5 +#define intlTxtGetNextChar 6 +#define intlTxtGetChar 7 +#define intlTxtSetNextChar 8 +#define intlTxtCharBounds 9 +#define intlTxtPrepFindString 10 +#define intlTxtFindString 11 +#define intlTxtReplaceStr 12 +#define intlTxtWordBounds 13 +#define intlTxtCharEncoding 14 +#define intlTxtStrEncoding 15 +#define intlTxtEncodingName 16 +#define intlTxtMaxEncoding 17 +#define intlTxtTransliterate 18 +#define intlTxtCharIsValid 19 +#define intlTxtCompare 20 +#define intlTxtCaselessCompare 21 +#define intlTxtCharWidth 22 +#define intlTxtGetTruncationOffset 23 +#define intlIntlGetRoutineAddress 24 +#define intlIntlHandleEvent 25 +#define intlTxtParamString 26 + +#define intlMaxSelector intlTxtParamString + +typedef UInt16 IntlSelector; + +#else + +typedef enum { + intlIntlInit = 0, + intlTxtByteAttr, + intlTxtCharAttr, + intlTxtCharXAttr, + intlTxtCharSize, + intlTxtGetPreviousChar, + intlTxtGetNextChar, + intlTxtGetChar, + intlTxtSetNextChar, + intlTxtCharBounds, + intlTxtPrepFindString, + intlTxtFindString, + intlTxtReplaceStr, + intlTxtWordBounds, + intlTxtCharEncoding, + intlTxtStrEncoding, + intlTxtEncodingName, + intlTxtMaxEncoding, + intlTxtTransliterate, + intlTxtCharIsValid, + intlTxtCompare, + intlTxtCaselessCompare, + intlTxtCharWidth, + intlTxtGetTruncationOffset, + intlIntlGetRoutineAddress, + intlIntlHandleEvent, + intlTxtParamString, + + intlMaxSelector = intlTxtParamString, + intlBigSelector = 0x7FFF // Force IntlSelector to be 16 bits. +} IntlSelector; + +#endif + +/*********************************************************************** + * Public routines + ***********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +// Return back the address of the routine indicated by . If +// isn't a valid routine selector, return back NULL. +void *IntlGetRoutineAddress(IntlSelector inSelector) + INTL_TRAP(intlIntlGetRoutineAddress); + +#ifdef __cplusplus + } +#endif + +#endif // __INTLMGR_H__ + diff --git a/sdk-3.5/include/Core/System/IrLib.h b/sdk-3.5/include/Core/System/IrLib.h new file mode 100644 index 0000000..f7f524b --- /dev/null +++ b/sdk-3.5/include/Core/System/IrLib.h @@ -0,0 +1,1543 @@ +/******************************************************************* + * IrLib.h + * + * Copyright (c) 1994-1999, Palm Computing, 3Com Corporation or its + * subsidiaries ("3Com"). All rights reserved. + * + * Portions of this file are: + * Copyright Counterpoint Systems Foundry, Inc. 1995, 1996 + * + *------------------------------------------------------------------- + * FileName: IrLib.h + * + * 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. + * + *******************************************************************/ + +#ifndef __IRLIB_H__ +#define __IRLIB_H__ + +#include +#include + +// 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. + +#include + +// name of Ir library +#define irLibName "IrDA Library" + +// Feature Creators and numbers, for use with the FtrGet() call. This +// feature can be obtained to get the current version of the Ir Library +#define irFtrCreator sysFileCIrLib +#define 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 +#define irOpenOptBackground 0x80000000 // Unsupported background task use +#define irOpenOptDisconnect3 0x10000000 // sets amount of time in seconds +#define irOpenOptDisconnect8 0x20000000 // after no activity from other +#define irOpenOptDisconnect12 0x30000000 // device before disconnect is +#define irOpenOptDisconnect16 0x40000000 // initiated. +#define irOpenOptDisconnect20 0x50000000 // default is 40 secs +#define irOpenOptDisconnect25 0x60000000 +#define irOpenOptDisconnect30 0x70000000 +#define irOpenOptDisconnect40 0x00000000 +#define irOpenOptSpeed115200 0x0000003F // sets max negotiated baud rate +#define irOpenOptSpeed57600 0x0000001F // default is 57600 +#define irOpenOptSpeed38400 0x0000000F +#define irOpenOptSpeed19200 0x00000007 +#define irOpenOptSpeed9600 0x00000003 + +// Option codes for ExgLibControl +// These options are all unique to the Ir transport +#define irGetScanningMode (exgLibCtlSpecificOp | 1) // returns scanning enabled +#define irSetScanningMode (exgLibCtlSpecificOp | 2) // en/disables ir scanning mode +#define irGetStatistics (exgLibCtlSpecificOp | 3) // returns performance stats +#define irSetSerialMode (exgLibCtlSpecificOp | 4) // sets driver to use direct serial +#define irSetBaudMask (exgLibCtlSpecificOp | 5) // set possible baud rates (irOpenOpts) +#define irSetSupported (exgLibCtlSpecificOp | 6) // disables the ir not supported dialog + +// structure returned by irGetStatistics +typedef struct { + UInt16 recLineErrors; // # of serial errors since library opend + UInt16 crcErrors; // # of crc errors ... +} IrStatsType; + +//----------------------------------------------------------------------------- +// Ir library call ID's. +//----------------------------------------------------------------------------- + +#ifdef __GNUC__ + +// these start after the ObxLib interface... +#define irLibTrapBind (exgLibTrapLast) +#define irLibTrapUnBind (exgLibTrapLast+1) +#define irLibTrapDiscoverReq (exgLibTrapLast+2) +#define irLibTrapConnectIrLap (exgLibTrapLast+3) +#define irLibTrapDisconnectIrLap (exgLibTrapLast+4) +#define irLibTrapConnectReq (exgLibTrapLast+5) +#define irLibTrapConnectRsp (exgLibTrapLast+6) +#define irLibTrapDataReq (exgLibTrapLast+7) +#define irLibTrapLocalBusy (exgLibTrapLast+8) +#define irLibTrapMaxTxSize (exgLibTrapLast+9) +#define irLibTrapMaxRxSize (exgLibTrapLast+10) +#define irLibTrapSetDeviceInfo (exgLibTrapLast+11) +#define irLibTrapIsNoProgress (exgLibTrapLast+12) +#define irLibTrapIsRemoteBusy (exgLibTrapLast+13) +#define irLibTrapIsMediaBusy (exgLibTrapLast+14) +#define irLibTrapIsIrLapConnected (exgLibTrapLast+15) +#define irLibTrapTestReq (exgLibTrapLast+16) +#define irLibTrapIAS_Add (exgLibTrapLast+17) +#define irLibTrapIAS_Query (exgLibTrapLast+18) +#define irLibTrapIAS_SetDeviceName (exgLibTrapLast+19) +#define irLibTrapIAS_Next (exgLibTrapLast+20) +#define irLibTrapIrOpen (exgLibTrapLast+21) +#define irLibTrapHandleEvent (exgLibTrapLast+22) +#define irLibTrapWaitForEvent (exgLibTrapLast+23) + +#define irLibTrapLast (exgLibTrapLast+24) + +#else + +#pragma mark Traps +typedef enum { + irLibTrapBind = exgLibTrapLast, // these start after the ObxLib interface... + irLibTrapUnBind, + irLibTrapDiscoverReq, + irLibTrapConnectIrLap, + irLibTrapDisconnectIrLap, + irLibTrapConnectReq, + irLibTrapConnectRsp, + irLibTrapDataReq, + irLibTrapLocalBusy, + irLibTrapMaxTxSize, + irLibTrapMaxRxSize, + irLibTrapSetDeviceInfo, + irLibTrapIsNoProgress, + irLibTrapIsRemoteBusy, + irLibTrapIsMediaBusy, + irLibTrapIsIrLapConnected, + irLibTrapTestReq, + irLibTrapIAS_Add, + irLibTrapIAS_Query, + irLibTrapIAS_SetDeviceName, + irLibTrapIAS_Next, + irLibTrapIrOpen, + irLibTrapHandleEvent, + irLibTrapWaitForEvent, + + irLibTrapLast + } IrLibTrapNumberEnum; + +#endif + + +/**************************************************************************** + * + * Types and Constants + * + ****************************************************************************/ + +/* Maximum size of packet that can be sent at connect time (ConnectReq or + * ConnectRsp) for IrLMP and Tiny TP connections. + */ +#define IR_MAX_CON_PACKET 60 +#define IR_MAX_TTP_CON_PACKET 52 +#define IR_MAX_TEST_PACKET 376 +#define IR_MAX_DEVICE_INFO 23 + +/* Size of the device list used in discovery process + */ +#define 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. + */ +#define IR_MAX_XID_LEN 23 + + +/* Maximum allowed LSAP in IrLMP + */ +#define IR_MAX_LSAP 0x6f + +/* The following are used to access the hint bits in the first byte + * of the Device Info field of an XID frame (IrDeviceInfo). + */ +#define IR_HINT_PNP 0x01 +#define IR_HINT_PDA 0x02 +#define IR_HINT_COMPUTER 0x04 +#define IR_HINT_PRINTER 0x08 +#define IR_HINT_MODEM 0x10 +#define IR_HINT_FAX 0x20 +#define IR_HINT_LAN 0x40 +#define IR_HINT_EXT 0x80 + +/* 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. + */ +#define IR_HINT_TELEPHONY 0x01 +#define IR_HINT_FILE 0x02 +#define IR_HINT_IRCOMM 0x04 +#define IR_HINT_MESSAGE 0x08 +#define IR_HINT_HTTP 0x10 +#define IR_HINT_OBEX 0x20 + + +/*--------------------------------------------------------------------------- + * + * Status of a stack operation or of the stack. + */ +typedef UInt8 IrStatus; + +#define IR_STATUS_SUCCESS 0 /* Successful and complete */ +#define IR_STATUS_FAILED 1 /* Operation failed */ +#define IR_STATUS_PENDING 2 /* Successfully started but pending */ +#define IR_STATUS_DISCONNECT 3 /* Link disconnected */ +#define IR_STATUS_NO_IRLAP 4 /* No IrLAP Connection exists */ +#define IR_STATUS_MEDIA_BUSY 5 /* IR Media is busy */ +#define IR_STATUS_MEDIA_NOT_BUSY 6 /* IR Media is not busy */ +#define IR_STATUS_NO_PROGRESS 7 /* IrLAP not making progress */ +#define IR_STATUS_LINK_OK 8 /* No progress condition cleared */ + +/*--------------------------------------------------------------------------- + * + * Character set for user strings. These are definitions for the character + * set in Nicknames and in IAS attributes of type User String. + */ +typedef UInt8 IrCharSet; + +#define IR_CHAR_ASCII 0 +#define IR_CHAR_ISO_8859_1 1 +#define IR_CHAR_ISO_8859_2 2 +#define IR_CHAR_ISO_8859_3 3 +#define IR_CHAR_ISO_8859_4 4 +#define IR_CHAR_ISO_8859_5 5 +#define IR_CHAR_ISO_8859_6 6 +#define IR_CHAR_ISO_8859_7 7 +#define IR_CHAR_ISO_8859_8 8 +#define IR_CHAR_ISO_8859_9 9 +#define IR_CHAR_UNICODE 0xff + +/*--------------------------------------------------------------------------- + * + * All indication and confirmations are sent to the IrLMP/TTP connections + * through one callback function. The types of the events passed are + * defined below. + */ +typedef UInt8 IrEvent; + +#define LEVENT_LM_CON_IND 0 +#define LEVENT_LM_DISCON_IND 1 +#define LEVENT_DATA_IND 2 +#define LEVENT_PACKET_HANDLED 3 +#define LEVENT_LAP_CON_IND 4 +#define LEVENT_LAP_DISCON_IND 5 +#define LEVENT_DISCOVERY_CNF 6 +#define LEVENT_LAP_CON_CNF 7 +#define LEVENT_LM_CON_CNF 8 +#define LEVENT_STATUS_IND 9 +#define LEVENT_TEST_IND 10 +#define LEVENT_TEST_CNF 11 + + +/* LmConnect flags - used internally + */ +#define LCON_FLAGS_TTP 0x02 + + + +/**************************************************************************** + * + * IAS Types and Constants + * + ****************************************************************************/ + +/* Maximum size of a query that observes the IrDA Lite rules + */ +#define 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. + */ +#define IR_MAX_IAS_NAME 60 +#define 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. + */ +#define 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. + */ +#define IAS_ATTRIB_MISSING 0 +#define IAS_ATTRIB_INTEGER 1 +#define IAS_ATTRIB_OCTET_STRING 2 +#define IAS_ATTRIB_USER_STRING 3 +#define IAS_ATTRIB_UNDEFINED 0xff + +/* Ias Return Codes. One of these values will be found in the IAS Query + * structure in the retCode field after a successful IAS Query. + */ +#define IAS_RET_SUCCESS 0 /* Query operation is successful */ +#define IAS_RET_NO_SUCH_CLASS 1 /* Query failed no such class exists */ +#define IAS_RET_NO_SUCH_ATTRIB 2 /* Query failed no such attribute exists */ +#define IAS_RET_UNSUPPORTED 0xff /* Query failed operation is unsupported */ + + /* IAS Get Value By Class opcode number + */ +#define IAS_GET_VALUE_BY_CLASS 4 + +// Macros used in accessing ias structures +#define IasGetU16(ptr) (UInt16)( ((UInt16)(*((UInt8*)ptr) << 8)) | \ + ((UInt16) (*((UInt8*)ptr+1)))) +#define IasGetU32(ptr) (UInt32)( ((UInt32)(*((UInt8*)ptr)) << 24) | \ + ((UInt32)(*((UInt8*)ptr+1)) << 16) | \ + ((UInt32)(*((UInt8*)ptr+2)) << 8) | \ + ((UInt32)(*((UInt8*)ptr+3))) ) + +/**************************************************************************** + * + * Data Structures + * + ****************************************************************************/ + +// stack functions use a diferent type for booleans +typedef int BOOL; + +/*--------------------------------------------------------------------------- + * + * ListEntry is used internally by the stack + */ +typedef struct _ListEntry +{ + struct _ListEntry *Flink; + struct _ListEntry *Blink; + +} ListEntry; + +/* Forward declaration of the IrConnect structure + */ +typedef struct _hconnect IrConnect; + +/*--------------------------------------------------------------------------- + * + * Packet Structure for sending IrDA packets. + */ +typedef struct _IrPacket { + /* The node field must be the first field in the structure. It is used + * internally by the stack + */ + ListEntry node; + + /* The buff field is used to point to a buffer of data to send and len + * field indicates the number of bytes in buff. + */ + UInt8 * buff; + UInt16 len; + + /*================== For Internal Use Only ======================= + * + * The following is used internally by the stack and should not be + * modified by the upper layer. + * + *==================================================================*/ + + IrConnect* origin; /* Pointer to connection which owns packet */ + UInt8 headerLen; /* Number of bytes in the header */ + UInt8 header[14]; /* Storage for the header */ + UInt8 reserved; /* Explicitly account for 16-bit alignment padding */ +} IrPacket; + + +/*--------------------------------------------------------------------------- + * + * 32-bit Device Address + */ +typedef union { + UInt8 u8[4]; + UInt16 u16[2]; + UInt32 u32; +} IrDeviceAddr; + +/*--------------------------------------------------------------------------- + * + * 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. + */ +typedef struct { + IrDeviceAddr hDevice; /* 32-bit address of device */ + UInt8 len; /* Length of xid */ + UInt8 xid[IR_MAX_XID_LEN];/* XID information */ +} IrDeviceInfo; + +/*--------------------------------------------------------------------------- + * + * List of Device Discovery info elements. + */ +typedef struct { + UInt8 nItems; /* Number items in the list */ + UInt8 reserved; /* Explicitly account for 16-bit alignment padding */ + IrDeviceInfo dev[IR_DEVICE_LIST_SIZE]; /* Fixed size in IrDA Lite */ +} IrDeviceList; + +/*--------------------------------------------------------------------------- + * + * 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. + */ +typedef struct { + IrEvent event; /* Event causing callback */ + UInt8 reserved1; /* Explicitly account for 16-bit alignment padding */ + UInt8 * rxBuff; /* Receive buffer already advanced to app data */ + UInt16 rxLen; /* Length of data in receive buffer */ + IrPacket* packet; /* Pointer to packet being returned */ + IrDeviceList* deviceList; /* Pointer to discovery device list */ + IrStatus status; /* Status of stack */ + UInt8 reserved2; /* Explicitly account for 16-bit alignment padding */ +} 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. + */ +typedef void (*IrCallBack)(IrConnect*, IrCallBackParms*); + +/*--------------------------------------------------------------------------- + * + * Definition of IrConnect structure. This structure is used to manage an + * IrLMP or Tiny TP connection. + */ +typedef struct _hconnect { + UInt8 lLsap; /* Local LSAP this connection will listen on */ + UInt8 rLsap; /* Remote Lsap */ + + /*================== For Internal Use Only ======================= + * + * The following is used internally by the stack and should not be + * modified by the user. + * + *==================================================================*/ + + UInt8 flags; /* Flags containing state, type, etc. */ + UInt8 reserved; /* Explicitly account for 16-bit alignment padding */ + IrCallBack callBack; /* Pointer to callback function */ + + /* Tiny TP fields */ + IrPacket packet; /* Packet for internal use */ + ListEntry packets; /* List of packets to send */ + UInt16 sendCredit; /* Amount of credit from peer */ + UInt8 availCredit; /* Amount of credit to give to peer */ + UInt8 dataOff; /* Amount of data less than IrLAP size */ +} _hconnect; + +/**************************************************************************** + * + * IAS Data Strucutres + * + ****************************************************************************/ + +/*--------------------------------------------------------------------------- + * + * The LmIasAttribute is a strucutre that holds one attribute of an IAS + * object. + */ +typedef struct _IrIasAttribute { + UInt8 * name; /* Pointer to name of attribute */ + UInt8 len; /* Length of attribute name */ + UInt8 reserved1; /* Explicitly account for 16-bit alignment padding */ + UInt8 * value; /* Hardcode value (see below) */ + UInt8 valLen; /* Length of the value. */ + UInt8 reserved2; /* Explicitly account for 16-bit alignment padding */ +} 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. + */ +typedef struct _IrIasObject { + UInt8 * name; /* Pointer to name of object */ + UInt8 len; /* Length of object name */ + + UInt8 nAttribs; /* Number of attributes */ + IrIasAttribute* attribs; /* A pointer to an array of attributes */ + +} IrIasObject; + + +/*--------------------------------------------------------------------------- + * + * Forward declaration of a structure used for performing IAS Queries so + * that a callback type can be defined for use in the structure. + */ +typedef struct _IrIasQuery IrIasQuery; +typedef void (*IrIasQueryCallBack)(IrStatus); + +/*--------------------------------------------------------------------------- + * + * Actual definition of the IrIasQuery structure. + */ +typedef struct _IrIasQuery +{ + /* 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 + */ + UInt8 queryLen; /* Total length of the query */ + UInt8 reserved; /* Explicitly account for 16-bit alignment padding */ + UInt8 * queryBuf; /* Points to buffer containing the query */ + + /* Fields for the query result */ + UInt16 resultBufSize; /* Size of the result buffer */ + UInt16 resultLen; /* Actual number of bytes in the result buffer */ + UInt16 listLen; /* Number of items in the result list. */ + UInt16 offset; /* Offset into results buffer */ + UInt8 retCode; /* Return code of operation */ + UInt8 overFlow; /* Set TRUE if result exceeded result buffer size */ + UInt8 * result; /* Pointer to buffer containing result; */ + + /* Pointer to callback function */ + IrIasQueryCallBack callBack; +} _IrIasQuery; + +/**************************************************************************** + * + * Function Reference + * + ****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*--------------------------------------------------------------------------- + * + * 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 + * + */ +Err IrOpen(UInt16 refnum, UInt32 options) + SYS_TRAP(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 + * + */ +#if EMULATION_LEVEL == EMULATION_NONE +Err IrClose(UInt16 refnum) + SYS_TRAP(sysLibTrapClose); +#else +// IrClose does not actually exist in the emulator so map it to ExgLibClose +#define IrClose(refNum) ExgLibClose(refNum) +#endif + +/*--------------------------------------------------------------------------- + * + * 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 + */ +IrStatus IrBind(UInt16 refNum,IrConnect* con, IrCallBack callBack) + SYS_TRAP(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. + */ +IrStatus IrUnbind(UInt16 refNum,IrConnect* con) + SYS_TRAP(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. + */ +IrStatus IrDiscoverReq(UInt16 refNum,IrConnect* con) + SYS_TRAP(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 + */ +IrStatus IrConnectIrLap(UInt16 refNum,IrDeviceAddr deviceAddr) + SYS_TRAP(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. + */ +IrStatus IrDisconnectIrLap(UInt16 refNum) + SYS_TRAP(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). + */ +IrStatus IrConnectReq(UInt16 refNum,IrConnect* con, IrPacket* packet, UInt8 credit) + SYS_TRAP(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). + */ +IrStatus IrConnectRsp(UInt16 refNum,IrConnect* con,IrPacket* packet, UInt8 credit) + SYS_TRAP(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 + */ +IrStatus IrDataReq(UInt16 refNum,IrConnect* con, IrPacket* packet) + SYS_TRAP(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 + */ +#define 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 + */ +void IrLocalBusy(UInt16 refNum,BOOL flag) + SYS_TRAP(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 + */ +#define 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 + */ +#define 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. + */ +UInt16 IrMaxTxSize(UInt16 refNum,IrConnect* con) + SYS_TRAP(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). + */ +UInt16 IrMaxRxSize(UInt16 refNum,IrConnect* con) + SYS_TRAP(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). + */ +IrStatus IrSetDeviceInfo(UInt16 refNum,UInt8 *info, UInt8 len) + SYS_TRAP(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. + */ +BOOL IrIsNoProgress(UInt16 refNum) + SYS_TRAP(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. + */ +BOOL IrIsRemoteBusy(UInt16 refNum) + SYS_TRAP(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. + */ +BOOL IrIsMediaBusy(UInt16 refNum) + SYS_TRAP(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. + */ +BOOL IrIsIrLapConnected(UInt16 refNum) + SYS_TRAP(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). + */ +IrStatus IrTestReq(UInt16 refNum,IrDeviceAddr devAddr, IrConnect* con, IrPacket* packet) + SYS_TRAP(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 + */ +IrStatus IrIAS_Add(UInt16 refNum,IrIasObject* obj) + SYS_TRAP(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. + */ +IrStatus IrIAS_Query(UInt16 refNum,IrIasQuery* token) + SYS_TRAP(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). + */ +IrStatus IrIAS_SetDeviceName(UInt16 refNum,UInt8 *name, UInt8 len) + SYS_TRAP(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 + */ +#define 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 + */ +#define 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. + */ +#define 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. + */ +#define 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. + */ +#define 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 + */ +#define 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 + */ +#define 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 + */ +#define 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 + */ +#define 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 + */ +#define 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. + */ +UInt8 * IrIAS_Next(UInt16 refNum,IrIasQuery* token) + SYS_TRAP(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. + */ +Boolean IrHandleEvent(UInt16 refnum) + SYS_TRAP(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. + */ +Err IrWaitForEvent(UInt16 libRefnum,Int32 timeout) + SYS_TRAP(irLibTrapWaitForEvent); + +#ifdef __cplusplus +} +#endif + +#endif // IR_LIB_H + + + diff --git a/sdk-3.5/include/Core/System/KeyMgr.h b/sdk-3.5/include/Core/System/KeyMgr.h new file mode 100644 index 0000000..0220c4e --- /dev/null +++ b/sdk-3.5/include/Core/System/KeyMgr.h @@ -0,0 +1,75 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: KeyMgr.h + * + * Description: + * Include file for Key manager + * + * History: + * 9/13/95 Created by Ron Marianetti + * 2/04/98 srj- added contrast key defines + * 8/23/98 SCL- Cross-merged 3.1 and 3.2 + * + *****************************************************************************/ + +#ifndef __KEYMGR_H__ +#define __KEYMGR_H__ + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Definition of bit field returned from KeyCurrentState + ********************************************************************/ +#define keyBitPower 0x0001 // Power key +#define keyBitPageUp 0x0002 // Page-up +#define keyBitPageDown 0x0004 // Page-down +#define keyBitHard1 0x0008 // App #1 +#define keyBitHard2 0x0010 // App #2 +#define keyBitHard3 0x0020 // App #3 +#define keyBitHard4 0x0040 // App #4 +#define keyBitCradle 0x0080 // Button on cradle +#define keyBitAntenna 0x0100 // Antenna "key" +#define keyBitContrast 0x0200 // Contrast key + +#define keyBitsAll 0xFFFFFFFF // all keys + + +#define slowestKeyDelayRate 0xff +#define slowestKeyPeriodRate 0xff + + +/******************************************************************** + * Key manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Set/Get the auto-key repeat rate +Err KeyRates(Boolean set, UInt16 *initDelayP, UInt16 *periodP, + UInt16 *doubleTapDelayP, Boolean *queueAheadP) + SYS_TRAP(sysTrapKeyRates); + +// Get the current state of the hardware keys +// This is now updated every tick, even when more than 1 key is held down. +UInt32 KeyCurrentState(void) + SYS_TRAP(sysTrapKeyCurrentState); + +// Set the state of the hardware key mask which controls if the key +// generates a keyDownEvent +UInt32 KeySetMask(UInt32 keyMask) + SYS_TRAP(sysTrapKeySetMask); + +#ifdef __cplusplus +} +#endif + + +#endif //__KEYMGR_H__ + diff --git a/sdk-3.5/include/Core/System/Localize.h b/sdk-3.5/include/Core/System/Localize.h new file mode 100644 index 0000000..3a0703a --- /dev/null +++ b/sdk-3.5/include/Core/System/Localize.h @@ -0,0 +1,53 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Localize.h + * + * Description: + * Functions to localize data. + * + * History: + * 8/28/96 Roger - Initial version + * + *****************************************************************************/ + +#ifndef __LOCALIZE_H__ +#define __LOCALIZE_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + +// The number format (thousands separator and decimal point). This defines +// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland). +typedef enum { + nfCommaPeriod, + nfPeriodComma, + nfSpaceComma, + nfApostrophePeriod, + nfApostropheComma + } NumberFormatType; + + + +#ifdef __cplusplus +extern "C" { +#endif + + +void LocGetNumberSeparators(NumberFormatType numberFormat, + Char *thousandSeparator, Char *decimalSeparator) + SYS_TRAP(sysTrapLocGetNumberSeparators); + + + +#ifdef __cplusplus +} +#endif + + +#endif // __LOCALIZE_H__ + diff --git a/sdk-3.5/include/Core/System/MemoryMgr.h b/sdk-3.5/include/Core/System/MemoryMgr.h new file mode 100644 index 0000000..1d62805 --- /dev/null +++ b/sdk-3.5/include/Core/System/MemoryMgr.h @@ -0,0 +1,340 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: MemoryMgr.h + * + * Description: + * Include file for Memory Manager + * + * History: + * 10/25/94 RM Created by Ron Marianetti + * 10/28/99 kwk Added memErrROMOnlyCard. + * + *****************************************************************************/ + +#ifndef __MEMORYMGR_H__ +#define __MEMORYMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. +#include + + +/************************************************************ + * Memory Manager Types + *************************************************************/ +typedef enum { memIDPtr, memIDHandle } LocalIDKind; + + +/************************************************************ + * Flags accepted as parameter for MemNewChunk. + *************************************************************/ +#define memNewChunkFlagPreLock 0x0100 +#define memNewChunkFlagNonMovable 0x0200 +#define memNewChunkFlagAtStart 0x0400 // force allocation at front of heap +#define memNewChunkFlagAtEnd 0x0800 // force allocation at end of heap + + +/************************************************************ + * Memory Manager Debug settings for the MemSetDebugMode function + *************************************************************/ +#define memDebugModeCheckOnChange 0x0001 +#define memDebugModeCheckOnAll 0x0002 +#define memDebugModeScrambleOnChange 0x0004 +#define memDebugModeScrambleOnAll 0x0008 +#define memDebugModeFillFree 0x0010 +#define memDebugModeAllHeaps 0x0020 +#define memDebugModeRecordMinDynHeapFree 0x0040 + + + + +/************************************************************ + * Memory Manager result codes + *************************************************************/ +#define memErrChunkLocked (memErrorClass | 1) +#define memErrNotEnoughSpace (memErrorClass | 2) +#define memErrInvalidParam (memErrorClass | 3) /* invalid param or requested size is too big */ +#define memErrChunkNotLocked (memErrorClass | 4) +#define memErrCardNotPresent (memErrorClass | 5) +#define memErrNoCardHeader (memErrorClass | 6) +#define memErrInvalidStoreHeader (memErrorClass | 7) +#define memErrRAMOnlyCard (memErrorClass | 8) +#define memErrWriteProtect (memErrorClass | 9) +#define memErrNoRAMOnCard (memErrorClass | 10) +#define memErrNoStore (memErrorClass | 11) +#define memErrROMOnlyCard (memErrorClass | 12) + + +/******************************************************************** + * Memory Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err MemInit(void) + SYS_TRAP(sysTrapMemInit); + +Err MemKernelInit(void) + SYS_TRAP(sysTrapMemKernelInit); + +Err MemInitHeapTable(UInt16 cardNo) + SYS_TRAP(sysTrapMemInitHeapTable); + +//------------------------------------------------------------------- +// Card formatting and Info +//------------------------------------------------------------------- +UInt16 MemNumCards(void) + SYS_TRAP(sysTrapMemNumCards); + +Err MemCardFormat(UInt16 cardNo, Char *cardNameP, + Char *manufNameP, Char *ramStoreNameP) + SYS_TRAP(sysTrapMemCardFormat); + +Err MemCardInfo(UInt16 cardNo, + Char *cardNameP, Char *manufNameP, + UInt16 *versionP, UInt32 *crDateP, + UInt32 *romSizeP, UInt32 *ramSizeP, + UInt32 *freeBytesP) + SYS_TRAP(sysTrapMemCardInfo); + + +//------------------------------------------------------------------- +// Store Info +//------------------------------------------------------------------- +Err MemStoreInfo(UInt16 cardNo, UInt16 storeNumber, + UInt16 *versionP, UInt16 *flagsP, Char *nameP, + UInt32 * crDateP, UInt32 *bckUpDateP, + UInt32 * heapListOffsetP, UInt32 *initCodeOffset1P, + UInt32 *initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreInfo); + +Err MemStoreSetInfo(UInt16 cardNo, UInt16 storeNumber, + UInt16 *versionP, UInt16 *flagsP, Char *nameP, + UInt32 *crDateP, UInt32 *bckUpDateP, + UInt32 *heapListOffsetP, UInt32 *initCodeOffset1P, + UInt32 *initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreSetInfo); + + +//------------------------------------------------------------------- +// Heap Info & Utilities +//------------------------------------------------------------------- +UInt16 MemNumHeaps(UInt16 cardNo) + SYS_TRAP(sysTrapMemNumHeaps); + +UInt16 MemNumRAMHeaps(UInt16 cardNo) + SYS_TRAP(sysTrapMemNumRAMHeaps); + +UInt16 MemHeapID(UInt16 cardNo, UInt16 heapIndex) + SYS_TRAP(sysTrapMemHeapID); + +Boolean MemHeapDynamic(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapDynamic); + +Err MemHeapFreeBytes(UInt16 heapID, UInt32 *freeP, UInt32 *maxP) + SYS_TRAP(sysTrapMemHeapFreeBytes); + +UInt32 MemHeapSize(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapSize); + +UInt16 MemHeapFlags(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapFlags); + + +// Heap utilities +Err MemHeapCompact(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapCompact); + +Err MemHeapInit(UInt16 heapID, Int16 numHandles, Boolean initContents) + SYS_TRAP(sysTrapMemHeapInit); + +Err MemHeapFreeByOwnerID(UInt16 heapID, UInt16 ownerID) + SYS_TRAP(sysTrapMemHeapFreeByOwnerID); + + +//------------------------------------------------------------------- +// Low Level Allocation +//------------------------------------------------------------------- +MemPtr MemChunkNew(UInt16 heapID, UInt32 size, UInt16 attr) + SYS_TRAP(sysTrapMemChunkNew); + +Err MemChunkFree(MemPtr chunkDataP) + SYS_TRAP(sysTrapMemChunkFree); + + + +//------------------------------------------------------------------- +// Pointer (Non-Movable) based Chunk Routines +//------------------------------------------------------------------- +MemPtr MemPtrNew(UInt32 size) + SYS_TRAP(sysTrapMemPtrNew); + +#define MemPtrFree( p) \ + MemChunkFree(p) + +// Getting Attributes +MemHandle MemPtrRecoverHandle(MemPtr p) + SYS_TRAP(sysTrapMemPtrRecoverHandle); + +UInt16 MemPtrFlags(MemPtr p) + SYS_TRAP(sysTrapMemPtrFlags); + +UInt32 MemPtrSize(MemPtr p) + SYS_TRAP(sysTrapMemPtrSize); + +UInt16 MemPtrOwner(MemPtr p) + SYS_TRAP(sysTrapMemPtrOwner); + +UInt16 MemPtrHeapID(MemPtr p) + SYS_TRAP(sysTrapMemPtrHeapID); + +Boolean MemPtrDataStorage(MemPtr p) + SYS_TRAP(sysTrapMemPtrDataStorage); + +UInt16 MemPtrCardNo(MemPtr p) + SYS_TRAP(sysTrapMemPtrCardNo); + +LocalID MemPtrToLocalID(MemPtr p) + SYS_TRAP(sysTrapMemPtrToLocalID); + +// Setting Attributes +Err MemPtrSetOwner(MemPtr p, UInt16 owner) + SYS_TRAP(sysTrapMemPtrSetOwner); + +Err MemPtrResize(MemPtr p, UInt32 newSize) + SYS_TRAP(sysTrapMemPtrResize); + +Err MemPtrResetLock(MemPtr p) + SYS_TRAP(sysTrapMemPtrResetLock); + +Err MemPtrUnlock(MemPtr p) + SYS_TRAP(sysTrapMemPtrUnlock); + + +//------------------------------------------------------------------- +// MemHandle (Movable) based Chunk Routines +//------------------------------------------------------------------- +MemHandle MemHandleNew(UInt32 size) + SYS_TRAP(sysTrapMemHandleNew); + +Err MemHandleFree(MemHandle h) + SYS_TRAP(sysTrapMemHandleFree); + +// Getting Attributes +UInt16 MemHandleFlags(MemHandle h) + SYS_TRAP(sysTrapMemHandleFlags); + +UInt32 MemHandleSize(MemHandle h) + SYS_TRAP(sysTrapMemHandleSize); + +UInt16 MemHandleOwner(MemHandle h) + SYS_TRAP(sysTrapMemHandleOwner); + +UInt16 MemHandleLockCount(MemHandle h) + SYS_TRAP(sysTrapMemHandleLockCount); + +UInt16 MemHandleHeapID(MemHandle h) + SYS_TRAP(sysTrapMemHandleHeapID); + +Boolean MemHandleDataStorage(MemHandle h) + SYS_TRAP(sysTrapMemHandleDataStorage); + +UInt16 MemHandleCardNo(MemHandle h) + SYS_TRAP(sysTrapMemHandleCardNo); + +LocalID MemHandleToLocalID(MemHandle h) + SYS_TRAP(sysTrapMemHandleToLocalID); + + +// Setting Attributes +Err MemHandleSetOwner( MemHandle h, UInt16 owner) + SYS_TRAP(sysTrapMemHandleSetOwner); + +Err MemHandleResize(MemHandle h, UInt32 newSize) + SYS_TRAP(sysTrapMemHandleResize); + +MemPtr MemHandleLock(MemHandle h) + SYS_TRAP(sysTrapMemHandleLock); + +Err MemHandleUnlock(MemHandle h) + SYS_TRAP(sysTrapMemHandleUnlock); + +Err MemHandleResetLock(MemHandle h) + SYS_TRAP(sysTrapMemHandleResetLock); + + + + +//------------------------------------------------------------------- +// Local ID based routines +//------------------------------------------------------------------- +MemPtr MemLocalIDToGlobal(LocalID local, UInt16 cardNo) + SYS_TRAP(sysTrapMemLocalIDToGlobal); + +LocalIDKind MemLocalIDKind(LocalID local) + SYS_TRAP(sysTrapMemLocalIDKind); + +MemPtr MemLocalIDToPtr(LocalID local, UInt16 cardNo) + SYS_TRAP(sysTrapMemLocalIDToPtr); + +MemPtr MemLocalIDToLockedPtr(LocalID local, UInt16 cardNo) + SYS_TRAP(sysTrapMemLocalIDToLockedPtr); + + +//------------------------------------------------------------------- +// Utilities +//------------------------------------------------------------------- +Err MemMove(void *dstP, const void *sP, Int32 numBytes) + SYS_TRAP(sysTrapMemMove); + +Err MemSet(void *dstP, Int32 numBytes, UInt8 value) + SYS_TRAP(sysTrapMemSet); + +Int16 MemCmp (const void *s1, const void *s2, Int32 numBytes) + SYS_TRAP(sysTrapMemCmp); + +Err MemSemaphoreReserve(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreReserve); + +Err MemSemaphoreRelease(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreRelease); + +//------------------------------------------------------------------- +// Debugging Support +//------------------------------------------------------------------- +UInt16 MemDebugMode(void) + SYS_TRAP(sysTrapMemDebugMode); + +Err MemSetDebugMode(UInt16 flags) + SYS_TRAP(sysTrapMemSetDebugMode); + +Err MemHeapScramble(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapScramble); + +Err MemHeapCheck(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapCheck); + + +#ifdef __cplusplus +} +#endif + + + + + +#endif // __MEMORYMGR_H__ + diff --git a/sdk-3.5/include/Core/System/ModemMgr.h b/sdk-3.5/include/Core/System/ModemMgr.h new file mode 100644 index 0000000..8a49f16 --- /dev/null +++ b/sdk-3.5/include/Core/System/ModemMgr.h @@ -0,0 +1,149 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ModemMgr.h + * + * Description: + * Include file for Modem Manager + * + * History: + * 9/20/95 VMK - Created by Vitaly Kruglikov + * + *****************************************************************************/ + +#ifndef __MODEM_MGR_H__ +#define __MODEM_MGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. +#include + + +/************************************************************ + * Modem Manager constants + *************************************************************/ + +#define mdmMaxStringSize 40 + +#define mdmCmdBufSize 81 // command buffer capacity (including null) +#define mdmRespBufSize 81 // reply buffer capacity (including null) +#define mdmCmdSize 8 // max storage needed for smartmodem command + +#define mdmDefCmdTimeOut 500000L // in micro-seconds + +#define mdmDefDTWaitSec 4 +#define mdmDefDCDWaitSec 70 +#define mdmDefSpeakerVolume 1 + + +// Speaker volume settings +enum { + mdmVolumeOff = 0, + mdmVolumeLow = 1, + mdmVolumeMed = 2, + mdmVolumeHigh = 3 + }; + + +// Modem connection stages (NEW for Pilot 2.0) +typedef enum { + mdmStageInvalid = 0, // invalid state + mdmStageReserved = 1, // reserved for 1.0 compatibility + mdmStageFindingModem, // checking if modem is present + mdmStageInitializing, // initializing the modem + mdmStageDialing, // dialing the modem + mdmStageWaitingForCarrier, // waiting for carrier detect + mdmStageHangingUp // hanging up the modem + } MdmStageEnum; + +/************************************************************ + * Modem Manager data structures + *************************************************************/ +// Prototype for the "user cancel" check callback function +typedef Int16 (*MdmUserCanProcPtr)(UInt32 userRef); + +typedef struct MdmInfoType { + UInt16 portID; // serial port ID number. [NewSerialMgr; replaces serRefNum] + UInt32 initialBaud; // initial baud rate to use + UInt32 cmdTimeOut; // number of micro-sec to wait after a cmd + Int16 dtWaitSec; // dialtone wait (sec) (-1 for modem's default) + Int16 dcdWaitSec; // dcd timeout wait (sec) (-1 for modem's default) + Int16 volume; // speaker volume(see mdmVolume... constants) + Boolean pulse; // pulse or tone dialing + Boolean hwHShake; // enable cts/rts handshaking + Boolean autoBaud; // enable/disable auto-baud to connected baud rate + UInt8 reserved1; + MdmUserCanProcPtr canProcP; // ptr to user-cancel function + UInt32 userRef; // parameter for canProcP() + Char cmdBuf[mdmCmdBufSize]; // build all commands here + Char respBuf[mdmRespBufSize];// response buffer + UInt32 connectBaud; // baud at which connection was established + // (0 = unknown) + UInt8 curStage; // set by ModemMgr to report current MdmStageEnum + UInt8 reserved2; + } MdmInfoType; + +typedef MdmInfoType* MdmInfoPtr; + +/************************************************************ + * Modem Manager result codes + * (mdmErrorClass is defined in ErrorBase.h) + *************************************************************/ +#pragma mark -Error Codes- + +#define mdmErrNoTone (mdmErrorClass | 1) // no dial tone +#define mdmErrNoDCD (mdmErrorClass | 2) // no carrier / timeout +#define mdmErrBusy (mdmErrorClass | 3) // busy signal heard +#define mdmErrUserCan (mdmErrorClass | 4) // cancelled by user +#define mdmErrCmdError (mdmErrorClass | 5) // command error +#define mdmErrNoModem (mdmErrorClass | 6) // no modem detected +#define mdmErrMemory (mdmErrorClass | 7) // not enough memory +#define mdmErrPrefs (mdmErrorClass | 8) // modem preferences have not been + // setup - (app should take user to modem prefs panel) +#define mdmErrDial (mdmErrorClass | 9) // dial command error - most likely the dial + // string is too long for the modem's buffer or + // contains invalid characters +// New error code for empty phone number which is only invalid if +// the modem type is not a "Direct Connect" modem +#define mdmErrNoPhoneNum (mdmErrorClass | 10) // No phone number and not "Direct Connect" + + +/******************************************************************** + * Modem Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#pragma mark -API Routines- + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +Err MdmDial(MdmInfoPtr modemP, Char *okDialP, Char *userInitP, Char *phoneNumP) + SYS_TRAP(sysTrapMdmDial); + +Err MdmHangUp(MdmInfoPtr modemP) + SYS_TRAP(sysTrapMdmHangUp); + + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Modem Manager Macros + *************************************************************/ + +#endif // __MODEM_MGR_H__ + diff --git a/sdk-3.5/include/Core/System/NetBitUtils.h b/sdk-3.5/include/Core/System/NetBitUtils.h new file mode 100644 index 0000000..a8c40e6 --- /dev/null +++ b/sdk-3.5/include/Core/System/NetBitUtils.h @@ -0,0 +1,134 @@ +/****************************************************************************** + * + * Copyright (c) 1997-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: NetBitUtils.h + * + * Description: + * Header file for bit manipulation routines used primarily + * by wireless network protocols. + * + * These routines live in the NetLib but are broken out here into + * a separate header so that they can be more easily used by source + * files that don't need access to the other NetLib functions. + * + * History: + * 6/11/97 Created by Ron Marianetti + * Name Date Description + * ---- ---- ----------- + * vmk 8/25/98 Defined bitVarIntMaxBits and bitVarIntMaxBytes + * + *****************************************************************************/ + +#ifndef __NETBITUTILS_H__ +#define __NETBITUTILS_H__ + +#include +#include + +#include + +// # of bits in a byte +#define bitsInByte 8 + + +// Maximum size of variable-size ints in # of bits and bytes. This is based on +// the largest variable size int, which is encoded as follows: 1111 Bit[32] +#define bitVarIntMaxBits 36 +#define bitVarIntMaxBytes ((bitVarIntMaxBits + bitsInByte - 1) / bitsInByte) + + +//===================================================== +// BitXXX Macros +// +// The following macros are handy because they don't require that +// the source code pass in the NetLib library refnum to every +// call. +// +// When building server code or other emulation code where th +// library trap dispatcher is not used, the libRefNUm is unused +// and can be 0. +// +// When building for the viewer, the libRefNum must be the refNum +// of the NetLib. For applications, this libRefNum must be put +// into an application global named 'AppNetRefnum'. +// +//==================================================== +#if USE_TRAPS == 0 + #define netPrvRefnum 0 +#else + #define netPrvRefnum AppNetRefnum +#endif + + +#define BitMove( dstP, dstBitOffsetP, srcP, srcBitOffsetP, numBits) \ + NetLibBitMove(netPrvRefnum, dstP, dstBitOffsetP, srcP, srcBitOffsetP, numBits) + +#define BitPutFixed( dstP, dstBitOffsetP, value, numBits) \ + NetLibBitPutFixed(netPrvRefnum, dstP, dstBitOffsetP, value, numBits) + +#define BitGetFixed(srcP, srcBitOffsetP, numBits) \ + NetLibBitGetFixed(netPrvRefnum, srcP, srcBitOffsetP, numBits) + +#define BitPutUIntV(dstP, dstBitOffsetP, value) \ + NetLibBitPutUIntV(netPrvRefnum, dstP, dstBitOffsetP, value) + +#define BitGetUIntV(srcP, srcBitOffsetP) \ + NetLibBitGetUIntV(netPrvRefnum, srcP, srcBitOffsetP) + +#define BitPutIntV(dstP, dstBitOffsetP, value) \ + NetLibBitPutIntV(netPrvRefnum, dstP, dstBitOffsetP, value) + +#define BitGetIntV(srcP, srcBitOffsetP) \ + NetLibBitGetIntV(netPrvRefnum, srcP, srcBitOffsetP) + + + + +//===================================================== +// Functions +//==================================================== +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Bit Moving functions. For "slim" bit packing protocols +// used over wireless. +//-------------------------------------------------- +void NetLibBitMove(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + UInt8 *srcP, UInt32 *srcBitOffsetP, + UInt32 numBits) + SYS_TRAP(netLibTrapBitMove); + + +void NetLibBitPutFixed(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + UInt32 value, UInt16 numBits) + SYS_TRAP(netLibTrapBitPutFixed); + +UInt32 NetLibBitGetFixed(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + UInt16 numBits) + SYS_TRAP(netLibTrapBitGetFixed); + +void NetLibBitPutUIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + UInt32 value) + SYS_TRAP(netLibTrapBitPutUIntV); + +UInt32 NetLibBitGetUIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP) + SYS_TRAP(netLibTrapBitGetUIntV); + +void NetLibBitPutIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + Int32 value) + SYS_TRAP(netLibTrapBitPutUIntV); + +Int32 NetLibBitGetIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP) + SYS_TRAP(netLibTrapBitGetUIntV); + +#ifdef __cplusplus +} +#endif + + +#endif // __NETBITUTILS_H__ + diff --git a/sdk-3.5/include/Core/System/NetMgr.h b/sdk-3.5/include/Core/System/NetMgr.h new file mode 100644 index 0000000..a6808b8 --- /dev/null +++ b/sdk-3.5/include/Core/System/NetMgr.h @@ -0,0 +1,1590 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: NetMgr.h + * + * Description: + * This module contains the interface definition for the TCP/IP + * library on Pilot. + * + * History: + * 2/14/96 Created by Ron Marianetti + * Name Date Description + * ---- ---- ----------- + * jrb 3/13/98 Removed NetIFSettings that are Mobitex specific. + * Added RadioStateEnum for the setting. + * Added NetIFSettingSpecificMobitex + * Added what are considered "generic" wirless settings. + * jaq 10/1/98 added netMaxIPAddrStrLen constant + * scl 3/ 5/99 integrated Eleven's changes into Main + * + *****************************************************************************/ + +#ifndef __NETMGR_H__ +#define __NETMGR_H__ + +#include +#include +#include + +// Get rid of warnings about unused pragmas when compiling with +// Visual C +#ifdef _MSC_VER +#pragma warning( disable : 4068) +#endif + +/******************************************************************** + * Type and creator of Net Library database + ********************************************************************/ + +// Creator. Used for both the database that contains the Net Library and +// it's preferences database. +#define netCreator 'netl' // Our Net Library creator + +// Feature Creators and numbers, for use with the FtrGet() call. This +// feature can be obtained to get the current version of the Net Library +#define netFtrCreator netCreator +#define netFtrNumVersion 0 // get version of Net Library + // 0xMMmfsbbb, where MM is major version, m is minor version + // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development, + // bbb is build number for non-releases + // V1.12b3 would be: 0x01122003 + // V2.00a2 would be: 0x02001002 + // V1.01 would be: 0x01013000 + + +// Types. Used to identify the Net Library from it's prefs. +#define netLibType 'libr' // Our Net Code Resources Database type +#define netPrefsType 'rsrc' // Our Net Preferences Database type + + +// All Network interface's have the following type: +#define netIFFileType 'neti' // The filetype of all Network Interfaces + +// Each Network interface has a unique creator: +#define netIFCreatorLoop 'loop' // Loopback network interface creator. +#define netIFCreatorSLIP 'slip' // SLIP network interface creator. +#define netIFCreatorPPP 'ppp_' // PPP network interface creator. +// +#define netIFCreatorRAM 'ram_' // Mobitex network interface creator + + +// Special value for configIndex parameter to NetLibOpenConfig that tells it +// to use the current settings - even if they are not the defined default settings +// This is provided for testing purposes +#define netConfigIndexCurSettings 0xFFFF + +// Commented out netMaxNetIFs since Tim says it should NOT be here!! +// Still need to fix (Eleven) code that currently depends on it... +// Max # of interfaces that can be installed +//#define netMaxNetIFs 4 + + +//----------------------------------------------------------------------------- +// Misc. constants +//----------------------------------------------------------------------------- +#define netDrvrTypeNameLen 8 // Maximum driver type length +#define netDrvrHWNameLen 16 // Maximum driver hardware name length +#define netIFNameLen 10 // Maximum interface name (driver type + instance num) +#define netIFMaxHWAddrLen 14 // Maximum size of a hardware address +#define netMaxIPAddrStrLen 16 // Max length of an IP address string with null terminator (255.255.255.255) + + + +//----------------------------------------------------------------------------- +// Names of built-in configuration aliases available through the +// NetLibConfigXXX calls +//----------------------------------------------------------------------------- +#define netCfgNameDefault ".Default" // The default configuration +#define netCfgNameDefWireline ".DefWireline" // The default wireline configuration +#define netCfgNameDefWireless ".DefWireless" // The default wireless configuration +#define netCfgNameCTPWireline ".CTPWireline" // Wireline through the Jerry Proxy +#define netCfgNameCTPWireless ".CTPWireless" // Wireless through the Jerry Proxy + + +//----------------------------------------------------------------------------- +//Flags for the NetUWirelessAppHandleEvent() utility routine +//----------------------------------------------------------------------------- +#define netWLAppEventFlagCTPOnly 0x00000001 // using wireless radio for CTP protocol only +#define netWLAppEventFlagDisplayErrs 0x00000002 // Show error alerts for any errors + +//----------------------------------------------------------------------------- +// Option constants that can be passed to NetSocketOptionSet and NetSocketOptionGet +// When an option is set or retrieved, both the level of the option and the +// option number must be specified. The level refers to which layer the option +// refers to, like the uppermost socket layer, for example. +//----------------------------------------------------------------------------- + +// Socket level options +typedef enum { + // IP Level options + netSocketOptIPOptions = 1, // options in IP header (IP_OPTIONS) + + // TCP Level options + netSocketOptTCPNoDelay = 1, // don't delay send to coalesce packets + netSocketOptTCPMaxSeg = 2, // TCP maximum segment size (TCP_MAXSEG) + + // Socket level options + netSocketOptSockDebug = 0x0001, // turn on debugging info recording + netSocketOptSockAcceptConn = 0x0002, // socket has had listen + netSocketOptSockReuseAddr = 0x0004, // allow local address reuse + netSocketOptSockKeepAlive = 0x0008, // keep connections alive + netSocketOptSockDontRoute = 0x0010, // just use interface addresses + netSocketOptSockBroadcast = 0x0020, // permit sending of broadcast msgs + netSocketOptSockUseLoopback = 0x0040, // bypass hardware when possible + netSocketOptSockLinger = 0x0080, // linger on close if data present + netSocketOptSockOOBInLine = 0x0100, // leave received OutOfBand data in line + + netSocketOptSockSndBufSize = 0x1001, // send buffer size + netSocketOptSockRcvBufSize = 0x1002, // receive buffer size + netSocketOptSockSndLowWater = 0x1003, // send low-water mark + netSocketOptSockRcvLowWater = 0x1004, // receive low-water mark + netSocketOptSockSndTimeout = 0x1005, // send timeout + netSocketOptSockRcvTimeout = 0x1006, // receive timeout + netSocketOptSockErrorStatus= 0x1007, // get error status and clear + netSocketOptSockSocketType = 0x1008, // get socket type + + // The following are Pilot specific options + netSocketOptSockNonBlocking = 0x2000, // set non-blocking mode on or off + netSocketOptSockRequireErrClear = 0x2001, // return error from all further calls to socket + // unless netSocketOptSockErrorStatus is cleared. + netSocketOptSockMultiPktAddr = 0x2002 // for SOCK_RDM (RMP) sockets. This is the + // fixed IP addr (i.e. Mobitex MAN #) to use + // for multiple packet requests. + } NetSocketOptEnum; + + + + +// Option levels for SocketOptionSet and SocketOptionGet +typedef enum { + netSocketOptLevelIP = 0, // IP level options (IPPROTO_IP) + netSocketOptLevelTCP = 6, // TCP level options (IPPROTO_TCP) + netSocketOptLevelSocket = 0xFFFF // Socket level options (SOL_SOCKET) + } NetSocketOptLevelEnum; + + +// Structure used for manipulating the linger option +typedef struct { + Int16 onOff; // option on/off + Int16 time; // linger time in seconds + } NetSocketLingerType; + +//----------------------------------------------------------------------------- +// Enumeration of Socket domains and types passed to NetSocketOpen +//----------------------------------------------------------------------------- +typedef enum { + netSocketAddrRaw=0, // (AF_UNSPEC, AF_RAW) + netSocketAddrINET=2 // (AF_INET) + } NetSocketAddrEnum; + +typedef enum { + netSocketTypeStream=1, // (SOCK_STREAM) + netSocketTypeDatagram=2, // (SOCK_DGRAM) + netSocketTypeRaw=3, // (SOCK_RAW) + netSocketTypeReliableMsg=4, // (SOCK_RDM) + netSocketTypeLicensee=8 // Socket entry reserved for licensees. + } NetSocketTypeEnum; + +// Protocols, passed in the protocol parameter to NetLibSocketOpen +#define netSocketProtoIPICMP 1 // IPPROTO_ICMP +#define netSocketProtoIPTCP 6 // IPPROTO_TCP +#define netSocketProtoIPUDP 17 // IPPROTO_UDP +#define netSocketProtoIPRAW 255 // IPPROTO_RAW + + +//----------------------------------------------------------------------------- +// Enumeration of Socket direction, passed to NetSocketShutdown +//----------------------------------------------------------------------------- +typedef enum { + netSocketDirInput=0, + netSocketDirOutput=1, + netSocketDirBoth=2 + } NetSocketDirEnum; + + +//----------------------------------------------------------------------------- +// Basic Types +//----------------------------------------------------------------------------- +// Socket refnum +typedef Int16 NetSocketRef; + +// Type used to hold internet addresses +typedef UInt32 NetIPAddr; // a 32-bit IP address. + + + +//----------------------------------------------------------------------------- +// Structure used to hold an internet socket address. This includes the internet +// address and the port number. This structure directly maps to the BSD unix +// struct sockaddr_in. +//----------------------------------------------------------------------------- +typedef struct NetSocketAddrINType { + Int16 family; // Address family in HBO (Host UInt8 Order) + UInt16 port; // the UDP port in NBO (Network UInt8 Order) + NetIPAddr addr; // IP address in NBO (Network UInt8 Order) + } NetSocketAddrINType; + +// Constant that means "use the local machine's IP address" +#define netIPAddrLocal 0 // Can be used in NetSockAddrINType.addr + + +// Structure used to hold a generic socket address. This is a generic struct +// designed to hold any type of address including internet addresses. This +// structure directly maps to the BSD unix struct sockaddr. +typedef struct NetSocketAddrType { + Int16 family; // Address family + UInt8 data[14]; // 14 bytes of address + } NetSocketAddrType; + + +// Structure used to hold a raw socket address. When using the netSocketAddrRaw +// protocol family, the caller must bind() the socket to an interface and +// specifies the interface using this structure. IMPORTANT: NUMEROUS +// ROUTINES IN NETLIB RELY ON THE FACT THAT THIS STRUCTURE IS THE SAME +// SIZE AS A NetSocketAddrINType STRUCTURE. +typedef struct NetSocketAddrRawType { + Int16 family; // Address family in HBO (Host UInt8 Order) + UInt16 ifInstance; // the interface instance number + UInt32 ifCreator; // the interface creator + } NetSocketAddrRawType; + + + +//----------------------------------------------------------------------------- +// Structure used to hold information about data to be sent. This structure +// is passed to NetLibSendMsg and contains the optional address to send to, +// a scatter-write array of data to be sent, and optional access rights +//----------------------------------------------------------------------------- + +// Scatter/Gather array type. A pointer to an array of these structs is +// passed to the NetLibSendPB and NetLibRecvPB calls. It specifies where +// data should go to or come from as a list of buffer addresses and sizes. +typedef struct NetIOVecType { + UInt8 * bufP; // buffer address + UInt16 bufLen; // buffer length + } NetIOVecType, *NetIOVecPtr; + +#define netIOVecMaxLen 16 // max# of NetIOVecTypes in an array + +// Read/Write ParamBlock type. Passed directly to the SendPB and RecvPB calls. +typedef struct { + UInt8 * addrP; // address - or 0 for default + UInt16 addrLen; // length of address + NetIOVecPtr iov; // scatter/gather array + UInt16 iovLen; // length of above array + UInt8 * accessRights; // access rights + UInt16 accessRightsLen; // length of accessrights + } NetIOParamType, *NetIOParamPtr; + +// Flags values for the NetLibSend, NetLibReceive calls +#define netIOFlagOutOfBand 0x01 // process out-of-band data +#define netIOFlagPeek 0x02 // peek at incoming message +#define netIOFlagDontRoute 0x04 // send without using routing + + + +//----------------------------------------------------------------------------- +// Structures used for looking up a host by name or address (NetLibGetHostByName) +//----------------------------------------------------------------------------- + +// Equates for DNS names, from RFC-1035 +#define netDNSMaxDomainName 255 +#define netDNSMaxDomainLabel 63 + +#define netDNSMaxAliases 1 // max # of aliases for a host +#define netDNSMaxAddresses 4 // max # of addresses for a host + + +// The actual results of NetLibGetHostByName() are returned in this structure. +// This structure is designed to match the "struct hostent" structure in Unix. +typedef struct { + Char * nameP; // official name of host + Char ** nameAliasesP; // array of alias's for the name + UInt16 addrType; // address type of return addresses + UInt16 addrLen; // the length, in bytes, of the addresses + UInt8 ** addrListP; // array of ptrs to addresses in HBO + } NetHostInfoType, *NetHostInfoPtr; + + +// "Buffer" passed to call as a place to store the results +typedef struct { + NetHostInfoType hostInfo; // high level results of call are here + + // The following fields contain the variable length data that + // hostInfo points to + Char name[netDNSMaxDomainName+1]; // hostInfo->name + + Char *aliasList[netDNSMaxAliases+1]; // +1 for 0 termination. + Char aliases[netDNSMaxAliases][netDNSMaxDomainName+1]; + + NetIPAddr* addressList[netDNSMaxAddresses]; + NetIPAddr address[netDNSMaxAddresses]; + + } NetHostInfoBufType, *NetHostInfoBufPtr; + + +//----------------------------------------------------------------------------- +// Structures used for looking up a service (NetLibGetServByName) +//----------------------------------------------------------------------------- + +// Equates for service names +#define netServMaxName 15 // max # characters in service name +#define netProtoMaxName 15 // max # characters in protocol name +#define netServMaxAliases 1 // max # of aliases for a service + + +// The actual results of NetLibGetServByName() are returned in this structure. +// This structure is designed to match the "struct servent" structure in Unix. +typedef struct { + Char * nameP; // official name of service + Char ** nameAliasesP; // array of alias's for the name + UInt16 port; // port number for this service + Char * protoP; // name of protocol to use + } NetServInfoType, *NetServInfoPtr; + +// "Buffer" passed to call as a place to store the results +typedef struct { + NetServInfoType servInfo; // high level results of call are here + + // The following fields contain the variable length data that + // servInfo points to + Char name[netServMaxName+1]; // hostInfo->name + + Char * aliasList[netServMaxAliases+1]; // +1 for 0 termination. + Char aliases[netServMaxAliases][netServMaxName]; + Char protoName[netProtoMaxName+1]; + + UInt8 reserved; + } NetServInfoBufType, *NetServInfoBufPtr; + + + +//-------------------------------------------------------------------- +// Structure of a configuration name. Used by NetLibConfigXXX calls +// added for the new Config calls. +//--------------------------------------------------------------------- +#define netConfigNameSize 32 +typedef struct { + Char name[netConfigNameSize]; // name of configuration + } NetConfigNameType, *NetConfigNamePtr; + + + +/******************************************************************** + * Tracing Flags. These flags are ORed together and passed as a UInt32 + * in the netSettingTraceFlags setting and netIFSettingTraceFlags to + * enable/disable various trace options. + ********************************************************************/ +#define netTracingErrors 0x00000001 // record errors +#define netTracingMsgs 0x00000002 // record messages +#define netTracingPktIP 0x00000004 // record packets sent/received + // to/from interfaces at the IP layer + // NOTE: netTracingPktData40 & netTracingPktData + // will control how much data of each packet is + // recorded. +#define netTracingFuncs 0x00000008 // record function flow +#define netTracingAppMsgs 0x00000010 // record application messages + // (NetLibTracePrintF, NetLibTracePutS) +#define netTracingPktData40 0x00000020 // record first 40 bytes of packets + // when netTracingPktsXX is also on. + // NOTE: Mutually exclusive with + // netTracingPktData and only applicable if + // one of the netTracingPktsXX bits is also set +#define netTracingPktData 0x00000040 // record all bytes of IP packets + // sent/received to/from interfaces + // NOTE: Mutually exclusive with + // netTracingPkts & netTracingPktData64 +#define netTracingPktIFHi 0x00000080 // record packets sent/received at highest layer + // of interface (just below IP layer). + // NOTE: netTracingPktData40 & netTracingPktData + // will control how much data of each packet is + // recorded. +#define netTracingPktIFMid 0x00000100 // record packets sent/received at mid layer + // of interface (just below IFHi layer). + // NOTE: netTracingPktData40 & netTracingPktData + // will control how much data of each packet is + // recorded. +#define netTracingPktIFLow 0x00000200 // record packets sent/received at low layer + // of interface (just below IFMid layer). + // NOTE: netTracingPktData40 & netTracingPktData + // will control how much data of each packet is + // recorded. + + +// OBSOLETE tracing bit, still used by Network Panel +#define netTracingPkts netTracingPktIP + + +/******************************************************************** + * Command numbers and parameter blocks for the NetLibMaster() call. + * This call is used to put the Net library into certain debugging modes + * or for obtaining statistics from the Net Library. + * + ********************************************************************/ +#pragma mark Master +typedef enum { + // These calls return info + netMasterInterfaceInfo, + netMasterInterfaceStats, + netMasterIPStats, + netMasterICMPStats, + netMasterUDPStats, + netMasterTCPStats, + + // This call used to read the trace buffer. + netMasterTraceEventGet // get trace event by index + + } NetMasterEnum; + + +typedef struct NetMasterPBType { + + // These fields are specific to each command + union { + + //............................................................. + // InterfaceInfo command + //............................................................. + struct { + UInt16 index; // -> index of interface + UInt32 creator; // <- creator + UInt16 instance; // <- instance + void * netIFP; // <- net_if pointer + + // driver level info + Char drvrName[netDrvrTypeNameLen]; // <- type of driver (SLIP,PPP, etc) + Char hwName[netDrvrHWNameLen]; // <- hardware name (Serial Library, etc) + UInt8 localNetHdrLen; // <- local net header length + UInt8 localNetTrailerLen; // <- local net trailer length + UInt16 localNetMaxFrame; // <- local net maximum frame size + + // media layer info + Char ifName[netIFNameLen];// <- interface name w/instance + Boolean driverUp; // <- true if interface driver up + Boolean ifUp; // <- true if interface is up + UInt16 hwAddrLen; // <- length of hardware address + UInt8 hwAddr[netIFMaxHWAddrLen]; // <- hardware address + UInt16 mtu; // <- maximum transfer unit of interface + UInt32 speed; // <- speed in bits/sec. + UInt32 lastStateChange; // <- time in milliseconds of last state change + + // Address info + NetIPAddr ipAddr; // Address of this interface + NetIPAddr subnetMask; // subnet mask of local network + NetIPAddr broadcast; // broadcast address of local network + } interfaceInfo; + + //............................................................. + // InterfaceStats command + //............................................................. + struct { + UInt16 index; // -> index of interface + UInt32 inOctets; // <- .... + UInt32 inUcastPkts; + UInt32 inNUcastPkts; + UInt32 inDiscards; + UInt32 inErrors; + UInt32 inUnknownProtos; + UInt32 outOctets; + UInt32 outUcastPkts; + UInt32 outNUcastPkts; + UInt32 outDiscards; + UInt32 outErrors; + } interfaceStats; + + //............................................................. + // IPStats command + //............................................................. + struct { + UInt32 ipInReceives; + UInt32 ipInHdrErrors; + UInt32 ipInAddrErrors; + UInt32 ipForwDatagrams; + UInt32 ipInUnknownProtos; + UInt32 ipInDiscards; + UInt32 ipInDelivers; + UInt32 ipOutRequests; + UInt32 ipOutDiscards; + UInt32 ipOutNoRoutes; + UInt32 ipReasmReqds; + UInt32 ipReasmOKs; + UInt32 ipReasmFails; + UInt32 ipFragOKs; + UInt32 ipFragFails; + UInt32 ipFragCreates; + UInt32 ipRoutingDiscards; + UInt32 ipDefaultTTL; + UInt32 ipReasmTimeout; + } ipStats; + + //............................................................. + // ICMPStats command + //............................................................. + struct { + UInt32 icmpInMsgs; + UInt32 icmpInErrors; + UInt32 icmpInDestUnreachs; + UInt32 icmpInTimeExcds; + UInt32 icmpInParmProbs; + UInt32 icmpInSrcQuenchs; + UInt32 icmpInRedirects; + UInt32 icmpInEchos; + UInt32 icmpInEchoReps; + UInt32 icmpInTimestamps; + UInt32 icmpInTimestampReps; + UInt32 icmpInAddrMasks; + UInt32 icmpInAddrMaskReps; + UInt32 icmpOutMsgs; + UInt32 icmpOutErrors; + UInt32 icmpOutDestUnreachs; + UInt32 icmpOutTimeExcds; + UInt32 icmpOutParmProbs; + UInt32 icmpOutSrcQuenchs; + UInt32 icmpOutRedirects; + UInt32 icmpOutEchos; + UInt32 icmpOutEchoReps; + UInt32 icmpOutTimestamps; + UInt32 icmpOutTimestampReps; + UInt32 icmpOutAddrMasks; + UInt32 icmpOutAddrMaskReps; + } icmpStats; + + //............................................................. + // UDPStats command + //............................................................. + struct { + UInt32 udpInDatagrams; + UInt32 udpNoPorts; + UInt32 udpInErrors; + UInt32 udpOutDatagrams; + } udpStats; + + //............................................................. + // TCPStats command + //............................................................. + struct { + UInt32 tcpRtoAlgorithm; + UInt32 tcpRtoMin; + UInt32 tcpRtoMax; + UInt32 tcpMaxConn; + UInt32 tcpActiveOpens; + UInt32 tcpPassiveOpens; + UInt32 tcpAttemptFails; + UInt32 tcpEstabResets; + UInt32 tcpCurrEstab; + UInt32 tcpInSegs; + UInt32 tcpOutSegs; + UInt32 tcpRetransSegs; + UInt32 tcpInErrs; + UInt32 tcpOutRsts; + } tcpStats; + + //............................................................. + // TraceEventGet command + //............................................................. + struct { + UInt16 index; // which event + Char * textP; // ptr to text string to return it in + } traceEventGet; + + } param; + + } NetMasterPBType, *NetMasterPBPtr; + + + + + +//----------------------------------------------------------------------------- +// Enumeration of Net settings as passed to NetLibSettingGet/Set. +//----------------------------------------------------------------------------- +#pragma mark Settings +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Global environment settings common to all attached network interfaces, +// passed to NetLibSettingGet/Set +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +typedef enum { + netSettingResetAll, // void, NetLibSettingSet only, resets all settings + // to their defaults. + + netSettingPrimaryDNS, // UInt32, IP address of Primary DN Server + netSettingSecondaryDNS, // UInt32, IP address of Secondary DN Server + netSettingDefaultRouter, // UInt32, IP address of Default router + netSettingDefaultIFCreator, // UInt32, Creator type of default interface + netSettingDefaultIFInstance, // UInt16, Instance# of default interface + netSettingHostName, // Char[64], name of host (not including domain) + netSettingDomainName, // Char[256], domain name of hosts's domain + netSettingHostTbl, // Char[], host table + netSettingCloseWaitTime, // UInt32, time in milliseconds to stay in close-wait state + netSettingInitialTCPResendTime, // UInt32, time in milliseconds before TCP resends a packet. + // This is just the initial value, the timeout is adjusted + // from this initial value depending on history of ACK times. + // This is sometimes referred to as the RTO (Roundtrip Time Out) + // See RFC-1122 for additional information. + + + // The following settings are not used for configuration, but rather put the + // stack into various modes for debugging, etc. + netSettingTraceBits = 0x1000, // UInt32, enable/disable various trace flags (netTraceBitXXXX) + netSettingTraceSize, // UInt32, max trace buffer size in bytes. Default 0x800. + // Setting this will also clear the trace buffer. + netSettingTraceStart, // UInt32, for internal use ONLY!! + netSettingTraceRoll, // UInt8, if true, trace buffer will rollover after it fills. + // Default is true. + + netSettingRTPrimaryDNS, // used internally by Network interfaces + // that dynamically obtain the DNS address + netSettingRTSecondaryDNS, // used internally by Network interfaces + // that dynamically obtain the DNS address + + netSettingConfigTable // used internally by NetLib - NOT FOR USE BY + // APPLICATIONS!! + + } NetSettingEnum; + + +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Settings for each Network Interface, passed to NetLibIFSettingGet/Set +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +typedef enum { + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Reset all settings to defaults + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingResetAll, // void, NetLibIFSettingSet only, resets all settings + // to their defaults. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Status - read only + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingUp, // UInt8, true if interface is UP. + netIFSettingName, // Char[32], name of interface + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Addressing + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingReqIPAddr, // UInt32, requested IP address of this interface + netIFSettingSubnetMask, // UInt32, subnet mask of this interface + netIFSettingBroadcast, // UInt32, broadcast address for this interface + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // User Info + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingUsername, // Char[], login script user name + // If 0 length, then user will be prompted for it + netIFSettingPassword, // Char[], login script user password + // If 0 length, then user will be prompted for it + netIFSettingDialbackUsername, // Char[], login script dialback user name. + // If 0 length, then netIFSettingUsername is used + netIFSettingDialbackPassword, // Char[], login script dialback user password. + // If 0 length, then user will be prompted for it + netIFSettingAuthUsername, // Char[], PAP/CHAP name. + // If 0 length, then netIFSettingUsername is used + netIFSettingAuthPassword, // Char[], PAP/CHAP password. + // If "$", then user will be prompted for it + // else If 0 length, then netIFSettingPassword or result + // of it's prompt (if it was empty) will be used + // else it is used as-is. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Connect Settings + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingServiceName, // Char[], name of service + netIFSettingLoginScript, // Char[], login script + netIFSettingConnectLog, // Char[], connect log + netIFSettingInactivityTimeout, // UInt16, # of seconds of inactivity allowed before + // interface is brought down. If 0 then + // no inactivity timeout enforced. + netIFSettingEstablishmentTimeout, // UInt16, max delay in seconds between connection + // establishment stages + + // Serial based protocol options + netIFSettingDynamicIP, // UInt8, if true, get IP address from server + // N/A for SLIP + netIFSettingVJCompEnable, // UInt8, if true enable VJ Header compression + // Default is on for PPP, off for SLIP + netIFSettingVJCompSlots, // UInt8, # of slots to use for VJ compression. + // Default is 4 for PPP, 16 for SLIP + // (each slot uses 256 bytes of RAM). + netIFSettingMTU, // UInt16, maximum transmission unit in bytes + // ignored in current PPP and SLIP interfaces + netIFSettingAsyncCtlMap, // UInt32, bitmask of characters to escape + // ignored in current PPP interfaces + + // Serial settings, used by serial based network interfaces + netIFSettingPortNum, // UInt16, port number to use + netIFSettingBaudRate, // UInt32, baud rate in bits/sec. + netIFSettingFlowControl, // UInt8, flow control setting bits. Set to 0x01 for + // hardware flow control, else set to 0x00. + netIFSettingStopBits, // UInt8, # of stop bits + netIFSettingParityOn, // UInt8, true if parity on + netIFSettingParityEven, // UInt8, true if parity even + + // Modem settings, optionally used by serial based network interfaces + netIFSettingUseModem, // UInt8, if true dial-up through modem + netIFSettingPulseDial, // UInt8, if true use pulse dial, else tone + netIFSettingModemInit, // Char[], modem initialization string + netIFSettingModemPhone, // Char[], modem phone number string + netIFSettingRedialCount, // UInt16, # of times to redial + + + //--------------------------------------------------------------------------------- + // New Settings as of PalmOS 3.0 + // Power control, usually only implemented by wireless interfaces + //--------------------------------------------------------------------------------- + netIFSettingPowerUp, // UInt8, true if this interface is powered up + // false if this interface is in power-down mode + // interfaces that don't support power modes should + // quietly ignore this setting. + + // Wireless or Wireline, read-only, returns true for wireless interfaces. this + // setting is used by application level functions to determine which interface(s) + // to attach/detach given user preference and/or state of the antenna. + netIFSettingWireless, // UInt8, true if this interface is wireless + + + + // Option to query server for address of DNS servers + netIFSettingDNSQuery, // UInt8, if true PPP queries for DNS address. Default true + + + //--------------------------------------------------------------------------------- + // New Settings as of PalmOS 3.2 + // Power control, usually only implemented by wireless interfaces + //--------------------------------------------------------------------------------- + + netIFSettingQuitOnTxFail, // BYTE W-only. Power down RF on tx fail + netIFSettingQueueSize, // UInt8 R-only. The size of the Tx queue in the RF interface + netIFSettingTxInQueue, // BYTE R-only. Packets remaining to be sent + netIFSettingTxSent, // BYTE R-only. Packets sent since SocketOpen + netIFSettingTxDiscard, // BYTE R-only. Packets discarded on SocketClose + netIFSettingRssi, // char R-only. signed value in dBm. + netIFSettingRssiAsPercent, // char R-only. signed value in percent, with 0 being no coverage and 100 being excellent. + netIFSettingRadioState, // enum R-only. current state of the radio + netIFSettingBase, // UInt32 R-only. Interface specific + netIFSettingRadioID, // UInt32[2] R-only, two 32-bit. interface specific + netIFSettingBattery, // UInt8, R-only. percentage of battery left + netIFSettingNetworkLoad, // UInt8, R-only. percent estimate of network loading + + //--------------------------------------------------------------------------------- + // New Settings as of PalmOS 3.3 + //--------------------------------------------------------------------------------- + + netIFSettingConnectionName, // Char [] Connection Profile Name + + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // The following settings are not used for configuration, but rather put the + // stack into various modes for debugging, etc. + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingTraceBits = 0x1000, // UInt32, enable/disable various trace flags (netTraceBitXXXX) + netIFSettingGlobalsPtr, // UInt32, (Read-Only) sinterface's globals ptr + netIFSettingActualIPAddr, // UInt32, (Read-Only) the actual IP address that the interface + // ends up using. The login script executor stores + // the result of the "g" script command here as does + // the PPP negotiations. + netIFSettingServerIPAddr, // UInt32, (Read-Only) the IP address of the PPP server + // we're connected to + + + // The following setting should be true if this network interface should be + // brought down when the Pilot is turned off. + netIFSettingBringDownOnPowerDown, // UInt8, if true interface will be brought down when + // Pilot is turned off. + + // The following setting is used by the TCP/IP stack ONLY!! It tells the interface + // to pass all received packets as-is to the NetIFCallbacksPtr->raw_rcv() routine. + // This setting gets setup when an application creates a raw socket in the raw domain + netIFSettingRawMode, // UInt32, parameter to pass to raw_rcv() along with + // packet pointer. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // 3rd party settings start here... + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingCustom = 0x8000 + + } NetIFSettingEnum; + + + +//========================================================================================= +// Enums for the netIFSettingRadioState setting +// +// JB added for the radio state setting. +// fixed naming conventions. +//========================================================================================= +typedef enum { + netRadioStateOffNotConnected=0, + netRadioStateOnNotConnected, // scanning + netRadioStateOnConnected, // have channel + netRadioStateOffConnected + } NetRadioStateEnum; + + + +/************************************************************ + * Net Library Macros + *************************************************************/ +// Return current time in milliseconds. +#define NetNow() (TimGetTicks() * 1000L/sysTicksPerSecond) + + +// File Descriptor macros used for the NetLibSelect() call +typedef UInt32 NetFDSetType; +#define netFDSetSize 32 + +#define netFDSet(n,p) ((*p) |= (1L << n)) +#define netFDClr(n,p) ((*p) &= ~(1L << n)) +#define netFDIsSet(n,p) ((*p) & (1L << n)) +#define netFDZero(p) ((*p) = 0) + + + +//----------------------------------------------------------------------------- +// Net error codes +//----------------------------------------------------------------------------- +#pragma mark ErrorCodes +#define netErrAlreadyOpen (netErrorClass | 1) +#define netErrNotOpen (netErrorClass | 2) +#define netErrStillOpen (netErrorClass | 3) +#define netErrParamErr (netErrorClass | 4) +#define netErrNoMoreSockets (netErrorClass | 5) +#define netErrOutOfResources (netErrorClass | 6) +#define netErrOutOfMemory (netErrorClass | 7) +#define netErrSocketNotOpen (netErrorClass | 8) +#define netErrSocketBusy (netErrorClass | 9) //EINPROGRESS +#define netErrMessageTooBig (netErrorClass | 10) +#define netErrSocketNotConnected (netErrorClass | 11) +#define netErrNoInterfaces (netErrorClass | 12) //ENETUNREACH +#define netErrBufTooSmall (netErrorClass | 13) +#define netErrUnimplemented (netErrorClass | 14) +#define netErrPortInUse (netErrorClass | 15) //EADDRINUSE +#define netErrQuietTimeNotElapsed (netErrorClass | 16) //EADDRINUSE +#define netErrInternal (netErrorClass | 17) +#define netErrTimeout (netErrorClass | 18) //ETIMEDOUT +#define netErrSocketAlreadyConnected (netErrorClass | 19) //EISCONN +#define netErrSocketClosedByRemote (netErrorClass | 20) +#define netErrOutOfCmdBlocks (netErrorClass | 21) +#define netErrWrongSocketType (netErrorClass | 22) +#define netErrSocketNotListening (netErrorClass | 23) +#define netErrUnknownSetting (netErrorClass | 24) +#define netErrInvalidSettingSize (netErrorClass | 25) +#define netErrPrefNotFound (netErrorClass | 26) +#define netErrInvalidInterface (netErrorClass | 27) +#define netErrInterfaceNotFound (netErrorClass | 28) +#define netErrTooManyInterfaces (netErrorClass | 29) +#define netErrBufWrongSize (netErrorClass | 30) +#define netErrUserCancel (netErrorClass | 31) +#define netErrBadScript (netErrorClass | 32) +#define netErrNoSocket (netErrorClass | 33) +#define netErrSocketRcvBufFull (netErrorClass | 34) +#define netErrNoPendingConnect (netErrorClass | 35) +#define netErrUnexpectedCmd (netErrorClass | 36) +#define netErrNoTCB (netErrorClass | 37) +#define netErrNilRemoteWindowSize (netErrorClass | 38) +#define netErrNoTimerProc (netErrorClass | 39) +#define netErrSocketInputShutdown (netErrorClass | 40) // EOF to sockets API +#define netErrCmdBlockNotCheckedOut (netErrorClass | 41) +#define netErrCmdNotDone (netErrorClass | 42) +#define netErrUnknownProtocol (netErrorClass | 43) +#define netErrUnknownService (netErrorClass | 44) +#define netErrUnreachableDest (netErrorClass | 45) +#define netErrReadOnlySetting (netErrorClass | 46) +#define netErrWouldBlock (netErrorClass | 47) //EWOULDBLOCK +#define netErrAlreadyInProgress (netErrorClass | 48) //EALREADY +#define netErrPPPTimeout (netErrorClass | 49) +#define netErrPPPBroughtDown (netErrorClass | 50) +#define netErrAuthFailure (netErrorClass | 51) +#define netErrPPPAddressRefused (netErrorClass | 52) +// The following map into the Epilogue DNS errors declared in DNS.ep.h: +// and MUST be kept in this order!! +#define netErrDNSNameTooLong (netErrorClass | 53) +#define netErrDNSBadName (netErrorClass | 54) +#define netErrDNSBadArgs (netErrorClass | 55) +#define netErrDNSLabelTooLong (netErrorClass | 56) +#define netErrDNSAllocationFailure (netErrorClass | 57) +#define netErrDNSTimeout (netErrorClass | 58) +#define netErrDNSUnreachable (netErrorClass | 59) +#define netErrDNSFormat (netErrorClass | 60) +#define netErrDNSServerFailure (netErrorClass | 61) +#define netErrDNSNonexistantName (netErrorClass | 62) +#define netErrDNSNIY (netErrorClass | 63) +#define netErrDNSRefused (netErrorClass | 64) +#define netErrDNSImpossible (netErrorClass | 65) +#define netErrDNSNoRRS (netErrorClass | 66) +#define netErrDNSAborted (netErrorClass | 67) +#define netErrDNSBadProtocol (netErrorClass | 68) +#define netErrDNSTruncated (netErrorClass | 69) +#define netErrDNSNoRecursion (netErrorClass | 70) +#define netErrDNSIrrelevant (netErrorClass | 71) +#define netErrDNSNotInLocalCache (netErrorClass | 72) +#define netErrDNSNoPort (netErrorClass | 73) +// The following map into the Epilogue IP errors declared in IP.ep.h: +// and MUST be kept in this order!! +#define netErrIPCantFragment (netErrorClass | 74) +#define netErrIPNoRoute (netErrorClass | 75) +#define netErrIPNoSrc (netErrorClass | 76) +#define netErrIPNoDst (netErrorClass | 77) +#define netErrIPktOverflow (netErrorClass | 78) +// End of Epilogue IP errors +#define netErrTooManyTCPConnections (netErrorClass | 79) +#define netErrNoDNSServers (netErrorClass | 80) +#define netErrInterfaceDown (netErrorClass | 81) + +// Mobitex network radio interface error code returns +#define netErrNoChannel (netErrorClass | 82) // The datalink layer cannot acquire a channel +#define netErrDieState (netErrorClass | 83) // Mobitex network has issued a DIE command. +#define netErrReturnedInMail (netErrorClass | 84) // The addressed of the transmitted packet was not available, and the message was placed in the network's mailbox. +#define netErrReturnedNoTransfer (netErrorClass | 85) // This message cannot be transferred or put in the network mailbox. +#define netErrReturnedIllegal (netErrorClass | 86) // The message could not be switched to the network +#define netErrReturnedCongest (netErrorClass | 87) // Line, radio channels, or network nodes are congested. +#define netErrReturnedError (netErrorClass | 88) // Technical error in the network. +#define netErrReturnedBusy (netErrorClass | 89) // The B-party is busy. +#define netErrGMANState (netErrorClass | 90) // The modem has not registered with the network. +#define netErrQuitOnTxFail (netErrorClass | 91) // Couldn't get packet through, shutdown. +#define netErrFlexListFull (netErrorClass | 92) // raw IF error message: see Mobitex spec. +#define netErrSenderMAN (netErrorClass | 93) // ditto +#define netErrIllegalType (netErrorClass | 94) // ditto +#define netErrIllegalState (netErrorClass | 95) // ditto +#define netErrIllegalFlags (netErrorClass | 96) // ditto +#define netErrIllegalSendlist (netErrorClass | 97) // ditto +#define netErrIllegalMPAKLength (netErrorClass | 98) // ditto +#define netErrIllegalAddressee (netErrorClass | 99) // ditto +#define netErrIllegalPacketClass (netErrorClass | 100) // ditto +#define netErrBufferLength (netErrorClass | 101) // any +#define netErrNiCdLowBattery (netErrorClass | 102) // any +#define netErrRFinterfaceFatal (netErrorClass | 103) // any +#define netErrIllegalLogout (netErrorClass | 104) // raw IF error message +#define netErrAAARadioLoad (netErrorClass | 105) // 7/20/98 JB. If there is insufficient AAA +#define netErrAntennaDown (netErrorClass | 106) +#define netErrNiCdCharging (netErrorClass | 107) // just for charging +#define netErrAntennaWentDown (netErrorClass | 108) +#define netErrNotActivated (netErrorClass | 109) // The unit has not been FULLY activated. George and Morty completed. +#define netErrRadioTemp (netErrorClass | 110) // Radio's temp is too high for FCC compliant TX +#define netErrNiCdChargeError (netErrorClass | 111) // Charging stopped due to NiCd charging characteristic +#define netErrNiCdSag (netErrorClass | 112) // the computed sag or actual sag indicates a NiCd with diminished capacity. +#define netErrNiCdChargeSuspend (netErrorClass | 113) // Charging has been suspended due to low AAA batteries. +// Left room for more Mobitex errors + +// Configuration errors +#define netErrConfigNotFound (netErrorClass | 115) +#define netErrConfigCantDelete (netErrorClass | 116) +#define netErrConfigTooMany (netErrorClass | 117) +#define netErrConfigBadName (netErrorClass | 118) +#define netErrConfigNotAlias (netErrorClass | 119) +#define netErrConfigCantPointToAlias (netErrorClass | 120) +#define netErrConfigEmpty (netErrorClass | 121) +#define netErrAlreadyOpenWithOtherConfig (netErrorClass | 122) +#define netErrConfigAliasErr (netErrorClass | 123) +#define netErrNoMultiPktAddr (netErrorClass | 124) +#define netErrOutOfPackets (netErrorClass | 125) +#define netErrMultiPktAddrReset (netErrorClass | 126) +#define netErrStaleMultiPktAddr (netErrorClass | 127) + +// Login scripting plugin errors +#define netErrScptPluginMissing (netErrorClass | 128) +#define netErrScptPluginLaunchFail (netErrorClass | 129) +#define netErrScptPluginCmdFail (netErrorClass | 130) +#define netErrScptPluginInvalidCmd (netErrorClass | 131) + +#define netErrMobitexStart netErrNoChannel +#define netErrMobitexEnd netErrNiCdChargeSuspend + +//----------------------------------------------------------------------------- +// Net library call ID's. Each library call gets the trap number: +// netTrapXXXX which serves as an index into the library's dispatch table. +// The constant sysLibTrapCustom is the first available trap number after +// the system predefined library traps Open,Close,Sleep & Wake. +// +// WARNING!!! This order of these traps MUST match the order of the dispatch +// table in NetDispatch.c!!! +//----------------------------------------------------------------------------- + +#ifdef __GNUC__ + +#define netLibTrapAddrINToA (sysLibTrapCustom) +#define netLibTrapAddrAToIN (sysLibTrapCustom+1) + +#define netLibTrapSocketOpen (sysLibTrapCustom+2) +#define netLibTrapSocketClose (sysLibTrapCustom+3) +#define netLibTrapSocketOptionSet (sysLibTrapCustom+4) +#define netLibTrapSocketOptionGet (sysLibTrapCustom+5) +#define netLibTrapSocketBind (sysLibTrapCustom+6) +#define netLibTrapSocketConnect (sysLibTrapCustom+7) +#define netLibTrapSocketListen (sysLibTrapCustom+8) +#define netLibTrapSocketAccept (sysLibTrapCustom+9) +#define netLibTrapSocketShutdown (sysLibTrapCustom+10) + +#define netLibTrapSendPB (sysLibTrapCustom+11) +#define netLibTrapSend (sysLibTrapCustom+12) +#define netLibTrapReceivePB (sysLibTrapCustom+13) +#define netLibTrapReceive (sysLibTrapCustom+14) +#define netLibTrapDmReceive (sysLibTrapCustom+15) +#define netLibTrapSelect (sysLibTrapCustom+16) + +#define netLibTrapPrefsGet (sysLibTrapCustom+17) +#define netLibTrapPrefsSet (sysLibTrapCustom+18) + + // The following traps are for internal and Network interface + // use only. +#define netLibTrapDrvrWake (sysLibTrapCustom+19) +#define netLibTrapInterfacePtr (sysLibTrapCustom+20) +#define netLibTrapMaster (sysLibTrapCustom+21) + + // New Traps +#define netLibTrapGetHostByName (sysLibTrapCustom+22) +#define netLibTrapSettingGet (sysLibTrapCustom+23) +#define netLibTrapSettingSet (sysLibTrapCustom+24) +#define netLibTrapIFAttach (sysLibTrapCustom+25) +#define netLibTrapIFDetach (sysLibTrapCustom+26) +#define netLibTrapIFGet (sysLibTrapCustom+27) +#define netLibTrapIFSettingGet (sysLibTrapCustom+28) +#define netLibTrapIFSettingSet (sysLibTrapCustom+29) +#define netLibTrapIFUp (sysLibTrapCustom+30) +#define netLibTrapIFDown (sysLibTrapCustom+31) +#define netLibTrapIFMediaUp (sysLibTrapCustom+32) +#define netLibTrapScriptExecuteV32 (sysLibTrapCustom+33) +#define netLibTrapGetHostByAddr (sysLibTrapCustom+34) +#define netLibTrapGetServByName (sysLibTrapCustom+35) +#define netLibTrapSocketAddr (sysLibTrapCustom+36) +#define netLibTrapFinishCloseWait (sysLibTrapCustom+37) +#define netLibTrapGetMailExchangeByName (sysLibTrapCustom+38) +#define netLibTrapPrefsAppend (sysLibTrapCustom+39) +#define netLibTrapIFMediaDown (sysLibTrapCustom+40) +#define netLibTrapOpenCount (sysLibTrapCustom+41) + +#define netLibTrapTracePrintF (sysLibTrapCustom+42) +#define netLibTrapTracePutS (sysLibTrapCustom+43) + +#define netLibTrapOpenIfCloseWait (sysLibTrapCustom+44) +#define netLibTrapHandlePowerOff (sysLibTrapCustom+45) + +#define netLibTrapConnectionRefresh (sysLibTrapCustom+46) + + // Traps added after 1.0 release of NetLib +#define netLibTrapBitMove (sysLibTrapCustom+47) +#define netLibTrapBitPutFixed (sysLibTrapCustom+48) +#define netLibTrapBitGetFixed (sysLibTrapCustom+49) +#define netLibTrapBitPutUIntV (sysLibTrapCustom+50) +#define netLibTrapBitGetUIntV (sysLibTrapCustom+51) +#define netLibTrapBitPutIntV (sysLibTrapCustom+52) +#define netLibTrapBitGetIntV (sysLibTrapCustom+53) + + // Traps added after 2.0 release of NetLib +#define netLibOpenConfig (sysLibTrapCustom+54) +#define netLibConfigMakeActive (sysLibTrapCustom+55) +#define netLibConfigList (sysLibTrapCustom+56) +#define netLibConfigIndexFromName (sysLibTrapCustom+57) +#define netLibConfigDelete (sysLibTrapCustom+58) +#define netLibConfigSaveAs (sysLibTrapCustom+59) +#define netLibConfigRename (sysLibTrapCustom+60) +#define netLibConfigAliasSet (sysLibTrapCustom+61) +#define netLibConfigAliasGet (sysLibTrapCustom+62) + + // Traps added after 3.2 release of NetLib +#define netLibTrapScriptExecute (sysLibTrapCustom+63) + +#define netLibTrapLast (sysLibTrapCustom+64) + +#else + +#pragma mark Traps +typedef enum { + netLibTrapAddrINToA = sysLibTrapCustom, + netLibTrapAddrAToIN, + + netLibTrapSocketOpen, + netLibTrapSocketClose, + netLibTrapSocketOptionSet, + netLibTrapSocketOptionGet, + netLibTrapSocketBind, + netLibTrapSocketConnect, + netLibTrapSocketListen, + netLibTrapSocketAccept, + netLibTrapSocketShutdown, + + netLibTrapSendPB, + netLibTrapSend, + netLibTrapReceivePB, + netLibTrapReceive, + netLibTrapDmReceive, + netLibTrapSelect, + + netLibTrapPrefsGet, + netLibTrapPrefsSet, + + // The following traps are for internal and Network interface + // use only. + netLibTrapDrvrWake, + netLibTrapInterfacePtr, + netLibTrapMaster, + + // New Traps + netLibTrapGetHostByName, + netLibTrapSettingGet, + netLibTrapSettingSet, + netLibTrapIFAttach, + netLibTrapIFDetach, + netLibTrapIFGet, + netLibTrapIFSettingGet, + netLibTrapIFSettingSet, + netLibTrapIFUp, + netLibTrapIFDown, + netLibTrapIFMediaUp, + netLibTrapScriptExecuteV32, + netLibTrapGetHostByAddr, + netLibTrapGetServByName, + netLibTrapSocketAddr, + netLibTrapFinishCloseWait, + netLibTrapGetMailExchangeByName, + netLibTrapPrefsAppend, + netLibTrapIFMediaDown, + netLibTrapOpenCount, + + netLibTrapTracePrintF, + netLibTrapTracePutS, + + netLibTrapOpenIfCloseWait, + netLibTrapHandlePowerOff, + + netLibTrapConnectionRefresh, + + // Traps added after 1.0 release of NetLib + netLibTrapBitMove, + netLibTrapBitPutFixed, + netLibTrapBitGetFixed, + netLibTrapBitPutUIntV, + netLibTrapBitGetUIntV, + netLibTrapBitPutIntV, + netLibTrapBitGetIntV, + + // Traps added after 2.0 release of NetLib + netLibOpenConfig, + netLibConfigMakeActive, + netLibConfigList, + netLibConfigIndexFromName, + netLibConfigDelete, + netLibConfigSaveAs, + netLibConfigRename, + netLibConfigAliasSet, + netLibConfigAliasGet, + + // Traps added after 3.2 release of NetLib + netLibTrapScriptExecute, + + netLibTrapLast + } NetLibTrapNumberEnum; + +#endif + + +/************************************************************ + * Net Library procedures. + *************************************************************/ +#pragma mark Functions +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +Err NetLibOpen (UInt16 libRefnum, UInt16 *netIFErrsP) + SYS_TRAP(sysLibTrapOpen); + +Err NetLibClose (UInt16 libRefnum, UInt16 immediate) + SYS_TRAP(sysLibTrapClose); + +Err NetLibSleep (UInt16 libRefnum) + SYS_TRAP(sysLibTrapSleep); + +Err NetLibWake (UInt16 libRefnum) + SYS_TRAP(sysLibTrapWake); + + +// This call forces the library to complete a close if it's +// currently in the close-wait state. Returns 0 if library is closed, +// Returns netErrFullyOpen if library is still open by some other task. +Err NetLibFinishCloseWait(UInt16 libRefnum) + SYS_TRAP(netLibTrapFinishCloseWait); + +// This call is for use by the Network preference panel only. It +// causes the NetLib to fully open if it's currently in the close-wait +// state. If it's not in the close wait state, it returns an error code +Err NetLibOpenIfCloseWait(UInt16 libRefnum) + SYS_TRAP(netLibTrapOpenIfCloseWait); + +// Get the open Count of the NetLib +Err NetLibOpenCount (UInt16 refNum, UInt16 *countP) + SYS_TRAP(netLibTrapOpenCount); + +// Give NetLib a chance to close the connection down in response +// to a power off event. Returns non-zero if power should not be +// turned off. EventP points to the event that initiated the power off +// which is either a keyDownEvent of the hardPowerChr or the autoOffChr. +// Don't include unless building for Viewer +#ifdef __SYSEVENT_H__ +Err NetLibHandlePowerOff (UInt16 refNum, SysEventType *eventP) + SYS_TRAP(netLibTrapHandlePowerOff); +#endif + + +// Check status or try and reconnect any interfaces which have come down. +// This call can be made by applications when they suspect that an interface +// has come down (like PPP or SLIP). NOTE: This call can display UI +// (if 'refresh' is true) so it MUST be called from the UI task. +Err NetLibConnectionRefresh(UInt16 refNum, Boolean refresh, + UInt8 *allInterfacesUpP, UInt16 *netIFErrP) + SYS_TRAP(netLibTrapConnectionRefresh); + + + +//-------------------------------------------------- +// Net address translation and conversion routines. +//-------------------------------------------------- + +// convert host Int16 to network Int16 +#define NetHToNS(x) (x) + +// convert host long to network long +#define NetHToNL(x) (x) + +// convert network Int16 to host Int16 +#define NetNToHS(x) (x) + +// convert network long to host long +#define NetNToHL(x) (x) + +// Convert 32-bit IP address to ascii dotted decimal form. The Sockets glue +// macro inet_ntoa will pass the address of an application global string in +// spaceP. +Char * NetLibAddrINToA(UInt16 libRefnum, NetIPAddr inet, Char *spaceP) + SYS_TRAP(netLibTrapAddrINToA); + +// Convert a dotted decimal ascii string format of an IP address into +// a 32-bit value. +NetIPAddr NetLibAddrAToIN(UInt16 libRefnum, Char *a) + SYS_TRAP(netLibTrapAddrAToIN); + + + +//-------------------------------------------------- +// Socket creation and option setting +//-------------------------------------------------- + +// Create a socket and return a refnum to it. Protocol is normally 0. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +NetSocketRef NetLibSocketOpen(UInt16 libRefnum, NetSocketAddrEnum domain, + NetSocketTypeEnum type, Int16 protocol, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketOpen); + +// Close a socket. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketClose(UInt16 libRefnum, NetSocketRef socket, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketClose); + +// Set a socket option. Level is usually netSocketOptLevelSocket. Option is one of +// netSocketOptXXXXX. OptValueP is a pointer to the new value and optValueLen is +// the length of the option value. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketOptionSet(UInt16 libRefnum, NetSocketRef socket, + UInt16 /*NetSocketOptLevelEnum*/ level, UInt16 /*NetSocketOptEnum*/ option, + void *optValueP, UInt16 optValueLen, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketOptionSet); + +// Get a socket option. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketOptionGet(UInt16 libRefnum, NetSocketRef socket, + UInt16 /*NetSocketOptLevelEnum*/ level, UInt16 /*NetSocketOptEnum*/ option, + void *optValueP, UInt16 *optValueLenP, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketOptionGet); + + +//-------------------------------------------------- +// Socket Control +//-------------------------------------------------- + +// Bind a source address and port number to a socket. This makes the +// socket accept incoming packets destined for the given socket address. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketBind(UInt16 libRefnum, NetSocketRef socket, + NetSocketAddrType *sockAddrP, Int16 addrLen, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketBind); + + +// Connect to a remote socket. For a stream based socket (i.e. TCP), this initiates +// a 3-way handshake with the remote machine to establish a connection. For +// non-stream based socket, this merely specifies a destination address and port +// number for future outgoing packets from this socket. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketConnect(UInt16 libRefnum, NetSocketRef socket, + NetSocketAddrType *sockAddrP, Int16 addrLen, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketConnect); + + +// Makes a socket ready to accept incoming connection requests. The queueLen +// specifies the max number of pending connection requests that will be enqueued +// while the server is busy handling other requests. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketListen(UInt16 libRefnum, NetSocketRef socket, + UInt16 queueLen, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketListen); + + +// Blocks the current process waiting for an incoming connection request. The socket +// must have previously be put into listen mode through the NetLibSocketListen call. +// On return, *sockAddrP will have the remote machines address and port number. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketAccept(UInt16 libRefnum, NetSocketRef socket, + NetSocketAddrType *sockAddrP, Int16 *addrLenP, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketAccept); + + +// Shutdown a connection in one or both directions. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketShutdown(UInt16 libRefnum, NetSocketRef socket, + Int16 /*NetSocketDirEnum*/ direction, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketShutdown); + + + +// Gets the local and remote addresses of a socket. Useful for TCP sockets that +// get dynamically bound at connect time. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketAddr(UInt16 libRefnum, NetSocketRef socketRef, + NetSocketAddrType *locAddrP, Int16 *locAddrLenP, + NetSocketAddrType *remAddrP, Int16 *remAddrLenP, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketAddr); + + + +//-------------------------------------------------- +// Sending and Receiving +//-------------------------------------------------- +// Send data through a socket. The data is specified through the NetIOParamType +// structure. +// Flags is one or more of netMsgFlagXXX. +// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled +// in with error code. +Int16 NetLibSendPB(UInt16 libRefNum, NetSocketRef socket, + NetIOParamType *pbP, UInt16 flags, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSendPB); + +// Send data through a socket. The data to send is passed in a single buffer, +// unlike NetLibSendPB. If toAddrP is not nil, the data will be sent to +// address *toAddrP. +// Flags is one or more of netMsgFlagXXX. +// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled +// in with error code. +Int16 NetLibSend(UInt16 libRefNum, NetSocketRef socket, + void *bufP, UInt16 bufLen, UInt16 flags, + void *toAddrP, UInt16 toLen, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSend); + +// Receive data from a socket. The data is gatthered into buffers specified in the +// NetIOParamType structure. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +Int16 NetLibReceivePB(UInt16 libRefNum, NetSocketRef socket, + NetIOParamType *pbP, UInt16 flags, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapReceivePB); + +// Receive data from a socket. The data is read into a single buffer, unlike +// NetLibReceivePB. If fromAddrP is not nil, *fromLenP must be initialized to +// the size of the buffer that fromAddrP points to and on exit *fromAddrP will +// have the address of the sender in it. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +Int16 NetLibReceive(UInt16 libRefNum, NetSocketRef socket, + void *bufP, UInt16 bufLen, UInt16 flags, + void *fromAddrP, UInt16 *fromLenP, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapReceive); + + +// Receive data from a socket directly into a (write-protected) Data Manager +// record. +// If fromAddrP is not nil, *fromLenP must be initialized to +// the size of the buffer that fromAddrP points to and on exit *fromAddrP will +// have the address of the sender in it. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +Int16 NetLibDmReceive(UInt16 libRefNum, NetSocketRef socket, + void *recordP, UInt32 recordOffset, UInt16 rcvLen, UInt16 flags, + void *fromAddrP, UInt16 *fromLenP, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapDmReceive); + + +//-------------------------------------------------- +// Name Lookups +//-------------------------------------------------- +NetHostInfoPtr NetLibGetHostByName(UInt16 libRefNum, Char *nameP, + NetHostInfoBufPtr bufP, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapGetHostByName); + + +NetHostInfoPtr NetLibGetHostByAddr(UInt16 libRefNum, UInt8 *addrP, UInt16 len, UInt16 type, + NetHostInfoBufPtr bufP, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapGetHostByAddr); + + +NetServInfoPtr NetLibGetServByName(UInt16 libRefNum, const Char *servNameP, + const Char *protoNameP, NetServInfoBufPtr bufP, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapGetServByName); + +// Looks up a mail exchange name and returns a list of hostnames for it. Caller +// must pass space for list of return names (hostNames), space for +// list of priorities for those hosts (priorities) and max # of names to +// return (maxEntries). +// Returns # of entries found, or -1 on error. If error, *errP gets filled in +// with error code. +Int16 NetLibGetMailExchangeByName(UInt16 libRefNum, Char *mailNameP, + UInt16 maxEntries, + Char hostNames[][netDNSMaxDomainName+1], UInt16 priorities[], + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapGetMailExchangeByName); + + +//-------------------------------------------------- +// Interface setup +//-------------------------------------------------- +Err NetLibIFGet(UInt16 libRefNum, UInt16 index, UInt32 *ifCreatorP, + UInt16 *ifInstanceP) + SYS_TRAP(netLibTrapIFGet); + +Err NetLibIFAttach(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + Int32 timeout) + SYS_TRAP(netLibTrapIFAttach); + +Err NetLibIFDetach(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + Int32 timeout) + SYS_TRAP(netLibTrapIFDetach); + +Err NetLibIFUp(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance) + SYS_TRAP(netLibTrapIFUp); + +Err NetLibIFDown(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + Int32 timeout) + SYS_TRAP(netLibTrapIFDown); + + + + +//-------------------------------------------------- +// Settings +//-------------------------------------------------- +// General settings +Err NetLibSettingGet(UInt16 libRefNum, + UInt16 /*NetSettingEnum*/ setting, void *valueP, UInt16 *valueLenP) + SYS_TRAP(netLibTrapSettingGet); + +Err NetLibSettingSet(UInt16 libRefNum, + UInt16 /*NetSettingEnum*/ setting, void *valueP, UInt16 valueLen) + SYS_TRAP(netLibTrapSettingSet); + +// Network interface specific settings. +Err NetLibIFSettingGet(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + UInt16 /*NetIFSettingEnum*/ setting, void *valueP, UInt16 *valueLenP) + SYS_TRAP(netLibTrapIFSettingGet); + +Err NetLibIFSettingSet(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + UInt16 /*NetIFSettingEnum*/ setting, void *valueP, UInt16 valueLen) + SYS_TRAP(netLibTrapIFSettingSet); + + + +//-------------------------------------------------- +// System level +//-------------------------------------------------- +Int16 NetLibSelect(UInt16 libRefNum, UInt16 width, NetFDSetType *readFDs, + NetFDSetType *writeFDs, NetFDSetType *exceptFDs, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSelect); + + + +//-------------------------------------------------- +// Debugging support +//-------------------------------------------------- +Err NetLibMaster(UInt16 libRefNum, UInt16 cmd, NetMasterPBPtr pbP, + Int32 timeout) + SYS_TRAP(netLibTrapMaster); + +Err NetLibTracePrintF(UInt16 libRefNum, Char *formatStr, ...) + SYS_TRAP(netLibTrapTracePrintF); + +Err NetLibTracePutS(UInt16 libRefNum, Char *strP) + SYS_TRAP(netLibTrapTracePutS); + + + + + +//-------------------------------------------------- +// Configuration Calls +//-------------------------------------------------- +Err NetLibOpenConfig( UInt16 refNum, UInt16 configIndex, UInt32 openFlags, + UInt16 *netIFErrP) + SYS_TRAP(netLibOpenConfig); + +Err NetLibConfigMakeActive( UInt16 refNum, UInt16 configIndex) + SYS_TRAP(netLibConfigMakeActive); + +Err NetLibConfigList( UInt16 refNum, NetConfigNameType nameArray[], + UInt16 *arrayEntriesP) + SYS_TRAP(netLibConfigList); + +Err NetLibConfigIndexFromName( UInt16 refNum, NetConfigNamePtr nameP, + UInt16 *indexP) + SYS_TRAP(netLibConfigIndexFromName); + +Err NetLibConfigDelete( UInt16 refNum, UInt16 index) + SYS_TRAP(netLibConfigDelete); + +Err NetLibConfigSaveAs( UInt16 refNum, NetConfigNamePtr nameP) + SYS_TRAP(netLibConfigSaveAs); + +Err NetLibConfigRename( UInt16 refNum, UInt16 index, + NetConfigNamePtr newNameP) + SYS_TRAP(netLibConfigRename); + +Err NetLibConfigAliasSet( UInt16 refNum, UInt16 configIndex, + UInt16 aliasToIndex) + SYS_TRAP(netLibConfigAliasSet); + +Err NetLibConfigAliasGet( UInt16 refNum, UInt16 aliasIndex, + UInt16 *indexP, Boolean *isAnotherAliasP) + SYS_TRAP(netLibConfigAliasGet); + + + + +#ifdef __cplusplus +} +#endif + + +// Include the NetMgr Bit Utils +#include + +#endif // __NETMGR_H__ + diff --git a/sdk-3.5/include/Core/System/NotifyMgr.h b/sdk-3.5/include/Core/System/NotifyMgr.h new file mode 100644 index 0000000..ecf181d --- /dev/null +++ b/sdk-3.5/include/Core/System/NotifyMgr.h @@ -0,0 +1,256 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: NotifyMgr.h + * + * Description: + * Include file for Notification Manager + * + * History: + * 6/15/98 JED - Created by Jesse Donaldson + * 12/23/99 jmp - Fix <> vs. "" problem. + * + *****************************************************************************/ + +#ifndef __NOTIFY_H__ +#define __NOTIFY_H__ + +#include +#include + +#include + +typedef struct SysNotifyParamType + { + UInt32 notifyType; // What type of event occurred? + UInt32 broadcaster; // normally creator code of broadcasting app + void * notifyDetailsP; // ptr to notification-specific data, if any + void * userDataP; // user specified ptr passed back with notification + Boolean handled; // true if event is handled yet + UInt8 reserved2; + } SysNotifyParamType; + + +typedef Err (*SysNotifyProcPtr)(SysNotifyParamType *notifyParamsP); + +#define sysNotifyNormalPriority 0 // clients should use this priority + +#define sysNotifyBroadcasterCode sysFileCSystem // broadcaster code for events broadcast by the system + +#define sysNotifyNoDatabaseID 0xFFFFFFFF + +#define 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). +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define sysNotifyDefaultQueueSize 5 +#else +#define sysNotifyDefaultQueueSize 15 +#endif + +/* + 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 (e.g., sysNotifyDBRemovedEvent) are broadcast + BEFORE the fact (e.g. before the database has been deleted). + + 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 external 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. +*/ + +#define sysNotifySyncStartEvent 'hots' // Sent at the start of a hotsync. + // Always sent from UI thread. + // param: none + +#define sysNotifySyncFinishEvent 'sync' // Sent at the end of a hotsync. + // Always sent from UI thread. + // param: none + +#define sysNotifyAntennaRaisedEvent 'tena' // Sent when the antenna is raised on a + // Palm VII series device. + // Always sent from UI thread. + // param: none + +#define sysNotifyResetFinishedEvent 'rstf' // Broadcast after all app launchcodes + // are sent after a reset. + // Always sent from UI thread. + // param: none + +#define sysNotifyForgotPasswordEvent 'bozo' // Broadcast when the user presses the + // 'Forgotten Password' button in the + // security app, just before every database's + // private records are deleted. + +#define sysNotifyTimeChangeEvent '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). + +#define sysNotifySleepRequestEvent '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. + +#define sysNotifySleepNotifyEvent '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. + + +#define sysNotifyEarlyWakeupEvent '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. + + +#define sysNotifyLateWakeupEvent '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. + + +#define sysNotifyDisplayChangeEvent 'scrd' // Sent when the display depth is + // changed, notifyDetailsP has old/new depth + // see SysNotifyDisplayChangeDetailsType + + +#define sysNotifyMenuCmdBarOpenEvent '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. + +typedef struct { + UInt32 oldDepth; + UInt32 newDepth; + } SysNotifyDisplayChangeDetailsType; + +/* +Possible event types to be added in the future: +NOTE that these are NOT implemented yet!!!! + +#define sysNotifyDBAddedEvent 'dbs+' // Broadcast after a database is added to the device + // param: ptr to SysNotifyDBInfoType. + +#define sysNotifyDBRemovedEvent 'dbs-' // broadcast before a database is removed from the device + // param: ptr to SysNotifyDBInfoType. + +#define sysNotifyInitializeEvent 'helo' // broadcast to an app after its installed + // so it can do any necessary initalization + // This event is always broadcast. + // param: ptr to SysNotifyDBInfoType. + +#define sysNotifyCleanupEvent '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. + +#define sysNotifyCardChangedEvent 'card' // broadcast when the owner's business card + // has changed, allowing apps to adjust for that. + // param: ptr to new owner data. + +#define sysNotifyCountryChangedEvent 'cnty'// broadcast when the user changes the current + // locale, allowing apps to adjust for that. + // param: ptr to new locale info. +*/ + + + +// Possible values for the sleep-reason for the sysNotifySleepEvent +#define sysSleepPowerButton 0 +#define sysSleepAutoOff 1 +#define sysSleepResumed 2 +#define sysSleepUnknown 3 + + +typedef struct +{ + UInt16 reason; // contains the reason we are going to sleep. See above list for possible values. + UInt16 deferSleep; // 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. +} SleepEventParamType; + + +typedef struct SysNotifyDBInfoType + { + UInt32 creatorID; // creator code of dabatase + UInt32 typeID; // type code of dabatase + LocalID dbID; // database ID of dabatase + UInt16 cardNo; // card number that dabatase resides on + }SysNotifyDBInfoType; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern Err SysNotifyRegister(UInt16 cardNo, LocalID dbID, UInt32 notifyType, + SysNotifyProcPtr callbackP, Int8 priority, void *userDataP) + SYS_TRAP(sysTrapSysNotifyRegister); + +extern Err SysNotifyUnregister(UInt16 cardNo, LocalID dbID, UInt32 notifyType, Int8 priority) + SYS_TRAP(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. + */ +extern Err SysNotifyBroadcast(SysNotifyParamType *notify) + SYS_TRAP(sysTrapSysNotifyBroadcast); + +extern Err SysNotifyBroadcastDeferred(SysNotifyParamType *notify, Int16 paramSize) + SYS_TRAP(sysTrapSysNotifyBroadcastDeferred); + +#ifdef __cplusplus +} +#endif + + + +#endif // __NOTIFY_H__ + diff --git a/sdk-3.5/include/Core/System/OverlayMgr.h b/sdk-3.5/include/Core/System/OverlayMgr.h new file mode 100644 index 0000000..63f8b7f --- /dev/null +++ b/sdk-3.5/include/Core/System/OverlayMgr.h @@ -0,0 +1,229 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: OverlayMgr.h + * + * Description: + * Public header for routines that support overlays & locales. + * + * History: + * Created by Ken Krugler + * 06/24/99 kwk Created by Ken Krugler. + * 07/06/99 CS Added omSpecAttrForBase + * (and renumbered omSpecAttrStripped). + * 07/29/99 CS Added omOverlayKindBase for the entries in the base + * DBs 'ovly' resource (they had been set to + * omOverlayKindReplace before). + * 07/29/99 CS Bumped version to 3, since now we're supposed to + * support omOverlayKindAdd. + * 09/29/99 kwk Bumped version to 4, since we added the baseChecksum + * field to OmOverlaySpecType, as a way of speeding up + * overlay validation. + * 09/29/99 CS Actually bumped version to 4, which Ken forgot. + * 10/08/99 kwk Added OmGetRoutineAddress selector/declaration. + * Moved OmDispatch, OmInit, and OmOpenOverlayDatabase + * into OverlayPrv.h + * + *****************************************************************************/ + +#ifndef __OVERLAYMGR_H__ +#define __OVERLAYMGR_H__ + +// Include elementary types +#include +#include + +#ifdef _WIN32 + #pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union +#endif + +/*********************************************************************** + * Overlay Manager constants + **********************************************************************/ + +#define omOverlayVersion 0x0004 // Version of OmOverlaySpecType/OmOverlayRscType +#define omOverlayDBType 'ovly' // Overlay database type +#define omOverlayRscType 'ovly' // Overlay desc resource type +#define omOverlayRscID 1000 // Overlay desc resource ID + +#define omFtrCreator 'ovly' // For get/set of Overlay features. +#define omFtrShowErrorsFlag 0 // Boolean - True => display overlay errors. + +// Flags for OmOverlaySpecType.flags field +#define omSpecAttrForBase 1 // 'ovly' (in base) describes base itself +#define omSpecAttrStripped 2 // Localized resources stripped (base only) + +// OmFindOverlayDatabase called with stripped base, and no appropriate overlay was found. +#define omErrBaseRequiresOverlay (omErrorClass | 1) + +// OmOverlayDBNameToLocale or OmLocaleToOverlayDBName were passed an unknown locale. +#define omErrUnknownLocale (omErrorClass | 2) + +// OmOverlayDBNameToLocale was passed a poorly formed string. +#define omErrBadOverlayDBName (omErrorClass | 3) + +// OmGetIndexedLocale was passed an invalid index. +#define omErrInvalidLocaleIndex (omErrorClass | 4) + +// OmSetSystemLocale was passed an invalid locale (doesn't correspond to available +// system overlay). + +#define omErrInvalidLocale (omErrorClass | 5) + +// OmSetSystemLocale was passed a locale that referenced an invalid system overlay +// (missing one or more required resources) + +#define omErrInvalidSystemOverlay (omErrorClass | 6) + +// Values for OmOverlayKind +#define omOverlayKindHide 0 // Hide base resource (not supported in version <= 3) +#define omOverlayKindAdd 1 // Add new resource (not support in version <= 2) +#define omOverlayKindReplace 2 // Replace base resource +#define omOverlayKindBase 3 // Description of base resource itself (not supported in version <= 2) + +/*********************************************************************** + * Selectors & macros used for calling Overlay Manager routines + **********************************************************************/ + +#ifdef DIRECT_OVERLAY_CALLS + #define OMDISPATCH_TRAP(omSelectorNum) +#else + #define OMDISPATCH_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapOmDispatch, sel) +#endif + +// Selectors used for getting to the right Overlay Manager routine via +// the OmDispatch trap. + +#ifdef __GNUC__ + +#define omInit 0 +#define omOpenOverlayDatabase 1 +#define omLocaleToOverlayDBName 2 +#define omOverlayDBNameToLocale 3 +#define omGetCurrentLocale 4 +#define omGetIndexedLocale 5 +#define omGetSystemLocale 6 +#define omSetSystemLocale 7 +#define omGetRoutineAddress 8 + +#define omMaxSelector omGetRoutineAddress + +typedef UInt16 OmSelector; + +#else + +typedef enum { + omInit = 0, + omOpenOverlayDatabase, + omLocaleToOverlayDBName, + omOverlayDBNameToLocale, + omGetCurrentLocale, + omGetIndexedLocale, + omGetSystemLocale, + omSetSystemLocale, + omGetRoutineAddress, + + omMaxSelector = omGetRoutineAddress, + omBigSelector = 0x7FFF // Force OmSelector to be 16 bits. +} OmSelector; + +#endif + +/*********************************************************************** + * Overlay Manager types + **********************************************************************/ + +typedef UInt16 OmOverlayKind; + + +typedef struct { + OmOverlayKind overlayType; // Replace, delete, etc. + UInt32 rscType; // Resource type to overlay + UInt16 rscID; // Resource ID to overlay + UInt32 rscLength; // Length of base resource + UInt32 rscChecksum; // Checksum of base resource data +} OmOverlayRscType; + +typedef struct { + UInt16 language; // Language spoken in locale + UInt16 country; // Specifies "dialect" of language +} OmLocaleType; + +// Definition of the Overlay Description Resource ('ovly') +typedef struct { + UInt16 version; // Version of this structure + UInt32 flags; // Flags + UInt32 baseChecksum; // Checksum of all overlays[].checksum + OmLocaleType targetLocale; // Language, & country of overlay resources + UInt32 baseDBType; // Type of base DB to overlay + UInt32 baseDBCreator; // Creator of base DB to overlay + UInt32 baseDBCreateDate; // Date base DB was created + UInt32 baseDBModDate; // Date base DB was last modified + UInt16 numOverlays; // Number of resources to overlay + OmOverlayRscType overlays[0]; // Descriptions of resources to overlay +} OmOverlaySpecType; + + +/*********************************************************************** + * Overlay Manager routines + **********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +// Return in an overlay database name that's appropriate +// for the base name and the locale . If the +// param in NULL, use the current locale. The +// buffer must be at least dmDBNameLength bytes. + +Err OmLocaleToOverlayDBName(const Char *baseDBName, const OmLocaleType *targetLocale, + Char *overlayDBName) + OMDISPATCH_TRAP(omLocaleToOverlayDBName); + +// Given the name of an overlay database in , return back +// the overlay in overlayLocale. If the name isn't an overlay name, +// return omErrBadOverlayDBName. + +Err OmOverlayDBNameToLocale(const Char *overlayDBName, OmLocaleType *overlayLocale) + OMDISPATCH_TRAP(omOverlayDBNameToLocale); + +// Return the current locale in . This may not be the same as +// the system locale, which will take effect after the next reset. + +void OmGetCurrentLocale(OmLocaleType *currentLocale) + OMDISPATCH_TRAP(omGetCurrentLocale); + +// Return the nth available locale in . Indexes are zero-based, and the +// omErrInvalidLocaleIndex result will be returned if is out of bounds. + +Err OmGetIndexedLocale(UInt16 localeIndex, OmLocaleType *theLocale) + OMDISPATCH_TRAP(omGetIndexedLocale); + +// Return the system locale in . This may not be the same as +// the current locale. + +void OmGetSystemLocale(OmLocaleType *systemLocale) + OMDISPATCH_TRAP(omGetSystemLocale); + +// Set the post-reset system locale to be . Return omErrInvalidLocale if +// the passed locale doesnŐt correspond to a valid System.prc overlay. + +Err OmSetSystemLocale(const OmLocaleType *systemLocale) + OMDISPATCH_TRAP(omSetSystemLocale); + +// Return back the address of the routine indicated by . If +// isn't a valid routine selector, return back NULL. + +void *OmGetRoutineAddress(OmSelector inSelector) + OMDISPATCH_TRAP(omGetRoutineAddress); + +#ifdef __cplusplus + } +#endif + +#endif + diff --git a/sdk-3.5/include/Core/System/Password.h b/sdk-3.5/include/Core/System/Password.h new file mode 100644 index 0000000..32ff45e --- /dev/null +++ b/sdk-3.5/include/Core/System/Password.h @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Password.h + * + * Description: + * Password include file + * + * History: + * 4/1/95 - created by Roger Flores + * + *****************************************************************************/ + +#ifndef __PASSWORD_H__ +#define __PASSWORD_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +#define pwdLength 32 +#define pwdEncryptionKeyLength 64 + +#ifdef __cplusplus +extern "C" { +#endif + +Boolean PwdExists() + SYS_TRAP(sysTrapPwdExists); + +Boolean PwdVerify(Char *string) + SYS_TRAP(sysTrapPwdVerify); + +void PwdSet(Char *oldPassword, Char *newPassword) + SYS_TRAP(sysTrapPwdSet); + +void PwdRemove(void) + SYS_TRAP(sysTrapPwdRemove); + +#ifdef __cplusplus +} +#endif + +#endif // __PASSWORD_H__ + diff --git a/sdk-3.5/include/Core/System/PenMgr.h b/sdk-3.5/include/Core/System/PenMgr.h new file mode 100644 index 0000000..e5225b0 --- /dev/null +++ b/sdk-3.5/include/Core/System/PenMgr.h @@ -0,0 +1,97 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PenMgr.h + * + * Description: + * Include file for Pen manager + * + * History: + * 6/5/96 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __PEN_MGR_H +#define __PEN_MGR_H + +// Pilot common definitions +#include +#include +#include +#include + + +/******************************************************************** + * Pen Manager Errors + * the constant serErrorClass is defined in ErrorBase.h + ********************************************************************/ +#define penErrBadParam (penErrorClass | 1) +#define penErrIgnorePoint (penErrorClass | 2) + + + +/******************************************************************** + * Pen manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initializes the Pen Manager +Err PenOpen(void) + SYS_TRAP(sysTrapPenOpen); + +// Closes the Pen Manager and frees whatever memory it allocated +Err PenClose(void) + SYS_TRAP(sysTrapPenClose); + + +// Put pen to sleep +Err PenSleep(void) + SYS_TRAP(sysTrapPenSleep); + +// Wake pen +Err PenWake(void) + SYS_TRAP(sysTrapPenWake); + + +// Get the raw pen coordinates from the hardware. +Err PenGetRawPen(PointType *penP) + SYS_TRAP(sysTrapPenGetRawPen); + +// Reset calibration in preparation for setting it again +Err PenResetCalibration (void) + SYS_TRAP(sysTrapPenResetCalibration); + +// Set calibration settings for the pen +Err PenCalibrate (PointType *digTopLeftP, PointType *digBotRightP, + PointType *scrTopLeftP, PointType *scrBotRightP) + SYS_TRAP(sysTrapPenCalibrate); + +// Scale a raw pen coordinate into screen coordinates +Err PenRawToScreen(PointType *penP) + SYS_TRAP(sysTrapPenRawToScreen); + +// Scale a screen pen coordinate back into a raw coordinate +Err PenScreenToRaw(PointType *penP) + SYS_TRAP(sysTrapPenScreenToRaw); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _PenGetRawPen \ + ASM_SYS_TRAP(sysTrapPenGetRawPen) + + + +#endif //__PEN_MGR_H + diff --git a/sdk-3.5/include/Core/System/Preferences.h b/sdk-3.5/include/Core/System/Preferences.h new file mode 100644 index 0000000..bab562d --- /dev/null +++ b/sdk-3.5/include/Core/System/Preferences.h @@ -0,0 +1,441 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Preferences.h + * + * 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. + * + *****************************************************************************/ + +#ifndef __PREFERENCES_H__ +#define __PREFERENCES_H__ + +#include +#include +#include + +/*********************************************************************** + * Constants + ***********************************************************************/ + +#define noPreferenceFound -1 + +// Preference version constants +#define preferenceDataVer2 2 // Palm OS 2.0 +#define preferenceDataVer3 3 // Palm OS 3.0 +#define preferenceDataVer4 4 // Palm OS 3.1 +#define preferenceDataVer5 5 // Palm OS 3.2a +#define preferenceDataVer6 6 // Palm OS 3.2b/3.3 +#define preferenceDataVer8 8 // Palm OS 3.5 + +// Be SURE to update "preferenceDataVerLatest" when adding a new prefs version... +#define preferenceDataVerLatest preferenceDataVer8 + + +#define defaultAutoOffDuration 2 // minutes +#define defaultAutoOffDurationSecs (2 * minutesInSeconds) // seconds + +#define peggedAutoOffDuration 0xFF // minutes (UInt8) +#define peggedAutoOffDurationSecs 0xFFFF // seconds (UInt16) + + +// Obsolete after V20 +#if EMULATION_LEVEL == EMULATION_NONE + #define defaultSysSoundLevel slOn + #define defaultGameSoundLevel slOn + #define defaultAlarmSoundLevel slOn +#else // EMULATION_LEVEL != EMULATION_NONE + #define defaultSysSoundLevel slOff + #define defaultGameSoundLevel slOff + #define defaultAlarmSoundLevel slOn +#endif + + +#if EMULATION_LEVEL == EMULATION_NONE + #define defaultSysSoundVolume sndMaxAmp + #define defaultGameSoundVolume sndMaxAmp + #define defaultAlarmSoundVolume sndMaxAmp +#else // EMULATION_LEVEL != EMULATION_NONE + #define defaultSysSoundVolume 0 + #define defaultGameSoundVolume 0 + #define defaultAlarmSoundVolume sndMaxAmp +#endif + +typedef enum + { + cAustralia = 0, // 0 + cAustria, // 1 + cBelgium, // 2 + cBrazil, // 3 + cCanada, // 4 + cDenmark, // 5 + cFinland, // 6 + cFrance, // 7 + cGermany, // 8 + cHongKong, // 9 + cIceland, // 10 + cIreland, // 11 + cItaly, // 12 + cJapan, // 13 + cLuxembourg, // 14 + cMexico, // 15 + cNetherlands, // 16 + cNewZealand, // 17 + cNorway, // 18 + cSpain, // 19 + cSweden, // 20 + cSwitzerland, // 21 + cUnitedKingdom, // 22 + cUnitedStates, // 23 + cIndia, // 24 + cIndonesia, // 25 + cKorea, // 26 + cMalaysia, // 27 + cRepChina, // 28 + cPhilippines, // 29 + cSingapore, // 30 + cThailand, // 31 + cTaiwan // 32 + + // Always add new countries at the end! + // Always update OverlayMgr.cp! + + } CountryType; + +#define countryFirst cAustralia +#define countryLast cTaiwan +#define countryCount (countryLast - countryFirst + 1) + + +typedef enum + { + languageFirst = 0, + lEnglish = languageFirst, // 0 + lFrench, // 1 + lGerman, // 2 + lItalian, // 3 + lSpanish, // 4 + // 5 (English WorkPad - unused) + lJapanese = 6, // 6 + lDutch, // 7 + + + // Always add new languages at the end! + // Always update OverlayMgr.cp! + + languageLast = lDutch + } LanguageType; + +#define languageCount (languageLast - languageFirst + 1) + +typedef enum + { + unitsEnglish = 0, // Feet, yards, miles, gallons, pounds, slugs, etc. + unitsMetric // Meters, liters, grams, newtons, etc. + } MeasurementSystemType; + + +// These sound levels must corrospond to positions in the popup lists +// used by the preferences app. These are made obsolete after V20. The +// loudness of the sound is now represented as a number from 0 to sndMaxAmp. +typedef enum { + slOn = 0, + slOff = 1 + } SoundLevelTypeV20; + + +#define countryNameLength 20 +#define currencyNameLength 20 +#define currencySymbolLength 6 + +// An array of these structures (one per country) is kept in the system +// resource. +typedef struct + { + CountryType country; // Country the structure represents + UInt8 filler1; // (Word alignment) + Char countryName[countryNameLength]; + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Int8 weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + UInt8 filler2; // (Word alignment) + Char currencyName[currencyNameLength]; // Dollars + Char currencySymbol[currencySymbolLength]; // $ + Char uniqueCurrencySymbol[currencySymbolLength]; // US$ + UInt8 currencyDecimalPlaces; // 2 for 1.00 + DaylightSavingsTypes daylightSavings; // Type of daylight savings correction + UInt32 minutesWestOfGMT; // minutes west of Greenwich + MeasurementSystemType measurementSystem; // metric, english, etc. + UInt8 filler3; // (Word alignment) + } CountryPreferencesType; + +// The number format (thousands separator and decimal point). This defines +// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland). +typedef enum { + alOff, // Never show an animation + alEventsOnly, // Show an animation for an event + alEventsAndRandom, // Also show random animation + alEventsAndMoreRandom // Show random animations more frequently + } AnimationLevelType; + + +typedef enum + { + prefVersion, + prefCountry, + prefDateFormat, + prefLongDateFormat, + prefWeekStartDay, + prefTimeFormat, + prefNumberFormat, + prefAutoOffDuration, // prefAutoOffDurationSecs is now preferred (prefAutoOffDuration is in minutes) + prefSysSoundLevelV20, // slOn or slOff - error beeps and other non-alarm/game sounds + prefGameSoundLevelV20, // slOn or slOff - game sound effects + prefAlarmSoundLevelV20, // slOn or slOff - alarm sound effects + prefHidePrivateRecordsV33, + prefDeviceLocked, + prefLocalSyncRequiresPassword, + prefRemoteSyncRequiresPassword, + prefSysBatteryKind, + prefAllowEasterEggs, + prefMinutesWestOfGMT, + prefDaylightSavings, + prefRonamaticChar, + prefHard1CharAppCreator, // App creator for hard key #1 + prefHard2CharAppCreator, // App creator for hard key #2 + prefHard3CharAppCreator, // App creator for hard key #3 + prefHard4CharAppCreator, // App creator for hard key #4 + prefCalcCharAppCreator, // App creator for calculator soft key + prefHardCradleCharAppCreator, // App creator for hard cradle key + prefLauncherAppCreator, // App creator for launcher soft key + prefSysPrefFlags, + prefHardCradle2CharAppCreator, // App creator for 2nd hard cradle key + prefAnimationLevel, + + // Additions for PalmOS 3.0: + prefSysSoundVolume, // actual amplitude - error beeps and other non-alarm/game sounds + prefGameSoundVolume, // actual amplitude - game sound effects + prefAlarmSoundVolume, // actual amplitude - alarm sound effects + prefBeamReceive, // False turns off IR sniffing, sends still work. + prefCalibrateDigitizerAtReset, // True makes the user calibrate at soft reset time + prefSystemKeyboardID, // ID of the preferred keyboard resource + prefDefSerialPlugIn, // creator ID of the default serial plug-in + + // Additions for PalmOS 3.1: + prefStayOnWhenPluggedIn, // don't sleep after timeout when using line current + prefStayLitWhenPluggedIn, // keep backlight on when not sleeping on line current + + // Additions for PalmOS 3.2: + prefAntennaCharAppCreator, // App creator for antenna key + + // Additions for PalmOS 3.3: + prefMeasurementSystem, // English, Metric, etc. + + // Additions for PalmOS 3.5: + prefShowPrivateRecords, // returns privateRecordViewEnum + prefAutoOffDurationSecs // auto-off duration in seconds + + } SystemPreferencesChoice; + + +typedef struct { + UInt16 version; // Version of preference info + + // International preferences + CountryType country; // Country the device is in + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + UInt8 weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + + // system preferences + UInt8 autoOffDuration; // Time period before shutting off (in minutes) + SoundLevelTypeV20 sysSoundLevel; // slOn or slOff - error beeps and other non-alarm sounds + SoundLevelTypeV20 alarmSoundLevel; // slOn or slOff - alarm only + Boolean hideSecretRecords; // True to not display records with + // their secret bit attribute set + Boolean deviceLocked; // Device locked until the system + // password is entered + UInt8 reserved1; + UInt16 sysPrefFlags; // Miscellaneous system pref flags + // copied into the global GSysPrefFlags + // at boot time. + SysBatteryKind sysBatteryKind; // The type of batteries installed. This + // is copied into the globals GSysbatteryKind + // at boot time. + UInt8 reserved2; + + } SystemPreferencesTypeV10; + + +// Any entries added to this structure must be initialized in +// Prefereces.c:GetPreferenceResource + +typedef struct + { + UInt16 version; // Version of preference info + + // International preferences + CountryType country; // Country the device is in + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Int8 weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + + // system preferences + UInt8 autoOffDuration; // Time period in minutes before shutting off (use autoOffDurationSecs instead). + SoundLevelTypeV20 sysSoundLevelV20; // slOn or slOff - error beeps and other non-alarm/game sounds + SoundLevelTypeV20 gameSoundLevelV20; // slOn or slOff - game sound effects + SoundLevelTypeV20 alarmSoundLevelV20; // slOn or slOff - alarm sound effects + Boolean hideSecretRecords; // True to not display records with + // their secret bit attribute set + Boolean deviceLocked; // Device locked until the system + // password is entered + Boolean localSyncRequiresPassword; // User must enter password on Pilot + Boolean remoteSyncRequiresPassword; // User must enter password on Pilot + UInt16 sysPrefFlags; // Miscellaneous system pref flags + // copied into the global GSysPrefFlags + // at boot time. Constants are + // sysPrefFlagXXX defined in SystemPrv.h + SysBatteryKind sysBatteryKind; // The type of batteries installed. This + // is copied into the globals GSysbatteryKind + // at boot time. + UInt8 reserved1; + UInt32 minutesWestOfGMT; // minutes west of Greenwich + DaylightSavingsTypes daylightSavings; // Type of daylight savings correction + UInt8 reserved2; + UInt16 ronamaticChar; // character to generate from ronamatic stroke. + // Typically it popups the onscreen keyboard. + UInt32 hard1CharAppCreator; // creator of application to launch in response + // to the hard button #1. Used by SysHandleEvent. + UInt32 hard2CharAppCreator; // creator of application to launch in response + // to the hard button #2. Used by SysHandleEvent. + UInt32 hard3CharAppCreator; // creator of application to launch in response + // to the hard button #3. Used by SysHandleEvent. + UInt32 hard4CharAppCreator; // creator of application to launch in response + // to the hard button #4. Used by SysHandleEvent. + UInt32 calcCharAppCreator; // creator of application to launch in response + // to the Calculator icon. Used by SysHandleEvent. + UInt32 hardCradleCharAppCreator; // creator of application to launch in response + // to the Cradle button. Used by SysHandleEvent. + UInt32 launcherCharAppCreator; // creator of application to launch in response + // to the launcher button. Used by SysHandleEvent. + UInt32 hardCradle2CharAppCreator; // creator of application to launch in response + // to the 2nd Cradle button. Used by SysHandleEvent. + AnimationLevelType animationLevel; // amount of animation to display + + Boolean maskPrivateRecords; // Only meaningful if hideSecretRecords is true. + //true to show a grey placeholder box for secret records. + //was reserved3 - added for 3.5 + + + // Additions for PalmOS 3.0: + UInt16 sysSoundVolume; // system amplitude (0 - sndMaxAmp) - taps, beeps + UInt16 gameSoundVolume; // game amplitude (0 - sndMaxAmp) - explosions + UInt16 alarmSoundVolume; // alarm amplitude (0 - sndMaxAmp) + Boolean beamReceive; // False turns off IR sniffing, sends still work. + Boolean calibrateDigitizerAtReset; // True makes the user calibrate at soft reset time + UInt16 systemKeyboardID; // ID of the preferred keyboard resource + UInt32 defSerialPlugIn; // creator ID of the default serial plug-in + + // Additions for PalmOS 3.1: + Boolean stayOnWhenPluggedIn; // don't sleep after timeout when using line current + Boolean stayLitWhenPluggedIn; // keep backlight on when not sleeping on line current + + // Additions for PalmOS 3.2: + UInt32 antennaCharAppCreator; // creator of application to launch in response + // to the antenna key. Used by SysHandleEvent. + + // Additions for PalmOS 3.5: + MeasurementSystemType measurementSystem; // metric, english, etc. + UInt8 reserved3; + UInt16 autoOffDurationSecs; // Time period in seconds before shutting off. + + } SystemPreferencesType; + + + +typedef SystemPreferencesType *SystemPreferencesPtr; + + +//------------------------------------------------------------------- +// Preferences routines +//------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + + +extern DmOpenRef PrefOpenPreferenceDBV10 (void) + SYS_TRAP(sysTrapPrefOpenPreferenceDBV10); + +extern DmOpenRef PrefOpenPreferenceDB (Boolean saved) + SYS_TRAP(sysTrapPrefOpenPreferenceDB); + +extern void PrefGetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefGetPreferences); + +extern void PrefSetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefSetPreferences); + +extern UInt32 PrefGetPreference(SystemPreferencesChoice choice) + SYS_TRAP(sysTrapPrefGetPreference); + +extern void PrefSetPreference(SystemPreferencesChoice choice, UInt32 value) + SYS_TRAP(sysTrapPrefSetPreference); + +extern Int16 PrefGetAppPreferences (UInt32 creator, UInt16 id, void *prefs, + UInt16 *prefsSize, Boolean saved) + SYS_TRAP(sysTrapPrefGetAppPreferences); + +extern Boolean PrefGetAppPreferencesV10 (UInt32 type, Int16 version, void *prefs, + UInt16 prefsSize) + SYS_TRAP(sysTrapPrefGetAppPreferencesV10); + +extern void PrefSetAppPreferences (UInt32 creator, UInt16 id, Int16 version, + void *prefs, UInt16 prefsSize, Boolean saved) + SYS_TRAP(sysTrapPrefSetAppPreferences); + +extern void PrefSetAppPreferencesV10 (UInt32 creator, Int16 version, void *prefs, + UInt16 prefsSize) + SYS_TRAP(sysTrapPrefSetAppPreferencesV10); + + +#ifdef __cplusplus +} +#endif + + +#endif // __PREFERENCES_H__ + diff --git a/sdk-3.5/include/Core/System/Rect.h b/sdk-3.5/include/Core/System/Rect.h new file mode 100644 index 0000000..b985279 --- /dev/null +++ b/sdk-3.5/include/Core/System/Rect.h @@ -0,0 +1,82 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Rect.h + * + * Description: + * This file defines rectangle structures and routines. + * + * History: + * November 3, 1994 Created by Roger Flores + * Name Date Description + * ---- ---- ----------- + * bob 2/9/99 Use Coord abstraction, fix up consts + * + *****************************************************************************/ + +#ifndef __RECT_H__ +#define __RECT_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +typedef struct AbsRectType { + Coord left; + Coord top; + Coord right; + Coord bottom; +} AbsRectType; + + +typedef struct PointType { + Coord x; + Coord y; +} PointType; + + +typedef struct RectangleType { + PointType topLeft; + PointType extent; +} RectangleType; + +typedef RectangleType *RectanglePtr; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void RctSetRectangle (RectangleType *rP, + Coord left, Coord top, Coord width, Coord height) + SYS_TRAP(sysTrapRctSetRectangle); + +extern void RctCopyRectangle (const RectangleType *srcRectP, + RectangleType *dstRectP) + SYS_TRAP(sysTrapRctCopyRectangle); + +extern void RctInsetRectangle (RectangleType *rP, Coord insetAmt) + SYS_TRAP(sysTrapRctInsetRectangle); + +extern void RctOffsetRectangle (RectangleType *rP, Coord deltaX, Coord deltaY) + SYS_TRAP(sysTrapRctOffsetRectangle); + +extern Boolean RctPtInRectangle (Coord x, Coord y, const RectangleType *rP) + SYS_TRAP(sysTrapRctPtInRectangle); + +extern void RctGetIntersection (const RectangleType *r1P, const RectangleType *r2P, + RectangleType *r3P) + SYS_TRAP(sysTrapRctGetIntersection); + + +#ifdef __cplusplus +} +#endif + + +#endif //__RECT_H__ + diff --git a/sdk-3.5/include/Core/System/ScriptPlugin.h b/sdk-3.5/include/Core/System/ScriptPlugin.h new file mode 100644 index 0000000..6da9b9f --- /dev/null +++ b/sdk-3.5/include/Core/System/ScriptPlugin.h @@ -0,0 +1,99 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ScriptPlugin.h + * + * YOU SHOULD CAREFULLY READ THE TERMS AND CONDITIONS SET FORTH IN THE FILE License.txt BEFORE USING THIS + * SOFTWARE, THE USE OF WHICH IS LICENSED BY PALM COMPUTING, INC., A SUBSIDIARY OF 3COM CORPORATION + * (COLLECTIVELY, "3COM"), FOR USE ONLY AS SET FORTH IN SUCH TERMS AND CONDITIONS. IF YOU DO NOT AGREE + * TO SUCH TERMS AND CONDITIONS, DO NOT USE THE SOFTWARE. USING ANY PART OF THE SOFTWARE INDICATES THAT + * YOU ACCEPT SUCH TERMS. + * + * Description: + * Include file for script plugin modules of the Network Pref Panel + * and the Net library. Note that you need to include the file + * in your plugin before this file. + * + * History: + * WK 6/10/98 Created + * + *****************************************************************************/ + +#ifndef __SCRIPTPLUGIN_H__ +#define __SCRIPTPLUGIN_H__ + +#include +#include + +// Plugin Launch command codes +// +typedef enum { + scptLaunchCmdDoNothing = sysAppLaunchCmdCustomBase, + scptLaunchCmdListCmds, + scptLaunchCmdExecuteCmd +} ScriptPluginLaunchCodesEnum; + +// Commands for the callback selector function +// +#define pluginNetLibDoNothing 0 // For debug purposes. +#define pluginNetLibReadBytes 1 // Receive X number of bytes. +#define pluginNetLibWriteBytes 2 // Send X number of bytes. +#define pluginNetLibGetUserName 3 // Get the user name from the service profile. +#define pluginNetLibGetUserPwd 4 // Get the user password from the service profile. +#define pluginNetLibCheckCancelStatus 5 // Check the user cancel status. +#define pluginNetLibPromptUser 6 // Prompt the user for data and collect it. +#define pluginNetLibConnLog 7 // Write to the connection log. +#define pluginNetLibCallUIProc 8 // Call the plugin's UI function. +#define pluginNetLibGetSerLibRefNum 9 // Get the Serial library reference number. + + + +// Plugin constants +// +#define pluginMaxCmdNameLen 15 +#define pluginMaxModuleNameLen 15 +#define pluginMaxNumOfCmds 10 +#define pluginMaxLenTxtStringArg 63 + +typedef struct { + Char commandName[pluginMaxCmdNameLen + 1]; + Boolean hasTxtStringArg; + UInt8 reserved; // explicitly account for 16-bit alignment padding +} PluginCmdType; + +typedef PluginCmdType *PluginCmdPtr; + + +typedef struct { + Char pluginName[pluginMaxModuleNameLen + 1]; + UInt16 numOfCommands; + PluginCmdType command[pluginMaxNumOfCmds]; +} PluginInfoType; + +typedef PluginInfoType *PluginInfoPtr; + + + +// Plugin Execute structures + +typedef Err (*ScriptPluginSelectorProcPtr) (void *handle, UInt16 command, void *dataBufferP, + UInt16 *sizeP, UInt16 *dataTimeoutP, void *procAddrP); + + +typedef struct { + ScriptPluginSelectorProcPtr selectorProcP; +} PluginCallbackProcType, *PluginCallbackProcPtr; + + +typedef struct { + Char commandName[pluginMaxCmdNameLen + 1]; + Char txtStringArg[pluginMaxLenTxtStringArg + 1]; + PluginCallbackProcPtr procP; + void * handle; +} PluginExecCmdType, *PluginExecCmdPtr; + + +#endif // __SCRIPTPLUGIN_H__ + diff --git a/sdk-3.5/include/Core/System/SerialDrvr.h b/sdk-3.5/include/Core/System/SerialDrvr.h new file mode 100644 index 0000000..a6c850d --- /dev/null +++ b/sdk-3.5/include/Core/System/SerialDrvr.h @@ -0,0 +1,122 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SerialDrvr.h + * + * Description: + * Constants and data structures for serial drvr ('sdrv') code. + * + * History: + * 1/23/98 Created by Ben Manuto + * + *****************************************************************************/ + +#ifndef __SERIALDRVR_H__ +#define __SERIALDRVR_H__ + +#include + +// ********** Constants + +#define kDrvrCreator 0 +#define kDrvrResID 0 +#define kDrvrCODEType 'code' + + +// kDrvrVersion is included by all sdrv's and vdrv's and is returned by the drvr to the +// serial manager to show the driver version is consistent with the required version of +// drvr the new serial manager needs in order to operate properly. +#define kDrvrVersion 3 + +#define kMaxPortDescStrLen 64 +#define kPortDescStrID 1000 + +// Flags denoting capabilities and features of this port. + +#define portPhysicalPort 0x00000001 // Should be unset for virtual port. + +#define portRS232Capable 0x00000004 // Denotes this serialHW has a RS-232 port. +#define portIRDACapable 0x00000008 // Denotes this serialHW has a IR port and support IRDA mode. + +#define portCradlePort 0x00000010 // Denotes this SerialHW controls the cradle port. +#define portExternalPort 0x00000020 // Denotes this SerialHW's port is external or on a memory card. +#define portModemPort 0x00000040 // Denotes this SerialHW communicates with a modem. + +#define portCncMgrVisible 0x00000080 // Denotes this serial port's name is to be displayted in the Connection panel. +#define portPrivateUse 0x00001000 // Set if this drvr is for special software and NOT general apps in system. + + +// ********** Structs + +typedef enum DrvrIRQEnum { + drvrIRQNone = 0x00, + drvrIRQ1 = 0x01, + drvrIRQ2 = 0x02, + drvrIRQ3 = 0x04, + drvrIRQ4 = 0x08, + drvrIRQ5 = 0x10, + drvrIRQ6 = 0x20, + drvrIRQOther = 0x40 +} DrvrIRQEnum; + + +// ***** Info about this particular port + +typedef struct { + UInt32 drvrID; // e.g. creator type, such as 'u328' + UInt32 drvrVersion; // version of code that works for this HW. + UInt32 maxBaudRate; // Maximum baud rate for this uart. + UInt32 handshakeThreshold; // Baud rate at which hardware handshaking should be used. + UInt32 portFlags; // flags denoting features of this uart. + Char *portDesc; // Pointer to null-terminated string describing this HW. + DrvrIRQEnum irqType; // IRQ line for this uart serial HW. + UInt8 reserved; +} DrvrInfoType; + +typedef DrvrInfoType *DrvrInfoPtr; + + +typedef enum DrvrEntryOpCodeEnum { // OpCodes for the entry function. + drvrEntryGetUartFeatures, + drvrEntryGetDrvrFuncts +} DrvrEntryOpCodeEnum; + + +typedef enum DrvrStatusEnum { + drvrStatusCtsOn = 0x0001, + drvrStatusRtsOn = 0x0002, + drvrStatusDsrOn = 0x0004, + drvrStatusTxFifoFull = 0x0008, + drvrStatusTxFifoEmpty = 0x0010, + drvrStatusBreakAsserted = 0x0020, + drvrStatusDataReady = 0x0040, // For polling mode debugger only at this time. + drvrStatusLineErr = 0x0080 // For polling mode debugger only at this time. +} DrvrStatusEnum; + + +// ********** Entry Point Function type + +typedef Err (*DrvEntryPointProcPtr)(DrvrEntryOpCodeEnum opCode, void *uartData); + + +// ********** ADT and functions for Rcv Queue. + +typedef Err (*WriteByteProcPtr)(void *theQ, UInt8 theByte, UInt16 lineErrs); +typedef Err (*WriteBlockProcPtr)(void *theQ, UInt8 *bufP, UInt16 size, UInt16 lineErrs); +typedef UInt32 (*GetSizeProcPtr)(void *theQ); +typedef UInt32 (*GetSpaceProcPtr)(void *theQ); + +typedef struct DrvrRcvQType { + void * rcvQ; + WriteByteProcPtr qWriteByte; + WriteBlockProcPtr qWriteBlock; + GetSizeProcPtr qGetSize; + GetSpaceProcPtr qGetSpace; +} DrvrRcvQType; + +typedef DrvrRcvQType *DrvrHWRcvQPtr; + +#endif // __SERIALDRVR_H__ + diff --git a/sdk-3.5/include/Core/System/SerialLinkMgr.h b/sdk-3.5/include/Core/System/SerialLinkMgr.h new file mode 100644 index 0000000..31450ce --- /dev/null +++ b/sdk-3.5/include/Core/System/SerialLinkMgr.h @@ -0,0 +1,436 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SerialLinkMgr.h + * + * Description: + * Source for Serial Link Routines on Pilot + * + * History: + * 2/6/95 replaces DSerial.h from Debugger + * + *****************************************************************************/ + +#ifndef __SERIAL_LINK_H +#define __SERIAL_LINK_H + + + +// Pilot common definitions +#include +#include + + +//************************************************************************* +// Pre-defined, fixxed Socket ID's +//************************************************************************* +#define slkSocketDebugger 0 // Debugger Socket +#define slkSocketConsole 1 // Console Socket +#define slkSocketRemoteUI 2 // Remote UI Socket +#define slkSocketDLP 3 // Desktop Link Socket +#define slkSocketFirstDynamic 4 // first dynamic socket ID + + +//************************************************************************* +// Packet Types +//************************************************************************* +#define slkPktTypeSystem 0 // System packets +#define slkPktTypeUnused1 1 // used to be: Connection Manager packets +#define slkPktTypePAD 2 // PAD Protocol packets +#define slkPktTypeLoopBackTest 3 // Loop-back test packets + + + +//************************************************************************* +// +// Packet structure: +// header +// body (0-dbgMaxPacketBodyLength bytes of data) +// footer +// +//************************************************************************* + +//---------------------------------------------------------------------- +// packet header +// Fields marked with -> must be filled in by caller +// Fields marked with X will be filled in by SlkSendPacket. +//---------------------------------------------------------------------- + +typedef UInt8 SlkPktHeaderChecksum; + +typedef struct SlkPktHeaderType { + UInt16 signature1; // X first 2 bytes of signature + UInt8 signature2; // X 3 and final byte of signature + UInt8 dest; // -> destination socket Id + UInt8 src; // -> src socket Id + UInt8 type; // -> packet type + UInt16 bodySize; // X size of body + UInt8 transId; // -> transaction Id + // if 0 specified, it will be replaced + SlkPktHeaderChecksum checksum; // X check sum of header + } SlkPktHeaderType; + +typedef SlkPktHeaderType* SlkPktHeaderPtr; + +#define slkPktHeaderSignature1 0xBEEF +#define slkPktHeaderSignature2 0xED + +#define slkPktHeaderSigFirst 0xBE // First byte +#define slkPktHeaderSigSecond 0xEF // second byte +#define slkPktHeaderSigThird 0xED // third byte + +//---------------------------------------------------------------------- +// packet footer +//---------------------------------------------------------------------- +typedef struct SlkPktFooterType { + UInt16 crc16; // header and body crc + } SlkPktFooterType; + +typedef SlkPktFooterType* SlkPktFooterPtr; + + +//************************************************************************* +// +// Write Data Structure passed to SlkSendPacket. This structure +// Tells SlkSendPacket where each of the chunks that comprise the body are +// and the size of each. SlkSendPacket accepts a pointer to an array +// of SlkWriteDataTypes, the last one has a size field of 0. +// +//************************************************************************* +typedef struct SlkWriteDataType { + UInt16 size; // last one has size of 0 + void* dataP; // pointer to data + } SlkWriteDataType; +typedef SlkWriteDataType* SlkWriteDataPtr; + + + + +//************************************************************************* +// +// CPU-dependent macros for getting/setting values from/to packets +// +//************************************************************************* + +//-------------------------------------------------------------------- +// macros to get packet values +//-------------------------------------------------------------------- + +#define slkGetPacketByteVal(srcP) (*(UInt8 *)(srcP)) + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketWordVal(srcP) \ + ( (UInt16) \ + ( \ + ((UInt16)((UInt8 *)(srcP))[0] << 8) | \ + ((UInt16)((UInt8 *)(srcP))[1]) \ + ) \ + ) +#else +#define slkGetPacketWordVal(srcP) \ + ( *((UInt16 *)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketDWordVal(srcP) \ + ( (UInt32) \ + ( \ + ((UInt32)((UInt8 *)(srcP))[0] << 24) | \ + ((UInt32)((UInt8 *)(srcP))[1] << 16) | \ + ((UInt32)((UInt8 *)(srcP))[2] << 8) | \ + ((UInt32)((UInt8 *)(srcP))[3]) \ + ) \ + ) +#else +#define slkGetPacketDWordVal(srcP) \ + ( *((UInt32 *)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#define slkGetPacketSignature1(sigP) \ + slkGetPacketWordVal(sigP) + +#define slkGetPacketSignature2(sigP) \ + slkGetPacketByteVal(sigP) + + +#define slkGetPacketDest(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketSrc(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketType(commandP) \ + slkGetPacketByteVal(commandP) + + +#define slkGetPacketBodySize(lengthP) \ + slkGetPacketWordVal(lengthP) + +#define slkGetPacketTransId(transIDP) \ + slkGetPacketByteVal(transIDP) + +#define slkGetPacketHdrChecksum(checksumP) \ + slkGetPacketByteVal(checksumP) + + +#define slkGetPacketTotalChecksum(checksumP) \ + slkGetPacketWordVal(checksumP) + + + + + + +//-------------------------------------------------------------------- +// macros to set packet values +//-------------------------------------------------------------------- + + +#define slkSetPacketByteVal(srcByteVal, destP) \ + ( *(UInt8 *)(destP) = (UInt8)(srcByteVal) ) + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketWordVal(srcWordVal, destP) \ + \ + do { \ + UInt16 ___srcVal; \ + UInt8 * ___srcValP; \ + \ + ___srcVal = (UInt16)(srcWordVal); \ + ___srcValP = (UInt8 *)(&___srcVal); \ + \ + ((UInt8 *)(destP))[0] = ___srcValP[1]; \ + ((UInt8 *)(destP))[1] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketWordVal(srcWordVal, destP) \ + ( *((UInt16 *)(destP)) = (UInt16)(srcWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + do { \ + UInt32 ___srcVal; \ + UInt8 * ___srcValP; \ + \ + ___srcVal = (UInt32)(srcDWordVal); \ + ___srcValP = (UInt8 *)(&___srcVal); \ + \ + ((UInt8 *)(destP))[0] = ___srcValP[3]; \ + ((UInt8 *)(destP))[1] = ___srcValP[2]; \ + ((UInt8 *)(destP))[2] = ___srcValP[1]; \ + ((UInt8 *)(destP))[3] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + ( *((UInt32 *)(destP)) = (UInt32)(srcDWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + + +#define slkSetPacketSignature1(magic, destP) \ + slkSetPacketWordVal(magic, destP) + +#define slkSetPacketSignature2(magic, destP) \ + slkSetPacketByteVal(magic, destP) + + +#define slkSetPacketDest(dest, destP) \ + slkSetPacketByteVal(dest, destP) + +#define slkSetPacketSrc(src, destP) \ + slkSetPacketByteVal(src, destP) + + +#define slkSetPacketType(type, destP) \ + slkSetPacketByteVal(type, destP) + + +#define slkSetPacketBodySize(numBytes, destP) \ + slkSetPacketWordVal(numBytes, destP) + + +#define slkSetPacketTransId(transID, destP) \ + slkSetPacketByteVal(transID, destP) + +#define slkSetPacketHdrChecksum(checksum, destP) \ + slkSetPacketByteVal(checksum, destP) + +#define slkSetPacketTotalChecksum(checksum, destP) \ + slkSetPacketWordVal(checksum, destP) + + + + + + +/******************************************************************* + * Serial Link Manager Errors + * the constant slkErrorClass is defined in SystemMgr.h + *******************************************************************/ +#define slkErrChecksum (slkErrorClass | 1) +#define slkErrFormat (slkErrorClass | 2) +#define slkErrBuffer (slkErrorClass | 3) +#define slkErrTimeOut (slkErrorClass | 4) +#define slkErrHandle (slkErrorClass | 5) +#define slkErrBodyLimit (slkErrorClass | 6) +#define slkErrTransId (slkErrorClass | 7) +#define slkErrResponse (slkErrorClass | 8) +#define slkErrNoDefaultProc (slkErrorClass | 9) +#define slkErrWrongPacketType (slkErrorClass | 10) +#define slkErrBadParam (slkErrorClass | 11) +#define slkErrAlreadyOpen (slkErrorClass | 12) +#define slkErrOutOfSockets (slkErrorClass | 13) +#define slkErrSocketNotOpen (slkErrorClass | 14) +#define slkErrWrongDestSocket (slkErrorClass | 15) +#define slkErrWrongPktType (slkErrorClass | 16) +#define slkErrBusy (slkErrorClass | 17) // called while sending a packet + // only returned on single-threaded + // emulation implementations +#define slkErrNotOpen (slkErrorClass | 18) + + + +/******************************************************************* + * Type definition for a Serial Link Socket Listener + * + *******************************************************************/ +typedef void (*SlkSocketListenerProcPtr) + (SlkPktHeaderPtr headerP, void *bodyP); + +typedef struct SlkSocketListenType { + SlkSocketListenerProcPtr listenerP; + SlkPktHeaderPtr headerBufferP; // App allocated buffer for header + void* bodyBufferP; // App allocated buffer for body + UInt32 bodyBufferSize; + } SlkSocketListenType; +typedef SlkSocketListenType* SlkSocketListenPtr; + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// Initializes the Serial Link Manager +//------------------------------------------------------------------- +Err SlkOpen(void) + SYS_TRAP(sysTrapSlkOpen); + +//------------------------------------------------------------------- +// Close down the Serial Link Manager +//------------------------------------------------------------------- +Err SlkClose(void) + SYS_TRAP(sysTrapSlkClose); + + + + +//------------------------------------------------------------------- +// Open up another Serial Link socket. The caller must have already +// opened the comm library and set it to the right settings. +//------------------------------------------------------------------- + +Err SlkOpenSocket(UInt16 portID, UInt16 *socketP, Boolean staticSocket) + SYS_TRAP(sysTrapSlkOpenSocket); + + +//------------------------------------------------------------------- +// Close up a Serial Link socket. +// Warning: This routine is assymetrical with SlkOpenSocket because it +// WILL CLOSE the library for the caller (unless the refNum is the +// refNum of the debugger comm library). +//------------------------------------------------------------------- +Err SlkCloseSocket(UInt16 socket) + SYS_TRAP(sysTrapSlkCloseSocket); + + +//------------------------------------------------------------------- +// Get the library refNum for a particular Socket +//------------------------------------------------------------------- + + + Err SlkSocketPortID(UInt16 socket, UInt16 *portIDP) + SYS_TRAP(sysTrapSlkSocketRefNum); + + #define SlkSocketRefNum SlkSocketPortID + + +//------------------------------------------------------------------- +// Set the in-packet timeout for a socket +//------------------------------------------------------------------- +Err SlkSocketSetTimeout(UInt16 socket, Int32 timeout) + SYS_TRAP(sysTrapSlkSocketSetTimeout); + + + + + +//------------------------------------------------------------------- +// Flush a Socket +//------------------------------------------------------------------- +Err SlkFlushSocket(UInt16 socket, Int32 timeout) + SYS_TRAP(sysTrapSlkFlushSocket); + + +//------------------------------------------------------------------- +// Set up a Socket Listener +//------------------------------------------------------------------- +Err SlkSetSocketListener(UInt16 socket, SlkSocketListenPtr socketP) + SYS_TRAP(sysTrapSlkSetSocketListener); + + +//------------------------------------------------------------------- +// Sends a packet's header, body, footer. Stuffs the header's +// magic number and checksum fields. Expects all other +// header fields to be filled in by caller. +// errors returned: dseHandle, dseLine, dseIO, dseParam, dseBodyLimit, +// dseOther +//------------------------------------------------------------------- +Err SlkSendPacket(SlkPktHeaderPtr headerP, SlkWriteDataPtr writeList) + SYS_TRAP(sysTrapSlkSendPacket); + + +//------------------------------------------------------------------- +// Receives and validates an entire packet. +// errors returned: dseHandle, dseParam, dseLine, dseIO, dseFormat, +// dseChecksum, dseBuffer, dseBodyLimit, dseTimeOut, +// dseOther +//------------------------------------------------------------------- +Err SlkReceivePacket( UInt16 socket, Boolean andOtherSockets, + SlkPktHeaderPtr headerP, void *bodyP, UInt16 bodySize, + Int32 timeout) + SYS_TRAP(sysTrapSlkReceivePacket); + + +//------------------------------------------------------------------- +// Do Default processing of a System packet +//------------------------------------------------------------------- +Err SlkSysPktDefaultResponse(SlkPktHeaderPtr headerP, void *bodyP) + SYS_TRAP(sysTrapSlkSysPktDefaultResponse); + +//------------------------------------------------------------------- +// Do RPC call +//------------------------------------------------------------------- +Err SlkProcessRPC(SlkPktHeaderPtr headerP, void *bodyP) + SYS_TRAP(sysTrapSlkProcessRPC); + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIAL_LINK_H + diff --git a/sdk-3.5/include/Core/System/SerialMgr.h b/sdk-3.5/include/Core/System/SerialMgr.h new file mode 100644 index 0000000..782efca --- /dev/null +++ b/sdk-3.5/include/Core/System/SerialMgr.h @@ -0,0 +1,405 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SerialMgr.h + * + * Description: + * Include file for Serial manager + * + * History: + * 1/14/98 SerialMgr.h created by Ben Manuto + * + *****************************************************************************/ + +#ifndef __SERIALMGR_H +#define __SERIALMGR_H + + +// Pilot common definitions +#include +#include + +// New Serial manager feature number +#define sysFtrNewSerialPresent 1 + +/******************************************************************** + * Serial Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ + +#define serErrBadParam (serErrorClass | 1) +#define serErrBadPort (serErrorClass | 2) +#define serErrNoMem (serErrorClass | 3) +#define serErrBadConnID (serErrorClass | 4) +#define serErrTimeOut (serErrorClass | 5) +#define serErrLineErr (serErrorClass | 6) +#define serErrAlreadyOpen (serErrorClass | 7) +#define serErrStillOpen (serErrorClass | 8) +#define serErrNotOpen (serErrorClass | 9) +#define serErrNotSupported (serErrorClass | 10) // functionality not supported +#define serErrNoDevicesAvail (serErrorClass | 11) // No serial devices were loaded or are available. + + +// +// mask values for the lineErrors from SerGetStatus +// + +#define serLineErrorParity 0x0001 // parity error +#define serLineErrorHWOverrun 0x0002 // HW overrun +#define serLineErrorFraming 0x0004 // framing error +#define serLineErrorBreak 0x0008 // break signal asserted +#define serLineErrorHShake 0x0010 // line hand-shake error +#define serLineErrorSWOverrun 0x0020 // HW overrun +#define serLineErrorCarrierLost 0x0040 // CD dropped + + +/******************************************************************** + * Serial Port Definitions + ********************************************************************/ + +#define serPortLocalHotSync 0x8000 // Use physical HotSync port + +#define serPortCradlePort 0x8000 // Use the RS-232 cradle port. +#define serPortIrPort 0x8001 // Use available IR port. + + +// This constant is used by the Serial Link Mgr only +#define serPortIDMask 0xC000 + + +/******************************************************************** + * Serial Settings Descriptor + ********************************************************************/ + +#define srmSettingsFlagStopBitsM 0x00000001 // mask for stop bits field +#define srmSettingsFlagStopBits1 0x00000000 // 1 stop bits +#define srmSettingsFlagStopBits2 0x00000001 // 2 stop bits +#define srmSettingsFlagParityOnM 0x00000002 // mask for parity on +#define srmSettingsFlagParityEvenM 0x00000004 // mask for parity even +#define srmSettingsFlagXonXoffM 0x00000008 // (NOT IMPLEMENTED) mask for Xon/Xoff flow control +#define srmSettingsFlagRTSAutoM 0x00000010 // mask for RTS rcv flow control +#define srmSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control +#define srmSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char +#define srmSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char +#define srmSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char +#define srmSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char +#define srmSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char +#define srmSettingsFlagFlowControl 0x00000100 // mask for enabling/disabling special flow control feature + // for the software receive buffer. + + +// Default settings +#define srmDefaultSettings (srmSettingsFlagBitsPerChar8 | \ + srmSettingsFlagStopBits1 | \ + srmSettingsFlagRTSAutoM) + +#define srmDefaultCTSTimeout (5*sysTicksPerSecond) + + +// Status bitfield constants + +#define srmStatusCtsOn 0x00000001 +#define srmStatusRtsOn 0x00000002 +#define srmStatusDsrOn 0x00000004 +#define srmStatusBreakSigOn 0x00000008 + + +// +// Info fields describing serial HW capabilities. +// + +#define serDevCradlePort 0x00000001 // Serial HW controls RS-232 serial from cradle connector of Pilot. +#define serDevRS232Serial 0x00000002 // Serial HW has RS-232 line drivers +#define serDevIRDACapable 0x00000004 // Serial Device has IR line drivers and generates IRDA mode serial. +#define serDevModemPort 0x00000008 // Serial deivce drives modem connection. +#define serDevCncMgrVisible 0x00000010 // Serial device port name string to be displayed in Connection Mgr panel. + + +typedef struct DeviceInfoType { + UInt32 serDevCreator; // Four Character creator type for serial driver ('sdrv') + UInt32 serDevFtrInfo; // Flags defining features of this serial hardware. + UInt32 serDevMaxBaudRate; // Maximum baud rate for this device. + UInt32 serDevHandshakeBaud; // HW Handshaking is reccomended for baud rates over this + Char *serDevPortInfoStr; // Description of serial HW device or virtual device. + UInt8 reserved[8]; // Reserved. +} DeviceInfoType; + +typedef DeviceInfoType *DeviceInfoPtr; + + +/******************************************************************** + * Type of a wakeup handler procedure which can be installed through the + * SerSetWakeupHandler() call. + ********************************************************************/ +typedef void (*WakeupHandlerProcPtr)(UInt32 refCon); + +/******************************************************************** + * Type of an emulator-mode only blocking hook routine installed via + * SerControl function serCtlEmuSetBlockingHook. This is supported only + * under emulation mode. The argument to the function is the value + * specified in the SerCallbackEntryType structure. The intention of the + * return value is to return false if serial manager should abort the + * current blocking action, such as when an app quit event has been received; + * otherwise, it should return true. However, in the current implementation, + * this return value is ignored. The callback can additionally process + * events to enable user interaction with the UI, such as interacting with the + * debugger. + ********************************************************************/ +typedef Boolean (*BlockingHookProcPtr) (UInt32 userRef); + + +/******************************************************************** + * Serial Library Control Enumerations (Pilot 2.0) + ********************************************************************/ + +/******************************************************************** + * Structure for specifying callback routines. + ********************************************************************/ +typedef struct SrmCallbackEntryType { + BlockingHookProcPtr funcP; // function pointer + UInt32 userRef; // ref value to pass to callback +} SrmCallbackEntryType; +typedef SrmCallbackEntryType* SrmCallbackEntryPtr; + + +typedef enum SrmCtlEnum { + srmCtlFirstReserved = 0, // RESERVE 0 + + srmCtlSetBaudRate, // Sets the current baud rate for the HW. + // valueP = MemPtr to Int32, valueLenP = MemPtr to sizeof(Int32) + + srmCtlGetBaudRate, // Gets the current baud rate for the HW. + + srmCtlSetFlags, // Sets the current flag settings for the serial HW. + + srmCtlGetFlags, // Gets the current flag settings the serial HW. + + srmCtlSetCtsTimeout, // Sets the current Cts timeout value. + + srmCtlGetCtsTimeout, // Gets the current Cts timeout value. + + srmCtlStartBreak, // turn RS232 break signal on: + // users are responsible for ensuring that the break is set + // long enough to genearate a valid BREAK! + // valueP = 0, valueLenP = 0 + + srmCtlStopBreak, // turn RS232 break signal off: + // valueP = 0, valueLenP = 0 + + srmCtlStartLocalLoopback, // Start local loopback test + // valueP = 0, valueLenP = 0 + + srmCtlStopLocalLoopback, // Stop local loopback test + // valueP = 0, valueLenP = 0 + + + srmCtlIrDAEnable, // Enable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + srmCtlIrDADisable, // Disable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + srmCtlRxEnable, // enable receiver ( for IrDA ) + + srmCtlRxDisable, // disable receiver ( for IrDA ) + + srmCtlEmuSetBlockingHook, // Set a blocking hook routine FOR EMULATION + // MODE ONLY - NOT SUPPORTED ON THE PILOT + //PASS: + // valueP = MemPtr to SerCallbackEntryType + // *valueLenP = sizeof(SerCallbackEntryType) + //RETURNS: + // the old settings in the first argument + + srmCtlUserDef, // Specifying this opCode passes through a user-defined + // function to the DrvControl function. This is for use + // specifically by serial driver developers who need info + // from the serial driver that may not be available through the + // standard SrmMgr interface. + + srmCtlGetOptimalTransmitSize, // This function will ask the port for the most efficient buffer size + // for transmitting data packets. This opCode returns serErrNotSupported + // if the physical or virtual device does not support this feature. + // The device can return a transmit size of 0, if send buffering is + // requested, but the actual size is up to the caller to choose. + // valueP = MemPtr to UInt32 --> return optimal buf size + // ValueLenP = sizeof(UInt32) + + srmCtlSetDTRAsserted, // Enable or disable DTR. + + srmCtlGetDTRAsserted, // Determine if DTR is enabled or disabled. + + srmCtlLAST // ***** ADD NEW ENTRIES BEFORE THIS ONE + +} SrmCtlEnum; + + + +/******************************************************************** + * Serial Hardware Library Routines + ********************************************************************/ + +#ifdef BUILDING_NEW_SERIAL_MGR + #define SERIAL_TRAP(serialSelectorNum) +#else + #define SERIAL_TRAP(serialSelectorNum) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapSerialDispatch, \ + serialSelectorNum) +#endif + + +// ***************************************************************** +// * New Serial Manager trap selectors +// ***************************************************************** + +#ifdef __GNUC__ + +// The numbering of these #defines *MUST* match the sysSerialSelector in SerialMgr.c +#define sysSerialInstall 0 +#define sysSerialOpen 1 +#define sysSerialOpenBkgnd 2 +#define sysSerialClose 3 +#define sysSerialSleep 4 +#define sysSerialWake 5 +#define sysSerialGetDeviceCount 6 +#define sysSerialGetDeviceInfo 7 +#define sysSerialGetStatus 8 +#define sysSerialClearErr 9 +#define sysSerialControl 10 +#define sysSerialSend 11 +#define sysSerialSendWait 12 +#define sysSerialSendCheck 13 +#define sysSerialSendFlush 14 +#define sysSerialReceive 15 +#define sysSerialReceiveWait 16 +#define sysSerialReceiveCheck 17 +#define sysSerialReceiveFlush 18 +#define sysSerialSetRcvBuffer 19 +#define sysSerialRcvWindowOpen 20 +#define sysSerialRcvWindowClose 21 +#define sysSerialSetWakeupHandler 22 +#define sysSerialPrimeWakeupHandler 23 + +// Used by SerialMgrDispatch.c +#define maxSerialSelector sysSerialPrimeWakeupHandler + +#else + +typedef enum { // The order of this enum *MUST* match the sysSerialSelector in SerialMgr.c + sysSerialInstall = 0, + sysSerialOpen, + sysSerialOpenBkgnd, + sysSerialClose, + sysSerialSleep, + sysSerialWake, + sysSerialGetDeviceCount, + sysSerialGetDeviceInfo, + sysSerialGetStatus, + sysSerialClearErr, + sysSerialControl, + sysSerialSend, + sysSerialSendWait, + sysSerialSendCheck, + sysSerialSendFlush, + sysSerialReceive, + sysSerialReceiveWait, + sysSerialReceiveCheck, + sysSerialReceiveFlush, + sysSerialSetRcvBuffer, + sysSerialRcvWindowOpen, + sysSerialRcvWindowClose, + sysSerialSetWakeupHandler, + sysSerialPrimeWakeupHandler, + + maxSerialSelector = sysSerialPrimeWakeupHandler // Used by SerialMgrDispatch.c +} sysSerialSelector; + +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +Err SerialMgrInstall(void) + SERIAL_TRAP(sysSerialInstall); + +Err SrmOpen(UInt32 port, UInt32 baud, UInt16 *newPortIdP) + SERIAL_TRAP(sysSerialOpen); + +Err SrmOpenBackground(UInt32 port, UInt32 baud, UInt16 *newPortIdP) + SERIAL_TRAP(sysSerialOpenBkgnd); + +Err SrmClose(UInt16 portId) + SERIAL_TRAP(sysSerialClose); + +Err SrmSleep() + SERIAL_TRAP(sysSerialSleep); + +Err SrmWake() + SERIAL_TRAP(sysSerialWake); + +Err SrmGetDeviceCount(UInt16 *numOfDevicesP) + SERIAL_TRAP(sysSerialGetDeviceCount); + +Err SrmGetDeviceInfo(UInt32 deviceID, DeviceInfoType *deviceInfoP) + SERIAL_TRAP(sysSerialGetDeviceInfo); + +Err SrmGetStatus(UInt16 portId, UInt32 *statusFieldP, UInt16 *lineErrsP) + SERIAL_TRAP(sysSerialGetStatus); + +Err SrmClearErr (UInt16 portId) + SERIAL_TRAP(sysSerialClearErr); + +Err SrmControl(UInt16 portId, UInt16 op, void *valueP, UInt16 *valueLenP) + SERIAL_TRAP(sysSerialControl); + +UInt32 SrmSend (UInt16 portId, void *bufP, UInt32 count, Err *errP) + SERIAL_TRAP(sysSerialSend); + +Err SrmSendWait(UInt16 portId) + SERIAL_TRAP(sysSerialSendWait); + +Err SrmSendCheck(UInt16 portId, UInt32 *numBytesP) + SERIAL_TRAP(sysSerialSendCheck); + +Err SrmSendFlush(UInt16 portId) + SERIAL_TRAP(sysSerialSendFlush); + +UInt32 SrmReceive(UInt16 portId, void *rcvBufP, UInt32 count, Int32 timeout, Err *errP) + SERIAL_TRAP(sysSerialReceive); + +Err SrmReceiveWait(UInt16 portId, UInt32 bytes, Int32 timeout) + SERIAL_TRAP(sysSerialReceiveWait); + +Err SrmReceiveCheck(UInt16 portId, UInt32 *numBytesP) + SERIAL_TRAP(sysSerialReceiveCheck); + +Err SrmReceiveFlush(UInt16 portId, Int32 timeout) + SERIAL_TRAP(sysSerialReceiveFlush); + +Err SrmSetReceiveBuffer(UInt16 portId, void *bufP, UInt16 bufSize) + SERIAL_TRAP(sysSerialSetRcvBuffer); + +Err SrmReceiveWindowOpen(UInt16 portId, UInt8 **bufPP, UInt32 *sizeP) + SERIAL_TRAP(sysSerialRcvWindowOpen); + +Err SrmReceiveWindowClose(UInt16 portId, UInt32 bytesPulled) + SERIAL_TRAP(sysSerialRcvWindowClose); + +Err SrmSetWakeupHandler(UInt16 portId, WakeupHandlerProcPtr procP, UInt32 refCon) + SERIAL_TRAP(sysSerialSetWakeupHandler); + +Err SrmPrimeWakeupHandler(UInt16 portId, UInt16 minBytes) + SERIAL_TRAP(sysSerialPrimeWakeupHandler); + +void SrmSelectorErrPrv (UInt16 serialSelector); // used only by SerialMgrDispatch.c + +#ifdef __cplusplus +} +#endif + +#endif // __SERIALMGR_H + diff --git a/sdk-3.5/include/Core/System/SerialMgrOld.h b/sdk-3.5/include/Core/System/SerialMgrOld.h new file mode 100644 index 0000000..f12e9b0 --- /dev/null +++ b/sdk-3.5/include/Core/System/SerialMgrOld.h @@ -0,0 +1,346 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SerialMgrOld.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __SERIALMGROLD_H_ +#define __SERIALMGROLD_H_ + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Serial Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ + +#define serErrBadParam (serErrorClass | 1) +#define serErrBadPort (serErrorClass | 2) +#define serErrNoMem (serErrorClass | 3) +#define serErrBadConnID (serErrorClass | 4) +#define serErrTimeOut (serErrorClass | 5) +#define serErrLineErr (serErrorClass | 6) +#define serErrAlreadyOpen (serErrorClass | 7) +#define serErrStillOpen (serErrorClass | 8) +#define serErrNotOpen (serErrorClass | 9) +#define serErrNotSupported (serErrorClass | 10) // functionality not supported + + +/******************************************************************** + * Serial Port Definitions + ********************************************************************/ + +#define serPortDefault 0x0000 // Use prefDefSerialPlugIn +#define serPortLocalHotSync 0x8000 // Use physical HotSync port +#define serPortMaskLocal 0x7FFF // Mask off HotSync "hint" (for SerialMgr) + + +/******************************************************************** + * Serial Settings Descriptor + ********************************************************************/ + +typedef struct SerSettingsType { + UInt32 baudRate; // baud rate + UInt32 flags; // miscellaneous settings + Int32 ctsTimeout; // max # of ticks to wait for CTS to become asserted + // before transmitting; used only when + // configured with serSettingsFlagCTSAutoM. + } SerSettingsType; +typedef SerSettingsType* SerSettingsPtr; + +#define serSettingsFlagStopBitsM 0x00000001 // mask for stop bits field +#define serSettingsFlagStopBits1 0x00000000 // 1 stop bits +#define serSettingsFlagStopBits2 0x00000001 // 2 stop bits +#define serSettingsFlagParityOnM 0x00000002 // mask for parity on +#define serSettingsFlagParityEvenM 0x00000004 // mask for parity even +#define serSettingsFlagXonXoffM 0x00000008 // (NOT IMPLEMENTED) mask for Xon/Xoff flow control +#define serSettingsFlagRTSAutoM 0x00000010 // mask for RTS rcv flow control +#define serSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control +#define serSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char +#define serSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char +#define serSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char +#define serSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char +#define serSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char + + +// Default settings +#define serDefaultSettings (serSettingsFlagBitsPerChar8 | \ + serSettingsFlagStopBits1 | \ + serSettingsFlagRTSAutoM) + +#define serDefaultCTSTimeout (5*sysTicksPerSecond) + +// +// mask values for the lineErrors from SerGetStatus +// + +#define serLineErrorParity 0x0001 // parity error +#define serLineErrorHWOverrun 0x0002 // HW overrun +#define serLineErrorFraming 0x0004 // framing error +#define serLineErrorBreak 0x0008 // break signal asserted +#define serLineErrorHShake 0x0010 // line hand-shake error +#define serLineErrorSWOverrun 0x0020 // HW overrun +#define serLineErrorCarrierLost 0x0040 // CD dropped + + + + +/******************************************************************** + * Type of a wakeup handler procedure which can be installed through the + * SerSetWakeupHandler() call. + ********************************************************************/ +typedef void (*SerWakeupHandler) (UInt32 refCon); + +/******************************************************************** + * Type of an emulator-mode only blocking hook routine installed via + * SerControl function serCtlEmuSetBlockingHook. This is supported only + * under emulation mode. The argument to the function is the value + * specified in the SerCallbackEntryType structure. The intention of the + * return value is to return false if serial manager should abort the + * current blocking action, such as when an app quit event has been received; + * otherwise, it should return true. However, in the current implementation, + * this return value is ignored. The callback can additionally process + * events to enable user interaction with the UI, such as interacting with the + * debugger. + ********************************************************************/ +typedef Boolean (*SerBlockingHookHandler) (UInt32 userRef); + + + + +/******************************************************************** + * Serial Library Control Enumerations (Pilot 2.0) + ********************************************************************/ + +/******************************************************************** + * Structure for specifying callback routines. + ********************************************************************/ +typedef struct SerCallbackEntryType { + MemPtr funcP; // function pointer + UInt32 userRef; // ref value to pass to callback + } SerCallbackEntryType; +typedef SerCallbackEntryType* SerCallbackEntryPtr; + +// v2.0 extension +typedef enum SerCtlEnum { + serCtlFirstReserved = 0, // RESERVE 0 + + serCtlStartBreak, // 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, // turn RS232 break signal off: + // valueP = 0, valueLenP = 0 + + serCtlBreakStatus, // Get RS232 break signal status(on or off): + // valueP = MemPtr to UInt16 for returning status(0 = off, !0 = on) + // *valueLenP = sizeof(UInt16) + + serCtlStartLocalLoopback, // Start local loopback test + // valueP = 0, valueLenP = 0 + + serCtlStopLocalLoopback, // Stop local loopback test + // valueP = 0, valueLenP = 0 + + serCtlMaxBaud, // Get maximum supported baud rate: + // valueP = MemPtr to UInt32 for returned baud + // *valueLenP = sizeof(UInt32) + + serCtlHandshakeThreshold, // retrieve HW handshake threshold; this is the maximum baud rate + // which does not require hardware handshaking + // valueP = MemPtr to UInt32 for returned baud + // *valueLenP = sizeof(UInt32) + + serCtlEmuSetBlockingHook, // Set a blocking hook routine FOR EMULATION + // MODE ONLY - NOT SUPPORTED ON THE PILOT + //PASS: + // valueP = MemPtr to SerCallbackEntryType + // *valueLenP = sizeof(SerCallbackEntryType) + //RETURNS: + // the old settings in the first argument + + + serCtlIrDAEnable, // Enable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + serCtlIrDADisable, // Disable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + serCtlIrScanningOn, // Start Ir Scanning mode + + serCtlIrScanningOff, // Stop Ir Scanning mode + + serCtlRxEnable, // enable receiver ( for IrDA ) + + serCtlRxDisable, // disable receiver ( for IrDA ) + + serCtlLAST // ADD NEW ENTRIES BEFORE THIS ONE + } SerCtlEnum; + + +// 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. +#define serCtlFirstCustomEntry 0xA800 + +/******************************************************************** + * Serial Library Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Used by mac applications to map the pilot serial port to a particular +// macintosh port. +UInt16 SerSetMapPort( UInt16 pilotPort, UInt16 macPort ); + +// Acquires and opens a serial port with given baud and default settings. +Err SerOpen(UInt16 refNum, UInt16 port, UInt32 baud) + SYS_TRAP(sysLibTrapOpen); + +// Used by debugger to re-initialize serial port if necessary +Err SerDbgAssureOpen(UInt16 refNum, UInt16 port, UInt32 baud); + +// Closes the serial connection previously opened with SerOpen. +Err SerClose(UInt16 refNum) + SYS_TRAP(sysLibTrapClose); + +// Puts serial library to sleep +Err SerSleep(UInt16 refNum) + SYS_TRAP(sysLibTrapSleep); + +// Wake Serial library +Err SerWake(UInt16 refNum) + SYS_TRAP(sysLibTrapWake); + +// Get attributes of the serial connection +Err SerGetSettings(UInt16 refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom); + +// Set attributes of the serial connection +Err SerSetSettings(UInt16 refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom+1); + +// Return status of serial connection +UInt16 SerGetStatus(UInt16 refNum, Boolean * ctsOnP, + Boolean * dsrOnP) + SYS_TRAP(sysLibTrapCustom+2); + +// Reset error condition of serial connection +Err SerClearErr(UInt16 refNum) + SYS_TRAP(sysLibTrapCustom+3); + + + + +// Sends a buffer of data (may queue it up and return). +Err SerSend10(UInt16 refNum, void * bufP, UInt32 size) + SYS_TRAP(sysLibTrapCustom+4); + +// Waits until the serial transmit buffer empties. +// The timeout arg is ignored; CTS timeout is used +Err SerSendWait(UInt16 refNum, Int32 timeout) + SYS_TRAP(sysLibTrapCustom+5); + +// Returns how many characters are left in the send queue waiting +// for transmission +Err SerSendCheck(UInt16 refNum, UInt32 * numBytesP) + SYS_TRAP(sysLibTrapCustom+6); + +// Flushes the data out of the transmit buffer +Err SerSendFlush(UInt16 refNum) + SYS_TRAP(sysLibTrapCustom+7); + + + + +// Receives a buffer of data of the given size. +Err SerReceive10(UInt16 refNum, void * bufP, UInt32 bytes, Int32 timeout) + SYS_TRAP(sysLibTrapCustom+8); + +// Waits for at least 'bytes' bytes of data to arrive at the serial input. +// but does not read them in +Err SerReceiveWait(UInt16 refNum, UInt32 bytes, Int32 timeout) + SYS_TRAP(sysLibTrapCustom+9); + +// Returns how many characters are in the receive queue +Err SerReceiveCheck(UInt16 refNum, UInt32 * numBytesP) + SYS_TRAP(sysLibTrapCustom+10); + +// Flushes any data coming into the serial port, discarding the data. +void SerReceiveFlush(UInt16 refNum, Int32 timeout) + SYS_TRAP(sysLibTrapCustom+11); + + +// Specify a new input buffer. To restore the original buffer, pass +// bufSize = 0. +Err SerSetReceiveBuffer(UInt16 refNum, void * bufP, UInt16 bufSize) + SYS_TRAP(sysLibTrapCustom+12); + + +// The receive character interrupt service routine, called by kernel when +// a UART interrupt is detected. +Boolean SerReceiveISP(void) + SYS_TRAP(sysTrapSerReceiveISP); + + + +// "Back Door" into the serial receive queue. Used by applications (like TCP Media layers) +// that need faster access to received characters +Err SerReceiveWindowOpen(UInt16 refNum, UInt8 ** bufPP, UInt32 * sizeP) + SYS_TRAP(sysLibTrapCustom+13); + +Err SerReceiveWindowClose(UInt16 refNum, UInt32 bytesPulled) + SYS_TRAP(sysLibTrapCustom+14); + +// Can be called by applications that need an alternate wakeup mechanism +// when characters get enqueued by the interrupt routine. +Err SerSetWakeupHandler(UInt16 refNum, SerWakeupHandler procP, + UInt32 refCon) + SYS_TRAP(sysLibTrapCustom+15); + +// Called to prime wakeup handler +Err SerPrimeWakeupHandler(UInt16 refNum, UInt16 minBytes) + SYS_TRAP(sysLibTrapCustom+16); + +// Called to perform a serial manager control operation +// (v2.0 extension) +Err SerControl(UInt16 refNum, UInt16 op, void * valueP, UInt16 * valueLenP) + SYS_TRAP(sysLibTrapCustom+17); + + +// Sends a buffer of data (may queue it up and return). +UInt32 SerSend(UInt16 refNum, void * bufP, UInt32 count, Err* errP) + SYS_TRAP(sysLibTrapCustom+18); + +// Receives a buffer of data of the given size. +UInt32 SerReceive(UInt16 refNum, void * bufP, UInt32 count, Int32 timeout, Err* errP) + SYS_TRAP(sysLibTrapCustom+19); + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIALMGROLD_H_ + diff --git a/sdk-3.5/include/Core/System/SerialSdrv.h b/sdk-3.5/include/Core/System/SerialSdrv.h new file mode 100644 index 0000000..56d4623 --- /dev/null +++ b/sdk-3.5/include/Core/System/SerialSdrv.h @@ -0,0 +1,147 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SerialSdrv.h + * + * Description: + * Constants and data structures for serial drvr ('sdrv') code. + * + * History: + * 5/11/98 Created by Ben Manuto + * + *****************************************************************************/ + +#ifndef __SERIALSDRV_H__ +#define __SERIALSDRV_H__ + +#include +#include + +#include + +#include + + +// ĽĽĽĽĽĽĽĽĽĽ Constants + +#define kSdrvResType 'sdrv' + + +// ĽĽĽĽĽĽĽĽĽĽ Typdefs + +typedef enum SdrvCtlOpCodeEnum { // Control function opCodes + sdrvOpCodeNoOp = 0, + sdrvOpCodeSetBaudRate = 0x1000, // Set baud rate + sdrvOpCodeSetSettingsFlags, // Set port send/rcv settings. + sdrvOpCodeClearErr, // Clear any HW errors. + sdrvOpCodeEnableUART, // Enable the UART. + sdrvOpCodeDisableUART, // Disable the UART. + sdrvOpCodeEnableUARTInterrupts, // Enable the UART interrupts. + sdrvOpCodeDisableUARTInterrupts, // Disable the UART interrupts. + sdrvOpCodeSetSleepMode, // Put the HW in sleep mode. + sdrvOpCodeSetWakeupMode, // Wake the HW from sleep mode. + sdrvOpCodeRxEnable, // Enable the RX lines. + sdrvOpCodeRxDisable, // Disbale the RX lines. + sdrvOpCodeLineEnable, // Enable the RS-232 lines. + sdrvOpCodeFIFOCount, // Return bytes in HW FIFO. + sdrvOpCodeEnableIRDA, // Enable the IR mode for the UART. + sdrvOpCodeDisableIRDA, // Disable the IR mode for the UART. + sdrvOpCodeStartBreak, // Start a break signal. + sdrvOpCodeStopBreak, // Stop a break signal. + sdrvOpCodeStartLoopback, // Start loopback mode. + sdrvOpCodeStopLoopback, // Stop loopback mode. + sdrvOpCodeFlushTxFIFO, // Flush HW TX FIFO. + sdrvOpCodeFlushRxFIFO, // Flsuh HW RX FIFO. + sdrvOpCodeGetOptTransmitSize, // Get HW optimal buffer size. + sdrvOpCodeEnableRTS, // De-assert the RTS line to allow data to be received. + sdrvOpCodeDisableRTS, // Assert the RTS line to prevent rcv buffer overflows. + sdrvOpCodeSetDTRAsserted, // Assert or deassert DTR signal + sdrvOpCodeGetDTRAsserted, // Yields 'true' if DTR is asserted, 'false' otherwise. + + // --- Insert new control code above this line + sdrvOpCodeUserDef = 0x2000 +} SdrvCtlOpCodeEnum; + + +typedef void *SdrvDataPtr; + +#if EMULATION_LEVEL == EMULATION_NONE && !defined(__GNUC__) + +typedef void (*SerialMgrISPProcPtr)(void *portP:__A0); + +typedef Err (*SdrvOpenProcPtr)(SdrvDataPtr *drvrDataP, + UInt32 baudRate, + void *portP, + SerialMgrISPProcPtr saveDataProc); +typedef Err (*SdrvCloseProcPtr)(SdrvDataPtr drvrDataP); +typedef Err (*SdrvControlProcPtr)(SdrvDataPtr drvrDataP, + SdrvCtlOpCodeEnum controlCode, + void *controlDataP, + UInt16 *controlDataLenP); +typedef UInt16 (*SdrvStatusProcPtr)(SdrvDataPtr drvrDataP); +typedef UInt16 (*SdrvReadCharProcPtr)(SdrvDataPtr drvrDataP:__A0):__D0; +typedef Err (*SdrvWriteCharProcPtr)(SdrvDataPtr drvrDataP, UInt8 aChar); + +#else +typedef void (*SerialMgrISPProcPtr)(void *portP); +typedef Err (*SdrvOpenProcPtr)(SdrvDataPtr *drvrDataP, + UInt32 baudRate, + void *portP, + void *saveDataProc); +typedef Err (*SdrvCloseProcPtr)(SdrvDataPtr drvrDataP); +typedef Err (*SdrvControlProcPtr)(SdrvDataPtr drvrDataP, + SdrvCtlOpCodeEnum controlCode, + void *controlDataP, + UInt16 *controlDataLenP); +typedef UInt16 (*SdrvStatusProcPtr)(SdrvDataPtr drvrDataP); +typedef UInt16 (*SdrvReadCharProcPtr)(SdrvDataPtr drvrDataP); +typedef Err (*SdrvWriteCharProcPtr)(SdrvDataPtr drvrDataP, UInt8 aChar); +#endif + + +typedef struct { + SdrvOpenProcPtr drvOpen; + SdrvCloseProcPtr drvClose; + SdrvControlProcPtr drvControl; + SdrvStatusProcPtr drvStatus; + SdrvReadCharProcPtr drvReadChar; + SdrvWriteCharProcPtr drvWriteChar; +} SdrvAPIType; + +typedef SdrvAPIType *SdrvAPIPtr; + + +// Normally, serial drvr functions are accessed (by the NewSerialMgr) +// through the above SdrvAPIType structure of ProcPtrs. + +// However, SerialMgrDbg.c (the Serial Mgr linked to the boot/debugger code) +// needs to call the HAL's debug serial code through the HAL_CALL macro. + + +Err DrvOpen(SdrvDataPtr *drvrData, UInt32 baudRate, void *portP, + SerialMgrISPProcPtr saveDataProc) + HAL_CALL(sysTrapDbgSerDrvOpen); + +Err DrvClose(SdrvDataPtr drvrData) + HAL_CALL(sysTrapDbgSerDrvClose); + +Err DrvControl(SdrvDataPtr drvrData, SdrvCtlOpCodeEnum controlCode, + void *controlData, UInt16 *controlDataLen) + HAL_CALL(sysTrapDbgSerDrvControl); + +UInt16 DrvStatus(SdrvDataPtr drvrData) + HAL_CALL(sysTrapDbgSerDrvStatus); + +Err DrvWriteChar(SdrvDataPtr drvrData, UInt8 aChar) + HAL_CALL(sysTrapDbgSerDrvWriteChar); + +#if EMULATION_LEVEL == EMULATION_NONE && !defined(__GNUC__) +#pragma parameter __D0 DrvReadChar(__A0) +#endif +UInt16 DrvReadChar(SdrvDataPtr drvrData) + HAL_CALL(sysTrapDbgSerDrvReadChar); + +#endif // __SERIALSDRV_H__ + diff --git a/sdk-3.5/include/Core/System/SerialVdrv.h b/sdk-3.5/include/Core/System/SerialVdrv.h new file mode 100644 index 0000000..0c99a3a --- /dev/null +++ b/sdk-3.5/include/Core/System/SerialVdrv.h @@ -0,0 +1,86 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SerialVdrv.h + * + * Description: + * Constants and data structures for virtual driver ('vdrv') code. + * + * History: + * 5/11/98 Created by Ben Manuto + * + *****************************************************************************/ + +#ifndef __SERIALVDRV_H__ +#define __SERIALVDRV_H__ + +#include +#include +#include + + +// ********** Constants + +#define kVdrvResType 'vdrv' + + +// ********** Typedefs + +typedef enum VdrvCtlOpCodeEnum { // Control function opCodes + vdrvOpCodeNoOp = 0, + vdrvOpCodeSetBaudRate = 0x1000, // Set the port's baud rate. + vdrvOpCodeSetSettingsFlags, // Set the ports send/rvc settings + vdrvOpCodeSetCtsTimeout, // The HW handshake timeout. + vdrvOpCodeClearErr, // Clear any HW errors. + vdrvOpCodeSetSleepMode, // Put in sleep mode. + vdrvOpCodeSetWakeupMode, // Wake from sleep mode. + vdrvOpCodeFIFOCount, // Return bytes in FIFO + vdrvOpCodeStartBreak, // Start a break signal. + vdrvOpCodeStopBreak, // Stop a break signal + vdrvOpCodeStartLoopback, // Start loopback mode. + vdrvOpCodeStopLoopback, // Stop loopback mode. + vdrvOpCodeFlushTxFIFO, // Flush the TX FIFO. + vdrvOpCodeFlushRxFIFO, // Flush the RX FIFO. + vdrvOpCodeSendBufferedData, // Send any buffered data in e vdrv. + vdrvOpCodeRcvCheckIdle, // Check idle state. + vdrvOpCodeEmuSetBlockingHook, // Special opCode for the simulator. + vdrvOpCodeGetOptTransmitSize, // Get the optimal TX buffer size for this port. + vdrvOpCodeGetMaxRcvBlockSize, // Get the optimal RX buffer size for this port. + vdrvOpCodeNotifyBytesReadFromQ, // Notify the vdrv bytes have been removed from Q. + vdrvOpCodeSetDTRAsserted, // Assert or deassert DTR signal + vdrvOpCodeGetDTRAsserted, // Yields 'true' if DTR is asserted, 'false' otherwise. + + // --- Insert new control code above this line + vdrvOpCodeUserDef = 0x2000 +} VdrvCtlOpCodeEnum; + +typedef void *VdrvDataPtr; + +typedef Err (*VdrvOpenProcPtr)(VdrvDataPtr *drvrDataP, UInt32 baudRate, DrvrHWRcvQPtr rcvQP); +typedef Err (*VdrvCloseProcPtr)(VdrvDataPtr drvrDataP); + +typedef UInt16 (*VdrvStatusProcPtr)(VdrvDataPtr drvrDataP); +typedef Err (*VdrvControlProcPtr)(VdrvDataPtr drvrDataP, + VdrvCtlOpCodeEnum controlCode, + void *controlDataP, + UInt16 *controlDataLenP); + +typedef Err (*VdrvReadProcPtr)(VdrvDataPtr drvrDataP, void **bufP, UInt32 *sizeP); +typedef UInt32 (*VdrvWriteProcPtr)(VdrvDataPtr drvrDataP, void *bufP, UInt32 size, Err *errP); + + +typedef struct { + VdrvOpenProcPtr drvOpen; + VdrvCloseProcPtr drvClose; + VdrvControlProcPtr drvControl; + VdrvStatusProcPtr drvStatus; + VdrvReadProcPtr drvRead; + VdrvWriteProcPtr drvWrite; +} VdrvAPIType; + +typedef VdrvAPIType *VdrvAPIPtr; + +#endif // __SERIALVDRV_H__ + diff --git a/sdk-3.5/include/Core/System/SoundMgr.h b/sdk-3.5/include/Core/System/SoundMgr.h new file mode 100644 index 0000000..823672f --- /dev/null +++ b/sdk-3.5/include/Core/System/SoundMgr.h @@ -0,0 +1,315 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SoundMgr.h + * + * Description: + * Include file for Sound Manager + * + * History: + * 4/11/95 VMK - Created by Vitaly Kruglikov + * + *****************************************************************************/ + +#ifndef __SOUNDMGR_H__ +#define __SOUNDMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + +#include + + +/************************************************************ + * Sound Manager constants + * + *************************************************************/ + +// Sound Manager max and default volume levels +#define sndMaxAmp 64 +//#define sndVolumeMask 0x0ff +#define sndDefaultAmp sndMaxAmp + +#define sndMidiNameLength 32 // MIDI track name length *including* NULL terminator + + +/************************************************************ + * Sound Manager data structures + * + *************************************************************/ + +// +// Command numbers for SndCommandType's cmd field +// +typedef enum SndCmdIDType { + + sndCmdFreqDurationAmp = 1, // play a sound, blocking for the entire duration (except for zero amplitude) + // param1 = frequency in Hz + // param2 = duration in milliseconds + // param3 = amplitude (0 - sndMaxAmp); if 0, will return immediately + + // Commands added in PilotOS v3.0 + // ***IMPORTANT*** + // Please note that SndDoCmd() in PilotOS before v3.0 will Fatal Error on unknown + // commands (anything other than sndCmdFreqDurationAmp). For this reason, + // applications wishing to take advantage of these new commands while staying + // compatible with the earlier version of the OS, _must_ avoid using these commands + // when running on OS versions less thatn v3.0 (see sysFtrNumROMVersion in SystemMgr.h). + // Beginning with v3.0, SndDoCmd has been fixed to return sndErrBadParam when an + // unknown command is passed. + // + sndCmdNoteOn, // start a sound given its MIDI key index, max duration and velocity; + // the call will not wait for the sound to complete, returning imeediately; + // any other sound play request made before this one completes will interrupt it. + // param1 = MIDI key index (0-127) + // param2 = maximum duration in milliseconds + // param3 = velocity (0 - 127) (will be interpolated as amplitude) + + sndCmdFrqOn, // start a sound given its frequency in Hz, max duration and amplitude; + // the call will not wait for the sound to complete, returning imeediately; + // any other sound play request made before this one completes will interrupt it. + // param1 = frequency in Hz + // param2 = maximum duration in milliseconds + // param3 = amplitude (0 - sndMaxAmp) + + sndCmdQuiet // stop current sound + // param1 = 0 + // param2 = 0 + // param3 = 0 + + } SndCmdIDType; + + + + +// +// SndCommandType: used by SndDoCmd() +// + +typedef struct SndCommandType { +SndCmdIDType cmd; // command id +UInt8 reserved; +Int32 param1; // first parameter +UInt16 param2; // second parameter +UInt16 param3; // third parameter +} SndCommandType; + +typedef SndCommandType* SndCommandPtr; + + +// +// Beep numbers used by SndSysBeep() +// + +typedef enum SndSysBeepType { + sndInfo = 1, + sndWarning, + sndError, + sndStartUp, + sndAlarm, + sndConfirmation, + sndClick + } SndSysBeepType; + + +/************************************************************ + * Standard MIDI File (SMF) support structures + *************************************************************/ + + +// Structure of records in the MIDI sound database: +// +// Each MIDI record consists of a record header followed immediately by the +// Standard MIDI File (SMF) data stream. Only SMF format #0 is presently supported. +// The first byte of the record header is the byte offset from the beginning of the record +// to the SMF data stream. The name of the record follows the byte offset +// field. sndMidiNameLength is the limit on name size (including NULL). +#define sndMidiRecSignature 'PMrc' +typedef struct SndMidiRecHdrType { + UInt32 signature; // set to sndMidiRecSignature + UInt8 bDataOffset; // offset from the beginning of the record + // to the Standard Midi File data stream + UInt8 reserved; // set to zero + } SndMidiRecHdrType; + +typedef struct SndMidiRecType { + SndMidiRecHdrType hdr; // offset from the beginning of the record + // to the Standard Midi File data stream + Char name[2]; // Track name: 1 or more chars including NULL terminator. + // If a track has no name, the NULL character must still + // be provided. + // Set to 2 to pad the structure out to a word boundary. + } SndMidiRecType; + + +// Midi records found by SndCreateMidiList. +typedef struct SndMidiListItemType + { + Char name[sndMidiNameLength]; // including NULL terminator + UInt32 uniqueRecID; + LocalID dbID; + UInt16 cardNo; + } SndMidiListItemType; + + +// Commands for SndPlaySmf +typedef enum SndSmfCmdEnum { + sndSmfCmdPlay = 1, // play the selection + sndSmfCmdDuration // get the duration in milliseconds of the entire track + } SndSmfCmdEnum; + +typedef void SndComplFuncType(void *chanP, UInt32 dwUserData); +typedef SndComplFuncType *SndComplFuncPtr; + + +// Return true to continue, false to abort +typedef Boolean SndBlockingFuncType(void *chanP, UInt32 dwUserData, Int32 sysTicksAvailable); +typedef SndBlockingFuncType *SndBlockingFuncPtr; + +typedef struct SndCallbackInfoType { + MemPtr funcP; // pointer to the callback function (NULL = no function) + UInt32 dwUserData; // value to be passed in the dwUserData parameter of the callback function + } SndCallbackInfoType; + + +typedef struct SndSmfCallbacksType { + SndCallbackInfoType completion; // completion callback function (see SndComplFuncType) + SndCallbackInfoType blocking; // blocking hook callback function (see SndBlockingFuncType) + SndCallbackInfoType reserved; // RESERVED -- SET ALL FIELDS TO ZERO BEFORE PASSING + } SndSmfCallbacksType; + + +#define sndSmfPlayAllMilliSec 0xFFFFFFFFUL + +typedef struct SndSmfOptionsType { + // dwStartMilliSec and dwEndMilliSec are used as inputs to the function for sndSmfCmdPlay and as + // outputs for sndSmfCmdDuration + UInt32 dwStartMilliSec; // 0 = "start from the beginning" + UInt32 dwEndMilliSec; // sndSmfPlayAllMilliSec = "play the entire track"; + // the default is "play entire track" if this structure + // is not passed in + + // The amplitude and interruptible fields are used only for sndSmfCmdPlay + UInt16 amplitude; // relative volume: 0 - sndMaxAmp, inclusively; the default is + // sndMaxAmp if this structure is not passed in; if 0, the play will + // be skipped and the call will return immediately + + Boolean interruptible; // if true, sound play will be interrupted if + // user interacts with the controls (digitizer, buttons, etc.); + // if false, the paly will not be interrupted; the default behavior + // is "interruptible" if this structure is not passed in + + UInt8 reserved1; + UInt32 reserved; // RESERVED! -- MUST SET TO ZERO BEFORE PASSING + } SndSmfOptionsType; + + +typedef struct SndSmfChanRangeType { + UInt8 bFirstChan; // first MIDI channel (0-15 decimal) + UInt8 bLastChan; // last MIDI channel (0-15 decimal) + } SndSmfChanRangeType; + + + + +/************************************************************ + * Sound Manager result codes + * (sndErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define sndErrBadParam (sndErrorClass | 1) +#define sndErrBadChannel (sndErrorClass | 2) +#define sndErrMemory (sndErrorClass | 3) +#define sndErrOpen (sndErrorClass | 4) +#define sndErrQFull (sndErrorClass | 5) +#define sndErrQEmpty (sndErrorClass | 6) // internal +#define sndErrFormat (sndErrorClass | 7) // unsupported data format +#define sndErrBadStream (sndErrorClass | 8) // invalid data stream +#define sndErrInterrupted (sndErrorClass | 9) // play was interrupted + + + +/******************************************************************** + * Sound Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- + +// Initializes the Sound Manager. Should only be called by +// Pilot initialization code. +Err SndInit(void) SYS_TRAP(sysTrapSndInit); + +// Frees the Sound Manager. +//void SndFree(void) SYS_TRAP(sysTrapSndFree); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// Sets default sound volume levels +// +// Any parameter may be passed as NULL +extern void SndSetDefaultVolume(UInt16 *alarmAmpP, UInt16 *sysAmpP, UInt16 *defAmpP) + SYS_TRAP(sysTrapSndSetDefaultVolume); + +// Gets default sound volume levels +// +// Any parameter may be passed as NULL +extern void SndGetDefaultVolume(UInt16 *alarmAmpP, UInt16 *sysAmpP, UInt16 *masterAmpP) + SYS_TRAP(sysTrapSndGetDefaultVolume); + +// Executes a sound command on the given sound channel (pass +// channelP = 0 to use the shared channel). +extern Err SndDoCmd(void * /*SndChanPtr*/ channelP, SndCommandPtr cmdP, Boolean noWait) + SYS_TRAP(sysTrapSndDoCmd); + +// Plays one of several defined system beeps/sounds (see sndSysBeep... +// constants). +extern void SndPlaySystemSound(SndSysBeepType beepID) + SYS_TRAP(sysTrapSndPlaySystemSound); + + +// NEW FOR v3.0 +// Performs an operation on a Standard MIDI File (SMF) Format #0 +extern Err SndPlaySmf(void *chanP, SndSmfCmdEnum cmd, UInt8 *smfP, SndSmfOptionsType *selP, + SndSmfChanRangeType *chanRangeP, SndSmfCallbacksType *callbacksP, + Boolean bNoWait) + SYS_TRAP(sysTrapSndPlaySmf); + +// NEW FOR v3.0 +// Creates a list of all midi records. Useful for displaying in lists. +// For creator wildcard, pass creator=0; +extern Boolean SndCreateMidiList(UInt32 creator, Boolean multipleDBs, UInt16 *wCountP, MemHandle *entHP) + SYS_TRAP(sysTrapSndCreateMidiList); + +// NEW FOR v3.2 +// Plays a MIDI sound which is read out of an open resource database +extern Err SndPlaySmfResource(UInt32 resType, Int16 resID, SystemPreferencesChoice volumeSelector) + SYS_TRAP(sysTrapSndPlaySmfResource); + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Sound Manager Macros + * + *************************************************************/ + +#endif // __SOUND_MGR_H__ + diff --git a/sdk-3.5/include/Core/System/StdIOPalm.h b/sdk-3.5/include/Core/System/StdIOPalm.h new file mode 100644 index 0000000..ed42046 --- /dev/null +++ b/sdk-3.5/include/Core/System/StdIOPalm.h @@ -0,0 +1,231 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: StdIOPalm.h + * + * Description: + * This header file must be included by Palm standard IO apps so that they + * can use primitive standard IO functions like printf, getchar(), etc. + * + *****************************************************************************/ + +/* + * A PalmOS standard IO app is built like a normal PalmOS app but has + * a database type of 'sdio' instead of 'appl'. In addition, it must + * be named "Cmd-" where is the name of the command that + * users will enter to execute the app. For example, the 'ping' command + * would be placed in a database named "Cmd-ping". + * + * In order to run a PalmOS standard IO app, a regular PalmOS app + * must be running first that provides a window for the output. This type + * of app is called a StdIO Provider. The StdIO Provider launches the + * stdio app when the user types in a command line and "hits" enter. + * The provider app passes a structure pointer that contains the callbacks + * necessary for performing IO to the stdio app through the cmdPBP parameter + * of PilotMain. + * + * In addition to including this header, standard IO apps must link with + * the module :Libraries:PalmOS:Src:StdIOPalm.c. This module provides a PilotMain + * that extracts the command line arguments from the cmd and + * cmdPBP parameters and the glue code necessary for jumping through the + * appropriate callbacks provided by the StdIO provider. + * + * + * A minimal PalmOS stdio app's source file might look like this: + *------------------------------------------------------------------------- + + #include + + // When compiling for the device, the entry point must be called SioMain(). + #if EMULATION_LEVEL == EMULATION_NONE + #define MyHello SioMain + #endif + + Int16 MyHello(UInt16 argc, char* argv[]) + { + printf("\nHello World"); + } + + *------------------------------------------------------------------------- + * + * Notice that the bulk of the code is in a routine named MyHello() this is + * so the routine can easily be called and tested using the Simulator. + * + * When compiling for the viewer though, MyHello is renamed to SioMain(). + * This is the assumed entry point used by the StdIOPalm.c glue code when it + * is compiled for the viewer. + * + * HISTORY: + * 5-6-98 RM Created by Ron Marianetti + * + **********************************************************************/ +#ifndef __STDIOPALM_H__ +#define __STDIOPALM_H__ + +// Define this so we don't get the standard stuff +#define _STDIO_H + +// Get PalmOS includes +#include +#include // for _Palm_va_list + + +// All PalmOS Standard IO apps have the following database type +#define sioDBType 'sdio' + + +// Stub out the "FILE" type until we support real file IO +typedef void FILE; + + + +/******************************************************************* + * C Standard IO macros and functions + ********************************************************************/ + + +// We don't support re-direction yet, stdin is always the keyboard and +// stdout is always the stdio window. +#define stdin ((FILE*)0) +#define stdout ((FILE*)1) +#define stderr ((FILE*)2) + +#ifndef EOF +#define EOF -1 +#endif + + +//------------------------------------------------------------------------ +// Functions provided in the StdIOPalm.c module which must be linked in with +// the application source. +//------------------------------------------------------------------------ +#ifdef __cplusplus +extern "C" { +#endif + +// Your "main" entry point must have these calling conventions and +// must be named "SioMain". +Int16 SioMain(UInt16 argc, Char * argv[]); +typedef Int16 (*SioMainProcPtr)(UInt16 argc, Char * argv[]); + + +// This routine can be used to add your command to a simulator app +// that is a StdIO provider. It registers the command name and it's +// procedure pointer as a built-in command. THis is necessary in order +// to test under the Simulator because it doesn't support executing +// other databases. +void SioAddCommand(Char * cmdStr, SioMainProcPtr cmdProcP); + + +// File IO routines +Int16 Siofgetc (FILE* fs); +Char * Siofgets (Char * strP, UInt16 maxChars, FILE* fs); +Int16 Siofputc (Int16 c, FILE* fs); +Int16 Siofputs (const Char * strP, FILE* fs); +Int16 Siofprintf(FILE* fs, const Char * formatP, ...); +Int16 Siovfprintf(FILE* fs, const Char * formatP, _Palm_va_list args); + + +// stdin/stdout IO routines +Int16 Sioprintf(const Char * formatP, ...); +Int16 Sioputs(const Char * strP); +Char * Siogets(Char * strP); + + +// Execute a command line of text +Int16 Siosystem(const Char * cmdStrP); + +#ifdef __cplusplus +} +#endif + + + +//------------------------------------------------------------------------ +// Macros. +// If you don't want to use the C stdio names, define STDIO_PALM_NATIVE_NAMES_ONLY +// before including this header. You might want to do this for apps that +// run in the simulator that want to use the Desktops stdio library as well +// as the Palm stdio library from the same module. +//------------------------------------------------------------------------ +#ifndef STDIO_PALM_NATIVE_NAMES_ONLY +#define fgetc(fs) Siofgetc(fs) +#define fgets(strP,maxChars,fs) Siofgets(strP,maxChars,fs) +#define fputc(c,fs) Siofputc(c,fs) +#define fputs(strP,fs) Siofputs(strP,fs) +#define fprintf Siofprintf +#define vfprintf(fs,formatP,args) Siovfprintf(fs,formatP,args) + +#define printf Sioprintf +#define puts(strP) Sioputs(strP) +#define gets(strP) Siogets(strP) + +#define getchar() Siofgetc(stdin) +#define putc(c,fs) Siofputc(c,fs) +#define putchar(c) Siofputc(c, stdout) + +#define sprintf StrPrintF +#define vsprintf(x,y,z) StrVPrintF(x,(const Char *)y,z) + +#define system(strP) Siosystem(strP) + +#endif //STDIO_PALM_NATIVE_NAMES_ONLY + +#endif //__STDIOPALM_H__ + + +/* This is outside the "#ifndef __STDIOPALM_H__" so that StdIOProvider.h + can pick it up even if StdIOPalm.h has already been included. */ +#if defined(_STDIO_PALM_C_) && !defined(__STDIOPALM_H__SIOGLOBALS__) +#define __STDIOPALM_H__SIOGLOBALS__ +/********************************************************** + * Structure of stdio parameters that are pointed to by the + * application global GAppSioGlobalsP. In stdio apps, this application + * global gets initialized from the cmdPBP parameter to PilotMain. + * + * The stdio provider that launches the stdio app must create this + * structure and initialize it. + * + * NOTE: This structure should be considered for PRIVATE use + * by the StdIOPalm.c module only. Your source code should not + * reference it + ********************************************************************/ + +typedef struct SioGlobalsType { + // size of this structure, used for version matching/checking + // and flags. + UInt16 size; + UInt32 flags; + + // argc, argv parameters to this command + UInt16 argc; + Char ** argv; + + + // Basic standard IO procedure pointers which are filled in + // by the standard IO provider application. These are the + // callbacks available in the first rev. + Int16 (*fgetcProcP) (void* sioGP, FILE* fs); + Char * (*fgetsProcP) (void* sioGP, Char * strP, UInt16 n, FILE* fs); + + Int16 (*fputcProcP) (void* sioGP, Int16 c, FILE* fs); + Int16 (*fputsProcP) (void* sioGP, const Char * strP, FILE* fs); + + Int16 (*vfprintfProcP) (void* sioGP, FILE* fs, + const Char * formatP, _Palm_va_list args); + + Int16 (*systemProcP) (void* sioGP, const Char * strP); + + + // Standard IO provider private data follows this structure + // UInt8 private[]; + } SioGlobalsType, *SioGlobalsPtr; + + +// This global is declared in StdIOPalm.c which must be linked in with any +// stdio app. +extern SioGlobalsPtr GAppSioGlobalsP; +#endif + diff --git a/sdk-3.5/include/Core/System/StdIOProvider.h b/sdk-3.5/include/Core/System/StdIOProvider.h new file mode 100644 index 0000000..0792966 --- /dev/null +++ b/sdk-3.5/include/Core/System/StdIOProvider.h @@ -0,0 +1,68 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: StdIOProvider.h + * + * Description: + * This header file must be included by apps that want to provide + * a standard IO window and "execute" standard IO apps in it. See the + * comments in the file "StdIOProvier.c" for more info + * + *****************************************************************************/ + +#ifndef __STDIOPROVIDER_H__ +#define __STDIOPROVIDER_H__ + +#define _STDIO_PALM_C_ + +#include +#include +#include + + +/**************************************************************** + * Provider SioGlobalsType includes the client visible fields + * in the beginning + ****************************************************************/ +typedef struct { + SioGlobalsType client; + + UInt32 provA5; // saved A5 register + + MemHandle textH; // holds latest text + UInt16 formID; // Form ID that contains text field + UInt16 fieldID; // Field ID + UInt16 scrollerID; + Boolean echo; + + UInt8 reserved; + } SioProvGlobalsType, *SioProvGlobalsPtr; + + + +/******************************************************************* + * Function Prototypes + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err SioInit(UInt16 formID, UInt16 fieldID, UInt16 scrollerID); +Err SioFree(void); +Boolean SioHandleEvent (SysEventType * eventP); + +// This routine will execute a command line. It is faster than +// using the "system()" call but can only be used by the +// StdIO provider app itself. +Int16 SioExecCommand(const Char * cmd); + +void SioClearScreen(void); + +#ifdef __cplusplus +} +#endif + +#endif //_STDIOPROVIDER_H_ + diff --git a/sdk-3.5/include/Core/System/StringMgr.h b/sdk-3.5/include/Core/System/StringMgr.h new file mode 100644 index 0000000..13dc40f --- /dev/null +++ b/sdk-3.5/include/Core/System/StringMgr.h @@ -0,0 +1,106 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: StringMgr.h + * + * 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. + * + *****************************************************************************/ + +#ifndef __STRINGMGR_H__ +#define __STRINGMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. +#if EMULATION_LEVEL == EMULATION_NONE +# define _Palm_va_list char * +#else +# define _Palm_va_list va_list +# include +#endif + +// Max length of string returned by StrIToA, for -2147483647, plus space +// for the terminating null. +#define maxStrIToALen 12 + +#ifdef __cplusplus +extern "C" { +#endif + +// String Manipulation routines +Char * StrCopy(Char *dst, const Char *src) + SYS_TRAP(sysTrapStrCopy); + +Char * StrNCopy(Char *dst, const Char *src, Int16 n) + SYS_TRAP(sysTrapStrNCopy); + +Char * StrCat(Char *dst, const Char *src) + SYS_TRAP(sysTrapStrCat); + +Char * StrNCat(Char *dst, const Char *src, Int16 n) + SYS_TRAP(sysTrapStrNCat); + +Int16 StrLen(const Char *src) + SYS_TRAP(sysTrapStrLen); + +Int16 StrCompare(const Char *s1, const Char *s2) + SYS_TRAP(sysTrapStrCompare); + +Int16 StrNCompare(const Char *s1, const Char *s2, Int32 n) + SYS_TRAP(sysTrapStrNCompare); + +Int16 StrCaselessCompare(const Char *s1, const Char *s2) + SYS_TRAP(sysTrapStrCaselessCompare); + +Int16 StrNCaselessCompare(const Char *s1, const Char *s2, Int32 n) + SYS_TRAP(sysTrapStrNCaselessCompare); + +Char * StrToLower(Char *dst, const Char *src) + SYS_TRAP(sysTrapStrToLower); + +Char * StrIToA(Char *s, Int32 i) + SYS_TRAP(sysTrapStrIToA); + +Char * StrIToH(Char *s, UInt32 i) + SYS_TRAP(sysTrapStrIToH); + +Char * StrLocalizeNumber(Char *s, Char thousandSeparator, Char decimalSeparator) + SYS_TRAP(sysTrapStrLocalizeNumber); + +Char * StrDelocalizeNumber(Char *s, Char thousandSeparator, Char decimalSeparator) + SYS_TRAP(sysTrapStrDelocalizeNumber); + +Char * StrChr (const Char *str, WChar chr) + SYS_TRAP(sysTrapStrChr); + +Char * StrStr (const Char *str, const Char *token) + SYS_TRAP(sysTrapStrStr); + +Int32 StrAToI (const Char *str) + SYS_TRAP(sysTrapStrAToI); + +Int16 StrPrintF(Char *s, const Char *formatStr, ...) + SYS_TRAP(sysTrapStrPrintF); + +Int16 StrVPrintF(Char *s, const Char *formatStr, _Palm_va_list arg) + SYS_TRAP(sysTrapStrVPrintF); + +#ifdef __cplusplus +} +#endif + + + + +#endif //__STRINGMGR_H + diff --git a/sdk-3.5/include/Core/System/SysEvent.h b/sdk-3.5/include/Core/System/SysEvent.h new file mode 100644 index 0000000..09aeb88 --- /dev/null +++ b/sdk-3.5/include/Core/System/SysEvent.h @@ -0,0 +1,160 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SysEvent.h + * + * Description: + * This file defines event structures and routines. + * + * History: + * September 26, 1994 Created by Art Lamb + * 05/05/98 art Add Text Services event. + * 07/23/98 kwk Changed UInt16 field in keyDown event to WChar. + * 08/20/98 kwk Split tsmEvent into tsmConfirmEvent & tsmFepButtonEvent. + * 09/07/98 kwk Added EvtPeekEvent routine declaration. + * 10/13/98 kwk Removed EvtPeekEvent until API can be finalized. + * 03/11/99 grant Fixed types of pointers in SysEventType data fields. + * 05/31/99 kwk Added tsmFepModeEvent event. + * 07/14/99 jesse Moved UI structures & constants to Event.h + * defined ranges for future UI & system events. + * 07/30/99 kwk Moved TSM events here from Event.h + * 09/12/99 gap Add new multi-tap implementation + * 09/14/99 gap Removed EvtGetTrapState. + * + *****************************************************************************/ + +#ifndef __SYSEVENT_H__ +#define __SYSEVENT_H__ + +#include +#include +#include +#include +#include + + +typedef enum { + sysEventNilEvent = 0, + sysEventPenDownEvent, + sysEventPenUpEvent, + sysEventPenMoveEvent, + sysEventKeyDownEvent, + sysEventWinEnterEvent, + sysEventWinExitEvent, + sysEventAppStopEvent = 22, + sysEventTsmConfirmEvent = 35, + sysEventTsmFepButtonEvent, + sysEventTsmFepModeEvent, + + // add future UI level events in this numeric space + // to save room for new system level events + sysEventNextUIEvent = 0x0800, + + // Equates added for library events + sysEventFirstINetLibEvent = 0x1000, + sysEventFirstWebLibEvent = 0x1100, + + // Changed firstUserEvent from 32767 (0x7FFF) to 0x6000 + // Enums are signed ints, so 32767 technically only allowed for ONE event. + sysEventFirstUserEvent = 0x6000 +} SysEventsEnum; + + + +// keyDownEvent modifers +#define shiftKeyMask 0x0001 +#define capsLockMask 0x0002 +#define numLockMask 0x0004 +#define commandKeyMask 0x0008 +#define optionKeyMask 0x0010 +#define controlKeyMask 0x0020 +#define autoRepeatKeyMask 0x0040 // True if generated due to auto-repeat +#define doubleTapKeyMask 0x0080 // True if this is a double-tap event +#define poweredOnKeyMask 0x0100 // True if this is a double-tap event +#define appEvtHookKeyMask 0x0200 // True if this is an app hook key +#define libEvtHookKeyMask 0x0400 // True if this is a library hook key + +// define mask for all "virtual" keys +#define virtualKeyMask (appEvtHookKeyMask | libEvtHookKeyMask | commandKeyMask) + + +// Event timeouts +#define evtWaitForever -1 +#define evtNoWait 0 + +struct _GenericEventType { + UInt16 datum[8]; + }; + +struct _PenUpEventType { + PointType start; // display coord. of stroke start + PointType end; // display coord. of stroke start + }; + +struct _KeyDownEventType { + WChar chr; // ascii code + UInt16 keyCode; // virtual key code + UInt16 modifiers; + }; + +struct _WinEnterEventType { + WinHandle enterWindow; + WinHandle exitWindow; + }; + +struct _WinExitEventType { + WinHandle enterWindow; + WinHandle exitWindow; + }; + +struct _TSMConfirmType { + Char * yomiText; + UInt16 formID; + }; + +struct _TSMFepButtonType { + UInt16 buttonID; + }; + +struct _TSMFepModeEventType { + UInt16 mode; // DOLATER kwk - use real type for mode? + }; + + +// The event record. +typedef struct SysEventType { + SysEventsEnum eType; + Boolean penDown; + UInt8 tapCount; + Coord screenX; + Coord screenY; + union { + struct _GenericEventType generic; + + struct _PenUpEventType penUp; + struct _KeyDownEventType keyDown; + struct _WinEnterEventType winEnter; + struct _WinExitEventType winExit; + struct _TSMConfirmType tsmConfirm; + struct _TSMFepButtonType tsmFepButton; + struct _TSMFepModeEventType tsmFepMode; + + } data; + +} SysEventType; + + +// Events are stored in the event queue with some extra fields: +typedef struct { + SysEventType event; + UInt32 id; // used to support EvtAddUniqueEvent + } SysEventStoreType; + +#define PenGetPoint(a,b,c) EvtGetPen(a,b,c) + + + +#endif // __SYSEVENT_H__ + diff --git a/sdk-3.5/include/Core/System/SysEvtMgr.h b/sdk-3.5/include/Core/System/SysEvtMgr.h new file mode 100644 index 0000000..9648a74 --- /dev/null +++ b/sdk-3.5/include/Core/System/SysEvtMgr.h @@ -0,0 +1,251 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SysEvtMgr.h + * + * Description: + * Header for the System Event Manager + * + * History: + * 03/22/95 RM Created by Ron Marianetti + * 07/23/98 kwk Changed UInt16 param in EvtEnqueueKey to WChar. + * + *****************************************************************************/ + +#ifndef __SYSEVTMGR_H__ +#define __SYSEVTMGR_H__ + +#include +#include + +/************************************************************ + * System Event Manager Errors + *************************************************************/ +#define evtErrParamErr (evtErrorClass | 1) +#define evtErrQueueFull (evtErrorClass | 2) +#define evtErrQueueEmpty (evtErrorClass | 3) + + +/************************************************************ + * Commands for EvtSetAutoOffTimer() + *************************************************************/ +typedef enum +{ + SetAtLeast, // turn off in at least xxx seconds + SetExactly, // turn off in xxx seconds + SetAtMost, // turn off in at most xxx seconds + SetDefault, // change default auto-off timeout to xxx seconds + ResetTimer // reset the timer to the default auto-off timeout + +} EvtSetAutoOffCmd; + + +/************************************************************ + * Pen button info structure. This structure is used + * to hold the bounds of each button on the silk screen and + * the ascii code and modifiers byte that each will generate + * when tapped by the user. + *************************************************************/ +typedef struct PenBtnInfoType { + RectangleType boundsR; // bounding rectangle of button + WChar asciiCode; // ascii code for key event + UInt16 keyCode; // virtual key code for key event + UInt16 modifiers; // modifiers for key event + } PenBtnInfoType; +typedef PenBtnInfoType* PenBtnInfoPtr; + +typedef struct PenBtnListType { + UInt16 numButtons; // Count of number of buttons + PenBtnInfoType buttons[1]; // Placeholder for one or more buttons + } PenBtnListType; + + +/************************************************************ + * Silkscreen area info structure. An array of these structures + * is returned by the EvtGetSilkscreenAreaList function. + *************************************************************/ + +// Different types of rectangles on the display. For new vendor areas, +// the type should be set to the vendor's creator code, as assigned +// by 3Com's Partner Engineering group. +#define silkscreenRectScreen 'scrn' +#define silkscreenRectGraffiti 'graf' + +// Values for SilkscreenAreaType.index if areaType = silkscreenRectGraffiti +#define alphaGraffitiSilkscreenArea 0 +#define numericGraffitiSilkscreenArea 1 + +// One silkscreen area. The areaType field tells us which type of +// area it is, while the index field has different meanings depending +// on the area type. +typedef struct SilkscreenAreaType { + RectangleType bounds; + UInt32 areaType; // four byte creator code. + UInt16 index; + } SilkscreenAreaType; + + +/************************************************************ + * System Event Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err EvtSysInit(void) + SYS_TRAP(sysTrapEvtSysInit); + +// Return next "System" event. This routine will send strokes to Graffiti as necessary +// and return a key event. Otherwise, it will return a simple pen down or pen +// up event, or put the processor to sleep for a max time of 'timeout' if +// no events are available. +void EvtGetSysEvent(SysEventType *eventP, Int32 timeout) + SYS_TRAP(sysTrapEvtGetSysEvent); + + +// Return true if there is a low level system event (pen or key) available +Boolean EvtSysEventAvail(Boolean ignorePenUps) + SYS_TRAP(sysTrapEvtSysEventAvail); + + + +// Translate a stroke in the silk screen area to a key event +Err EvtProcessSoftKeyStroke(PointType *startPtP, PointType *endPtP) + SYS_TRAP(sysTrapEvtProcessSoftKeyStroke); + + +//----------------------------------------------------------------- +// Pen Queue Utilties +//------------------------------------------------------------------ + +// Replace current pen queue with another of the given size +Err EvtSetPenQueuePtr(MemPtr penQueueP, UInt32 size) + SYS_TRAP(sysTrapEvtSetPenQueuePtr); + +// Return size of current pen queue in bytes +UInt32 EvtPenQueueSize(void) + SYS_TRAP(sysTrapEvtPenQueueSize); + +// Flush the pen queue +Err EvtFlushPenQueue(void) + SYS_TRAP(sysTrapEvtFlushPenQueue); + + +// Append a point to the pen queue. Passing -1 for x and y means +// pen-up (terminate the current stroke). Called by digitizer interrupt routine +Err EvtEnqueuePenPoint(PointType *ptP) + SYS_TRAP(sysTrapEvtEnqueuePenPoint); + + +// Return the stroke info for the next stroke in the pen queue. This MUST +// be the first call when removing a stroke from the queue +Err EvtDequeuePenStrokeInfo(PointType *startPtP, PointType *endPtP) + SYS_TRAP(sysTrapEvtDequeuePenStrokeInfo); + +// Dequeue the next point from the pen queue. Returns non-0 if no +// more points. The point returned will be (-1,-1) at the end +// of the stroke. +Err EvtDequeuePenPoint(PointType *retP) + SYS_TRAP(sysTrapEvtDequeuePenPoint); + + +// Flush the entire stroke from the pen queue and dispose it +Err EvtFlushNextPenStroke() + SYS_TRAP(sysTrapEvtFlushNextPenStroke); + + + + +//----------------------------------------------------------------- +// Key Queue Utilties +//------------------------------------------------------------------ + +// Replace current key queue with another of the given size. This routine will +// intialize the given key queue before installing it +Err EvtSetKeyQueuePtr(MemPtr keyQueueP, UInt32 size) + SYS_TRAP(sysTrapEvtSetKeyQueuePtr); + +// Return size of current key queue in bytes +UInt32 EvtKeyQueueSize(void) + SYS_TRAP(sysTrapEvtKeyQueueSize); + +// Flush the key queue +Err EvtFlushKeyQueue(void) + SYS_TRAP(sysTrapEvtFlushKeyQueue); + + +// Append a key to the key queue. +Err EvtEnqueueKey(WChar ascii, UInt16 keycode, UInt16 modifiers) + SYS_TRAP(sysTrapEvtEnqueueKey); + +// Return true of key queue empty. +Boolean EvtKeyQueueEmpty(void) + SYS_TRAP(sysTrapEvtKeyQueueEmpty); + + +// Pop off the next key event from the key queue and fill in the given +// event record structure. Returns non-zero if there aren't any keys in the +// key queue. If peek is non-zero, key will be left in key queue. +Err EvtDequeueKeyEvent(SysEventType *eventP, UInt16 peek) + SYS_TRAP(sysTrapEvtDequeueKeyEvent); + + +//----------------------------------------------------------------- +// Silkscreen information calls +//------------------------------------------------------------------ + +// Return pointer to the pen based button list +const PenBtnInfoType* EvtGetPenBtnList(UInt16* numButtons) + SYS_TRAP(sysTrapEvtGetPenBtnList); + +// Return pointer to the silkscreen area list +const SilkscreenAreaType* EvtGetSilkscreenAreaList(UInt16* numAreas) + SYS_TRAP(sysTrapEvtGetSilkscreenAreaList); + + +//----------------------------------------------------------------- +// General Utilities +//------------------------------------------------------------------ +// Force the system to wake-up. This will result in a null event being +// sent to the current app. +Err EvtWakeup(void) + SYS_TRAP(sysTrapEvtWakeup); + +// Reset the auto-off timer. This is called by the SerialLink Manager in order +// so we don't auto-off while receiving data over the serial port. +Err EvtResetAutoOffTimer(void) + SYS_TRAP(sysTrapEvtResetAutoOffTimer); + +Err EvtSetAutoOffTimer(EvtSetAutoOffCmd cmd, UInt16 timeout) + SYS_TRAP(sysTrapEvtSetAutoOffTimer); + +// Set Graffiti enabled or disabled. +void EvtEnableGraffiti(Boolean enable) + SYS_TRAP(sysTrapEvtEnableGraffiti); + +// Force a NullEvent at or before tick +Boolean EvtSetNullEventTick(UInt32 tick) + SYS_TRAP(sysTrapEvtSetNullEventTick); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _EvtEnqueuePenPoint \ + ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint) + + + +#endif //__SYSEVTMGR_H__ + diff --git a/sdk-3.5/include/Core/System/SysResTypes.rh b/sdk-3.5/include/Core/System/SysResTypes.rh new file mode 100644 index 0000000..87b8acc --- /dev/null +++ b/sdk-3.5/include/Core/System/SysResTypes.rh @@ -0,0 +1,67 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SysResTypes.rh + * + * Description: + * Include file for PalmRez. This file contains resource definitions + * 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 + * 07/23/99 bob Split out from SystemMgr.rh + * + *****************************************************************************/ + +#ifndef __SYSRESTYPES_RH__ +#define __SYSRESTYPES_RH__ + +#include + +//----------------------------------------------------------- +// This section is only valid when running the resource compiler +//----------------------------------------------------------- +#ifdef RESOURCE_COMPILER + +// Definition of the Pilot Preferences Resource. This must match +// the definition of the structure SysAppPrefs in SystemMgr.h +resdef { + word priority; // AMX task priority + long stackSize; // required stack size + long minHeapSpace; // min required free space in heap + } sysResTAppPrefs; + +// Definition of the extended preferences resource. This must +// match the definition of the structure SysExtPrefsType in SystemMgr.h + +resdef { + word version; // Version of structure. + long flags; // 32 flags. + } sysResTExtPrefs; + +// Definition of the ROM - Based Feature table +resdef { + word featureNum; // Feature number + long featureValue; // Feature value + } 'FITM'; + +resdef { + long creator; // creator type + word len(featureItems); + resource 'FITM' featureItems[]; + } 'CITM'; + +resdef { + word len(creatorItems); + resource 'CITM' creatorItems[]; + } sysResTFeatures; + + +#endif + + +#endif // __SYSRESTYPES_RH__ + diff --git a/sdk-3.5/include/Core/System/SysUtils.h b/sdk-3.5/include/Core/System/SysUtils.h new file mode 100644 index 0000000..b1633fd --- /dev/null +++ b/sdk-3.5/include/Core/System/SysUtils.h @@ -0,0 +1,102 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SysUtils.h + * + * Description: + * These are miscellaneous routines. + * + * History: + * April 27, 1995 Created by Roger Flores + * + *****************************************************************************/ + +#ifndef __SYSUTILS_H__ +#define __SYSUTILS_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. +#include + + + +//typedef Int16 _comparF (const void *, const void *, Int16 other); +typedef Int16 _comparF (void *, void *, Int32 other); +typedef _comparF * CmpFuncPtr; + +typedef Int16 _searchF (void const *searchData, void const *arrayData, Int32 other); +typedef _searchF * SearchFuncPtr; + + +// For backwards compatibility +#define GremlinIsOn hostSelectorGremlinIsRunning + +/************************************************************ + * Constants + *************************************************************/ +#define sysRandomMax 0x7FFF // Max value returned from SysRandom() + + +/************************************************************ + * Macros + *************************************************************/ +#define Abs(a) (((a) >= 0) ? (a) : -(a)) + +/************************************************************ + * procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Boolean SysBinarySearch (void const *baseP, const Int16 numOfElements, const Int16 width, + SearchFuncPtr searchF, void const *searchData, + const Int32 other, Int32 *position, const Boolean findFirst) + SYS_TRAP(sysTrapSysBinarySearch); + +void SysInsertionSort (void *baseP, Int16 numOfElements, Int16 width, + const CmpFuncPtr comparF, const Int32 other) + SYS_TRAP(sysTrapSysInsertionSort); + +void SysQSort (void *baseP, Int16 numOfElements, Int16 width, + const CmpFuncPtr comparF, const Int32 other) + SYS_TRAP(sysTrapSysQSort); + +void SysCopyStringResource (Char *string, Int16 theID) + SYS_TRAP(sysTrapSysCopyStringResource); + +MemHandle SysFormPointerArrayToStrings(Char *c, Int16 stringCount) + SYS_TRAP(sysTrapSysFormPointerArrayToStrings); + + +// Return a random number ranging from 0 to sysRandomMax. +// Normally, 0 is passed unless you want to start with a new seed. +Int16 SysRandom(Int32 newSeed) + SYS_TRAP(sysTrapSysRandom); + + +Char * SysStringByIndex(UInt16 resID, UInt16 index, Char *strP, UInt16 maxLen) + SYS_TRAP(sysTrapSysStringByIndex); + +Char * SysErrString(Err err, Char *strP, UInt16 maxLen) + SYS_TRAP(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. +UInt32 HostControl(HostControlTrapNumber selector, ...) + SYS_TRAP(sysTrapHostControl); + + +// For backwards compatibility +#define SysGremlins HostControl + +#ifdef __cplusplus +} +#endif + +#endif // __SYSUTILS_H__ + diff --git a/sdk-3.5/include/Core/System/SystemMgr.h b/sdk-3.5/include/Core/System/SystemMgr.h new file mode 100644 index 0000000..1ad061c --- /dev/null +++ b/sdk-3.5/include/Core/System/SystemMgr.h @@ -0,0 +1,1174 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SystemMgr.h + * + * Description: + * Pilot system equates + * + * History: + * 10/27/94 RM Created by Ron Marianetti + * 10/07/96 SCL Added sysAppLaunchFlagDataRelocated flag + * 11/13/96 vmk Added sysErrDelayWakened error code + * 08/12/98 dia Added sysFtrNumGremlinsSupportGlobals. + * 08/18/98 SCL Added sysFtrNumHwrMiscFlags and ...FlagsExt. + * Redefined sysFtrNumProcessorID. + * 08/23/98 SCL Merged in tsmErrorClass. + * 09/07/98 kwk Added SysWantEvent routine declaration. + * 10/05/98 jfs Added SysLCDContrast trap descriptor + * 04/08/99 kwk Added sysFtrNumVendor (OS 3.3 and later) + * 06/28/99 kwk Added omErrorClass. + * 08/11/99 kwk Added sysFtrNumCharEncodingFlags. + * 11/01/99 kwk Moved SysWantEvent to SystemPrv.h + * 12/03/99 SCL Moved SysAppInfoType, SysAppStartup, and SysAppExit + * here from SystemPrv.h (for StartupCode/Runtime) + * + *****************************************************************************/ + +#ifndef __SYSTEMMGR_H__ +#define __SYSTEMMGR_H__ + +// Include elementary types +#include +#include // Trap Numbers. + +// Other types +#include // Resource definitions. + + +// System Headers +#include +#include +#include +#include +#include +#include // for DmOpenRef +#include + + +/************************************************************ + * 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 + #define sysTicksPerSecond 100 // 100/sec on Pilot +#elif EMULATION_LEVEL == EMULATION_WINDOWS + #define sysTicksPerSecond 1000 // 1000/sec on Windows PC +#elif EMULATION_LEVEL == EMULATION_UNIX + #define sysTicksPerSecond 1000 + // 1000/sec on Linux +#else + #error Invalid EMULATION_LEVEL +#endif + + + +/************************************************************ + * Rules for creating and using the Command Parameter Block + * passed to SysUIAppSwitch + *************************************************************/ + +// A parameter block containing application-specific information may be passed +// to an application when launching it via SysUIAppSwitch. To create the +// parameter block, you allocate a memory block using MemPtrNew and then you must +// call MemPtrSetOwner to set the block's owner ID to 0. This assigns the block's +// ownership to the system so that it will not be automatically freed by the system +// when the calling app exits. The command block must be self contained. It must not +// have pointers to anything on the stack or in memory blocks owned by an application. +// The launching and launched applications do not need to worry about freeing the +// command block since the system will do this after the launched application exits. +// If no parameter block is being passed, this parameter must be NULL. + + +/************************************************************ + * Action Codes + * + * IMPORTANT ACTION CODE CONSIDERATIONS: + * + * Many action codes are "sent" to apps via a direct function call into the app's + * PilotMain() function without launching the app. For these action codes, the + * application's global and static variables are *not* available, unless the + * application is already running. Some action codes are synchronized with the + * currently running UI applcation via the event manager (alarm action codes, + * for example), while others, such as HotSync action codes, are sent from a + * background thread. To find out if your app is running (is the current UI + * app) when an action code is received, test the sysAppLaunchFlagSubCall flag + * (defined in SystemMgr.h) which is passed to your PilotMain in the + * launchFlags parameter (the third PilotMain parameter). If it is non-zero, + * you may assume that your app is currently running and the global variables + * are accessible. This information is useful if your app maintains an open + * data database (or another similar resource) when it is running. If the app + * receives an action code and the sysAppLaunchFlagSubCall is set in + * launchFlags, the handler may access global variables and use the open + * database handle while handling the call. On the other hand, if the + * sysAppLaunchFlagSubCall flag is not set (ie., zero), the handler will need + * to open and close the database itself and is not allowed to access global + * or static variables. + * + *************************************************************/ + +// NOTE: for defining custom action codes, see sysAppLaunchCmdCustomBase below. + +// System SysAppLaunch Commands +#define sysAppLaunchCmdNormalLaunch 0 // Normal Launch + +#define sysAppLaunchCmdFind 1 // Find string + +#define sysAppLaunchCmdGoTo 2 // Launch and go to a particular record + +#define sysAppLaunchCmdSyncNotify 3 // Sent to apps whose databases changed during + // HotSync after the sync has been completed, + // including when the app itself has been installed + // by HotSync. The data database(s) must have the + // same creator ID as the application for this + // mechanism to function correctly. This is a + // good opportunity to update/initialize/validate + // the app's data, such as resorting records, + // setting alarms, etc. + // + // Parameter block: None. + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a + // direct function call into the app's + // PilotMain function from the background + // thread of the HotSync application. + + +#define sysAppLaunchCmdTimeChange 4 // Sent to all applications and preference + // panels when the system time is changed. + // This notification is the right place to + // update alarms and other time-related + // activities and resources. + // + // Parameter block: None. + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdSystemReset 5 // Sent to all applications and preference + // panels when the system is either soft-reset + // or hard-reset. This notification is the + // right place to initialize and/or validate + // your application's preferences/features/ + // database(s) as well as to update alarms and + // other time-related activities and resources. + // + // Parameter block: SysAppLaunchCmdSystemResetType + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdAlarmTriggered 6 // Sent to an application at the time its + // alarm time expires (even when another app + // is already displaying its alarm dialog box). + // This call is intended to allow the app to + // perform some very quick activity, such as + // scheduling the next alarm or performing a + // quick maintenance task. The handler for + // sysAppLaunchCmdAlarmTriggered must take as + // little time as possible and is *not* allowed + // to block (this would delay notification for + // alarms set by other applications). + // + // Parameter block: SysAlarmTriggeredParamType + // (defined in AlarmMgr.h) + // Restrictions: No accessing of global or + // static variables unless sysAppLaunchFlagSubCall + // flag is set, as discussed above. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdDisplayAlarm 7 // Sent to an application when it is time + // to display the alarm UI. The application + // is responsible for making any alarm sounds + // and for displaying the alarm UI. + // sysAppLaunchCmdDisplayAlarm calls are ordered + // chronoligically and are not overlapped. + // This means that your app will receive + // sysAppLaunchCmdDisplayAlarm only after + // all earlier alarms have been displayed. + // + // Parameter block: SysDisplayAlarmParamType + // (defined in AlarmMgr.h) + // Restrictions: No accessing of global or + // static variables unless sysAppLaunchFlagSubCall + // flag is set, as discussed above. UI calls are + // allowed to display the app's alarm dialog. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdCountryChange 8 // The country has changed + +#define sysAppLaunchCmdSyncRequestLocal 9 // Sent to the HotSync application to request a + // local HotSync. ("HotSync" button was pressed.) + +#define sysAppLaunchCmdSyncRequest sysAppLaunchCmdSyncRequestLocal // for backward compatibility + +#define sysAppLaunchCmdSaveData 10 // Sent to running app before sysAppLaunchCmdFind + // or other action codes that will cause data + // searches or manipulation. + +#define sysAppLaunchCmdInitDatabase 11 // Sent to an application when a database with + // a matching Creator ID is created during + // HotSync (in response to a "create db" + // request). This allows the application to + // initialize a newly-created database during + // HotSync. This might include creating some + // default records, setting up the database's + // application and sort info blocks, etc. + // + // Parameter block: SysAppLaunchCmdInitDatabaseType + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a + // direct function call into the app's + // PilotMain function from the background + // thread of the HotSync application. + +#define sysAppLaunchCmdSyncCallApplicationV10 12 // Used by DesktopLink Server command "call application"; + // Pilot v1.0 only!!! + +//------------------------------------------------------------------------ +// New launch codes defined for PalmOS 2.0 +//------------------------------------------------------------------------ + +#define sysAppLaunchCmdPanelCalledFromApp 13 // The panel should display a done + // button instead of the pick list. + // The Done button will return the user + // to the last app. + +#define sysAppLaunchCmdReturnFromPanel 14 // A panel returned to this app + +#define sysAppLaunchCmdLookup 15 // Lookup info managed by an app + +#define sysAppLaunchCmdSystemLock 16 // Lock the system until a password is entered. + +#define sysAppLaunchCmdSyncRequestRemote 17 // Sent to the HotSync application to request + // a remote HotSync. ("Remote HotSync" button + // was pressed.) + +#define sysAppLaunchCmdHandleSyncCallApp 18 // Pilot v2.0 and greater. Sent by DesktopLink Server to an application to handle + // the "call application" command; use DlkControl with + // control code dlkCtlSendCallAppReply to send the reply(see DLServer.h). + // This action code replaces the v1.0 code sysAppLaunchCmdSyncCallApplication. + // vmk 11/26/96 + +#define sysAppLaunchCmdAddRecord 19 // Add a record to an applications's database. + + +//------------------------------------------------------------------------ +// Standard Service Panel launch codes (used by network panel, dialer panel, etc.) +//------------------------------------------------------------------------ +#define sysSvcLaunchCmdSetServiceID 20 +#define sysSvcLaunchCmdGetServiceID 21 +#define sysSvcLaunchCmdGetServiceList 22 +#define sysSvcLaunchCmdGetServiceInfo 23 + + +#define sysAppLaunchCmdFailedAppNotify 24 // An app just switched to failed. +#define sysAppLaunchCmdEventHook 25 // Application event hook callback +#define sysAppLaunchCmdExgReceiveData 26 // Exg command for app to receive data. +#define sysAppLaunchCmdExgAskUser 27 // Exg command sent before asking user. + + +//------------------------------------------------------------------------ +// Standard Dialer Service launch codes (30 - 39 reserved) +//------------------------------------------------------------------------ + +// sysDialLaunchCmdDial: dials the modem(optionally displays dial progress UI), given service id +// and serial library reference number +#define sysDialLaunchCmdDial 30 +// sysDialLaunchCmdHangUp: hangs up the modem(optionally displays disconnect progress UI), given service id +// and serial library reference number +#define sysDialLaunchCmdHangUp 31 +#define sysDialLaunchCmdLast 39 + + +//------------------------------------------------------------------------ +// Additional standard Service Panel launch codes (used by network panel, dialer panel, etc) +// (40-49 reserved) +//------------------------------------------------------------------------ + +#define sysSvcLaunchCmdGetQuickEditLabel 40 // SvcQuickEditLabelInfoType +#define sysSvcLaunchCmdLast 49 + + +//------------------------------------------------------------------------ +// New launch codes defined for PalmOS 3.x where x >= 1 +//------------------------------------------------------------------------ + +#define sysAppLaunchCmdURLParams 50 // Sent from the Web Clipper application. + // This launch code gets used to satisfy + // URLs like the following: + // palm:memo.appl?param1=value1¶m2=value2 + // Everything in the URL past the '?' is passed + // to the app as the cmdPBP parameter of PilotMain(). + +#define sysAppLaunchCmdNotify 51 // This is a NotifyMgr notification sent + // via SysNotifyBroadcast. The cmdPBP parameter + // points to a SysNotifyParamType structure + // containing more specific information + // about the notification (e.g., what it's for). + +#define sysAppLaunchCmdOpenDB 52 // Sent to switch to an application and have it + // "open" up the given data file. The cmdPBP + // pointer is a pointer to a SysAppLaunchCmdOpenDBType + // structure that has the cardNo and localID of the database + // to open. This action code is used by the Launcher + // to launch data files, like Eleven PQA files that + // have the dmHdrAttrLaunchableData bit set in their + // database attributes. + +#define sysAppLaunchCmdAntennaUp 53 // Sent to switch only to the launcher when + // the antenna is raised and the launcher + // is the application in the buttons preferences + // that is to be run when the antenna is raised is + // the launcher. + +#define sysAppLaunchCmdGoToURL 54 // Sent to Clipper to have it launch and display + // a given URL. cmdPBP points to the URL string. + + +// ***ADD NEW SYSTEM ACTION CODES BEFORE THIS COMMENT*** + +//------------------------------------------------------------------------ +// Custom action code base (custom action codes begin at this value) +//------------------------------------------------------------------------ +#define sysAppLaunchCmdCustomBase 0x8000 + +// Your custom launch codes can be defined like this: +// +// typedef enum { +// myAppCmdDoSomething = sysAppLaunchCmdCustomBase, +// myAppCmdDoSomethingElse, +// myAppCmdEtcetera +// +// } MyAppCustomActionCodes; + + + +//------------------------------------------------------------------------ +// SysAppLaunch flags (passed to PilotMain) +//------------------------------------------------------------------------ + +#define sysAppLaunchFlagNewThread 0x01 // create a new thread for application + // - implies sysAppLaunchFlagNewStack +#define sysAppLaunchFlagNewStack 0x02 // create separate stack for application +#define sysAppLaunchFlagNewGlobals 0x04 // create new globals world for application + // - implies new owner ID for Memory chunks +#define sysAppLaunchFlagUIApp 0x08 // notifies launch routine that this is a UI app being + // launched. +#define sysAppLaunchFlagSubCall 0x10 // notifies launch routine that the app is calling it's + // entry point as a subroutine call. This tells the launch + // code that it's OK to keep the A5 (globals) pointer valid + // through the call. + // IMPORTANT: This flag is for internal use by + // SysAppLaunch only!!! It should NEVER be set + // by the caller. +#define sysAppLaunchFlagDataRelocated 0x80 // global data (static ptrs) have been "relocated" + // by either SysAppStartup or StartupCode.c + // IMPORTANT: This flag is for internal use by + // SysAppLaunch only!!! It should NEVER be set + // by the caller. + +// The set of private, internal flags that should never be set by the caller +#define sysAppLaunchFlagPrivateSet (sysAppLaunchFlagSubCall | sysAppLaunchFlagDataRelocated) + + + +//------------------------------------------------------------------- +// Parameter blocks for action codes +// NOTE: The parameter block for the sysAppLaunchCmdFind and sysAppLaunchCmdGoTo +// action codes are defined in "Find.h"; +//--------------------------------------------------------------------------- + +// For sysAppLaunchCmdSaveData +typedef struct { + Boolean uiComing; // true if system dialog will be put up + // before coming action code arrives. + UInt8 reserved1; + } SysAppLaunchCmdSaveDataType; + +// For sysAppLaunchCmdSystemReset +typedef struct { + Boolean hardReset; // true if system was hardReset, false if soft-reset. + Boolean createDefaultDB; // true if app should create default database. + } SysAppLaunchCmdSystemResetType; + + +// For sysAppLaunchCmdInitDatabase +typedef struct SysAppLaunchCmdInitDatabaseType { + DmOpenRef dbP; // Handle of the newly-created database, + // already open for read/write access. + // IMPORTANT: The handler *MUST* leave + // this database handle open on return. + UInt32 creator; // Creator ID of the newly-created database + UInt32 type; // Type ID of the newly-created database + UInt16 version; // Version number of the newly-created database + } SysAppLaunchCmdInitDatabaseType; + + +// For sysAppLaunchCmdSyncCallApplicationV10 +// This structure used on Pilot v1.0 only. See sysAppLaunchCmdHandleSyncCallApp +// for later platforms. +typedef struct SysAppLaunchCmdSyncCallApplicationTypeV10 { + UInt16 action; // call action id (app-specific) + UInt16 paramSize; // parameter size + void * paramP; // ptr to parameter + UInt8 remoteSocket; // remote socket id + UInt8 tid; // command transaction id + Boolean handled; // if handled, MUST be set true by the app + UInt8 reserved1; + } SysAppLaunchCmdSyncCallApplicationTypeV10; + + +// For sysAppLaunchCmdHandleSyncCallApp (Pilot v2.0 and greater). +// This structure replaces SysAppLaunchCmdSyncCallApplicationType +// which was used in Pilot v1.0 +typedef struct SysAppLaunchCmdHandleSyncCallAppType { + UInt16 pbSize; // this parameter block size (set to sizeof SysAppLaunchCmdHandleSyncCallAppType) + UInt16 action; // call action id (app-specific) + void * paramP; // ptr to parameter + UInt32 dwParamSize; // parameter size + void * dlRefP; // DesktopLink reference pointer for passing + // to DlkControl()'s dlkCtlSendCallAppReply code + + Boolean handled; // initialized to FALSE by DLServer; if + // handled, MUST be set TRUE by the app(the + // handler MUST call DlkControl with + // control code dlkCtlSendCallAppReply); + // if the handler is not going to send a reply, + // it should leave this field set to FALSE, in which + // case DesktopLink Server will send the default + // "unknown request" reply. + + UInt8 reserved1; + + Err replyErr; // error from dlkCtlSendCallAppReply + + // RESERVED FOR FUTURE EXTENSIONS + UInt32 dwReserved1; // RESERVED -- set to null!!! + UInt32 dwReserved2; // RESERVED -- set to null!!! + + // Target executable creator and type for testing the mechanism + // in EMULATION MODE ONLY!!! + #if EMULATION_LEVEL != EMULATION_NONE + UInt32 creator; + UInt32 type; + #endif + + } SysAppLaunchCmdHandleSyncCallAppType; + +// For sysAppLaunchCmdFailedAppNotify +typedef struct + { + UInt32 creator; + UInt32 type; + Err result; + } SysAppLaunchCmdFailedAppNotifyType; + + +// For sysAppLaunchCmdOpenDB +typedef struct + { + UInt16 cardNo; + LocalID dbID; + } SysAppLaunchCmdOpenDBType; + + +/************************************************************ + * Structure of Application info for an application. Applications + * do not necessarily have to be on their own thread - there + * can be more than 1 app on the same AMX task. Each application + * has an assocated SysAppInfoType structure which holds the + * application specific information like the database MemHandle of the + * app, the code MemHandle, the stack chunk pointer, the owner ID, etc. + * + * As of PalmOS 3.X, one of these structures is created for each + * app running as an action code. + * + **** + ****IMPORTANT: ADD NEW FIELDS AT THE END OF THE STRUCTURE FOR + **** BACKWARD COMPATIBILITY + **** + *************************************************************/ +typedef struct SysAppInfoType { + Int16 cmd; // command code for app + MemPtr cmdPBP; // cmd ParamBlock + UInt16 launchFlags; // launch flags + + UInt32 taskID; // AMX task ID of task that app runs in + MemHandle codeH; // code MemHandle of the main code segment + DmOpenRef dbP; // Application database access MemPtr of App + UInt8 *stackP; // stack chunk for the App + UInt8 *globalsChunkP; // globals chunk for the App + + UInt16 memOwnerID; // owner ID for Memory Manager chunks + MemPtr dmAccessP; // pointer to linked list of opened DB's + Err dmLastErr; // Last error from Data Manager + MemPtr errExceptionP; // ErrTry,Catch exception list + + // PalmOS v3.0 fields begin here + UInt8 *a5Ptr; // A5 MemPtr for this app + UInt8 *stackEndP; // stack chunk end for the App (last byte) + UInt8 *globalEndP; // global chunk end for the App (last byte) + struct SysAppInfoType *rootP; // Points to the SysAppInfoType first + // allocated for this thread. + MemPtr extraP; // unused MemPtr for the App. + } SysAppInfoType; +typedef SysAppInfoType *SysAppInfoPtr; + + +/************************************************************ + * Function prototype for libraries + *************************************************************/ + +// ***IMPORTANT*** +// ***IMPORTANT*** +// ***IMPORTANT*** +// +// The assembly level TrapDispatcher() function uses a hard-coded value for +// the size of the structure SysLibTblEntryType to obtain a pointer to a +// library entry in the library table. Therefore, any changes to this structure, +// require corresponding changes in TrapDispatcher() in ROMBoot.c. Furthermore, +// it is advantageous to keep the size of the structure a power of 2 as this +// improves performance by allowing the entry offset to be calculated by shifting +// left instead of using the multiply instruction. vmk 8/27/96 (yes, I fell into +// this trap myself) +typedef struct SysLibTblEntryType { + MemPtr *dispatchTblP; // pointer to library dispatch table + void *globalsP; // Library globals + + // New INTERNAL fields for v2.0 (vmk 8/27/96): + LocalID dbID; // database id of the library + void *codeRscH; // library code resource handle for RAM-based libraries + } SysLibTblEntryType; +typedef SysLibTblEntryType* SysLibTblEntryPtr; + +// Emulated versions of libraries have a slightly different dispatch table +// Enough for the offset to the library name and the name itself. +#if EMULATION_LEVEL != EMULATION_NONE +typedef struct SimDispatchTableType { + UInt32 numEntries; // number of library entries + void *entries[1]; // dispatch routine entries + // followed by pointer to name + } SimDispatchTableType; +typedef SimDispatchTableType* SimDispatchTablePtr; +#endif + + +// Library entry point procedure +typedef Err (*SysLibEntryProcPtr)(UInt16 refNum, SysLibTblEntryPtr entryP); + +// This library refNum is reserved for the Debugger comm library +#define sysDbgCommLibraryRefNum 0 + +// This portID is reserved for identifying the debugger's port +#define sysDbgCommPortID 0xC0FF + +// This refNum signals an invalid refNum +#define sysInvalidRefNum 0xFFFF + + +/************************************************************ + * Function prototype for Kernel + *************************************************************/ +// Task termination procedure prototype for use with SysTaskSetTermProc +typedef void (*SysTermProcPtr)(UInt32 taskID, Int32 reason); + +// Timer procedure for use with SysTimerCreate +typedef void (*SysTimerProcPtr)(Int32 timerID, Int32 param); + + + + +/************************************************************ + * System Errors + *************************************************************/ +#define sysErrTimeout (sysErrorClass | 1) +#define sysErrParamErr (sysErrorClass | 2) +#define sysErrNoFreeResource (sysErrorClass | 3) +#define sysErrNoFreeRAM (sysErrorClass | 4) +#define sysErrNotAllowed (sysErrorClass | 5) +#define sysErrSemInUse (sysErrorClass | 6) +#define sysErrInvalidID (sysErrorClass | 7) +#define sysErrOutOfOwnerIDs (sysErrorClass | 8) +#define sysErrNoFreeLibSlots (sysErrorClass | 9) +#define sysErrLibNotFound (sysErrorClass | 10) +#define sysErrDelayWakened (sysErrorClass | 11) // SysTaskDelay wakened by SysTaskWake before delay completed. +#define sysErrRomIncompatible (sysErrorClass | 12) +#define sysErrBufTooSmall (sysErrorClass | 13) +#define sysErrPrefNotFound (sysErrorClass | 14) + +// NotifyMgr error codes: +#define sysNotifyErrEntryNotFound (sysErrorClass | 16) // could not find registration entry in the list +#define sysNotifyErrDuplicateEntry (sysErrorClass | 17) // identical entry already exists +#define sysNotifyErrBroadcastBusy (sysErrorClass | 19) // a broadcast is already in progress - try again later. +#define sysNotifyErrBroadcastCancelled (sysErrorClass | 20) // a handler cancelled the broadcast + +// AMX error codes continued - jb 10/20/98 +#define sysErrMbId (sysErrorClass | 21) +#define sysErrMbNone (sysErrorClass | 22) +#define sysErrMbBusy (sysErrorClass | 23) +#define sysErrMbFull (sysErrorClass | 24) +#define sysErrMbDepth (sysErrorClass | 25) +#define sysErrMbEnv (sysErrorClass | 26) + +// NotifyMgr Phase #2 Error Codes: +#define sysNotifyErrQueueFull (sysErrorClass | 27) // deferred queue is full. +#define sysNotifyErrQueueEmpty (sysErrorClass | 28) // deferred queue is empty. +#define sysNotifyErrNoStackSpace (sysErrorClass | 29) // not enough stack space for a broadcast +#define sysErrNotInitialized (sysErrorClass | 30) // manager is not initialized + +// AMX error/warning codes continued - jed 9/10/99 +#define sysErrNotAsleep (sysErrorClass | 31) // Task woken by SysTaskWake was not asleep, 1 wake pending +#define sysErrNotAsleepN (sysErrorClass | 32) // Task woken by SysTaskWake was not asleep, >1 wake pending + + +// Power Manager error codes - should these be located elsewhere? -soe- +#define pwrErrNone (pwrErrorClass | 0) +#define pwrErrBacklight (pwrErrorClass | 1) +#define pwrErrRadio (pwrErrorClass | 2) +#define pwrErrBeam (pwrErrorClass | 3) + + + +/************************************************************ + * System Features + *************************************************************/ +#define sysFtrCreator sysFileCSystem // Feature Creator + +#define sysFtrNumROMVersion 1 // ROM Version + // 0xMMmfsbbb, where MM is major version, m is minor version + // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development, + // bbb is build number for non-releases + // V1.12b3 would be: 0x01122003 + // V2.00a2 would be: 0x02001002 + // V1.01 would be: 0x01013000 + +#define sysFtrNumProcessorID 2 // Product id + // 0xMMMMRRRR, where MMMM is the processor model and RRRR is the revision. +#define sysFtrNumProcessorMask 0xFFFF0000 // Mask to obtain processor model +#define sysFtrNumProcessor328 0x00010000 // Motorola 68328 (Dragonball) +#define sysFtrNumProcessorEZ 0x00020000 // Motorola 68EZ328 (Dragonball EZ) +#define sysFtrNumProductID sysFtrNumProcessorID // old (obsolete) define + +#define sysFtrNumBacklight 3 // Backlight + // bit 0: 1 if present. 0 if Feature does not exist or backlight is not present + +#define sysFtrNumEncryption 4 // Which encryption schemes are present +#define sysFtrNumEncryptionMaskDES 0x00000001 // bit 0: 1 if DES is present + +#define sysFtrNumCountry 5 // International ROM identifier + // Result is of type CountryType as defined in Preferences.h. + // Result is essentially the "default" country for this ROM. + // Assume cUnitedStates if sysFtrNumROMVersion >= 02000000 + // and feature does not exist. Result is in low sixteen bits. + +#define sysFtrNumLanguage 6 // Language identifier + // Result is of untyped; values are defined in Incs:BuildRules.h + // Result is essentially the "default" language for this ROM. + // This is new for the WorkPad (v2.0.2) and did NOT exist for any of the + // following: GermanPersonal, GermanPro, FrenchPersonal, FrenchPro + // Thus we can't really assume anything if the feature doesn't exist, + // though the actual language MAY be determined from sysFtrNumCountry, + // above. Result is in low sixteen bits. + +#define sysFtrNumDisplayDepth 7 // Display depth + // Result is the "default" display depth for the screen. (PalmOS 3.0) + // This value is used by ScrDisplayMode when setting the default display depth. + +#define sysFtrNumHwrMiscFlags 8 // GHwrMiscFlags value (PalmOS 3.1) +#define sysFtrNumHwrMiscFlagsExt 9 // GHwrMiscFlagsExt value (PalmOS 3.1) + +#define sysFtrNumIntlMgr 10 + // Result is a set of flags that define functionality supported + // by the Int'l Manager. (PalmOS 3.1) + +#define sysFtrNumEncoding 11 + // Result is the character encoding (defined in TextMgr.h) supported + // by this ROM. If this feature doesn't exist then the assumed encoding + // is latin (Windows code page 1252). (PalmOS 3.1) + +#define sysFtrDefaultFont 12 + // Default font ID used for displaying text. (PalmOS 3.1) + +#define sysFtrDefaultBoldFont 13 + // Default font ID used for displaying bold text. (PalmOS 3.1) + +#define sysFtrNumGremlinsSupportGlobals 14 // Globals for supporting gremlins. + // This value is a pointer to a memory location that stores global variables needed + // for intelligently supporting gremlins. Currently, it is only used in Progress.c. + // It is only initialized on first use (gremlins and progress bar in combination) + // when ERROR_CHECK_LEVEL == ERROR_CHECK_FULL. (PalmOS 3.2) + +#define sysFtrNumVendor 15 + // Result is the vendor id, in the low sixteen bits. (PalmOS 3.3) + +#define sysFtrNumCharEncodingFlags 16 + // Flags for a given character encoding, specified in TextMgr.h (PalmOS 3.5) + +#define sysFtrNumNotifyMgrVersion 17 // version of the NotifyMgr, if any (PalmOS 3.5) + +#define sysFtrNumOEMROMVersion 18 // Supplemental ROM version, provided by OEM + // This value may be present in OEM devices, and is in the same format + // as sysFtrNumROMVersion. (PalmOS 3.5) + +#define sysFtrNumErrorCheckLevel 19 // ROM build setting of ERROR_CHECK_LEVEL + // May be set to ERROR_CHECK_NONE, ERROR_CHECK_PARTIAL, or ERROR_CHECK_FULL + // as defined in . (PalmOS 3.5) + +#define sysFtrNumOEMCompanyID 20 // GHwrOEMCompanyID value (PalmOS 3.5) +#define sysFtrNumOEMDeviceID 21 // GHwrOEMDeviceID value (PalmOS 3.5) +#define sysFtrNumOEMHALID 22 // GHwrOEMHALID value (PalmOS 3.5) + + +/************************************************************ + * ROM token information (for SysGetROMToken, below) + *************************************************************/ +// Additional tokens and token information is located in +#define sysROMTokenSnum 'snum' // Memory Card Flash ID (serial number) + + +/************************************************************ + * Macros for extracting and combining ROM/OS version components + *************************************************************/ + +// ROM/OS stage numbers +#define sysROMStageDevelopment (0) +#define sysROMStageAlpha (1) +#define sysROMStageBeta (2) +#define sysROMStageRelease (3) + + +// MACRO: sysMakeROMVersion +// +// Builds a ROM version value from the major, minor, fix, stage, and build numbers +// +#define sysMakeROMVersion(major, minor, fix, stage, buildNum) \ + ( \ + (((UInt32)((UInt8)(major) & 0x0FF)) << 24) | \ + (((UInt32)((UInt8)(minor) & 0x00F)) << 20) | \ + (((UInt32)((UInt8)(fix) & 0x00F)) << 16) | \ + (((UInt32)((UInt8)(stage) & 0x00F)) << 12) | \ + (((UInt32)((UInt16)(buildNum) & 0x0FFF))) \ + ) + + +// Macros for parsing the ROM version number +// (the system OS version is obtained by calling +// FtrGet(sysFtrCreator, sysFtrNumROMVersion, dwOSVerP), where dwOSVerP is +// a pointer to to a UInt32 variable that is to receive the OS version number) +#define sysGetROMVerMajor(dwROMVer) (((UInt16)((dwROMVer) >> 24)) & 0x00FF) +#define sysGetROMVerMinor(dwROMVer) (((UInt16)((dwROMVer) >> 20)) & 0x000F) +#define sysGetROMVerFix(dwROMVer) (((UInt16)((dwROMVer) >> 16)) & 0x000F) +#define sysGetROMVerStage(dwROMVer) (((UInt16)((dwROMVer) >> 12)) & 0x000F) +#define sysGetROMVerBuild(dwROMVer) (((UInt16)(dwROMVer)) & 0x0FFF) + + + + +/************************************************************ + * System Types + *************************************************************/ + +// Types of batteries installed. +typedef enum { + sysBatteryKindAlkaline=0, + sysBatteryKindNiCad, + sysBatteryKindLiIon, + sysBatteryKindRechAlk, + sysBatteryKindNiMH, + sysBatteryKindLiIon1400, + sysBatteryKindLast=0xFF // insert new battery types BEFORE this one + } SysBatteryKind; + +// Different battery states (output of hwrBattery) +typedef enum { + sysBatteryStateNormal=0, + sysBatteryStateLowBattery, + sysBatteryStateCritBattery, + sysBatteryStateShutdown + } SysBatteryState; + + +// SysCreateDataBaseList can generate a list of database. +typedef struct + { + Char name[dmDBNameLength]; + UInt32 creator; + UInt32 type; + UInt16 version; + LocalID dbID; + UInt16 cardNo; + BitmapPtr iconP; + } SysDBListItemType; + + +// Structure of a generic message that can be send to a mailbox +// through the SysMailboxSend call. Note, this structure MUST +// be CJ_MAXMSZ bytes large, where CJ_MAXMSZ is defined in +// the AMX includes. +typedef struct { + UInt32 data[3]; + } SysMailboxMsgType; + + +// Constants used by the SysEvGroupSignal call +#define sysEvGroupSignalConstant 0 +#define sysEvGroupSignalPulse 1 + +// Constants used by the SysEvGroupWait call +#define sysEvGroupWaitOR 0 +#define sysEvGroupWaitAND 1 + + + +/************************************************************ + * System Pre-defined "file descriptors" + * These are used by applications that use the Net Library's + * NetLibSelect() call + *************************************************************/ +#define sysFileDescStdIn 0 + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Prototype for Pilot applications entry point +UInt32 PilotMain(UInt16 cmd, void *cmdPBP, UInt16 launchFlags); + + +// SystemMgr routines +void SysUnimplemented(void) + SYS_TRAP(sysTrapSysUnimplemented); + +void SysColdBoot(void *card0P, UInt32 card0Size, + void *card1P, UInt32 card1Size, + UInt32 sysCardHeaderOffset) + SYS_TRAP(sysTrapSysColdBoot); + +void SysInit(void) + SYS_TRAP(sysTrapSysInit); + +void SysReset(void) + SYS_TRAP(sysTrapSysReset); + +void SysPowerOn(void *card0P, UInt32 card0Size, + void *card1P, UInt32 card1Size, + UInt32 sysCardHeaderOffset, Boolean reFormat); + + +void SysDoze(Boolean onlyNMI) + SYS_TRAP(sysTrapSysDoze); + +Err SysSetPerformance(UInt32 *sysClockP, UInt16 *cpuDutyP) + SYS_TRAP(sysTrapSysSetPerformance); + +void SysSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapSysSleep); + +UInt16 SysSetAutoOffTime(UInt16 seconds) + SYS_TRAP(sysTrapSysSetAutoOffTime); + +UInt16 SysTicksPerSecond(void) + SYS_TRAP(sysTrapSysTicksPerSecond); + +Err SysLaunchConsole(void) + SYS_TRAP(sysTrapSysLaunchConsole); + +Boolean SysHandleEvent(EventPtr eventP) + SYS_TRAP(sysTrapSysHandleEvent); + +void SysUILaunch(void) + SYS_TRAP(sysTrapSysUILaunch); + +Err SysUIAppSwitch(UInt16 cardNo, LocalID dbID, UInt16 cmd, MemPtr cmdPBP) + SYS_TRAP(sysTrapSysUIAppSwitch); + +Err SysCurAppDatabase(UInt16 *cardNoP, LocalID *dbIDP) + SYS_TRAP(sysTrapSysCurAppDatabase); + +Err SysBroadcastActionCode(UInt16 cmd, MemPtr cmdPBP) + SYS_TRAP(sysTrapSysBroadcastActionCode); + +Err SysAppLaunch(UInt16 cardNo, LocalID dbID, UInt16 launchFlags, + UInt16 cmd, MemPtr cmdPBP, UInt32 *resultP) + SYS_TRAP(sysTrapSysAppLaunch); + +UInt16 SysNewOwnerID(void) + SYS_TRAP(sysTrapSysNewOwnerID); + +UInt32 SysSetA5(UInt32 newValue) + SYS_TRAP(sysTrapSysSetA5); + +// Routines used by startup code +Err SysAppStartup(SysAppInfoPtr *appInfoPP, MemPtr *prevGlobalsP, + MemPtr *globalsPtrP) + SYS_TRAP(sysTrapSysAppStartup); + +Err SysAppExit(SysAppInfoPtr appInfoP, MemPtr prevGlobalsP, MemPtr globalsP) + SYS_TRAP(sysTrapSysAppExit); + + +#if EMULATION_LEVEL != EMULATION_NONE +// Simulator-specific routines +MemPtr SysCardImageInfo(UInt16 cardNo, UInt32 *sizeP); + +void SysCardImageDeleted(UInt16 cardNo); +#endif // EMULATION_LEVEL != EMULATION_NONE + +UInt16 SysUIBusy(Boolean set, Boolean value) + SYS_TRAP(sysTrapSysUIBusy); + +UInt8 SysLCDContrast(Boolean set, UInt8 newContrastLevel) + SYS_TRAP(sysTrapSysLCDContrast); + +UInt8 SysLCDBrightness(Boolean set, UInt8 newBrightnessLevel) + SYS_TRAP(sysTrapSysLCDBrightness); + + +// System Dialogs +void SysBatteryDialog(void) + SYS_TRAP(sysTrapSysBatteryDialog); + +// Utilities +Err SysSetTrapAddress(UInt16 trapNum, void *procP) + SYS_TRAP(sysTrapSysSetTrapAddress); + +void * SysGetTrapAddress(UInt16 trapNum) + SYS_TRAP(sysTrapSysGetTrapAddress); + +UInt16 SysDisableInts(void) + SYS_TRAP(sysTrapSysDisableInts); + +void SysRestoreStatus(UInt16 status) + SYS_TRAP(sysTrapSysRestoreStatus); + +extern Char * SysGetOSVersionString() + SYS_TRAP(sysTrapSysGetOSVersionString); + +// The following trap is a public definition of HwrGetROMToken from +// See token definitions (like sysROMTokenSerial) above... +Err SysGetROMToken(UInt16 cardNo, UInt32 token, UInt8 **dataP, UInt16 *sizeP ) + SYS_TRAP(sysTrapHwrGetROMToken); + + +// Library Management +Err SysLibInstall(SysLibEntryProcPtr libraryP, UInt16 *refNumP) + SYS_TRAP(sysTrapSysLibInstall); + +Err SysLibLoad(UInt32 libType, UInt32 libCreator, UInt16 *refNumP) + SYS_TRAP(sysTrapSysLibLoad); + + +Err SysLibRemove(UInt16 refNum) + SYS_TRAP(sysTrapSysLibRemove); + +Err SysLibFind(const Char *nameP, UInt16 *refNumP) + SYS_TRAP(sysTrapSysLibFind); + +SysLibTblEntryPtr SysLibTblEntry(UInt16 refNum) + SYS_TRAP(sysTrapSysLibTblEntry); + +// Generic Library calls +Err SysLibOpen(UInt16 refNum) + SYS_TRAP(sysLibTrapOpen); +Err SysLibClose(UInt16 refNum) + SYS_TRAP(sysLibTrapClose); +Err SysLibSleep(UInt16 refNum) + SYS_TRAP(sysLibTrapSleep); +Err SysLibWake(UInt16 refNum) + SYS_TRAP(sysLibTrapWake); + + +//----------------------------------------------------- +// Kernel Prototypes +//----------------------------------------------------- +// Task Creation and deleation +Err SysTranslateKernelErr(Err err) + SYS_TRAP(sysTrapSysTranslateKernelErr); + +Err SysTaskCreate(UInt32 *taskIDP, UInt32 *creator, ProcPtr codeP, + MemPtr stackP, UInt32 stackSize, UInt32 attr, UInt32 priority, + UInt32 tSlice) + SYS_TRAP(sysTrapSysTaskCreate); + +Err SysTaskDelete(UInt32 taskID, UInt32 priority) + SYS_TRAP(sysTrapSysTaskDelete); + +Err SysTaskTrigger(UInt32 taskID) + SYS_TRAP(sysTrapSysTaskTrigger); + +UInt32 SysTaskID() + SYS_TRAP(sysTrapSysTaskID); + +Err SysTaskDelay(Int32 delay) + SYS_TRAP(sysTrapSysTaskDelay); + +Err SysTaskSetTermProc(UInt32 taskID, SysTermProcPtr termProcP) + SYS_TRAP(sysTrapSysTaskSetTermProc); + +Err SysTaskSwitching(Boolean enable) + SYS_TRAP(sysTrapSysTaskSwitching); + +Err SysTaskWait(Int32 timeout) + SYS_TRAP(sysTrapSysTaskWait); + +Err SysTaskWake(UInt32 taskID) + SYS_TRAP(sysTrapSysTaskWake); + +void SysTaskWaitClr(void) + SYS_TRAP(sysTrapSysTaskWaitClr); + +Err SysTaskSuspend(UInt32 taskID) + SYS_TRAP(sysTrapSysTaskSuspend); + +Err SysTaskResume(UInt32 taskID) + SYS_TRAP(sysTrapSysTaskResume); + + +// Counting Semaphores +Err SysSemaphoreCreate(UInt32 *smIDP, UInt32 *tagP, Int32 initValue) + SYS_TRAP(sysTrapSysSemaphoreCreate); + +Err SysSemaphoreDelete(UInt32 smID) + SYS_TRAP(sysTrapSysSemaphoreDelete); + +Err SysSemaphoreWait(UInt32 smID, UInt32 priority, Int32 timeout) + SYS_TRAP(sysTrapSysSemaphoreWait); + +Err SysSemaphoreSignal(UInt32 smID) + SYS_TRAP(sysTrapSysSemaphoreSignal); + +Err SysSemaphoreSet(UInt32 smID) + SYS_TRAP(sysTrapSysSemaphoreSet); + + +// Resource Semaphores +Err SysResSemaphoreCreate(UInt32 *smIDP, UInt32 *tagP) + SYS_TRAP(sysTrapSysResSemaphoreCreate); + +Err SysResSemaphoreDelete(UInt32 smID) + SYS_TRAP(sysTrapSysResSemaphoreDelete); + +Err SysResSemaphoreReserve(UInt32 smID, UInt32 priority, Int32 timeout) + SYS_TRAP(sysTrapSysResSemaphoreReserve); + +Err SysResSemaphoreRelease(UInt32 smID) + SYS_TRAP(sysTrapSysResSemaphoreRelease); + + + +// Timers +Err SysTimerCreate(UInt32 *timerIDP, UInt32 *tagP, + SysTimerProcPtr timerProc, UInt32 periodicDelay, + UInt32 param) + SYS_TRAP(sysTrapSysTimerCreate); + +Err SysTimerDelete(UInt32 timerID) + SYS_TRAP(sysTrapSysTimerDelete); + +Err SysTimerWrite(UInt32 timerID, UInt32 value) + SYS_TRAP(sysTrapSysTimerWrite); + +Err SysTimerRead(UInt32 timerID, UInt32 *valueP) + SYS_TRAP(sysTrapSysTimerRead); + + +// Information +Err SysKernelInfo(void *paramP) + SYS_TRAP(sysTrapSysKernelInfo); + +Boolean SysCreateDataBaseList(UInt32 type, UInt32 creator, UInt16 *dbCount, + MemHandle *dbIDs, Boolean lookupName) + SYS_TRAP(sysTrapSysCreateDataBaseList); + +Boolean SysCreatePanelList(UInt16 *panelCount, MemHandle *panelIDs) + SYS_TRAP(sysTrapSysCreatePanelList); + +UInt16 SysBatteryInfo(Boolean set, UInt16 *warnThresholdP, UInt16 *criticalThresholdP, + Int16 *maxTicksP, SysBatteryKind* kindP, Boolean *pluggedIn, UInt8 *percentP) + SYS_TRAP(sysTrapSysBatteryInfo); + +UInt16 SysBatteryInfoV20(Boolean set, UInt16 *warnThresholdP, UInt16 *criticalThresholdP, + Int16 *maxTicksP, SysBatteryKind* kindP, Boolean *pluggedIn) + SYS_TRAP(sysTrapSysBatteryInfoV20); + +Boolean SysGetStackInfo(MemPtr *startPP, MemPtr *endPP) + SYS_TRAP(sysTrapSysGetStackInfo); + + + +// Mailboxes +Err SysMailboxCreate(UInt32 *mbIDP, UInt32 *tagP, UInt32 depth) + SYS_TRAP(sysTrapSysMailboxCreate); + +Err SysMailboxDelete(UInt32 mbID) + SYS_TRAP(sysTrapSysMailboxDelete); + +Err SysMailboxFlush(UInt32 mbID) + SYS_TRAP(sysTrapSysMailboxFlush); + +Err SysMailboxSend(UInt32 mbID, void *msgP, UInt32 wAck) + SYS_TRAP(sysTrapSysMailboxSend); + +Err SysMailboxWait(UInt32 mbID, void *msgP, UInt32 priority, + Int32 timeout) + SYS_TRAP(sysTrapSysMailboxWait); + +// Event Groups +Err SysEvGroupCreate(UInt32 *evIDP, UInt32 *tagP, UInt32 init) + SYS_TRAP(sysTrapSysEvGroupCreate); + +//Err SysEvGroupDelete(UInt32 evID) // save trap table space - don't need + //SYS_TRAP(sysTrapSysEvGroupDelete); + +Err SysEvGroupSignal(UInt32 evID, UInt32 mask, UInt32 value, Int32 type) + SYS_TRAP(sysTrapSysEvGroupSignal); + +Err SysEvGroupRead(UInt32 evID, UInt32 *valueP) + SYS_TRAP(sysTrapSysEvGroupRead); + +Err SysEvGroupWait(UInt32 evID, UInt32 mask, UInt32 value, Int32 matchType, + Int32 timeout) + SYS_TRAP(sysTrapSysEvGroupWait); + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _SysSemaphoreSignal \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSignal) + +#define _SysSemaphoreSet \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSet) + +#define _SysDoze \ + ASM_SYS_TRAP(sysTrapSysDoze) + + +#endif //__SYSTEMMGR_H__ + diff --git a/sdk-3.5/include/Core/System/SystemPkt.h b/sdk-3.5/include/Core/System/SystemPkt.h new file mode 100644 index 0000000..3198d48 --- /dev/null +++ b/sdk-3.5/include/Core/System/SystemPkt.h @@ -0,0 +1,430 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SystemPkt.h + * + * Description: + * Structure of System Packets for the Serial Link Manager. These + * packets are used by the Debugger, Console, and Remote UI modules + * for communication with the host computer. + * + * History: + * 6/26/95 RM - Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __SYSTEM_PKT_H__ +#define __SYSTEM_PKT_H__ + +#include + + +//************************************************************************* +// Constants for System Packets +// +//************************************************************************* + +// Max # of bytes we can read/write at a time with the ReadMem and WriteMem +// commands; +#define sysPktMaxMemChunk 256 + +// Maximum body size for System Packets. This is big enough to have +// 256 bytes of data for the Read and Write Mem command plus whatever other +// parameters are in the body for these commands. +#define sysPktMaxBodySize (sysPktMaxMemChunk+16) + + +// Default nitial timeout value for packet receive routines in ticks +#define sysPktInitialTimeout (sysTicksPerSecond*10) + + + +//************************************************************************* +// Packet Body Structure +//************************************************************************* + +// Common fields at the start of every body +#define _sysPktBodyCommon \ + UInt8 command; \ + UInt8 _filler + + +// Generic System Packet Body +typedef struct SysPktBodyType { + _sysPktBodyCommon; + UInt8 data[sysPktMaxBodySize-2]; + } SysPktBodyType; +typedef SysPktBodyType* SysPktBodyPtr; + + + +//************************************************************************* +// The max size of the array of SlkWriteDataTypes used by System Packet +// assembly routines in order to minimize stack usage. +//************************************************************************* +#define sysPktMaxBodyChunks 3 + + + +//************************************************************************* +// packet commands +//************************************************************************* + +//-------------------------------------------------------------------- +// get state command +//-------------------------------------------------------------------- +#define sysPktStateCmd 0x00 +#define sysPktStateRsp 0x80 + +//-------------------------------------------------------------------- +// read memory command +//-------------------------------------------------------------------- +#define sysPktReadMemCmd 0x01 +#define sysPktReadMemRsp 0x81 + +typedef struct SysPktReadMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to read + UInt16 numBytes; // # of bytes to read + } SysPktReadMemCmdType; +typedef SysPktReadMemCmdType* SysPktReadMemCmdPtr; + +typedef struct SysPktReadMemRspType { + _sysPktBodyCommon; // Common Body header + // UInt8 data[?]; // variable size + } SysPktReadMemRspType; +typedef SysPktReadMemRspType* SysPktReadMemRspPtr; + + +//-------------------------------------------------------------------- +// write memory command +//-------------------------------------------------------------------- +#define sysPktWriteMemCmd 0x02 +#define sysPktWriteMemRsp 0x82 + +typedef struct SysPktWriteMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to write + UInt16 numBytes; // # of bytes to write + // UInt8 data[?]; // variable size data + } SysPktWriteMemCmdType; +typedef SysPktWriteMemCmdType* SysPktWriteMemCmdPtr; + +typedef struct SysPktWriteMemRspType { + _sysPktBodyCommon; // Common Body header + } SysPktWriteMemRspType; +typedef SysPktWriteMemRspType* SysPktWriteMemRspPtr; + + +//-------------------------------------------------------------------- +// single-step command +//-------------------------------------------------------------------- +#define sysPktSingleStepCmd 0x03 +// no response + +//-------------------------------------------------------------------- +// get routine name command +//-------------------------------------------------------------------- +#define sysPktGetRtnNameCmd 0x04 +#define sysPktGetRtnNameRsp 0x84 + +//-------------------------------------------------------------------- +// read registers command +//-------------------------------------------------------------------- +#define sysPktReadRegsCmd 0x05 +#define sysPktReadRegsRsp 0x85 + + +//-------------------------------------------------------------------- +// write registers command +//-------------------------------------------------------------------- +#define sysPktWriteRegsCmd 0x06 +#define sysPktWriteRegsRsp 0x86 + +//-------------------------------------------------------------------- +// continue command +//-------------------------------------------------------------------- +#define sysPktContinueCmd 0x07 +// no response + + +//-------------------------------------------------------------------- +// Remote Procedure call +//-------------------------------------------------------------------- +#define sysPktRPCCmd 0x0A +#define sysPktRPCRsp 0x8A + +typedef struct SysPktRPCParamInfo { + UInt8 byRef; // true if param is by reference + UInt8 size; // # of Bytes of paramData (must be even) + UInt16 data[1]; // variable length array of paramData + } SysPktRPCParamType; + +typedef struct SysPktRPCType { + _sysPktBodyCommon; // Common Body header + UInt16 trapWord; // which trap to execute + UInt32 resultD0; // result from D0 placed here + UInt32 resultA0; // result from A0 placed here + UInt16 numParams; // how many parameters follow + // Following is a variable length array ofSlkRPCParamInfo's + SysPktRPCParamType param[1]; + } SysPktRPCType; + + +//-------------------------------------------------------------------- +// Set/Get breakpoints +//-------------------------------------------------------------------- +#define sysPktGetBreakpointsCmd 0x0B +#define sysPktGetBreakpointsRsp 0x8B +#define sysPktSetBreakpointsCmd 0x0C +#define sysPktSetBreakpointsRsp 0x8C + + +//-------------------------------------------------------------------- +// Remote UI Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktRemoteUIUpdCmd 0x0C + +typedef struct SysPktRemoteUIUpdCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from traget to host after drawing operations + UInt16 rowBytes; // rowbytes of update area + UInt16 fromY; // top of update rect + UInt16 fromX; // left of update rect + UInt16 toY; // top of screen rect + UInt16 toX; // left of screen rect + UInt16 height; // bottom of update rect + UInt16 width; // right of update rect + + // The actual pixels of the update area follow + UInt16 pixels; // variable length... + + } SysPktRemoteUIUpdCmdType; + + +#define sysPktRemoteEvtCmd 0x0D + +typedef struct SysPktRemoteEvtCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from host to target to feed pen and keyboard + // events. They do not require a response. + Boolean penDown; // true if pen down + UInt8 padding1; + Int16 penX; // X location of pen + Int16 penY; // Y location of pen + + Boolean keyPress; // true if key event follows + UInt8 padding2; + UInt16 keyModifiers; // keyboard modifiers + WChar keyAscii; // key ascii code + UInt16 keyCode; // key virtual code + + } SysPktRemoteEvtCmdType; + + +//-------------------------------------------------------------------- +// Enable/Disable DbgBreak's command +//-------------------------------------------------------------------- +#define sysPktDbgBreakToggleCmd 0x0D +#define sysPktDbgBreakToggleRsp 0x8D + + +//-------------------------------------------------------------------- +// Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns info on the flash in: +// manuf - manufacturer code +// device - device code +//-------------------------------------------------------------------- +#define sysPktFlashCmd 0x0E // OBSOLETE AS OF 3.0! SEE BELOW! +#define sysPktFlashRsp 0x8E // OSBOLETE AS OF 3.0! SEE BELOW! + + +//-------------------------------------------------------------------- +// Get/Set communication parameters +//-------------------------------------------------------------------- +#define sysPktCommCmd 0x0F +#define sysPktCommRsp 0x8F + +typedef struct SysPktCommCmdType { + _sysPktBodyCommon; // Common Body header + Boolean set; // true to change parameters + UInt8 padding; + UInt32 baudRate; // new baud rate + UInt32 flags; // new flags + } SysPktCommCmdType; +typedef SysPktCommCmdType *SysPktCommCmdPtr; + +typedef struct SysPktCommRspType { + _sysPktBodyCommon; // Common Body header + UInt32 baudRate; // current baud rate + UInt32 flags; // current flags + } SysPktCommRspType; +typedef SysPktCommRspType *SysPktCommRspPtr; + + +//-------------------------------------------------------------------- +// Get/Set Trap Breaks +//-------------------------------------------------------------------- +#define sysPktGetTrapBreaksCmd 0x10 +#define sysPktGetTrapBreaksRsp 0x90 +#define sysPktSetTrapBreaksCmd 0x11 +#define sysPktSetTrapBreaksRsp 0x91 + + +//-------------------------------------------------------------------- +// Gremlins Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktGremlinsCmd 0x12 + +typedef struct SysPktGremlinsCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from target to host to send Gremlins stuff + UInt16 action; + UInt8 data[32]; + + } SysPktGremlinsCmdType; + +// Gremlins action codes +#define sysPktGremlinsIdle 1 +#define sysPktGremlinsEvent 2 + + +//-------------------------------------------------------------------- +// Find data - searches a range of addresses for data +//-------------------------------------------------------------------- +#define sysPktFindCmd 0x13 +#define sysPktFindRsp (sysPktFindCmd | 0x80) + +typedef struct SysPktFindCmdType { + _sysPktBodyCommon; // Common Body header + + UInt32 firstAddr; // first address to search + UInt32 lastAddr; // last address to begin searching + UInt16 numBytes; // number of data bytes to match + Boolean caseInsensitive; // if true, perform a case-insensitive search + UInt8 padding; + } SysPktFindCmdType; +typedef SysPktFindCmdType* SysPktFindCmdPtr; + +typedef struct SysPktFindRspType { + _sysPktBodyCommon; // Common Body header + + UInt32 addr; // address where data was found + Boolean found; // true if data was found + UInt8 padding; + + } SysPktFindRspType; +typedef SysPktFindRspType* SysPktFindRspPtr; + + +//-------------------------------------------------------------------- +// Get/Set Trap Conditionals. These are used to tell the debugger +// to conditionally break on a trap depending on the value of the +// first word on the stack. They are used when setting a-traps on +// library calls. This is a 3.0 feature. +//-------------------------------------------------------------------- +#define sysPktGetTrapConditionsCmd 0x14 +#define sysPktGetTrapConditionsRsp 0x94 +#define sysPktSetTrapConditionsCmd 0x15 +#define sysPktSetTrapConditionsRsp 0x95 + + +//-------------------------------------------------------------------- +// Checksum data - checksums a range of memory. +// This is a (late) 3.0 feature. +//-------------------------------------------------------------------- +#define sysPktChecksumCmd 0x16 +#define sysPktChecksumRsp (sysPktChecksumCmd | 0x80) + +typedef struct SysPktChecksumType { + _sysPktBodyCommon; // Common Body header + + UInt32 firstAddr; // -> first address to checksum + UInt16 numBytes; // -> number of bytes to checksum + UInt16 seed; // -> initial checksum value + UInt16 checksum; // <- checksum result + } SysPktChecksumType; +typedef SysPktChecksumType* SysPktChecksumPtr; + + +//-------------------------------------------------------------------- +// NEW Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns address to store flash code. +// Supercedes Obsolete 1.0 and 2.0 sysPktFlashCmd call above in the 3.0 ROM +//-------------------------------------------------------------------- +#define sysPktExecFlashCmd 0x17 +#define sysPktExecFlashRsp (sysPktExecFlashCmd | 0x80) + + +//-------------------------------------------------------------------- +// message from remote unit +//-------------------------------------------------------------------- +#define sysPktRemoteMsgCmd 0x7f + + +//-------------------------------------------------------------------- +// sysPktRemoteMsg +// Send a text message +//-------------------------------------------------------------------- +typedef struct SysPktRemoteMsgCmdType { + _sysPktBodyCommon; // Common Body header + //UInt8 text; // variable length text goes here + } SysPktRemoteMsgCmdType; +typedef SysPktRemoteMsgCmdType *SysPktRemoteMsgCmdPtr; + + + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//================================================================ +// +// Host Only Routines. +// +//================================================================ +#if (EMULATION_LEVEL != EMULATION_NONE) + + + //------------------------------------------------------------------- + // RPC + //------------------------------------------------------------------ + // Init preparate on an RPC packet header and body. + Err SlkRPCInitPacket(SlkPktHeaderType *headerP, UInt16 dstSocket, + SysPktRPCType *bodyP, UInt16 trapWord); + + + // Stuff a parameter into an RPC packet body + void * SlkRPCStuffParam(SysPktRPCType *bodyP, const void *dataP, + Int16 dataSize, Boolean byRef); + + // Send RPC packet and wait for response. + Err SlkRPCExecute(SlkPktHeaderPtr headerP, SysPktRPCType *bodyP, + Boolean async); + +#endif // (EMULATION_LEVEL != EMULATION_NONE) + + +#ifdef __cplusplus +} +#endif + + + + +#endif //__SYSTEM_PKT_H__ + diff --git a/sdk-3.5/include/Core/System/SystemPublic.h b/sdk-3.5/include/Core/System/SystemPublic.h new file mode 100644 index 0000000..a60660c --- /dev/null +++ b/sdk-3.5/include/Core/System/SystemPublic.h @@ -0,0 +1,105 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SystemPublic.h + * + * Description: + * Group file, include this to get all public System includes. + * + * History: + * 7/13/99 Created by Bob Ebert + * 08/08/99 kwk Deleted JapaneseFEP.h from include list, since it's + * a private header in /Libraries/TextServices. + * + *****************************************************************************/ + +#ifndef __SYSTEMPUBLIC_H__ +#define __SYSTEMPUBLIC_H__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // must come before NetMgr.h due to weird dependency in NetMgr.h +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// from Unix sub-folder +/* +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +*/ + + +#endif // __SYSTEMPUBLIC_H__ + diff --git a/sdk-3.5/include/Core/System/SystemResources.h b/sdk-3.5/include/Core/System/SystemResources.h new file mode 100644 index 0000000..c58ecce --- /dev/null +++ b/sdk-3.5/include/Core/System/SystemResources.h @@ -0,0 +1,341 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SystemResources.h + * + * Description: + * Include file for both PalmRez and the C Compiler. This file contains + * equates used by both tools. When compiling using the C compiler + * the variable RESOURCE_COMPILER must be defined. + * + * History: + * 02/27/95 ron Created by Ron Marianetti + * 08/04/95 vmk Added system resource id for Desktop Link user info + * 02/03/98 tlw Changed sysFileCDefaultApp from sysFileCMemory which + * no longer exists to sysFileCPreferences. + * 6/23/98 jhl Added FlashMgr resource + * 06/23/98 jhl Added FlashMgr resource + * 05/05/99 kwk Added simulator creator/file types, also the + * Japanese user dict panel creator and the TSM + * library creator. + * 05/06/99 lyl Added OEM System File type + * 06/25/99 kwk Added sysResIDAppPrefs & sysResIDOverlayFeatures. + * 07/14/99 kwk Added sysResTSilkscreen. + * 08/08/99 kwk Added sysFileCJEDict. + * 09/20/99 kwk Added keyboard feature for reentrancy check. + * + *****************************************************************************/ + +#ifndef __SYSTEMRESOURCES_H__ +#define __SYSTEMRESOURCES_H__ + +//----------------------------------------------------------- +// This section is common to both the C and Resource Compiler +//----------------------------------------------------------- + +//................................................................ +// File types and creators +// +// Each database shall have a creator ID and a type. +// +// The creator ID shall establish which application, patch, or extension +// a particular database is associated with. The creator ID should identify +// the application/patch/extension, NOT who created it. +// +// The type will determine which part of an application, +// patch, or extension a particular database is. +// +// There can be only one database per application, patch, or extension +// which has type 'application', 'patch', or 'extension'. +// +// Creators: +// +// ROM-based applications created by Palm Computing have all-lower case +// creator ID's. Third-party applications have creator ID's which +// are either all caps, or mixed case. The same requirements go for +// system patches and extensions. +// +// All applications, system patches and extensions shall have unique creator +// ID's. +// +// Types: +// +// 'Application', 'Extension', and 'Patch' file/database types for ROM-based +// apps shall be all-lower case (they are defined below). Other +// file/database types must be mixed-case, +// or all caps. These other types are internal to the applications, and +// therefore the system is unconcerned with their exact values. +//................................................................ +#define sysFileCSystem 'psys' // Creator type for System files +#define sysFileCOEMSystem 'poem' // Creator type for OEM System files +#define sysFileCGraffiti 'graf' // Creator type for Graffiti databases +#define sysFileCSystemPatch 'ptch' // Creator for System resource file patches + +#define sysFileCCalculator 'calc' // Creator type for Calculator App +#define sysFileCSecurity 'secr' // Creator type for Security App +#define sysFileCPreferences 'pref' // Creator type for Preferences App +#define sysFileCAddress 'addr' // Creator type for Address App +#define sysFileCToDo 'todo' // Creator type for To Do App +#define sysFileCDatebook 'date' // Creator type for Datebook App +#define sysFileCMemo 'memo' // Creator type for MemoPad App +#define sysFileCSync 'sync' // Creator type for HotSync App +#define sysFileCMemory 'memr' // Creator type for Memory App +#define sysFileCMail 'mail' // Creator type for Mail App +#define sysFileCExpense 'exps' // Creator type for Expense App +#define sysFileCLauncher 'lnch' // Creator type for Launcher App +#define sysFileCClipper 'clpr' // Creator type for clipper app. +#define sysFileCSetup 'setp' // Creator type for setup app. +#define sysFileCActivate 'actv' // Creator type for activation app. +#define sysFileCFlashInstaller 'fins' // Creator type for FlashInstaller app. +#define sysFileCRFDiag 'rfdg' // Creator type for RF diagnostics app. +#define sysFileCMessaging 'msgs' // Creator type for Messaging App +#define sysFileCModemFlashTool 'gsmf' // Creator type for Palm V modem flash app. +#define sysFileCJEDict 'dict' // Creator type for JEDict app. +#define sysFileHotSyncServer 'srvr' // Creator type for HotSync(R) Server app. +#define sysFileHotSyncServerUpdate 'hssu' // Creator type for HotSync(R) Server update app. + +// The following two apps are manufacturing, calibration and maintenance related +#define sysFileCMACUtilScreen 'mcut' // Creator type for screen oriented MACUtil app. +#define sysFileCMACUtilSerial 'mcus' // Creator type for serial line driven MACUtil app. +#define sysResIDMACUtilAutostart 10000 // Autostart serial MACUtil + +// Demo Apps +#define sysFileCGraffitiDemo 'gdem' // Creator type for Graffiti Demo +#define sysFileCMailDemo 'mdem' // Creator type for Mail Demo + +#define sysFileCFirstApp sysFileCPreferences // Creator type for First App after reset +#define sysFileCAltFirstApp sysFileCSetup // Creator type for First alternate App after reset (with hard key pressed) +#define sysFileCDefaultApp sysFileCPreferences // Creator type for Default app +#define sysFileCDefaultButton1App sysFileCDatebook // Creator type for dflt hard button 1 app +#define sysFileCDefaultButton2App sysFileCAddress // Creator type for dflt hard button 2 app +#define sysFileCDefaultButton3App sysFileCToDo // Creator type for dflt hard button 3 app +#define sysFileCDefaultButton4App sysFileCMemo // Creator type for dflt hard button 4 app +#define sysFileCDefaultCalcButtonApp sysFileCCalculator // Creator type for dflt calc button app +#define sysFileCDefaultCradleApp sysFileCSync // Creator type for dflt hot sync button app +#define sysFileCDefaultModemApp sysFileCSync // Creator type for dflt modem button app +#define sysFileCDefaultAntennaButtonApp sysFileCLauncher // Creator type for dflt antenna up button app +#define sysFileCNullApp '0000' // Creator type for non-existing app +#define sysFileCSimulator '\?\?\?\?' // Creator type for Simulator files (app.tres, sys.tres) + // '????' does not compile with VC++ (Elaine Server) + +#define sysFileCDigitizer 'digi' // Creator type for Digitizer Panel +#define sysFileCGeneral 'gnrl' // Creator type for General Panel +#define sysFileCFormats 'frmt' // Creator type for Formats Panel +#define sysFileCShortCuts 'shct' // Creator type for ShortCuts Panel +#define sysFileCButtons 'bttn' // Creator type for Buttons Panel +#define sysFileCOwner 'ownr' // Creator type for Owner Panel +#define sysFileCModemPanel 'modm' // Creator type for Modem Panel +#define sysFileCDialPanel 'dial' // Creator type for Dial Panel +#define sysFileCNetworkPanel 'netw' // Creator type for Network Panel +#define sysFileCWirelessPanel 'wrls' // Creator type for the wireless Panel. +#define sysFileCUserDict 'udic' // Creator type for the UserDict panel. +#define sysFileCPADHtal 'hpad' // Creator type for PAD HTAL lirary +#define sysFileCTCPHtal 'htcp' // Creator type for TCP HTAL lirary +#define sysFileCMineHunt 'mine' // Creator type for MineHunt App +#define sysFileCPuzzle15 'puzl' // Creator type for Puzzle "15" App +#define sysFileCOpenLibInfo 'olbi' // Creator type for Feature Manager features + // used for saving open library info under PalmOS v1.x +#define sysFileCHwrFlashMgr 'flsh' // Creator type for HwrFlashMgr features + +// Libraries. If the resource used by these are expected to be treated as part of +// the system's usage then the Memory app must be changed. +#define sysFileTLibrary 'libr' // File type of Shared Libraries +#define sysFileTLibraryExtension 'libx' // File type of library extensions + +#define sysFileCNet 'netl' // Creator type for Net (TCP/IP) Library +#define sysFileCRmpLib 'netp' // Creator type for RMP Library (NetLib plug-in) +#define sysFileCINetLib 'inet' // Creator type for INet Library +#define sysFileCSecLib 'secl' // Creator type for Ir Library +#define sysFileCWebLib 'webl' // Creator type for Web Library +#define sysFileCIrLib 'irda' // Creator type for Ir Library + +#define sysFileCSerialMgr 'smgr' // Creator for SerialMgrNew used for features. +#define sysFileCSerialWrapper 'swrp' // Creator type for Serial Wrapper Library. +#define sysFileCIrSerialWrapper 'iwrp' // Creator type for Ir Serial Wrapper Library. +#define sysFileCTextServices 'tsml' // Creator type for Text Services Library. + +#define sysFileTUartPlugIn 'sdrv' // File type for SerialMgrNew physical port plug-in. +#define sysFileTVirtPlugin 'vdrv' // Flir type for SerialMgrNew virtual port plug-in. +#define sysFileCUart328 'u328' // Creator type for '328 UART plug-in +#define sysFileCUart328EZ 'u8EZ' // Creator type for '328EZ UART plug-in +#define sysFileCUart650 'u650' // Creator type for '650 UART plug-in +#define sysFileCVirtIrComm 'ircm' // Creator type for IrComm virtual port plug-in. + +#define sysFileTSystem 'rsrc' // File type for Main System File +#define sysFileTSystemPatch 'ptch' // File type for System resource file patches +#define sysFileTKernel 'krnl' // File type for System Kernel (AMX) +#define sysFileTBoot 'boot' // File type for SmallROM System File +#define sysFileTSmallHal 'shal' // File type for SmallROM HAL File +#define sysFileTBigHal 'bhal' // File type for Main ROM HAL File +#define sysFileTSplash 'spls' // File type for Main ROM Splash File +#define sysFileTUIAppShell 'uish' // File type for UI Application Shell +#define sysFileTOverlay 'ovly' // File type for UI overlay database +#define sysFileTExtension 'extn' // File type for System Extensions +#define sysFileTApplication 'appl' // File type for applications +#define sysFileTPanel 'panl' // File type for preference panels +#define sysFileTSavedPreferences 'sprf' // File type for saved preferences +#define sysFileTPreferences 'pref' // File type for preferences +#define sysFileTMidi 'smfr' // File type for Standard MIDI File record databases +#define sysFileTpqa 'pqa ' // File type for the PQA files. + +#define sysFileTUserDictionary 'dict' // File type for input method user dictionary. +#define sysFileTLearningData 'lean' // File type for input method learning data. + +#define sysFileTGraffitiMacros 'macr' // Graffiti Macros database + +#define sysFileTHtalLib 'htal' // HTAL library + +#define sysFileTExgLib 'exgl' // Type of Exchange libraries + +#define sysFileTFileStream 'strm' // Default File Stream database type + +#define sysFileTTemp 'temp' // Temporary database type; in future versions + // of PalmOS (although likely not before 3.3), the + // system may automatically delete any db's of + // this type at reset time (however, apps are still + // responsible for deleting the ones they create + // before exiting to protect valuable storage space) + +#define sysFileTScriptPlugin 'scpt' // File type for plugin to the Network Panel to + //extend scripting capabilities. + +#define sysFileTSimulator '\?\?\?\?' // File type for Simulator files (app.tres, sys.tres) + // '????' does not compile with VC++ (Elaine Server) + +//................................................................ +// Resource types and IDs +//................................................................ +#define sysResTBootCode 'boot' // Resource type of boot resources +#define sysResIDBootReset 10000 // Reset code +#define sysResIDBootInitCode 10001 // Init code +#define sysResIDBootSysCodeStart 10100 // System code resources start here +#define sysResIDBootSysCodeMin 10102 // IDs 'Start' to this must exist!! +#define sysResIDBootUICodeStart 10200 // UI code resources start here +#define sysResIDBootUICodeMin 10203 // IDs 'Start' to this must exist!! + +#define sysResIDBootHAL 19000 // HAL code resource (from HAL.prc) + +#define sysResIDBitmapSplash 19000 // ID of (boot) splash screen bitmap +#define sysResIDBitmapConfirm 19001 // ID of hard reset confirmation bitmap + +#define sysResTAppPrefs 'pref' // Resource type of App preferences resources +#define sysResIDAppPrefs 0 // Application preference + +#define sysResTExtPrefs 'xprf' // Resource type of extended preferences +#define sysResIDExtPrefs 0 // Extended preferences + +#define sysResTAppCode 'code' // Resource type of App code resources +#define sysResTAppGData 'data' // Resource type of App global data resources + +#define sysResTExtensionCode 'extn' // Resource type of Extensions code +#define sysResTExtensionOEMCode 'exte' // Resource type of OEM Extensions code + +#define sysResTFeatures 'feat' // Resource type of System features table +#define sysResIDFeatures 10000 // Resource ID of System features table +#define sysResIDOverlayFeatures 10001 // Resource ID of system overlay feature table. + +#define sysResTCountries 'cnty' // Resource type of System countries table +#define sysResIDCountries 10000 // Resource ID of System countries table + +#define sysResTLibrary 'libr' // Resource type of System Libraries +//#define sysResIDLibrarySerMgr328 10000 // Dragonball (68328) UART +//#define sysResIDLibrarySerMgr681 10001 // 68681 UART +//#define sysResIDLibraryRMPPlugIn 10002 // Reliable Message Protocol NetLib Plug-in + +#define sysResTSilkscreen 'silk' // Resource type of silkscreen info. + +#define sysResTGrfTemplate 'tmpl' // Graffiti templates "file" +#define sysResIDGrfTemplate 10000 // Graffiti templates "file" ID +#define sysResTGrfDictionary 'dict' // Graffiti dictionary "file" +#define sysResIDGrfDictionary 10000 // Graffiti dictionary "file" ID +#define sysResIDGrfDefaultMacros 10000 // sysResTDefaultDB resource with Graffiti Macros database + +#define sysResTDefaultDB 'dflt' // Default database resource type +#define sysResIDDefaultDB 1 // resource ID of sysResTDefaultDB in each app + +#define sysResTErrStrings 'tSTL' // list of error strings +#define sysResIDErrStrings 10000 // resource ID is (errno>>8)+sysResIDErrStrings + +#define sysResIDOEMDBVersion 20001 // resource ID of "tver" and "tint" versions in OEM stamped databases + +// System Preferences +#define sysResTSysPref sysFileCSystem +#define sysResIDSysPrefMain 0 // Main preferences +#define sysResIDSysPrefPassword 1 // Password +#define sysResIDSysPrefFindStr 2 // Find string +#define sysResIDSysPrefCalibration 3 // Digitizer calibration. +#define sysResIDDlkUserInfo 4 // Desktop Link user information. +#define sysResIDDlkLocalPC 5 // Desktop Link local PC host name +#define sysResIDDlkCondFilterTab 6 // Desktop Link conduit filter table +#define sysResIDModemMgrPref 7 // Modem Manager preferences +#define sysResIDDlkLocalPCAddr 8 // Desktop Link local PC host address +#define sysResIDDlkLocalPCMask 9 // Desktop Link local PC host subnet mask + +// These prefs store parameters to pass to an app when launched with a button +#define sysResIDButton1Param 10 // Parameter for hard button 1 app +#define sysResIDButton2Param 11 // Parameter for hard button 2 app +#define sysResIDButton3Param 12 // Parameter for hard button 3 app +#define sysResIDButton4Param 13 // Parameter for hard button 4 app +#define sysResIDCalcButtonParam 14 // Parameter for calc button app +#define sysResIDCradleParam 15 // Parameter for hot sync button app +#define sysResIDModemParam 16 // Parameter for modem button app +#define sysResIDAntennaButtonParam 17 // Parameter for antenna up button app + +// New for Color, user's color preferences +#define sysResIDPrefUIColorTableBase 17 // base + depth = ID of actual pref +#define sysResIDPrefUIColorTable1 18 // User's UI colors for 1bpp displays +#define sysResIDPrefUIColorTable2 19 // User's UI colors for 2bpp displays +#define sysResIDPrefUIColorTable4 21 // User's UI colors for 4bpp displays +#define sysResIDPrefUIColorTable8 25 // User's UI colors for 8bpp displays + +// FlashMgr Resources - old +#define sysResTFlashMgr 'flsh' +#define sysResIDFlashMgrWorkspace 1 // RAM workspace during flash activity + +// FlashMgr Resources - new +#define sysResTHwrFlashIdent 'flid' // Flash identification code resource +#define sysResIDHwrFlashIdent 10000 // Flash identification code resource + +#define sysResTHwrFlashCode 'flcd' // Flash programming code resource + // (resource ID determined by device type) + +// OEM Feature type and id. +#define sysFtrTOEMSys sysFileCOEMSystem +#define sysFtrIDOEMSysHideBatteryGauge 1 + +// Onscreen keyboard features +#define sysFtrTKeyboard 'keyb' +#define sysFtrIDKeyboardActive 1 // Boolean value, true => keyboard is active. + // Currently only used for Japanese. + +// Activation status values. +#define sysActivateStatusFeatureIndex 1 +#define sysActivateNeedGeorgeQuery 0 +#define sysActivateNeedMortyQuery 1 +#define sysActivateFullyActivated 2 + +#define sysMaxUserDomainNameLength 64 + +// Current clipper feature indeces +#define sysClipperPQACardNoIndex 1 +#define sysClipperPQADbIDIndex 2 + +//----------------------------------------------------------- +// This section is only valid when running the resource compiler +// +// Actually, this section is obsolete. Instear, .r files should +// inlude SysResTypes.rh to get these definitions. +// +//----------------------------------------------------------- + +#ifdef RESOURCE_COMPILER + +#include + +#endif + + +#endif // __SYSTEMRESOURCES_H__ + diff --git a/sdk-3.5/include/Core/System/TextMgr.h b/sdk-3.5/include/Core/System/TextMgr.h new file mode 100644 index 0000000..e4c1ad2 --- /dev/null +++ b/sdk-3.5/include/Core/System/TextMgr.h @@ -0,0 +1,331 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: TextMgr.h + * + * Description: + * Header file for Text Manager. + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 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. + * + *****************************************************************************/ + +#ifndef __TEXTMGR_H__ +#define __TEXTMGR_H__ + +#include +#include + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// 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 encodids (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). + +typedef enum { + charEncodingUnknown = 0, // Unknown to this version of PalmOS. + + charEncodingAscii, // ISO 646-1991 + charEncodingISO8859_1, // ISO 8859 Part 1 + charEncodingPalmLatin, // PalmOS version of CP1252 + charEncodingShiftJIS, // Encoding for 0208-1990 + 1-byte katakana + charEncodingPalmSJIS, // PalmOS version of CP932 + charEncodingUTF8, // Encoding for Unicode + charEncodingCP1252, // Windows variant of 8859-1 + charEncodingCP932 // Windows variant of ShiftJIS +} CharEncodingType; + +// Transliteration operations for the TxtTransliterate call. We don't use +// an enum, since each character encoding contains its own set of special +// transliteration operations (which begin at translitOpCustomBase). + +typedef UInt16 TranslitOpType; + +#define translitOpUpperCase 0 +#define translitOpLowerCase 1 + +#define translitOpCustomBase 1000 // Beginning of char-encoding specific ops. + +#define translitOpPreprocess 0x8000 // Mask for pre-process option, where + // no transliteration actually is done. + +// Names of the known encodings. + +#define encodingNameAscii "us-ascii" +#define encodingNameISO8859_1 "ISO-8859-1" +#define encodingNameCP1252 "ISO-8859-1-Windows-3.1-Latin-1" +#define encodingNameShiftJIS "Shift_JIS" +#define encodingNameCP932 "Windows-31J" +#define encodingNameUTF8 "UTF-8" + +// Maximum length of any encoding name. + +#define maxEncodingNameLength 40 + +// Flags available in the sysFtrNumCharEncodingFlags feature attribute. + +#define charEncodingOnlySingleByte 0x00000001 +#define charEncodingHasDoubleByte 0x00000002 +#define charEncodingHasLigatures 0x00000004 +#define charEncodingLeftToRight 0x00000008 + +// Various byte attribute flags. Note that multiple flags can be +// set, thus a byte could be both a single-byte character, or the first +// byte of a multi-byte character. + +#define byteAttrFirst 0x80 // First byte of multi-byte char. +#define byteAttrLast 0x40 // Last byte of multi-byte char. +#define byteAttrMiddle 0x20 // Middle byte of muli-byte char. +#define byteAttrSingle 0x01 // Single byte. + +// Various sets of character attribute flags. + +#define charAttrPrint (_DI|_LO|_PU|_SP|_UP|_XA) +#define charAttrSpace (_CN|_SP|_XS) +#define charAttrAlNum (_DI|_LO|_UP|_XA) +#define charAttrAlpha (_LO|_UP|_XA) +#define charAttrCntrl (_BB|_CN) +#define charAttrGraph (_DI|_LO|_PU|_UP|_XA) +#define charAttrDelim (_SP|_PU) + +// Maximum size a single WChar character will occupy in a text string. + +#define maxCharBytes 4 + +// Text manager error codes. + +#define txtErrUknownTranslitOp (txtErrorClass | 1) +#define txtErrTranslitOverrun (txtErrorClass | 2) +#define txtErrTranslitOverflow (txtErrorClass | 3) + +/*********************************************************************** + * Public macros + ***********************************************************************/ + +#define TxtCharIsSpace(ch) ((TxtCharAttr(ch) & charAttrSpace) != 0) +#define TxtCharIsPrint(ch) ((TxtCharAttr(ch) & charAttrPrint) != 0) +#define TxtCharIsDigit(ch) ((TxtCharAttr(ch) & _DI) != 0) +#define TxtCharIsAlNum(ch) ((TxtCharAttr(ch) & charAttrAlNum) != 0) +#define TxtCharIsAlpha(ch) ((TxtCharAttr(ch) & charAttrAlpha) != 0) +#define TxtCharIsCntrl(ch) ((TxtCharAttr(ch) & charAttrCntrl) != 0) +#define TxtCharIsGraph(ch) ((TxtCharAttr(ch) & charAttrGraph) != 0) +#define TxtCharIsLower(ch) ((TxtCharAttr(ch) & _LO) != 0) +#define TxtCharIsPunct(ch) ((TxtCharAttr(ch) & _PU) != 0) +#define TxtCharIsUpper(ch) ((TxtCharAttr(ch) & _UP) != 0) +#define TxtCharIsHex(ch) ((TxtCharAttr(ch) & _XD) != 0) +#define TxtCharIsDelim(ch) ((TxtCharAttr(ch) & charAttrDelim) != 0) + +// is a hard key if the event modifier has the command bit set +// and is either in the proper range or is the calculator character. +#define TxtCharIsHardKey(m, c) ((((m) & commandKeyMask) != 0) && \ + ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr))) + +// is a virtual character if the event modifier has the command +// bit set. WARNING!!! This macro is only safe to use on Palm OS 3.5 or +// later. With earlier versions of the OS, use TxtGlueCharIsVirtual() +// in PalmOSGlue.lib +#define TxtCharIsVirtual(m, c) (((m) & commandKeyMask) != 0) + +#define TxtPreviousCharSize(inText, inOffset) TxtGetPreviousChar((inText), (inOffset), NULL) +#define TxtNextCharSize(inText, inOffset) TxtGetNextChar((inText), (inOffset), NULL) + + +/*********************************************************************** + * Public routines + ***********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +// Return back byte attribute (first, last, single, middle) for . + +UInt8 TxtByteAttr(UInt8 inByte) + INTL_TRAP(intlTxtByteAttr); + +// Return back the standard attribute bits for . + +UInt16 TxtCharAttr(WChar inChar) + INTL_TRAP(intlTxtCharAttr); + +// Return back the extended attribute bits for . + +UInt16 TxtCharXAttr(WChar inChar) + INTL_TRAP(intlTxtCharXAttr); + +// Return the size (in bytes) of the character . This represents +// how many bytes would be required to store the character in a string. + +UInt16 TxtCharSize(WChar inChar) + INTL_TRAP(intlTxtCharSize); + +// Return the width (in pixels) of the character . + +Int16 TxtCharWidth(WChar inChar) + INTL_TRAP(intlTxtCharWidth); + +// Load the character before offset in the text. Return +// back the size of the character. + +UInt16 TxtGetPreviousChar(const Char *inText, UInt32 inOffset, WChar *outChar) + INTL_TRAP(intlTxtGetPreviousChar); + +// Load the character at offset in the text. Return +// back the size of the character. + +UInt16 TxtGetNextChar(const Char *inText, UInt32 inOffset, WChar *outChar) + INTL_TRAP(intlTxtGetNextChar); + +// Return the character at offset in the text. + +WChar TxtGetChar(const Char *inText, UInt32 inOffset) + INTL_TRAP(intlTxtGetChar); + +// Set the character at offset in the text, and +// return back the size of the character. + +UInt16 TxtSetNextChar(Char *ioText, UInt32 inOffset, WChar inChar) + INTL_TRAP(intlTxtSetNextChar); + +// Replace the substring "^X" (where X is 0..9, as specified by ) +// with the string . If is NULL then don't modify . +// Make sure the resulting string doesn't contain more than bytes, +// excluding the terminating null. Return back the number of occurances of +// the substring found in . + +UInt16 TxtReplaceStr(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, UInt16 inParamNum) + INTL_TRAP(intlTxtReplaceStr); + +// Allocate a handle containing the result of substituting param0...param3 +// for ^0...^3 in , and return the locked result. If a parameter +// is NULL, replace the corresponding substring in the template with "". + +Char *TxtParamString(const Char *inTemplate, const Char *param0, + const Char *param1, const Char *param2, const Char *param3) + INTL_TRAP(intlTxtParamString); + +// Return the bounds of the character at in the +// text, via the & offsets, and also return the +// actual value of character at or following . + +WChar TxtCharBounds(const Char *inText, UInt32 inOffset, UInt32 *outStart, UInt32 *outEnd) + INTL_TRAP(intlTxtCharBounds); + +// Return the appropriate byte position for truncating such that it is +// at most bytes long. + +UInt32 TxtGetTruncationOffset(const Char *inText, UInt32 inOffset) + INTL_TRAP(intlTxtGetTruncationOffset); + +// Search for in . If found return true and pass back +// the found position (byte offset) in , and the length of the matched +// text in . + +Boolean TxtFindString(const Char *inSourceStr, const Char *inTargetStr, + UInt32 *outPos, UInt16 *outLength) + INTL_TRAP(intlTxtFindString); + +// Find the bounds of the word that contains the character at . +// Return the offsets in <*outStart> and <*outEnd>. Return true if the +// word we found was not empty & not a delimiter (attribute of first char +// in word not equal to space or punct). + +Boolean TxtWordBounds(const Char *inText, UInt32 inLength, UInt32 inOffset, + UInt32 *outStart, UInt32 *outEnd) + INTL_TRAP(intlTxtWordBounds); + +// Return the minimum (lowest) encoding required for . If we +// don't know about the character, return encoding_Unknown. + +CharEncodingType TxtCharEncoding(WChar inChar) + INTL_TRAP(intlTxtCharEncoding); + +// Return the minimum (lowest) encoding required to represent . +// This is the maximum encoding of any character in the string, where +// highest is unknown, and lowest is ascii. + +CharEncodingType TxtStrEncoding(const Char *inStr) + INTL_TRAP(intlTxtStrEncoding); + +// Return the higher (max) encoding of and . + +CharEncodingType TxtMaxEncoding(CharEncodingType a, CharEncodingType b) + INTL_TRAP(intlTxtMaxEncoding); + +// Return a pointer to the 'standard' name for . If the +// encoding is unknown, return a pointer to an empty string. + +const Char *TxtEncodingName(CharEncodingType inEncoding) + INTL_TRAP(intlTxtEncodingName); + +// Transliterate bytes of text found in , based +// on the requested operation. Place the results in , +// and set the resulting length in . On entry +// must contain the maximum size of the buffer. If the +// buffer isn't large enough, return an error (note that outDestText +// might have been modified during the operation). Note that if +// has the preprocess bit set, then is not modified, and +// will contain the total space required in the destination +// buffer in order to perform the operation. + +Err TxtTransliterate(const Char *inSrcText, UInt16 inSrcLength, Char *outDstText, + UInt16 *ioDstLength, TranslitOpType inOp) + INTL_TRAP(intlTxtTransliterate); + +// Return true if is a valid (drawable) character. Note that we'll +// return false if it is a virtual character code. + +Boolean TxtCharIsValid(WChar inChar) + INTL_TRAP(intlTxtCharIsValid); + +// Compare the first bytes of with the first bytes +// of . Return the results of the comparison: < 0 if sorts before +// , > 0 if sorts after , and 0 if they are equal. Also return +// the number of bytes that matched in and +// (either one of which can be NULL if the match length is not needed). +// This comparison is "caseless", in the same manner as a find operation, +// thus case, character size, etc. don't matter. + +Int16 TxtCaselessCompare(const Char *s1, UInt16 s1Len, UInt16 *s1MatchLen, + const Char *s2, UInt16 s2Len, UInt16 *s2MatchLen) + INTL_TRAP(intlTxtCaselessCompare); + +// Compare the first bytes of with the first bytes +// of . Return the results of the comparison: < 0 if sorts before +// , > 0 if sorts after , and 0 if they are equal. Also return +// the number of bytes that matched in and +// (either one of which can be NULL if the match length is not needed). + +Int16 TxtCompare(const Char *s1, UInt16 s1Len, UInt16 *s1MatchLen, + const Char *s2, UInt16 s2Len, UInt16 *s2MatchLen) + INTL_TRAP(intlTxtCompare); + +#ifdef __cplusplus + } +#endif + +#endif // __TEXTMGR_H__ + diff --git a/sdk-3.5/include/Core/System/TextServicesMgr.h b/sdk-3.5/include/Core/System/TextServicesMgr.h new file mode 100644 index 0000000..56ee2f7 --- /dev/null +++ b/sdk-3.5/include/Core/System/TextServicesMgr.h @@ -0,0 +1,133 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: TextServicesMgr.h + * + * Description: + * Header file for Text Services Manager. + * + * History: + * Created by Ken Krugler + * 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 + * + *****************************************************************************/ + +#ifndef __TEXTSERVICESMGR_H__ +#define __TEXTSERVICESMGR_H__ + +#include +#include +#include + +#ifndef USE_TSM_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_TSM_TRAPS 1 + #else + #define USE_TSM_TRAPS 0 + #endif +#endif + +#if USE_TSM_TRAPS + #define TSM_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapTsmDispatch, sel) +#else + #define TSM_TRAP(tsmSelectorNum) +#endif + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Selectors for routines found in the Text Services manager. The order +// of these selectors MUST match the jump table in TextServicesMgr.c. + +#ifdef __GNUC__ + +#define tsmGetFepMode 0 +#define tsmSetFepMode 1 +#define tsmHandleEvent 2 + +#define tsmMaxSelector tsmHandleEvent + +typedef UInt16 TsmSelector; + +#else + +typedef enum { + tsmGetFepMode = 0, + tsmSetFepMode, + tsmHandleEvent, + + tsmMaxSelector = tsmHandleEvent, + tsmBigSelector = 0x7FFF // Force TsmSelector to be 16 bits. +} TsmSelector; + +#endif + + +// Input mode - used with TsmGetFepMode. + +typedef enum { + tsmFepModeDefault, // Default 'on' mode. + tsmFepModeOff, // FEP is off + + tsmFepModeCustom = 128, // FEP-specific modes start here. + + tsmFepModeBig = 0x7fff // Force TsmFepModeType to be 16 bits. +} TsmFepModeType; + + +/*********************************************************************** + * Public types + ***********************************************************************/ + +// Structure exchanged with many Fep routines. This is how +// the Fep tells the editing code what to display, and how +// to display it. Note that it's also the context record for the +// Fep, thus additional (private) conversion information will +// typically be appended by the Fep. + +typedef struct { + UInt16 refnum; // Refnum of Fep shared library. + + Char *inlineText; // ptr to inline text. + + UInt16 convertedLen; // Length of converted text. + UInt16 pendingLen; // Length of unconverted (pending) text. + + UInt16 selectStart; // Start of selection range. + UInt16 selectEnd; // End of selection range (can extend past + // end of inline text) + + UInt16 convertStart; // Start of converted clause highlighting + UInt16 convertEnd; // End of converted clause highlighting +} TsmFepStatusType; + +/*********************************************************************** + * Public routines + ***********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Return the current mode for the fep indicated by , or the +// active fep's current session if is nil. +TsmFepModeType TsmGetFepMode(const TsmFepStatusType *inStatusP) + TSM_TRAP(tsmGetFepMode); + +// Set the mode for the fep indicated by is nil. The current mode is returned. +TsmFepModeType TsmSetFepMode(TsmFepStatusType *ioStatusP, TsmFepModeType inNewMode) + TSM_TRAP(tsmSetFepMode); + +#ifdef __cplusplus +} +#endif + +#endif // __TEXTSERVICESMGR_H__ + diff --git a/sdk-3.5/include/Core/System/TimeMgr.h b/sdk-3.5/include/Core/System/TimeMgr.h new file mode 100644 index 0000000..9d8fe94 --- /dev/null +++ b/sdk-3.5/include/Core/System/TimeMgr.h @@ -0,0 +1,72 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: TimeMgr.h + * + * Description: + * Time manager functions + * + * History: + * 1/19/95 roger - Created by Roger Flores + * + *****************************************************************************/ + +#ifndef __TIMEMGR_H__ +#define __TIMEMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Time Manager result codes + * (timErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define timErrMemory (timErrorClass | 1) + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err TimInit(void) SYS_TRAP(sysTrapTimInit); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// seconds since 1/1/1904 +UInt32 TimGetSeconds(void) + SYS_TRAP(sysTrapTimGetSeconds); + +// seconds since 1/1/1904 +void TimSetSeconds(UInt32 seconds) + SYS_TRAP(sysTrapTimSetSeconds); + +// ticks since power on +UInt32 TimGetTicks(void) + SYS_TRAP(sysTrapTimGetTicks); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __TIMEMGR_H__ + diff --git a/sdk-3.5/include/Core/System/Unix/arpa_inet.h b/sdk-3.5/include/Core/System/Unix/arpa_inet.h new file mode 100644 index 0000000..33d93a3 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/arpa_inet.h @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: arpa_inet.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)inet.h 1.8 88/08/19 SMI; from UCB 5.1 5/30/85 */ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * External definitions for + * functions in inet(3N) + */ + +#ifndef __UNIX_ARPA_INET_H__ +#define __UNIX_ARPA_INET_H__ + +#include + +//=========================================================================== +// Macros that convert Unix calls into native Pilot calls. +//=========================================================================== +// Convert a dotted decimal string representation into an IP address. +// return -1 on error +#define inet_addr(s) \ + NetLibAddrAToIN(AppNetRefnum, s) + +// Return a dotted decimal string representation of an IP address +#define inet_ntoa(in) \ + NetLibAddrINToA(AppNetRefnum, (in).s_addr, AppINETString) + + +//=========================================================================== +// Functions implemented through glue code +//=========================================================================== + +#ifdef __cplusplus +extern "C" { +#endif + +// Merge network number and local network address into an IP address +struct in_addr inet_makeaddr(UInt32 net, UInt32 lna); + +// Return the NBO network number of the dotted decimal string +UInt32 inet_network(Char * s); + +// Return the local network address of an IP address +UInt32 inet_lnaof(struct in_addr in); + +// Return the network number of an IP address +UInt32 inet_netof(struct in_addr in); + +#ifdef __cplusplus +} +#endif + +#endif /* __UNIX_ARPA_INET_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/netdb.h b/sdk-3.5/include/Core/System/Unix/netdb.h new file mode 100644 index 0000000..da519c6 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/netdb.h @@ -0,0 +1,116 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netdb.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +/* @(#)netdb.h 1.11 88/08/19 SMI from UCB 5.9 4/5/88 */ +/* + * Copyright (c) 1980,1983,1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + + + +#ifndef __UNIX_NETDB_H__ +#define __UNIX_NETDB_H__ + + +/* + * Structures returned by network data base library. + * All addresses are supplied in host order, and + * returned in network order (suitable for use in system calls). + */ + +struct hostent { + Char *h_name; /* official name of host */ + Char **h_aliases; /* alias list */ + UInt16 h_addrtype; /* host address type */ + UInt16 h_length; /* length of address */ + Char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + Char *n_name; /* official name of net */ + Char **n_aliases; /* alias list */ + UInt16 n_addrtype; /* net address type */ + UInt32 n_net; /* network # */ +}; + +struct servent { + Char *s_name; /* official service name */ + Char **s_aliases; /* alias list */ + UInt16 s_port; /* port # */ + Char *s_proto; /* protocol to use */ +}; + +struct protoent { + Char *p_name; /* official protocol name */ + Char **p_aliases; /* alias list */ + UInt16 p_proto; /* protocol # */ +}; + +struct rpcent { + Char *r_name; /* name of server for this rpc program */ + Char **r_aliases; /* alias list */ + Int16 r_number; /* rpc program number */ +}; + + +// Supported calls +#define gethostbyname(nameP) \ + ((struct hostent*)NetLibGetHostByName(AppNetRefnum, nameP,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define gethostbyaddr(addr,len,type) \ + ((struct hostent*)NetLibGetHostByAddr(AppNetRefnum, (UInt8 *)addr,len,type,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define getservbyname(serv,proto) \ + ((struct servent*)NetLibGetServByName(AppNetRefnum, serv,proto,&AppServInfo,AppNetTimeout,&h_errno)) + + +// Unsupported calls +// struct hostent *gethostent(); +// struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); +// struct servent *getservbyport(), *getservent(); +// struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); +// struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver) + */ + +extern Err h_errno; + +#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + + +#endif /* __UNIX_NETDB_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/netinet_in.h b/sdk-3.5/include/Core/System/Unix/netinet_in.h new file mode 100644 index 0000000..c0919ac --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/netinet_in.h @@ -0,0 +1,198 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netinet_in.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)in.h 1.19 90/07/27 SMI; from UCB 7.5 2/22/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981. + */ + +#ifndef __UNIX_NETINET_IN_H__ +#define __UNIX_NETINET_IN_H__ + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group control protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_HELLO 63 /* "hello" routing protocol */ +#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + +/* + * Port/socket numbers: network standard functions + */ +#define IPPORT_ECHO 7 +#define IPPORT_DISCARD 9 +#define IPPORT_SYSTAT 11 +#define IPPORT_DAYTIME 13 +#define IPPORT_NETSTAT 15 +#define IPPORT_FTP 21 +#define IPPORT_TELNET 23 +#define IPPORT_SMTP 25 +#define IPPORT_TIMESERVER 37 +#define IPPORT_NAMESERVER 42 +#define IPPORT_WHOIS 43 +#define IPPORT_MTP 57 + +/* + * Port/socket numbers: host specific functions + */ +#define IPPORT_TFTP 69 +#define IPPORT_RJE 77 +#define IPPORT_FINGER 79 +#define IPPORT_TTYLINK 87 +#define IPPORT_SUPDUP 95 + +/* + * UNIX TCP sockets + */ +#define IPPORT_EXECSERVER 512 +#define IPPORT_LOGINSERVER 513 +#define IPPORT_CMDSERVER 514 +#define IPPORT_EFSSERVER 520 + +/* + * UNIX UDP sockets + */ +#define IPPORT_BIFFUDP 512 +#define IPPORT_WHOSERVER 513 +#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Link numbers + */ +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 + +/* + * Internet address + * This definition contains obsolete fields for compatibility + * with SunOS 3.x and 4.2bsd. The presence of subnets renders + * divisions into fixed fields misleading at best. New code + * should use only the s_addr field. + */ +struct in_addr { + union { + struct { UInt8 s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { UInt16 s_w1,s_w2; } S_un_w; + UInt32 S_addr; + } S_un; +#define s_addr S_un.S_addr /* should be used for all code */ +#define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */ +#define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */ +#define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */ +#define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */ +#define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */ +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_NONE (u_long)0xFFFFFFFF /* error from inet_aton */ +#define INADDR_LOOPBACK (u_long)0x7F000001 +#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Define a macro to stuff the loopback address into an Internet address + */ +#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ + (a)->sin_family = AF_INET;} + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + Int16 sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + */ +#define IP_OPTIONS netSocketOptIPOptions /* set/get IP per-packet options */ + +/* + * Macros for number representation conversion. + */ +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + + +#endif /* __UNIX_NETINET_IN_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/netinet_in_systm.h b/sdk-3.5/include/Core/System/Unix/netinet_in_systm.h new file mode 100644 index 0000000..82d260c --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/netinet_in_systm.h @@ -0,0 +1,45 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netinet_in_systm.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)in_systm.h 1.8 88/08/19 SMI; from UCB 7.1 6/5/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +#ifndef __UNIX_NETINET_IN_SYSTM_H__ +#define __UNIX_NETINET_IN_SYSTM_H__ + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +typedef u_short n_short; /* Int16 as received from the net */ +typedef u_long n_long; /* long as received from the net */ + +typedef u_long n_time; /* ms since 00:00 GMT, byte rev */ + +#endif /* __UNIX_NETINET_IN_SYSTM_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/netinet_ip.h b/sdk-3.5/include/Core/System/Unix/netinet_ip.h new file mode 100644 index 0000000..46144bb --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/netinet_ip.h @@ -0,0 +1,135 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netinet_ip.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)ip.h 1.13 88/08/19 SMI; from UCB 7.6.1.1 3/15/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ + +#ifndef __UNIX_NETINET_IP_H__ +#define __UNIX_NETINET_IP_H__ + +#define IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + * + * We declare ip_len and ip_off to be Int16, rather than u_short + * pragmatically since otherwise unsigned comparisons can result + * against negative integers quite easily, and fail in subtle ways. + */ +struct ip { + u_char ip_v:4, /* version */ + ip_hl:4; /* header length */ + u_char ip_tos; /* type of service */ + Int16 ip_len; /* total length */ + u_short ip_id; /* identification */ + Int16 ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + u_char ipt_code; /* IPOPT_TS */ + u_char ipt_len; /* size of structure (variable) */ + u_char ipt_ptr; /* index of current entry */ + u_char ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ + union ipt_timestamp { + n_long ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + n_long ipt_time; + } ipt_ta[1]; + } ipt_timestamp; +}; + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 2 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +#endif /* __UNIX_NETINET_IP_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/netinet_tcp.h b/sdk-3.5/include/Core/System/Unix/netinet_tcp.h new file mode 100644 index 0000000..cad2db1 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/netinet_tcp.h @@ -0,0 +1,72 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netinet_tcp.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)tcp.h 1.11 88/08/19 SMI; from UCB 7.2 10/28/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __UNIX_NETINET_TCP_H__ +#define __UNIX_NETINET_TCP_H__ + +typedef UInt32 tcp_seq; +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + UInt16 th_sport; /* source port */ + UInt16 th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ + UInt8 th_off:4, /* data offset */ + th_x2:4; /* (unused) */ + UInt8 th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + UInt16 th_win; /* window */ + UInt16 th_sum; /* checksum */ + UInt16 th_urp; /* urgent pointer */ +}; + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + */ +#ifdef lint +#define TCP_MSS 536 +#else +#define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) +#endif + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY netSocketOptTCPNoDelay /* don't delay send to coalesce packets */ +#define TCP_MAXSEG netSocketOptTCPMaxSeg /* set maximum segment size */ + +#endif /* __UNIX_NETINET_TCP_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/sys_errno.h b/sdk-3.5/include/Core/System/Unix/sys_errno.h new file mode 100644 index 0000000..ac0f442 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/sys_errno.h @@ -0,0 +1,148 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_errno.h + * + * Description: + * This module contains the equivalent of the unix header + * for use in Pilot applications that wish to use the Berkeley sockets API + * + * History: + * 5/23/96 Created by Ron Marianetti + * + *****************************************************************************/ + +/* @(#)errno.h 2.14 90/01/23 SMI; from UCB 4.1 82/12/28 */ + +/* + * If error codes are added or changed here, they should be updated in + * /usr/src/lib/libc/gen/common/errlst.c as well. + */ + + +#ifndef _sys_errno_h +#define _sys_errno_h + +#define EPERM 1 /* Not owner */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR netErrTimeout /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No children */ +#define EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Not enough core */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Mount device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory*/ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ + +/* math software */ +#define EDOM 33 /* Argument too large */ +#define ERANGE 34 /* Result too large */ + +/* non-blocking and interrupt i/o */ +#define EWOULDBLOCK netErrWouldBlock /* Operation would block */ +#define EINPROGRESS netErrSocketBusy /* Operation now in progress */ +#define EALREADY netErrAlreadyInProgress /* Operation already in progress */ +/* ipc/network software */ + + /* argument errors */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported on socket */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by proto +col family */ +#define EADDRINUSE netErrPortInUse /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ + + /* operational errors */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH netErrNoInterfaces /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN netErrSocketAlreadyConnected /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT netErrTimeout /* Connection timed out */ +#define ECONNREFUSED 61 /* Connection refused */ + + /* */ +#define ELOOP 62 /* Too many levels of symbolic links */ +#define ENAMETOOLONG 63 /* File name too long */ + +/* should be rearranged */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ + +/* quotas & mush */ +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disc quota exceeded */ + +/* Network File System */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ + +/* streams */ +#define ENOSTR 72 /* Device is not a stream */ +#define ETIME 73 /* Timer expired */ +#define ENOSR 74 /* Out of streams resources */ +#define ENOMSG 75 /* No message of desired type */ +#define EBADMSG 76 /* Trying to read unreadable message */ + +/* SystemV IPC */ +#define EIDRM 77 /* Identifier removed */ + +/* SystemV Record Locking */ +#define EDEADLK 78 /* Deadlock condition. */ +#define ENOLCK 79 /* No record locks available. */ + +/* RFS */ +#define ENONET 80 /* Machine is not on the network */ +#define ERREMOTE 81 /* Object is remote */ +#define ENOLINK 82 /* the link has been severed */ +#define EADV 83 /* advertise error */ +#define ESRMNT 84 /* srmount error */ +#define ECOMM 85 /* Communication error on send */ +#define EPROTO 86 /* Protocol error */ +#define EMULTIHOP 87 /* multihop attempted */ +#define EDOTDOT 88 /* Cross mount point (not an error) */ +#define EREMCHG 89 /* Remote address changed */ + +/* POSIX */ +#define ENOSYS 90 /* function not implemented */ + +#endif /*!_sys_errno_h*/ + diff --git a/sdk-3.5/include/Core/System/Unix/sys_socket.h b/sdk-3.5/include/Core/System/Unix/sys_socket.h new file mode 100644 index 0000000..1631a7d --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/sys_socket.h @@ -0,0 +1,312 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_socket.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __UNIX_SYS_SOCKET_H__ +#define __UNIX_SYS_SOCKET_H__ + +// Include System headers +#include + +// Include the Pilot Net Manager defines +#include + +// Include other Unix headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// This is a set of unix calls that get stubbed out or replaced by +// PilotOS calls. +// +// Although these don't really "belong" here, it seems like the best solution +// rather than having a ton of other unix like header files that don't +// provide all the functionality that unix does. +#define sleep(x) SysTaskDelay(x*sysTicksPerSecond) +#define isatty(x) 1 +#define fork() -1 // can't support fork +#define abort(x) + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB +#define getenv(x) 0 +#endif + +/*=================================================================== + * Definitions related to sockets: types, address families, options. + ===================================================================*/ + +/* + * Types + */ +#define SOCK_STREAM netSocketTypeStream /* stream socket */ +#define SOCK_DGRAM netSocketTypeDatagram /* datagram socket */ +#define SOCK_RAW netSocketTypeRaw /* raw-protocol interface */ +#define SOCK_RDM netSocketTypeReliableMsg /* reliable message */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG netSocketOptSockDebug /* turn on debugging info recording */ +#define SO_ACCEPTCONN netSocketOptSockAcceptConn /* socket has had listen() */ +#define SO_REUSEADDR netSocketOptSockReuseAddr /* allow local address reuse */ +#define SO_KEEPALIVE netSocketOptSockKeepAlive /* keep connections alive */ +#define SO_DONTROUTE netSocketOptSockDontRoute /* just use interface addresses */ +#define SO_BROADCAST netSocketOptSockBroadcast /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK netSocketOptSockUseLoopback /* bypass hardware when possible */ +#define SO_LINGER netSocketOptSockLinger /* linger on close if data present */ +#define SO_OOBINLINE netSocketOptSockOOBInLine /* leave received OOB data in line */ +/* + * N.B.: The following definition is present only for compatibility + * with release 3.0. It will disappear in later releases. + */ +#define SO_DONTLINGER (~SO_LINGER) /* ~SO_LINGER */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF netSocketOptSockSndBufSize /* send buffer size */ +#define SO_RCVBUF netSocketOptSockRcvBufSize /* receive buffer size */ +#define SO_SNDLOWAT netSocketOptSockSndLowWater /* send low-water mark */ +#define SO_RCVLOWAT netSocketOptSockRcvLowWater /* receive low-water mark */ +#define SO_SNDTIMEO netSocketOptSockSndTimeout /* send timeout */ +#define SO_RCVTIMEO netSocketOptSockRcvTimeout /* receive timeout */ +#define SO_ERROR netSocketOptSockErrorStatus /* get error status and clear */ +#define SO_TYPE netSocketOptSockSocketType /* get socket type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + Int16 l_onoff; /* option on/off */ + Int16 l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET netSocketOptLevelSocket /* options for socket level */ + +/* + * Address families. + */ +#define AF_INET netSocketAddrINET /* internetwork: UDP, TCP, etc. */ +#define AF_RAW netSocketAddrRaw /* raw access to data-link interface */ + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + Int16 sa_family; /* address family */ + UInt8 sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + UInt16 sp_family; /* address family */ + UInt16 sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_INET AF_INET +#define PF_RAW AF_RAW + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct msghdr { + Char * msg_name; /* optional address */ + Int16 msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + Int16 msg_iovlen; /* # elements in msg_iov */ + Char * msg_accrights; /* access rights sent/received */ + Int16 msg_accrightslen; + }; + +#define MSG_OOB netIOFlagOutOfBand /* process out-of-band data */ +#define MSG_PEEK netIOFlagPeek /* peek at incoming message */ +#define MSG_DONTROUTE netIOFlagDontRoute /* send without using routing tables */ + +#define MSG_MAXIOVLEN netIOVecMaxLen + + +//=========================================================================== +// Globals used by the Sockets API. These are declard in the Socket.c module +// which must be linked in with any application that uses the sockets API. +//=========================================================================== +extern Err errno; +extern Int32 AppNetTimeout; +extern Char AppINETString[]; +extern NetHostInfoBufType AppHostInfo; +extern NetServInfoBufType AppServInfo; +extern UInt16 AppNetRefnum; + + +//=========================================================================== +// Macros that convert BSD Sockets calls into native Pilot calls. +//=========================================================================== +#define accept(socket,addr,addrlen) \ + NetLibSocketAccept(AppNetRefnum,socket,(NetSocketAddrType*)addr,(Int16 *)addrlen,AppNetTimeout,&errno) + +#define bind(socket,localaddr,addrlen) \ + NetLibSocketBind(AppNetRefnum, socket,(NetSocketAddrType*)localaddr,addrlen,AppNetTimeout,&errno) + +#define close(socket) \ + NetLibSocketClose(AppNetRefnum, socket,AppNetTimeout,&errno) + +#define connect(socket,addr,addrlen) \ + NetLibSocketConnect(AppNetRefnum, socket,(NetSocketAddrType*)addr,addrlen,AppNetTimeout,&errno) + +#define getsockopt(socket,level,opt,optvalP,optlenP) \ + NetLibSocketOptionGet(AppNetRefnum, socket,level,opt,optvalP,(UInt16 *)optlenP,AppNetTimeout,&errno) + +#define listen(socket,queuelen) \ + NetLibSocketListen(AppNetRefnum, socket,queuelen,AppNetTimeout,&errno) + +#define read(socket,buffer,buflen) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,0,0,0,AppNetTimeout,&errno) + +#define recv(socket,buffer,buflen,flags) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,flags,0,0,AppNetTimeout,&errno) + +#define recvfrom(socket,buffer,buflen,flags,from,fromlen) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,flags,from,(UInt16 *)fromlen,AppNetTimeout,&errno) + +#define recvmsg(socket,msg,flags) \ + NetLibReceivePB(AppNetRefnum, socket,(NetIOParamType*)msg,flags,AppNetTimeout,&errno) + +#define send(socket,buf,buflen,flags) \ + NetLibSend(AppNetRefnum, socket,buf,buflen,flags,0,0,AppNetTimeout,&errno) + +#define sendmsg(socket,msg,flags) \ + NetLibSendPB(AppNetRefnum, socket,(NetIOParamType*)msg,flags,AppNetTimeout,&errno) + +#define sendto(socket,buf,buflen,flags,to,tolen) \ + NetLibSend(AppNetRefnum, socket,buf,buflen,flags,to,tolen,AppNetTimeout,&errno) + +#define setsockopt(socket,level,opt,optvalP,optlen) \ + NetLibSocketOptionSet(AppNetRefnum, socket,level,opt,optvalP,optlen,AppNetTimeout,&errno) + +#define shutdown(socket,direction) \ + NetLibSocketShutdown(AppNetRefnum, socket,direction,AppNetTimeout,&errno) + +#define socket(domain,type,protocol) \ + NetLibSocketOpen(AppNetRefnum, domain,type,protocol,AppNetTimeout,&errno) + +#define write(socket,buf,buflen) \ + NetLibSend(AppNetRefnum, socket,(void *) buf,buflen,0,0,0,AppNetTimeout,&errno) + +#define getpeername(socket,nameP,nameLenP) \ + NetLibSocketAddr(AppNetRefnum, socket, 0, 0, (NetSocketAddrType*)nameP, (Int16 *)nameLenP, AppNetTimeout, &errno) + +#define getsockname(socket,nameP,nameLenP) \ + NetLibSocketAddr(AppNetRefnum, socket, (NetSocketAddrType*)nameP, (Int16 *)nameLenP, 0, 0, AppNetTimeout, &errno) + + +//=========================================================================== +// Sockets API calls that go through glue +//=========================================================================== + +#ifdef __cplusplus +extern "C" { +#endif + +Int16 getdomainname(Char * nameP, Int16 namelen); + +Int16 setdomainname(Char * nameP, Int16 namelen); + +Int16 gethostname(Char * nameP, Int16 namelen); + +Int16 sethostname(Char * nameP, Int16 namelen); + +Int16 select(Int16 width, fd_set* readfds, fd_set* writefds, + fd_set* exceptfds, struct timeval* timeout); + +Int16 gettimeofday(struct timeval* tp, struct timezone* tzp); + +Int16 settimeofday(struct timeval* tp, struct timezone* tzp); + + +void * MemCalloc(UInt32 nmemb, UInt32 size); + +void * MemRealloc(void * p, UInt32 size); + +#ifdef __cplusplus +} +#endif + + + +//=========================================================================== +// These are high level convenience functions. +//=========================================================================== + +#ifdef __cplusplus +extern "C" { +#endif + +// Initialize the NetSocket glue code globals if not already initialized. +// In particular, this sets up the AppNetRefnum global with the refnum of +// the NetLib. +Err NetUInit (void); + +// Open up a TCP socket and connect to the given host. If port is 0, the port +// number will be looked up by the serviceName parameter. Returns socket +// descriptor or -1 on error +NetSocketRef NetUTCPOpen(Char * hostName, Char * serviceName, Int16 port); + +// Read N bytes from a descriptor. This call automatically makes repeated read +// calls to the socket until all N bytes have been received +// Returns number of bytes read or -1 if error +Int32 NetUReadN(NetSocketRef fd, UInt8 * bufP, UInt32 numBytes); + + +// Write N bytes to a descriptor. This call automatically makes repeated write +// calls to the socket until all N bytes have been sent +// Returns number of bytes written or -1 if error +Int32 NetUWriteN(NetSocketRef fd, UInt8 * bufP, UInt32 numBytes); + +#ifdef __cplusplus +} +#endif + + +#endif /* __UNIX_SYS_SOCKET_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/sys_socketvar.h b/sdk-3.5/include/Core/System/Unix/sys_socketvar.h new file mode 100644 index 0000000..4bb277e --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/sys_socketvar.h @@ -0,0 +1,39 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_socketvar.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __UNIX_SYS_SOCKETVAR_H__ +#define __UNIX_SYS_SOCKETVAR_H__ + + +/* + * Socket state bits. + */ +#define SS_NOFDREF 0x001 /* no file table ref any more */ +#define SS_ISCONNECTED 0x002 /* socket connected to a peer */ +#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */ +#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ +#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */ +#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ +#define SS_RCVATMARK 0x040 /* at mark on input */ + +#define SS_PRIV 0x080 /* privileged for broadcast, raw... */ +#define SS_NBIO 0x100 /* non-blocking ops */ +#define SS_ASYNC 0x200 /* async i/o notify */ +#define SS_PIPE 0x400 /* pipe behavior for POSIX & SVID */ + +#endif /* __UNIX_SYS_SOCKETVAR_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/sys_time.h b/sdk-3.5/include/Core/System/Unix/sys_time.h new file mode 100644 index 0000000..d26e7f5 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/sys_time.h @@ -0,0 +1,51 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_time.h + * + * Description: + * This module contains the equivalent of the unix header + * for use in Pilot applications that wish to use the Berkeley sockets API + * + * History: + * 5/23/96 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __UNIX_SYS_TIME_H__ +#define __UNIX_SYS_TIME_H__ + + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ + +struct timeval { + Int32 tv_sec; /* seconds */ + Int32 tv_usec; /* and microseconds */ +}; + + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ +#define DST_GB 7 /* Great Britain and Eire */ +#define DST_RUM 8 /* Rumania */ +#define DST_TUR 9 /* Turkey */ +#define DST_AUSTALT 10 /* Australian style with shift in 1986 */ + + +#endif /* __UNIX_SYS_TIME_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/sys_types.h b/sdk-3.5/include/Core/System/Unix/sys_types.h new file mode 100644 index 0000000..6d02f54 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/sys_types.h @@ -0,0 +1,58 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_types.h + * + * Description: + * This module contains the Pilot equivalent of the "standard" unix + * header file + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __UNIX_SYS_TYPES_H__ +#define __UNIX_SYS_TYPES_H__ + +#include // Include Pilot Net Manager equates + +// Common Unix types +typedef UInt8 u_char; +typedef UInt16 u_short; +typedef UInt16 u_int; +typedef UInt32 u_long; + +typedef UInt16 ushort; /* System V compatibility */ +typedef UInt16 uint; /* System V compatibility */ + +// Define this so we don't get duplicate define warnings. +#define __size_t__ +typedef UInt32 size_t; // must be signed for some unix apps + +// File Descriptor Utilities, Pilot native forms in +typedef NetFDSetType fd_set; +#define FD_SETSIZE netFDSetSize + +#define FD_SET(n,p) netFDSet(n,p) +#define FD_CLR(n,p) netFDClr(n,p) +#define FD_ISSET(n,p) netFDIsSet(n,p) +#define FD_ZERO(p) netFDZero(p) + + +// Basic functions +#define bcopy(b1,b2,len) \ + MemMove(b2,b1,len) + +#define bzero(b,len) \ + MemSet(b,len,0) + +#define bcmp(b1,b2,len) \ + MemCmp(b1,b2,len) + + + +#endif /* __UNIX_SYS_TYPES_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/sys_uio.h b/sdk-3.5/include/Core/System/Unix/sys_uio.h new file mode 100644 index 0000000..9e7c0d4 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/sys_uio.h @@ -0,0 +1,34 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_uio.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)uio.h 2.9 89/06/27 SMI; from UCB 7.1 6/4/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ +#ifndef __UNIX_SYS_UIO_H__ +#define __UNIX_SYS_UIO_H__ + + +struct iovec { + UInt8 * iov_base; + UInt16 iov_len; +}; + + + +#endif /*__UNIXUIO_H__*/ + diff --git a/sdk-3.5/include/Core/System/Unix/unix_fcntl.h b/sdk-3.5/include/Core/System/Unix/unix_fcntl.h new file mode 100644 index 0000000..8c515e7 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/unix_fcntl.h @@ -0,0 +1,82 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_fcntl.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)fcntlcom.h 1.13 91/06/18 SMI; from UCB fcntl.h 5.2 1/8/86 */ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __fcntl_h +#define __fcntl_h + +/* + * Rewack the FXXXXX values as _FXXXX so that _POSIX_SOURCE works. + */ +#define _FOPEN (-1) /* from sys/file.h, kernel use only */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FSETBLK 0x0010 /* use block offsets */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ +#define _FMARK 0x10000 /* internal; mark during gc() */ +#define _FDEFER 0x20000 /* internal; defer for next gc pass */ + + +/* + * Flags that work for fcntl(fd, F_SETFL, FXXXX) + */ +#define FAPPEND _FAPPEND +#define FSYNC _FSYNC +#define FASYNC _FASYNC +#define FNBIO _FNBIO +#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */ +#define FNDELAY _FNDELAY + + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags (close on exec) */ +#define F_SETFD 2 /* Set fildes flags (close on exec) */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ + +/* Prototypes */ + +#define fcntl(a,b,c) NetFCntl(a,b,c) + +#ifdef __cplusplus +extern "C" { +#endif + +Int16 NetFCntl(Int16 fd, Int16 cmd, Int16 arg); + +#ifdef __cplusplus +} +#endif + +#endif /* !__fcntl_h */ + diff --git a/sdk-3.5/include/Core/System/Unix/unix_netdb.h b/sdk-3.5/include/Core/System/Unix/unix_netdb.h new file mode 100644 index 0000000..803e735 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/unix_netdb.h @@ -0,0 +1,116 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_netdb.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +/* @(#)netdb.h 1.11 88/08/19 SMI from UCB 5.9 4/5/88 */ +/* + * Copyright (c) 1980,1983,1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + + + +#ifndef __UNIX_NETDB_H__ +#define __UNIX_NETDB_H__ + + +/* + * Structures returned by network data base library. + * All addresses are supplied in host order, and + * returned in network order (suitable for use in system calls). + */ + +struct hostent { + Char *h_name; /* official name of host */ + Char **h_aliases; /* alias list */ + UInt16 h_addrtype; /* host address type */ + UInt16 h_length; /* length of address */ + Char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + Char *n_name; /* official name of net */ + Char **n_aliases; /* alias list */ + UInt16 n_addrtype; /* net address type */ + UInt32 n_net; /* network # */ +}; + +struct servent { + Char *s_name; /* official service name */ + Char **s_aliases; /* alias list */ + UInt16 s_port; /* port # */ + Char *s_proto; /* protocol to use */ +}; + +struct protoent { + Char *p_name; /* official protocol name */ + Char **p_aliases; /* alias list */ + UInt16 p_proto; /* protocol # */ +}; + +struct rpcent { + Char *r_name; /* name of server for this rpc program */ + Char **r_aliases; /* alias list */ + Int16 r_number; /* rpc program number */ +}; + + +// Supported calls +#define gethostbyname(nameP) \ + ((struct hostent*)NetLibGetHostByName(AppNetRefnum, nameP,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define gethostbyaddr(addr,len,type) \ + ((struct hostent*)NetLibGetHostByAddr(AppNetRefnum, (UInt8 *)addr,len,type,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define getservbyname(serv,proto) \ + ((struct servent*)NetLibGetServByName(AppNetRefnum, serv,proto,&AppServInfo,AppNetTimeout,&h_errno)) + + +// Unsupported calls +// struct hostent *gethostent(); +// struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); +// struct servent *getservbyport(), *getservent(); +// struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); +// struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver) + */ + +extern Err h_errno; + +#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + + +#endif /* __UNIX_NETDB_H__ */ + diff --git a/sdk-3.5/include/Core/System/Unix/unix_stdarg.h b/sdk-3.5/include/Core/System/Unix/unix_stdarg.h new file mode 100644 index 0000000..37179ab --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/unix_stdarg.h @@ -0,0 +1,38 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_stdarg.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +#if defined(EMULATION_LEVEL) && (EMULATION_LEVEL != EMULATION_NONE) + +#include // use the native stdarg + +#else + +#ifndef __stdarg_h +#define __stdarg_h + +#ifndef __va_list__ + #define __va_list__ + typedef char * va_list; // from +#endif /* __va_list__ */ + +#define __va_start(parm) (va_list) (&parm + 1) + +#define va_start(ap, parm) ap = __va_start(parm) +#define va_end(ap) + +#define va_arg(ap, type) (* (((type *) (ap += sizeof(type))) - 1) ) + +#endif /* !__stdarg_h */ +#endif /* EMULATION_LEVEL != EMULATION_NONE */ + diff --git a/sdk-3.5/include/Core/System/Unix/unix_stdio.h b/sdk-3.5/include/Core/System/Unix/unix_stdio.h new file mode 100644 index 0000000..6aa8ec0 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/unix_stdio.h @@ -0,0 +1,98 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_stdio.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +#ifndef __stdio_h +#define __stdio_h + +#include // Palm OS code uses this instead of + +#ifndef EOF + #define EOF -1 +#endif + +#define STDIN_FILENO sysFileDescStdIn + + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB + #define sprintf StrPrintF + #define vsprintf(x,y,z) StrVPrintF(x,(const Char *)y,z) + +#else + +#ifdef __cplusplus + extern "C" { +#endif + + int vsprintf(char *, const char *, _Va_list); + +#ifdef __cplusplus + } +#endif + +#endif + + + +// The following are macros that simply substitute an error code +// for functions which have no equivalent in the PilotOS. To +// ignore these, #define IGNORE_STDIO_STUBS ahead of this header +#ifndef IGNORE_STDIO_STUBS + +#ifndef _STDIO_H +#define stderr ((unsigned char *) - 1) +#define stdout ((unsigned char *) - 1) +#define stdin ((char *) - 1) +#endif // _STDIO_H + +#define STDOUT_FILENO -1 + +#define fclose(x) (-1) +#define fopen(x,y) (0) +#define tmpnam(x) (0) +#define S_ISREG(x) (0) + +#define fflush(x) 0 +#define fread(a,b,c,d) (0) +#define fwrite(a,b,c,d) (0) +#define ferror(x) (-1) + +#define unlink(s) (-1) +#define rmdir(x) (-1) +#define mkdir(x) (-1) +#define rename(x,y) (-1) +#define open(x,y) (-1) +#define getcwd(x,y) (0) + +#endif //IGNORE_STDIO_STUBS + + +// Function prototypes + +#ifdef __cplusplus +extern "C" { +#endif + +int sscanf(const char *, const char *, ...); + +#ifdef __cplusplus +} +#endif + + +#endif /* !__stdio_h */ + diff --git a/sdk-3.5/include/Core/System/Unix/unix_stdlib.h b/sdk-3.5/include/Core/System/Unix/unix_stdlib.h new file mode 100644 index 0000000..55fe564 --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/unix_stdlib.h @@ -0,0 +1,34 @@ +/****************************************************************************** + * + * Copyright (c) 1996 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_stdlib.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +#ifndef __stdlib_h +#define __stdlib_h + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB + +#define malloc(x) MemPtrNew(x) +#define calloc(x,y) MemCalloc(x,y) +#define realloc(x,y) MemRealloc(x,y) +#define free(x) MemPtrFree(x) +#define atoi(x) StrAToI(x) +#define atol(x) StrAToI(x) + +#endif + +#endif /* !__stdlib_h */ + diff --git a/sdk-3.5/include/Core/System/Unix/unix_string.h b/sdk-3.5/include/Core/System/Unix/unix_string.h new file mode 100644 index 0000000..a4be56c --- /dev/null +++ b/sdk-3.5/include/Core/System/Unix/unix_string.h @@ -0,0 +1,35 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_string.h + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +#ifndef __string_h +#define __string_h + +#include // Palm OS code uses this instead of + +#define strcpy(x,y) StrCopy((Char*)x,(Char*)y) +#define strncpy(x,y,z) StrNCopy(x,y,z) +#define strcmp(x,y) StrCompare(x,y) +#define strcat(x,y) StrCat(x,y) +#define strlen(x) StrLen((Char*)x) +#define strchr(x,y) StrChr(x,y) +#define strstr(x,y) StrStr(x,y) + +#define memcpy(x,y,z) (MemMove(x,(void *)y,z) ? x : x) +#define memset(x,y,z) (MemSet(x,z,y)) +#define memcmp(x,y,z) (MemCmp(x,y,z)) +#define index(x,y) StrChr(x,y) + + +#endif /* !__string.h */ + diff --git a/sdk-3.5/include/Core/System/Window.h b/sdk-3.5/include/Core/System/Window.h new file mode 100644 index 0000000..5aebc8a --- /dev/null +++ b/sdk-3.5/include/Core/System/Window.h @@ -0,0 +1,552 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Window.h + * + * Description: + * This file defines window structures and routines that support color. + * + * History: + * January 20, 1999 Created by Bob Ebert + * Name Date Description + * ---- ---- ----------- + * bob 1/20/99 Branch off WindowNew.h + * BS 4/20/99 Re-design of the screen driver + * bob 5/26/99 Cleanup/reorg + * jmp 12/23/99 Fix <> vs. "" problem. + * + *****************************************************************************/ + +#ifndef __WINDOW_H__ +#define __WINDOW_H__ + +#include +#include +#include +#include +#include + +#include // #define ERROR_CHECK_LEVEL + +#ifdef _WIN32 + #pragma warning(disable: 4214) // nonstandard extension used : bit field types other than int +#endif + +// enum for WinScrollRectangle +typedef enum { winUp = 0, winDown, winLeft, winRight } WinDirectionType; + + +// enum for WinCreateOffscreenWindow +typedef enum { screenFormat = 0, genericFormat } WindowFormatType; + + +// enum for WinLockScreen +typedef enum {winLockCopy, winLockErase, winLockDontCare} WinLockInitType; + + +// operations for the WinScreenMode function +typedef enum { + winScreenModeGetDefaults, + winScreenModeGet, + winScreenModeSetToDefaults, + winScreenModeSet, + winScreenModeGetSupportedDepths, + winScreenModeGetSupportsColor +} WinScreenModeOperation; + +// Operations for the WinPalette function +#define winPaletteGet 0 +#define winPaletteSet 1 +#define winPaletteSetToDefault 2 + +// transfer modes for color drawing +typedef enum {winPaint, winErase, winMask, winInvert, winOverlay, winPaintInverse, winSwap} WinDrawOperation; + + +typedef enum { blackPattern, whitePattern, grayPattern, customPattern } PatternType; +#define noPattern blackPattern +#define grayHLinePattern 0xAA +#define grayHLinePatternOdd 0x55 + + +// grayUnderline means dotted current foreground color +// solidUnderline means solid current foreground color +// colorUnderline redundant, use solidUnderline instead +typedef enum { noUnderline, grayUnderline, solidUnderline, colorUnderline } UnderlineModeType; + +#define WinMaxSupportedDepth 8 +#define WinNumSupportedColors 4 + +typedef UInt8 IndexedColorType; // 1-, 2-, 4-, or 8-bit index + +typedef UInt8 CustomPatternType [8]; // 8x8 1-bit deep pattern + +// for WinPalette startIndex value, respect indexes in passed table +#define WinUseTableIndexes -1 + +//----------------------------------------------- +// Draw state structures. +//----------------------------------------------- + + +typedef struct DrawStateType { + WinDrawOperation transferMode; + PatternType pattern; + UnderlineModeType underlineMode; + FontID fontId; + FontPtr font; + CustomPatternType patternData; + IndexedColorType foreColor; + IndexedColorType backColor; + IndexedColorType textColor; + UInt8 reserved; +} DrawStateType; + + +#define DrawStateStackSize 5 // enough for a control in a field in a window + + + + +//----------------------------------------------- +// The Window Structures. +//----------------------------------------------- + +typedef union FrameBitsType { + struct { + UInt16 cornerDiam : 8; // corner diameter, max 38 + UInt16 reserved_3 : 3; + UInt16 threeD : 1; // Draw 3D button + UInt16 shadowWidth : 2; // Width of shadow + UInt16 width : 2; // Width frame + } bits; + UInt16 word; // IMPORTANT: INITIALIZE word to zero before setting bits! +} FrameBitsType; + +typedef UInt16 FrameType; + +// Standard Frame Types +#define noFrame 0 +#define simpleFrame 1 +#define rectangleFrame 1 +#define simple3DFrame 0x0012 // 3d, frame = 2 +#define roundFrame 0x0401 // corner = 7, frame = 1 +#define boldRoundFrame 0x0702 // corner = 7, frame = 2 +#define popupFrame 0x0205 // corner = 2, frame = 1, shadow = 1 +#define dialogFrame 0x0302 // corner = 3, frame = 2 +#define menuFrame popupFrame + + +#define winDefaultDepthFlag 0xFF + +typedef struct WindowFlagsType { + UInt16 format:1; // window format: 0=screen mode; 1=generic mode + UInt16 offscreen:1; // offscreen flag: 0=onscreen ; 1=offscreen + UInt16 modal:1; // modal flag: 0=modeless window; 1=modal window + UInt16 focusable:1; // focusable flag: 0=non-focusable; 1=focusable + UInt16 enabled:1; // enabled flag: 0=disabled; 1=enabled + UInt16 visible:1; // visible flag: 0-invisible; 1=visible + UInt16 dialog:1; // dialog flag: 0=non-dialog; 1=dialog + UInt16 freeBitmap:1; // free bitmap w/window: 0=don't free, 1=free + UInt16 reserved :8; +} WindowFlagsType; + +typedef struct WindowType { + Coord displayWidthV20; // use WinGetDisplayExtent instead + Coord displayHeightV20; // use WinGetDisplayExtent instead + void * displayAddrV20; // use the drawing functions instead + WindowFlagsType windowFlags; + RectangleType windowBounds; + AbsRectType clippingBounds; + BitmapPtr bitmapP; + FrameBitsType frameType; + DrawStateType * drawStateP; // was GraphicStatePtr + struct WindowType * nextWindow; +} WindowType; + +typedef WindowType *WinPtr; +typedef WindowType *WinHandle; + + +//----------------------------------------------- +// More graphics shapes +//----------------------------------------------- +typedef struct WinLineType { + Coord x1; + Coord y1; + Coord x2; + Coord y2; +} WinLineType; + +// Rectangles, Points defined in Rect.h + + + +//----------------------------------------------- +// Low Memory Globals +//----------------------------------------------- + +// This is the structure of a low memory global reserved for the Window Manager +// In GRAPHIC_VERSION_2, it held a single drawing state. In this version, it +// holds stack information for structures that are allocated from the dynamic heap +typedef struct GraphicStateType { + DrawStateType * drawStateP; + DrawStateType * drawStateStackP; + Int16 drawStateIndex; + UInt16 screenLockCount; +} GraphicStateType; + +// ---------------------- +// Window manager errors +// ---------------------- +#define winErrPalette (winErrorClass | 1) + + + +//----------------------------------------------- +// Macros +//----------------------------------------------- + +// For now, the window handle is a pointer to a window structure, +// this however may change, so use the following macros. + +#define WinGetWindowPointer(winHandle) ((WindowType *) winHandle) + +#define WinGetWindowHandle(winPtr) ((WinHandle) winPtr) + +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define ECWinValidateHandle(winHandle) WinValidateHandle(winHandle) +#else +#define ECWinValidateHandle(winHandle) +#endif + + + + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------- +// Routines relating to windows management +//----------------------------------------------- + +extern Boolean WinValidateHandle (WinHandle winHandle) + SYS_TRAP(sysTrapWinValidateHandle); + +extern WinHandle WinCreateWindow (const RectangleType *bounds, FrameType frame, + Boolean modal, Boolean focusable, UInt16 *error) + SYS_TRAP(sysTrapWinCreateWindow); + +extern WinHandle WinCreateOffscreenWindow (Coord width, Coord height, + WindowFormatType format, UInt16 *error) + SYS_TRAP(sysTrapWinCreateOffscreenWindow); + +extern WinHandle WinCreateBitmapWindow (BitmapType *bitmapP, UInt16 *error) + SYS_TRAP(sysTrapWinCreateBitmapWindow); + +extern void WinDeleteWindow (WinHandle winHandle, Boolean eraseIt) + SYS_TRAP(sysTrapWinDeleteWindow); + +extern void WinInitializeWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinInitializeWindow); + +extern void WinAddWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinAddWindow); + +extern void WinRemoveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinRemoveWindow); + +extern void WinMoveWindowAddr (WindowType *oldLocationP, WindowType *newLocationP) + SYS_TRAP(sysTrapWinMoveWindowAddr); + +extern void WinSetActiveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetActiveWindow); + +extern WinHandle WinSetDrawWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetDrawWindow); + +extern WinHandle WinGetDrawWindow (void) + SYS_TRAP(sysTrapWinGetDrawWindow); + +extern WinHandle WinGetActiveWindow (void) + SYS_TRAP(sysTrapWinGetActiveWindow); + +extern WinHandle WinGetDisplayWindow (void) + SYS_TRAP(sysTrapWinGetDisplayWindow); + +extern WinHandle WinGetFirstWindow (void) + SYS_TRAP(sysTrapWinGetFirstWindow); + +extern void WinEnableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinEnableWindow); + +extern void WinDisableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinDisableWindow); + +extern void WinGetWindowFrameRect (WinHandle winHandle, RectangleType *r) + SYS_TRAP(sysTrapWinGetWindowFrameRect); + +extern void WinDrawWindowFrame (void) + SYS_TRAP(sysTrapWinDrawWindowFrame); + +extern void WinEraseWindow (void) + SYS_TRAP(sysTrapWinEraseWindow); + +extern WinHandle WinSaveBits (const RectangleType *source, UInt16 *error) + SYS_TRAP(sysTrapWinSaveBits); + +extern void WinRestoreBits (WinHandle winHandle, Coord destX, Coord destY) + SYS_TRAP(sysTrapWinRestoreBits); + +extern void WinCopyRectangle (WinHandle srcWin, WinHandle dstWin, + const RectangleType *srcRect, Coord destX, Coord destY, WinDrawOperation mode) + SYS_TRAP(sysTrapWinCopyRectangle); + +extern void WinScrollRectangle (const RectangleType *rP, WinDirectionType direction, + Coord distance, RectangleType *vacatedP) + SYS_TRAP(sysTrapWinScrollRectangle); + +extern void WinGetDisplayExtent (Coord *extentX, Coord *extentY) + SYS_TRAP(sysTrapWinGetDisplayExtent); + +extern void WinGetWindowBounds (RectangleType *rP) + SYS_TRAP(sysTrapWinGetWindowBounds); + +extern void WinSetWindowBounds (WinHandle winHandle, const RectangleType *rP) + SYS_TRAP(sysTrapWinSetWindowBounds); + +extern void WinGetWindowExtent (Coord *extentX, Coord *extentY) + SYS_TRAP(sysTrapWinGetWindowExtent); + +extern void WinDisplayToWindowPt (Coord *extentX, Coord *extentY) + SYS_TRAP(sysTrapWinDisplayToWindowPt); + +extern void WinWindowToDisplayPt (Coord *extentX, Coord *extentY) + SYS_TRAP(sysTrapWinWindowToDisplayPt); + +extern BitmapType *WinGetBitmap (WinHandle winHandle) + SYS_TRAP(sysTrapWinGetBitmap); + +extern void WinGetClip (RectangleType *rP) + SYS_TRAP(sysTrapWinGetClip); + +extern void WinSetClip (const RectangleType *rP) + SYS_TRAP(sysTrapWinSetClip); + +extern void WinResetClip (void) + SYS_TRAP(sysTrapWinResetClip); + +extern void WinClipRectangle (RectangleType *rP) + SYS_TRAP(sysTrapWinClipRectangle); + +extern Boolean WinModal (WinHandle winHandle) + SYS_TRAP(sysTrapWinModal); + +//----------------------------------------------- +// Routines to draw shapes or frames shapes +//----------------------------------------------- + +// Pixel(s) +extern IndexedColorType WinGetPixel (Coord x, Coord y) + SYS_TRAP(sysTrapWinGetPixel); + +extern void WinPaintPixel (Coord x, Coord y) // uses drawing mode + SYS_TRAP(sysTrapWinPaintPixel); + +extern void WinDrawPixel (Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawPixel); + +extern void WinErasePixel (Coord x, Coord y) + SYS_TRAP(sysTrapWinErasePixel); + +extern void WinInvertPixel (Coord x, Coord y) + SYS_TRAP(sysTrapWinInvertPixel); + +extern void WinPaintPixels (UInt16 numPoints, PointType pts[]) + SYS_TRAP(sysTrapWinPaintPixels); + +// Line(s) +extern void WinPaintLines (UInt16 numLines, WinLineType lines[]) + SYS_TRAP(sysTrapWinPaintLines); + +extern void WinPaintLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinPaintLine); + +extern void WinDrawLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinDrawLine); + +extern void WinDrawGrayLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinDrawGrayLine); + +extern void WinEraseLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinEraseLine); + +extern void WinInvertLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinInvertLine); + +extern void WinFillLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinFillLine); + + +// Rectangle +extern void WinPaintRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinPaintRectangle); + +extern void WinDrawRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinDrawRectangle); + +extern void WinEraseRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinEraseRectangle); + +extern void WinInvertRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinInvertRectangle); + +extern void WinFillRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinFillRectangle); + +// Rectangle frames +extern void WinPaintRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinPaintRectangleFrame); + +extern void WinDrawRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinDrawRectangleFrame); + +extern void WinDrawGrayRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinDrawGrayRectangleFrame); + +extern void WinEraseRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinEraseRectangleFrame); + +extern void WinInvertRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinInvertRectangleFrame); + +extern void WinGetFramesRectangle (FrameType frame, const RectangleType *rP, + RectangleType *obscuredRect) + SYS_TRAP(sysTrapWinGetFramesRectangle); + + +// Bitmap +extern void WinDrawBitmap (BitmapPtr bitmapP, Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawBitmap); + +extern void WinPaintBitmap (BitmapType *bitmapP, Coord x, Coord y) + SYS_TRAP(sysTrapWinPaintBitmap); + + +// Characters +extern void WinDrawChar (WChar theChar, Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawChar); + +extern void WinDrawChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawChars); + +extern void WinPaintChar (WChar theChar, Coord x, Coord y) + SYS_TRAP(sysTrapWinPaintChar); + +extern void WinPaintChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinPaintChars); + +extern void WinDrawInvertedChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawInvertedChars); + +extern void WinDrawTruncChars(const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth) + SYS_TRAP(sysTrapWinDrawTruncChars); + +extern void WinEraseChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinEraseChars); + +extern void WinInvertChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinInvertChars); + +extern UnderlineModeType WinSetUnderlineMode (UnderlineModeType mode) + SYS_TRAP(sysTrapWinSetUnderlineMode); + + + +//----------------------------------------------- +// Routines for patterns and colors +//----------------------------------------------- + +extern void WinPushDrawState (void) // "save" fore, back, text color, pattern, underline mode, font + SYS_TRAP(sysTrapWinPushDrawState); + +extern void WinPopDrawState (void) // "restore" saved drawing variables + SYS_TRAP(sysTrapWinPopDrawState); + + +extern WinDrawOperation WinSetDrawMode (WinDrawOperation newMode) + SYS_TRAP(sysTrapWinSetDrawMode); + + +extern IndexedColorType WinSetForeColor (IndexedColorType foreColor) + SYS_TRAP(sysTrapWinSetForeColor); + +extern IndexedColorType WinSetBackColor (IndexedColorType backColor) + SYS_TRAP(sysTrapWinSetBackColor); + +extern IndexedColorType WinSetTextColor (IndexedColorType textColor) + SYS_TRAP(sysTrapWinSetTextColor); + +// "obsolete" color call, supported for backwards compatibility +extern void WinSetColors(const RGBColorType *newForeColorP, RGBColorType *oldForeColorP, + const RGBColorType *newBackColorP, RGBColorType *oldBackColorP) + SYS_TRAP(sysTrapWinSetColors); + +extern void WinGetPattern (CustomPatternType *patternP) + SYS_TRAP(sysTrapWinGetPattern); + +extern PatternType WinGetPatternType (void) + SYS_TRAP(sysTrapWinGetPatternType); + +extern void WinSetPattern (const CustomPatternType *patternP) + SYS_TRAP(sysTrapWinSetPattern); + +extern void WinSetPatternType (PatternType newPattern) + SYS_TRAP(sysTrapWinSetPatternType); + +extern Err WinPalette(UInt8 operation, Int16 startIndex, + UInt16 paletteEntries, RGBColorType *tableP) + SYS_TRAP(sysTrapWinPalette); + +extern IndexedColorType WinRGBToIndex(const RGBColorType *rgbP) + SYS_TRAP(sysTrapWinRGBToIndex); + +extern void WinIndexToRGB(IndexedColorType i, RGBColorType *rgbP) + SYS_TRAP(sysTrapWinIndexToRGB); + + + +//----------------------------------------------- +// New WinScreen functions +//----------------------------------------------- + +extern void WinScreenInit(void) + SYS_TRAP(sysTrapWinScreenInit); + +extern Err WinScreenMode(WinScreenModeOperation operation, + UInt32 *widthP, + UInt32 *heightP, + UInt32 *depthP, + Boolean *enableColorP) + SYS_TRAP(sysTrapWinScreenMode); + + +//----------------------------------------------- +// Screen tracking (double buffering) support +//----------------------------------------------- +extern UInt8 *WinScreenLock(WinLockInitType initMode) + SYS_TRAP(sysTrapWinScreenLock); + +extern void WinScreenUnlock(void) + SYS_TRAP(sysTrapWinScreenUnlock); + +#ifdef __cplusplus +} +#endif + + +#endif //__WINDOW_H__ + diff --git a/sdk-3.5/include/Core/UI/AboutBox.h b/sdk-3.5/include/Core/UI/AboutBox.h new file mode 100644 index 0000000..03a4242 --- /dev/null +++ b/sdk-3.5/include/Core/UI/AboutBox.h @@ -0,0 +1,37 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: AboutBox.h + * + * Description: + * This file defines About Box routines + * + * History: + * October 25th, 1995 Created by Christopher Raff + * + *****************************************************************************/ + +#ifndef __ABOUTBOX_H__ +#define __ABOUTBOX_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// 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. +void AbtShowAbout (UInt32 creator) + SYS_TRAP(sysTrapAbtShowAbout); + +#ifdef __cplusplus +} +#endif + +#endif // __ABOUTBOX_H__ + diff --git a/sdk-3.5/include/Core/UI/Category.h b/sdk-3.5/include/Core/UI/Category.h new file mode 100644 index 0000000..5415f57 --- /dev/null +++ b/sdk-3.5/include/Core/UI/Category.h @@ -0,0 +1,120 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Category.h + * + * Description: + * Short description of what the file implements, who uses it + * and how it fits into the larger world. + * + * History: + * March 7, 1995 Created by Art Lamb + * 7/14/99 bob - fix up const junk + * 8/12/99 gap - add new constants categoryHideEditCategory & categoryDefaultEditCategoryString. + * + *****************************************************************************/ + +#ifndef __CATEGORY_H__ +#define __CATEGORY_H__ + +#include +#include + +#include +#include + +// 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. + +#define categoryHideEditCategory 10000 +#define categoryDefaultEditCategoryString 10001 + + +typedef struct { + UInt16 renamedCategories; + Char categoryLabels [dmRecNumCategories] [dmCategoryLength]; + UInt8 categoryUniqIDs[dmRecNumCategories]; + UInt8 lastUniqID; // Uniq IDs generated by the device are between + // 0 - 127. Those from the PC are 128 - 255. + UInt8 padding; +} AppInfoType; + +typedef AppInfoType *AppInfoPtr; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CategoryCreateListV10 (DmOpenRef db, ListType *lst, + UInt16 currentCategory, Boolean showAll) + SYS_TRAP(sysTrapCategoryCreateListV10); + +extern void CategoryCreateList (DmOpenRef db, ListType *listP, + UInt16 currentCategory, Boolean showAll, + Boolean showUneditables, UInt8 numUneditableCategories, + UInt32 editingStrID, Boolean resizeList) + SYS_TRAP(sysTrapCategoryCreateList); + + +extern void CategoryFreeListV10 (DmOpenRef db, const ListType *lst) + SYS_TRAP(sysTrapCategoryFreeListV10); + +extern void CategoryFreeList (DmOpenRef db, const ListType *listP, + Boolean showAll, UInt32 editingStrID) + SYS_TRAP(sysTrapCategoryFreeList); + +extern UInt16 CategoryFind (DmOpenRef db, const Char *name) + SYS_TRAP(sysTrapCategoryFind); + +extern void CategoryGetName (DmOpenRef db, UInt16 index, Char *name) + SYS_TRAP(sysTrapCategoryGetName); + +extern Boolean CategoryEditV10 (DmOpenRef db, UInt16 *category) + SYS_TRAP(sysTrapCategoryEditV10); + +extern Boolean CategoryEditV20 (DmOpenRef db, UInt16 *category, + UInt32 titleStrID) + SYS_TRAP(sysTrapCategoryEditV20); + +extern Boolean CategoryEdit (DmOpenRef db, UInt16 *category, + UInt32 titleStrID, UInt8 numUneditableCategories) + SYS_TRAP(sysTrapCategoryEdit); + +extern Boolean CategorySelectV10 (DmOpenRef db, const FormType *frm, + UInt16 ctlID, UInt16 lstID, Boolean title, UInt16 *categoryP, + Char *categoryName) + SYS_TRAP(sysTrapCategorySelectV10); + +extern Boolean CategorySelect (DmOpenRef db, const FormType *frm, + UInt16 ctlID, UInt16 lstID, Boolean title, UInt16 *categoryP, + Char *categoryName, UInt8 numUneditableCategories, UInt32 editingStrID) + SYS_TRAP(sysTrapCategorySelect); + +extern UInt16 CategoryGetNext (DmOpenRef db, UInt16 index) + SYS_TRAP(sysTrapCategoryGetNext); + +extern void CategorySetTriggerLabel (ControlType *ctl, Char *name) + SYS_TRAP(sysTrapCategorySetTriggerLabel); + +extern void CategoryTruncateName (Char *name, UInt16 maxWidth) + SYS_TRAP(sysTrapCategoryTruncateName); + +extern void CategoryInitialize (AppInfoPtr appInfoP, UInt16 localizedAppInfoStrID) + SYS_TRAP(sysTrapCategoryInitialize); + + +extern void CategorySetName (DmOpenRef db, UInt16 index, const Char *nameP) + SYS_TRAP(sysTrapCategorySetName); + +#ifdef __cplusplus +} +#endif + +#endif // __CATEGORY_H__ + diff --git a/sdk-3.5/include/Core/UI/Clipboard.h b/sdk-3.5/include/Core/UI/Clipboard.h new file mode 100644 index 0000000..715c8be --- /dev/null +++ b/sdk-3.5/include/Core/UI/Clipboard.h @@ -0,0 +1,62 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: clipBoard.h + * + * Description: + * This file defines clipboard structures and routines. + * + * History: + * September 1, 1994 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __CLIPBOARD_H__ +#define __CLIPBOARD_H__ + +#include +#include + +#define numClipboardForamts 3 +#define numClipboardFormats numClipboardForamts +#define cbdMaxTextLength 1000 + + +// Clipboard standard formats +enum clipboardFormats { clipboardText, clipboardInk, clipboardBitmap }; + +typedef enum clipboardFormats ClipboardFormatType; + +typedef struct { + MemHandle item; + UInt16 length; +} ClipboardItem; + +//---------------------------------------------------------- +// Clipboard Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void ClipboardAddItem + (const ClipboardFormatType format, const void *ptr, UInt16 length) + SYS_TRAP(sysTrapClipboardAddItem); + +extern Err ClipboardAppendItem + (const ClipboardFormatType format, const void *ptr, UInt16 length) + SYS_TRAP(sysTrapClipboardAppendItem); + +extern MemHandle ClipboardGetItem (const ClipboardFormatType format, + UInt16 *length) + SYS_TRAP(sysTrapClipboardGetItem); + +#ifdef __cplusplus +} +#endif + +#endif // __CLIPBOARD_H__ + diff --git a/sdk-3.5/include/Core/UI/Control.h b/sdk-3.5/include/Core/UI/Control.h new file mode 100644 index 0000000..472926c --- /dev/null +++ b/sdk-3.5/include/Core/UI/Control.h @@ -0,0 +1,189 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Control.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __CONTROL_H__ +#define __CONTROL_H__ + +#include +#include +#include +#include + +typedef struct { + 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; +} ControlAttrType; + + +enum controlStyles {buttonCtl, pushButtonCtl, checkboxCtl, popupTriggerCtl, + selectorTriggerCtl, repeatingButtonCtl, sliderCtl, + feedbackSliderCtl }; +typedef enum controlStyles ControlStyleType; + +enum buttonFrames {noButtonFrame, standardButtonFrame, boldButtonFrame, + rectangleButtonFrame}; +typedef enum buttonFrames ButtonFrameType; + + +typedef struct ControlType { + UInt16 id; + RectangleType bounds; + Char * text; + ControlAttrType attr; + ControlStyleType style; + FontID font; + UInt8 group; + UInt8 reserved; +} ControlType; + +typedef ControlType *ControlPtr; // 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) + +typedef struct GraphicControlType { + UInt16 id; + RectangleType bounds; + DmResID bitmapID; // overlays text in ControlType + DmResID selectedBitmapID; // overlays text in ControlType + ControlAttrType attr; + ControlStyleType style; + FontID unused; + UInt8 group; + UInt8 reserved; +} 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) + +typedef struct SliderControlType { + UInt16 id; + RectangleType bounds; + DmResID thumbID; // overlays text in ControlType + DmResID backgroundID; // overlays text in ControlType + ControlAttrType attr; // graphical *is* set + ControlStyleType style; // must be sliderCtl or repeatingSliderCtl + UInt8 reserved; + Int16 minValue; + Int16 maxValue; + Int16 pageSize; + Int16 value; + MemPtr activeSliderP; +} SliderControlType; + + +//---------------------------------------------------------- +// Control Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CtlDrawControl (ControlType *controlP) + SYS_TRAP(sysTrapCtlDrawControl); + +extern void CtlEraseControl (ControlType *controlP) + SYS_TRAP(sysTrapCtlEraseControl); + +extern void CtlHideControl (ControlType *controlP) + SYS_TRAP(sysTrapCtlHideControl); + +extern void CtlShowControl (ControlType *controlP) + SYS_TRAP(sysTrapCtlShowControl); + +extern Boolean CtlEnabled (const ControlType *controlP) + SYS_TRAP(sysTrapCtlEnabled); + +extern void CtlSetEnabled (ControlType *controlP, Boolean usable) + SYS_TRAP(sysTrapCtlSetEnabled); + +extern void CtlSetUsable (ControlType *controlP, Boolean usable) + SYS_TRAP(sysTrapCtlSetUsable); + +extern Int16 CtlGetValue (const ControlType *controlP) + SYS_TRAP(sysTrapCtlGetValue); + +extern void CtlSetValue (ControlType *controlP, Int16 newValue) + SYS_TRAP(sysTrapCtlSetValue); + +extern const Char *CtlGetLabel (const ControlType *controlP) + SYS_TRAP(sysTrapCtlGetLabel); + +extern void CtlSetLabel (ControlType *controlP, const Char *newLabel) + SYS_TRAP(sysTrapCtlSetLabel); + +extern void CtlSetGraphics (ControlType *ctlP, + DmResID newBitmapID, DmResID newSelectedBitmapID) + SYS_TRAP(sysTrapCtlSetGraphics); + +extern void CtlSetSliderValues(ControlType *ctlP, const UInt16 *minValueP, const UInt16 *maxValueP, + const UInt16 *pageSizeP, const UInt16 *valueP) + SYS_TRAP(sysTrapCtlSetSliderValues); + +extern void CtlGetSliderValues(const ControlType *ctlP, UInt16 *minValueP, UInt16 *maxValueP, + UInt16 *pageSizeP, UInt16 *valueP) + SYS_TRAP(sysTrapCtlGetSliderValues); + +extern void CtlHitControl (const ControlType *controlP) + SYS_TRAP(sysTrapCtlHitControl); + +extern Boolean CtlHandleEvent (ControlType *controlP, EventType *pEvent) + SYS_TRAP(sysTrapCtlHandleEvent); + +extern Boolean CtlValidatePointer (const ControlType *controlP) + SYS_TRAP(sysTrapCtlValidatePointer); + +extern ControlType *CtlNewControl (void **formPP, UInt16 ID, + ControlStyleType style, const Char *textP, + Coord x, Coord y, Coord width, Coord height, + FontID font, UInt8 group, Boolean leftAnchor) + SYS_TRAP(sysTrapCtlNewControl); + +extern GraphicControlType *CtlNewGraphicControl (void **formPP, UInt16 ID, + ControlStyleType style, DmResID bitmapID, DmResID selectedBitmapID, + Coord x, Coord y, Coord width, Coord height, + UInt8 group, Boolean leftAnchor) + SYS_TRAP(sysTrapCtlNewGraphicControl); + +extern SliderControlType *CtlNewSliderControl (void **formPP, UInt16 ID, + ControlStyleType style, DmResID thumbID, DmResID backgroundID, + Coord x, Coord y, Coord width, Coord height, UInt16 minValue, UInt16 maxValue, + UInt16 pageSize, UInt16 value) + SYS_TRAP(sysTrapCtlNewSliderControl); + +#ifdef __cplusplus +} +#endif + + +#endif //__CONTROL_H__ + diff --git a/sdk-3.5/include/Core/UI/Day.h b/sdk-3.5/include/Core/UI/Day.h new file mode 100644 index 0000000..aa307d9 --- /dev/null +++ b/sdk-3.5/include/Core/UI/Day.h @@ -0,0 +1,66 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Day.h + * + * Description: + * This file defines the date picker month object's structures + * and routines. + * + * History: + * May 31, 1995 Created by Roger Flores + * + *****************************************************************************/ + +#ifndef __DAY_H__ +#define __DAY_H__ + +#include +#include + +#include +#include + +typedef enum + { + selectDayByDay, // return d/m/y + selectDayByWeek, // return d/m/y with d as same day of the week + selectDayByMonth // return d/m/y with d as same day of the month + } SelectDayType; + +typedef struct DaySelectorType + { + RectangleType bounds; + Boolean visible; + UInt8 reserved1; + Int16 visibleMonth; // month actually displayed + Int16 visibleYear; // year actually displayed + DateTimeType selected; + SelectDayType selectDayBy; + UInt8 reserved2; + } DaySelectorType; + +typedef DaySelectorType *DaySelectorPtr; + +#ifdef __cplusplus +extern "C" { +#endif + +void DayDrawDaySelector (const DaySelectorPtr selectorP) + SYS_TRAP(sysTrapDayDrawDaySelector); + +Boolean DayHandleEvent (const DaySelectorPtr selectorP, + const EventType *pEvent) + SYS_TRAP(sysTrapDayHandleEvent); + +void DayDrawDays (const DaySelectorPtr selectorP) + SYS_TRAP(sysTrapDayDrawDays); + +#ifdef __cplusplus +} +#endif + +#endif //__DAY_H__ + diff --git a/sdk-3.5/include/Core/UI/Event.h b/sdk-3.5/include/Core/UI/Event.h new file mode 100644 index 0000000..1f2878e --- /dev/null +++ b/sdk-3.5/include/Core/UI/Event.h @@ -0,0 +1,329 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Event.h + * + * 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. + * + *****************************************************************************/ + +#ifndef __EVENT_H__ +#define __EVENT_H__ + +#include +#include +#include +#include +#include +#include + + +typedef enum { + nilEvent = 0, // system level + penDownEvent, // system level + penUpEvent, // system level + penMoveEvent, // system level + keyDownEvent, // system level + winEnterEvent, // system level + winExitEvent, // system level + ctlEnterEvent, + ctlExitEvent, + ctlSelectEvent, + ctlRepeatEvent, + lstEnterEvent, + lstSelectEvent, + lstExitEvent, + popSelectEvent, + fldEnterEvent, + fldHeightChangedEvent, + fldChangedEvent, + tblEnterEvent, + tblSelectEvent, + daySelectEvent, + menuEvent, + appStopEvent = 22, // system level + frmLoadEvent, + frmOpenEvent, + frmGotoEvent, + frmUpdateEvent, + frmSaveEvent, + frmCloseEvent, + frmTitleEnterEvent, + frmTitleSelectEvent, + tblExitEvent, + sclEnterEvent, + sclExitEvent, + sclRepeatEvent, + tsmConfirmEvent = 35, // system level + tsmFepButtonEvent, // system level + tsmFepModeEvent, // system level + + // add future UI level events in this numeric space + // to save room for new system level events + menuCmdBarOpenEvent = 0x0800, + menuOpenEvent, + menuCloseEvent, + frmGadgetEnterEvent, + frmGadgetMiscEvent, + + // Equates added for library events + firstINetLibEvent = 0x1000, + firstWebLibEvent = 0x1100, + + // Changed firstUserEvent from 32767 (0x7FFF) to 0x6000 + // Enums are signed ints, so 32767 technically only allowed for ONE event. + firstUserEvent = 0x6000 +} eventsEnum; + + +// The event record. +typedef struct EventType { + eventsEnum eType; + Boolean penDown; + UInt8 tapCount; + Int16 screenX; + Int16 screenY; + union { + struct _GenericEventType generic; + struct _PenUpEventType penUp; + struct _KeyDownEventType keyDown; + struct _WinEnterEventType winEnter; + struct _WinExitEventType winExit; + struct _TSMConfirmType tsmConfirm; + struct _TSMFepButtonType tsmFepButton; + struct _TSMFepModeEventType tsmFepMode; + + struct ctlEnter { + UInt16 controlID; + struct ControlType *pControl; + } ctlEnter; + + struct ctlSelect { + UInt16 controlID; + struct ControlType *pControl; + Boolean on; + UInt8 reserved1; + UInt16 value; // used for slider controls only + } ctlSelect; + + struct ctlRepeat { + UInt16 controlID; + struct ControlType *pControl; + UInt32 time; + UInt16 value; // used for slider controls only + } ctlRepeat; + + struct fldEnter { + UInt16 fieldID; + struct FieldType *pField; + } fldEnter; + + struct fldHeightChanged { + UInt16 fieldID; + struct FieldType *pField; + Int16 newHeight; + UInt16 currentPos; + } fldHeightChanged; + + struct fldChanged { + UInt16 fieldID; + struct FieldType *pField; + } fldChanged; + + struct fldExit { + UInt16 fieldID; + struct FieldType *pField; + } fldExit; + + struct lstEnter { + UInt16 listID; + struct ListType *pList; + Int16 selection; + } lstEnter; + + struct lstExit { + UInt16 listID; + struct ListType *pList; + } lstExit; + + struct lstSelect { + UInt16 listID; + struct ListType *pList; + Int16 selection; + } lstSelect; + + struct tblEnter { + UInt16 tableID; + struct TableType *pTable; + Int16 row; + Int16 column; + } tblEnter; + + struct tblExit { + UInt16 tableID; + struct TableType *pTable; + Int16 row; + Int16 column; + } tblExit; + + struct tblSelect { + UInt16 tableID; + struct TableType *pTable; + Int16 row; + Int16 column; + } tblSelect; + + struct frmLoad { + UInt16 formID; + } frmLoad; + + struct frmOpen { + UInt16 formID; + } frmOpen; + + struct frmGoto { + UInt16 formID; + UInt16 recordNum; // index of record that contain a match + UInt16 matchPos; // postion in record of the match. + UInt16 matchLen; // length of match. + UInt16 matchFieldNum; // field number string was found int + UInt32 matchCustom; // application specific info + } frmGoto; + + struct frmClose { + UInt16 formID; + } frmClose; + + struct frmUpdate { + UInt16 formID; + UInt16 updateCode; // Application specific + } frmUpdate; + + struct frmTitleEnter { + UInt16 formID; + } frmTitleEnter; + + struct frmTitleSelect { + UInt16 formID; + } frmTitleSelect; + + struct daySelect { + struct DaySelectorType *pSelector; + Int16 selection; + Boolean useThisDate; + UInt8 reserved1; + } daySelect; + + struct menu { + UInt16 itemID; + } menu; + + struct popSelect { + UInt16 controlID; + struct ControlType *controlP; + UInt16 listID; + struct ListType *listP; + Int16 selection; + Int16 priorSelection; + } popSelect; + + struct sclEnter { + UInt16 scrollBarID; + struct ScrollBarType *pScrollBar; + } sclEnter; + + struct sclExit { + UInt16 scrollBarID; + struct ScrollBarType *pScrollBar; + Int16 value; + Int16 newValue; + } sclExit; + + struct sclRepeat { + UInt16 scrollBarID; + struct ScrollBarType *pScrollBar; + Int16 value; + Int16 newValue; + Int32 time; + } sclRepeat; + + struct menuCmdBarOpen { + Boolean preventFieldButtons; // set to stop the field from automatically adding cut/copy/paste + UInt8 reserved; // alignment padding + } menuCmdBarOpen; + + struct menuOpen { + UInt16 menuRscID; + //struct MenuBarType *pMenu; + Int16 cause; + } menuOpen; + + struct gadgetEnter { + UInt16 gadgetID; // must be same as gadgetMisc + struct FormGadgetType * gadgetP; // must be same as gadgetMisc + } gadgetEnter; + + struct gadgetMisc { + UInt16 gadgetID; // must be same as gadgetEnter + struct FormGadgetType * gadgetP; // must be same as gadgetEnter + UInt16 selector; + void * dataP; + } gadgetMisc; + + } data; + +} EventType; + +typedef EventType *EventPtr; + +// Evaluate to true if 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 +#define EvtKeydownIsVirtual(eventP) (((eventP)->data.keyDown.modifiers & virtualKeyMask) != 0) + +#ifdef __cplusplus +extern "C" { +#endif + +//--------------------------------------------------------------------- +// Event Functions +//--------------------------------------------------------------------- + +void EvtAddEventToQueue (const EventType *event) + SYS_TRAP(sysTrapEvtAddEventToQueue); + +void EvtAddUniqueEventToQueue(const EventType *eventP, UInt32 id, + Boolean inPlace) + SYS_TRAP(sysTrapEvtAddUniqueEventToQueue); + +void EvtCopyEvent (const EventType *source, EventType *dest) + SYS_TRAP(sysTrapEvtCopyEvent); + +void EvtGetEvent (EventType *event, Int32 timeout) + SYS_TRAP(sysTrapEvtGetEvent); + +Boolean EvtEventAvail (void) + SYS_TRAP(sysTrapEvtEventAvail); + +void EvtGetPen(Int16 *pScreenX, Int16 *pScreenY, Boolean *pPenDown) + SYS_TRAP(sysTrapEvtGetPen); + +#ifdef __cplusplus +} +#endif + + +#endif // __EVENT_H__ + diff --git a/sdk-3.5/include/Core/UI/FatalAlert.h b/sdk-3.5/include/Core/UI/FatalAlert.h new file mode 100644 index 0000000..d1b4524 --- /dev/null +++ b/sdk-3.5/include/Core/UI/FatalAlert.h @@ -0,0 +1,42 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: FatalAlert.h + * + * Description: + * This file defines the system Fatal Alert support. + * + * History: + * September 12, 1994 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __FATALALERT_H__ +#define __FATALALERT_H__ + +#include +#include + +// Value returned by SysFatalAlert +#define fatalReset 0 +#define fatalEnterDebugger 1 +#define fatalDoNothing 0xFFFFU + +#ifdef __cplusplus +extern "C" { +#endif + +UInt16 SysFatalAlert (const Char *msg) + SYS_TRAP(sysTrapSysFatalAlert); + +void SysFatalAlertInit (void) + SYS_TRAP(sysTrapSysFatalAlertInit); + +#ifdef __cplusplus +} +#endif + +#endif // __FATALALERT_H__ + diff --git a/sdk-3.5/include/Core/UI/Field.h b/sdk-3.5/include/Core/UI/Field.h new file mode 100644 index 0000000..369a007 --- /dev/null +++ b/sdk-3.5/include/Core/UI/Field.h @@ -0,0 +1,274 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Field.h + * + * Description: + * This file defines field structures and routines. + * + * History: + * August 29, 1994 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __FIELD_H__ +#define __FIELD_H__ + +#include + +#include +#include +#include + +#define maxFieldTextLen 0x7fff + +// Maximun number of line the a dynamicly sizing field will expand to. +#define maxFieldLines 11 + + +// kind alignment values +enum justifications {leftAlign, centerAlign, rightAlign}; +typedef enum justifications JustificationType; + + +#define undoBufferSize 100 + +typedef enum { undoNone, undoTyping, undoBackspace, undoDelete, + undoPaste, undoCut, undoInput } UndoMode; + +typedef struct { + UndoMode mode; + UInt8 reserved; + UInt16 start; + UInt16 end; + UInt16 bufferLen; + Char *buffer; + } FieldUndoType; + + +typedef struct { + 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 +} FieldAttrType; + +typedef FieldAttrType *FieldAttrPtr; + +typedef struct { + UInt16 start; // position in text string of first char. + UInt16 length; // number of character in the line +} LineInfoType; + +typedef LineInfoType *LineInfoPtr; + + +typedef struct FieldType { + UInt16 id; + RectangleType rect; + FieldAttrType attr; + Char *text; // pointer to the start of text string + MemHandle textHandle; // block the contains the text string + LineInfoPtr lines; + UInt16 textLen; + UInt16 textBlockSize; + UInt16 maxChars; + UInt16 selFirstPos; + UInt16 selLastPos; + UInt16 insPtXPos; + UInt16 insPtYPos; + FontID fontID; + UInt8 reserved; +} FieldType; + + +typedef FieldType *FieldPtr; // deprecated, use FieldType * + + +//--------------------------------------------------------------------- +// Field Functions +//--------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void FldCopy (const FieldType *fldP) + SYS_TRAP(sysTrapFldCopy); + +extern void FldCut (FieldType *fldP) + SYS_TRAP(sysTrapFldCut); + +extern void FldDrawField (FieldType *fldP) + SYS_TRAP(sysTrapFldDrawField); + +extern void FldEraseField (FieldType *fldP) + SYS_TRAP(sysTrapFldEraseField); + +extern void FldFreeMemory (FieldType *fldP) + SYS_TRAP(sysTrapFldFreeMemory); + +extern void FldGetBounds (const FieldType *fldP, RectanglePtr rect) + SYS_TRAP(sysTrapFldGetBounds); + +extern FontID FldGetFont (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetFont); + +extern void FldGetSelection (const FieldType *fldP, UInt16 *startPosition, UInt16 *endPosition) + SYS_TRAP(sysTrapFldGetSelection); + +extern MemHandle FldGetTextHandle (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextHandle); + +extern Char * FldGetTextPtr (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextPtr); + +extern Boolean FldHandleEvent (FieldType *fldP, EventType *eventP) + SYS_TRAP(sysTrapFldHandleEvent); + +extern void FldPaste (FieldType *fldP) + SYS_TRAP(sysTrapFldPaste); + +extern void FldRecalculateField (FieldType *fldP, Boolean redraw) + SYS_TRAP(sysTrapFldRecalculateField); + +extern void FldSetBounds (FieldType *fldP, const RectangleType *rP) + SYS_TRAP(sysTrapFldSetBounds); + +extern void FldSetFont (FieldType *fldP, FontID fontID) + SYS_TRAP(sysTrapFldSetFont); + +extern void FldSetText (FieldType *fldP, MemHandle textHandle, UInt16 offset, UInt16 size) + SYS_TRAP(sysTrapFldSetText); + +extern void FldSetTextHandle (FieldType *fldP, MemHandle textHandle) + SYS_TRAP(sysTrapFldSetTextHandle); + +extern void FldSetTextPtr (FieldType *fldP, Char *textP) + SYS_TRAP(sysTrapFldSetTextPtr); + +extern void FldSetUsable (FieldType *fldP, Boolean usable) + SYS_TRAP(sysTrapFldSetUsable); + +extern void FldSetSelection (FieldType *fldP, UInt16 startPosition, UInt16 endPosition) + SYS_TRAP(sysTrapFldSetSelection); + +extern void FldGrabFocus (FieldType *fldP) + SYS_TRAP(sysTrapFldGrabFocus); + +extern void FldReleaseFocus (FieldType *fldP) + SYS_TRAP(sysTrapFldReleaseFocus); + +extern UInt16 FldGetInsPtPosition (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetInsPtPosition); + +extern void FldSetInsPtPosition (FieldType *fldP, UInt16 pos) + SYS_TRAP(sysTrapFldSetInsPtPosition); + +extern void FldSetInsertionPoint (FieldType *fldP, UInt16 pos) + SYS_TRAP(sysTrapFldSetInsertionPoint); + +extern UInt16 FldGetScrollPosition (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetScrollPosition); + +extern void FldSetScrollPosition (FieldType *fldP, UInt16 pos) + SYS_TRAP(sysTrapFldSetScrollPosition); + +extern void FldGetScrollValues (const FieldType *fldP, UInt16 *scrollPosP, + UInt16 *textHeightP, UInt16 *fieldHeightP) + SYS_TRAP(sysTrapFldGetScrollValues); + +extern UInt16 FldGetTextLength (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextLength); + +extern void FldScrollField (FieldType *fldP, UInt16 linesToScroll, WinDirectionType direction) + SYS_TRAP(sysTrapFldScrollField); + +extern Boolean FldScrollable (const FieldType *fldP, WinDirectionType direction) + SYS_TRAP(sysTrapFldScrollable); + +extern UInt16 FldGetVisibleLines (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetVisibleLines); + +extern UInt16 FldGetTextHeight (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextHeight); + +extern UInt16 FldCalcFieldHeight (const Char *chars, UInt16 maxWidth) + SYS_TRAP(sysTrapFldCalcFieldHeight); + +extern UInt16 FldWordWrap (const Char *chars, Int16 maxWidth) + SYS_TRAP(sysTrapFldWordWrap); + +extern void FldCompactText (FieldType *fldP) + SYS_TRAP(sysTrapFldCompactText); + +extern Boolean FldDirty (const FieldType *fldP) + SYS_TRAP(sysTrapFldDirty); + +extern void FldSetDirty (FieldType *fldP, Boolean dirty) + SYS_TRAP(sysTrapFldSetDirty); + +extern UInt16 FldGetMaxChars (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetMaxChars); + +extern void FldSetMaxChars (FieldType *fldP, UInt16 maxChars) + SYS_TRAP(sysTrapFldSetMaxChars); + +extern Boolean FldInsert (FieldType *fldP, const Char *insertChars, UInt16 insertLen) + SYS_TRAP(sysTrapFldInsert); + +extern void FldDelete (FieldType *fldP, UInt16 start, UInt16 end) + SYS_TRAP(sysTrapFldDelete); + +extern void FldUndo (FieldType *fldP) + SYS_TRAP(sysTrapFldUndo); + +extern UInt16 FldGetTextAllocatedSize (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextAllocatedSize); + +extern void FldSetTextAllocatedSize (FieldType *fldP, UInt16 allocatedSize) + SYS_TRAP(sysTrapFldSetTextAllocatedSize); + +extern void FldGetAttributes (const FieldType *fldP, FieldAttrPtr attrP) + SYS_TRAP(sysTrapFldGetAttributes); + +extern void FldSetAttributes (FieldType *fldP, const FieldAttrType *attrP) + SYS_TRAP(sysTrapFldSetAttributes); + +extern void FldSendChangeNotification (const FieldType *fldP) + SYS_TRAP(sysTrapFldSendChangeNotification); + +extern void FldSendHeightChangeNotification (const FieldType *fldP, UInt16 pos, Int16 numLines) + SYS_TRAP(sysTrapFldSendHeightChangeNotification); + +extern Boolean FldMakeFullyVisible (FieldType *fldP) + SYS_TRAP(sysTrapFldMakeFullyVisible); + +extern UInt16 FldGetNumberOfBlankLines (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetNumberOfBlankLines); + +extern FieldType *FldNewField (void **formPP, UInt16 id, + Coord x, Coord y, Coord width, Coord height, + FontID font, UInt32 maxChars, Boolean editable, Boolean underlined, + Boolean singleLine, Boolean dynamicSize, JustificationType justification, + Boolean autoShift, Boolean hasScrollBar, Boolean numeric) + SYS_TRAP(sysTrapFldNewField); + + +#ifdef __cplusplus +} +#endif + +#endif // __FIELD_H__ + diff --git a/sdk-3.5/include/Core/UI/Find.h b/sdk-3.5/include/Core/UI/Find.h new file mode 100644 index 0000000..b7806ab --- /dev/null +++ b/sdk-3.5/include/Core/UI/Find.h @@ -0,0 +1,123 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Find.h + * + * Description: + * This file defines field structures and routines. + * + * History: + * August 29, 1994 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __FIND_H__ +#define __FIND_H__ + +#include +#include + +#include +#include + +#define maxFinds 9 +#define maxFindStrLen 16 + +typedef struct { + UInt16 appCardNo; // card number of the application + LocalID appDbID; // LocalID of the application + Boolean foundInCaller; // true if found in app that called Find + UInt8 reserved; + + UInt16 dbCardNo; // card number of the database record was found in + LocalID dbID; // LocalID of the database record was found in + UInt16 recordNum; // index of record that contain a match + UInt16 matchPos; // postion in record of the match. + UInt16 matchFieldNum; // field number + UInt32 matchCustom; // app specific data + } FindMatchType; + +typedef FindMatchType *FindMatchPtr; + +typedef struct { + + // These fields are used by the applications. + UInt16 dbAccesMode; // read mode and maybe show secret + UInt16 recordNum; // index of last record that contained a match + Boolean more; // true of more matches to display + Char strAsTyped [maxFindStrLen+1]; // search string as entered + Char strToFind [maxFindStrLen+1]; // search string is lower case + UInt8 reserved1; + + + // 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. + UInt16 numMatches; // # of matches + UInt16 lineNumber; // next line in the results tabel + Boolean continuation; // true if contining search of same app + Boolean searchedCaller; // true after we've searched app that initiated the find + + LocalID callerAppDbID; // dbID of app that initiated search + UInt16 callerAppCardNo; // cardNo of app that initiated search + + LocalID appDbID; // dbID of app that we're currently searching + UInt16 appCardNo; // card number of app that we're currently searching + + Boolean newSearch; // true for first search + UInt8 reserved2; + DmSearchStateType searchState; // search state + FindMatchType match [maxFinds]; +} FindParamsType; + +typedef FindParamsType *FindParamsPtr; + + +// Param Block passsed with the sysAppLaunchCmdGoto Command +typedef struct { + Int16 searchStrLen; // length of search string. + UInt16 dbCardNo; // card number of the database + LocalID dbID; // LocalID of the database + UInt16 recordNum; // index of record that contain a match + UInt16 matchPos; // postion in record of the match. + UInt16 matchFieldNum; // field number string was found int + UInt32 matchCustom; // application specific info + } GoToParamsType; + +typedef GoToParamsType *GoToParamsPtr; + + +//---------------------------------------------------------- +// Find Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +void Find (GoToParamsPtr goToP) + SYS_TRAP(sysTrapFind); + + +Boolean FindStrInStr (Char const *strToSearch, Char const *strToFind, + UInt16 *posP) + SYS_TRAP(sysTrapFindStrInStr); + +Boolean FindSaveMatch (FindParamsPtr findParams, UInt16 recordNum, + UInt16 pos, UInt16 fieldNum, UInt32 appCustom, UInt16 cardNo, LocalID dbID) + SYS_TRAP(sysTrapFindSaveMatch); + +void FindGetLineBounds (const FindParamsType *findParams, RectanglePtr r) + SYS_TRAP(sysTrapFindGetLineBounds); + +Boolean FindDrawHeader (FindParamsPtr findParams, Char const *title) + SYS_TRAP(sysTrapFindDrawHeader); + +#ifdef __cplusplus +} +#endif + +#endif //__FIND_H__ + diff --git a/sdk-3.5/include/Core/UI/FontSelect.h b/sdk-3.5/include/Core/UI/FontSelect.h new file mode 100644 index 0000000..48101db --- /dev/null +++ b/sdk-3.5/include/Core/UI/FontSelect.h @@ -0,0 +1,37 @@ +/****************************************************************************** + * + * Copyright (c) 1997-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: FontSelect.h + * + * Description: + * This file defines the font selector routine. + * + * History: + * September 10, 1997 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __FONTSELECT_H__ +#define __FONTSELECT_H__ + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern FontID FontSelect (FontID fontID) + SYS_TRAP(sysTrapFontSelect); + + +#ifdef __cplusplus +} +#endif + +#endif // __FONTSELECT_H__ + diff --git a/sdk-3.5/include/Core/UI/Form.h b/sdk-3.5/include/Core/UI/Form.h new file mode 100644 index 0000000..3e0f39b --- /dev/null +++ b/sdk-3.5/include/Core/UI/Form.h @@ -0,0 +1,509 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Form.h + * + * Description: + * This file defines dialog box structures and routines. + * + * History: + * September 6, 1994 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __FORM_H__ +#define __FORM_H__ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#define noFocus 0xffff + +#define frmInvalidObjectId 0xffff +#define frmNoSelectedControl 0xff + +// Update code send as part of a frmUpdate event. +#define frmRedrawUpdateCode 0x8000 + +// Magic button IDs used by FrmCustomResponseAlert callbacks +#define frmResponseCreate 1974 +#define frmResponseQuit ((Int16) 0xBEEF) + + +// Alert constants and structures +enum alertTypes { + informationAlert, + confirmationAlert, + warningAlert, + errorAlert }; +typedef enum alertTypes AlertType; + +typedef struct { + UInt16 alertType; + UInt16 helpRscID; + UInt16 numButtons; + UInt16 defaultButton; +} AlertTemplateType; + + +// Types of object in a dialog box +enum formObjects { + frmFieldObj, + frmControlObj, + frmListObj, + frmTableObj, + frmBitmapObj, + frmLineObj, + frmFrameObj, + frmRectangleObj, + frmLabelObj, + frmTitleObj, + frmPopupObj, + frmGraffitiStateObj, + frmGadgetObj, + frmScrollBarObj }; +typedef enum formObjects FormObjectKind; + + +typedef struct { + UInt16 usable :1; // Set if part of ui + UInt16 reserved :15; // pad it out +} FormObjAttrType; + + +// Gadget support: +#define formGadgetDrawCmd 0 // paramP is unspecified +#define formGadgetEraseCmd 1 // paramP is unspecified +#define formGadgetHandleEventCmd 2 // paramP is an EventType *for the relevant event. +#define formGadgetDeleteCmd 3 // paramP is unspecified. + + +typedef struct { + 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 +} FormGadgetAttrType; + +struct FormType; // forward reference to FormType so we can declare the handler type: +typedef Boolean (FormGadgetHandlerType) (struct FormGadgetType *gadgetP, UInt16 cmd, void *paramP); + +struct FormGadgetType { + UInt16 id; + FormGadgetAttrType attr; + RectangleType rect; + const void * data; + FormGadgetHandlerType *handler; +}; +typedef struct FormGadgetType FormGadgetType; + + +// All of the smaller form objects: + +typedef struct { + FormObjAttrType attr; + PointType pos; + UInt16 rscID; +} FormBitmapType; + + +typedef struct { + FormObjAttrType attr; + PointType point1; + PointType point2; +} FormLineType; + + +typedef struct { + UInt16 id; + FormObjAttrType attr; + RectangleType rect; + UInt16 frameType; +} FormFrameType; + + +typedef struct { + FormObjAttrType attr; + RectangleType rect; +} FormRectangleType; + + +typedef struct { + UInt16 id; + PointType pos; + FormObjAttrType attr; + FontID fontID; + UInt8 reserved; + Char * text; +} FormLabelType; + + +typedef struct { + RectangleType rect; + Char * text; +} FormTitleType; + + +typedef struct { + UInt16 controlID; + UInt16 listID; +} FormPopupType; + + +typedef struct { + PointType pos; +} FrmGraffitiStateType; + + +typedef union { + void * ptr; + FieldType * field; + ControlType * control; + GraphicControlType * graphicControl; + SliderControlType * sliderControl; + ListType * list; + TableType * table; + FormBitmapType * bitmap; +// FormLineType * line; +// FormFrameType * frame; +// FormRectangleType * rectangle; + FormLabelType * label; + FormTitleType * title; + FormPopupType * popup; + FrmGraffitiStateType * grfState; + FormGadgetType * gadget; + ScrollBarType * scrollBar; +} FormObjectType; + +// typedef FormObjectType *FormObjectPtr; + + +typedef struct { + FormObjectKind objectType; + UInt8 reserved; + FormObjectType object; +} FormObjListType; + + +typedef struct { + 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 reserved :7; // pad to 16 + UInt16 reserved2; // FormAttrType now explicitly 32-bits wide. +} FormAttrType; + + +typedef Boolean FormEventHandlerType (EventType *eventP); + +typedef FormEventHandlerType *FormEventHandlerPtr; + +struct FormType { + WindowType window; + UInt16 formId; + FormAttrType attr; + WinHandle bitsBehindForm; + FormEventHandlerType * handler; + UInt16 focus; + UInt16 defaultButton; + UInt16 helpRscId; + UInt16 menuRscId; + UInt16 numObjects; + FormObjListType * objects; +}; + +typedef struct FormType FormType; +typedef FormType *FormPtr; + + +// 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 +typedef struct FormActiveStateType { + UInt16 data[11]; + } FormActiveStateType; + + +// FrmCustomResponseAlert callback routine prototype +typedef Boolean FormCheckResponseFuncType + (Int16 button, Char * attempt); + +typedef FormCheckResponseFuncType *FormCheckResponseFuncPtr; + + +//----------------------------------------------- +// Macros +//----------------------------------------------- + +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define ECFrmValidatePtr(formP) FrmValidatePtr(formP) +#else +#define ECFrmValidatePtr(formP) +#endif + +//-------------------------------------------------------------------- +// +// Form Function +// +//-------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern FormType * FrmInitForm (UInt16 rscID) + SYS_TRAP(sysTrapFrmInitForm); + +extern void FrmDeleteForm (FormType *formP) + SYS_TRAP(sysTrapFrmDeleteForm); + +extern void FrmDrawForm (FormType *formP) + SYS_TRAP(sysTrapFrmDrawForm); + +extern void FrmEraseForm (FormType *formP) + SYS_TRAP(sysTrapFrmEraseForm); + +extern FormType * FrmGetActiveForm (void) + SYS_TRAP(sysTrapFrmGetActiveForm); + +extern void FrmSetActiveForm (FormType *formP) + SYS_TRAP(sysTrapFrmSetActiveForm); + +extern UInt16 FrmGetActiveFormID (void) + SYS_TRAP(sysTrapFrmGetActiveFormID); + +extern Boolean FrmGetUserModifiedState (const FormType *formP) + SYS_TRAP(sysTrapFrmGetUserModifiedState); + +extern void FrmSetNotUserModified (FormType *formP) + SYS_TRAP(sysTrapFrmSetNotUserModified); + +extern UInt16 FrmGetFocus (const FormType *formP) + SYS_TRAP(sysTrapFrmGetFocus); + +extern void FrmSetFocus (FormType *formP, UInt16 fieldIndex) + SYS_TRAP(sysTrapFrmSetFocus); + +extern Boolean FrmHandleEvent (FormType *formP, EventType *eventP) + SYS_TRAP(sysTrapFrmHandleEvent); + +extern void FrmGetFormBounds (const FormType *formP, RectangleType *rP) + SYS_TRAP(sysTrapFrmGetFormBounds); + +extern WinHandle FrmGetWindowHandle (const FormType *formP) + SYS_TRAP(sysTrapFrmGetWindowHandle); + +extern UInt16 FrmGetFormId (const FormType *formP) + SYS_TRAP(sysTrapFrmGetFormId); + +extern FormType *FrmGetFormPtr (UInt16 formId) + SYS_TRAP(sysTrapFrmGetFormPtr); + +extern FormType *FrmGetFirstForm (void) + SYS_TRAP(sysTrapFrmGetFirstForm); + +extern UInt16 FrmGetNumberOfObjects (const FormType *formP) + SYS_TRAP(sysTrapFrmGetNumberOfObjects); + +extern UInt16 FrmGetObjectIndex (const FormType *formP, UInt16 objID) + SYS_TRAP(sysTrapFrmGetObjectIndex); + +extern UInt16 FrmGetObjectId (const FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmGetObjectId); + +extern FormObjectKind FrmGetObjectType (const FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmGetObjectType); + +extern void *FrmGetObjectPtr (const FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmGetObjectPtr); + +extern void FrmGetObjectBounds (const FormType *formP, UInt16 objIndex, + RectangleType *rP) + SYS_TRAP(sysTrapFrmGetObjectBounds); + +extern void FrmHideObject (FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmHideObject); + +extern void FrmShowObject (FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmShowObject); + +extern void FrmGetObjectPosition (const FormType *formP, UInt16 objIndex, + Coord *x, Coord *y) + SYS_TRAP(sysTrapFrmGetObjectPosition); + +extern void FrmSetObjectPosition (FormType *formP, UInt16 objIndex, + Coord x, Coord y) + SYS_TRAP(sysTrapFrmSetObjectPosition); + +extern void FrmSetObjectBounds (FormType *formP, UInt16 objIndex, + const RectangleType *bounds) + SYS_TRAP(sysTrapFrmSetObjectBounds); + +extern Int16 FrmGetControlValue (const FormType *formP, UInt16 controlID) + SYS_TRAP(sysTrapFrmGetControlValue); + +extern void FrmSetControlValue (const FormType *formP, UInt16 controlID, + Int16 newValue) + SYS_TRAP(sysTrapFrmSetControlValue); + +extern UInt16 FrmGetControlGroupSelection (const FormType *formP, + UInt8 groupNum) + SYS_TRAP(sysTrapFrmGetControlGroupSelection); + +extern void FrmSetControlGroupSelection (const FormType *formP, + UInt8 groupNum, UInt16 controlID) + SYS_TRAP(sysTrapFrmSetControlGroupSelection); + +extern void FrmCopyLabel (FormType *formP, UInt16 labelID, + const Char *newLabel) + SYS_TRAP(sysTrapFrmCopyLabel); + +extern const Char *FrmGetLabel (const FormType *formP, UInt16 labelID) + SYS_TRAP(sysTrapFrmGetLabel); + +extern void FrmSetCategoryLabel (const FormType *formP, UInt16 objIndex, + Char *newLabel) + SYS_TRAP(sysTrapFrmSetCategoryLabel); + +extern const Char *FrmGetTitle (const FormType *formP) + SYS_TRAP(sysTrapFrmGetTitle); + +extern void FrmSetTitle (FormType *formP, Char *newTitle) + SYS_TRAP(sysTrapFrmSetTitle); + +extern void FrmCopyTitle (FormType *formP, const Char *newTitle) + SYS_TRAP(sysTrapFrmCopyTitle); + +extern void *FrmGetGadgetData (const FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmGetGadgetData); + +extern void FrmSetGadgetData (FormType *formP, UInt16 objIndex, + const void *data) + SYS_TRAP(sysTrapFrmSetGadgetData); + +extern void FrmSetGadgetHandler (FormType *formP, UInt16 objIndex, + FormGadgetHandlerType *attrP) + SYS_TRAP(sysTrapFrmSetGadgetHandler); + +extern UInt16 FrmDoDialog (FormType *formP) + SYS_TRAP(sysTrapFrmDoDialog); + +extern UInt16 FrmAlert (UInt16 alertId) + SYS_TRAP(sysTrapFrmAlert); + +extern UInt16 FrmCustomAlert (UInt16 alertId, const Char *s1, + const Char *s2, const Char *s3) + SYS_TRAP(sysTrapFrmCustomAlert); + +extern void FrmHelp (UInt16 helpMsgId) + SYS_TRAP(sysTrapFrmHelp); + +extern void FrmUpdateScrollers (FormType *formP, UInt16 upIndex, + UInt16 downIndex, Boolean scrollableUp, Boolean scrollableDown) + SYS_TRAP(sysTrapFrmUpdateScrollers); + +extern Boolean FrmVisible (const FormType *formP) + SYS_TRAP(sysTrapFrmVisible); + +extern void FrmSetEventHandler (FormType *formP, FormEventHandlerType *handler) + SYS_TRAP(sysTrapFrmSetEventHandler); + +extern Boolean FrmDispatchEvent (EventType *eventP) + SYS_TRAP(sysTrapFrmDispatchEvent); + + + + +extern void FrmPopupForm (UInt16 formId) + SYS_TRAP(sysTrapFrmPopupForm); + +extern void FrmGotoForm (UInt16 formId) + SYS_TRAP(sysTrapFrmGotoForm); + +extern void FrmUpdateForm (UInt16 formId, UInt16 updateCode) + SYS_TRAP(sysTrapFrmUpdateForm); + +extern void FrmReturnToForm (UInt16 formId) + SYS_TRAP(sysTrapFrmReturnToForm); + +extern void FrmCloseAllForms (void) + SYS_TRAP(sysTrapFrmCloseAllForms); + +extern void FrmSaveAllForms (void) + SYS_TRAP(sysTrapFrmSaveAllForms); + + + +extern Boolean FrmPointInTitle (const FormType *formP, Coord x, Coord y) + SYS_TRAP(sysTrapFrmPointInTitle); + +extern void FrmSetMenu (FormType *formP, UInt16 menuRscID) + SYS_TRAP(sysTrapFrmSetMenu); + +extern Boolean FrmValidatePtr (const FormType *formP) + SYS_TRAP(sysTrapFrmValidatePtr); + +extern Err FrmAddSpaceForObject (FormType **formPP, MemPtr *objectPP, + FormObjectKind objectKind, UInt16 objectSize) + SYS_TRAP(sysTrapFrmAddSpaceForObject); + +extern Err FrmRemoveObject (FormType **formPP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmRemoveObject); + +extern FormType *FrmNewForm (UInt16 formID, const Char *titleStrP, + Coord x, Coord y, Coord width, Coord height, Boolean modal, + UInt16 defaultButton, UInt16 helpRscID, UInt16 menuRscID) + SYS_TRAP(sysTrapFrmNewForm); + +extern FormLabelType *FrmNewLabel (FormType **formPP, UInt16 ID, const Char *textP, + Coord x, Coord y, FontID font) + SYS_TRAP(sysTrapFrmNewLabel); + +extern FormBitmapType *FrmNewBitmap (FormType **formPP, UInt16 ID, + UInt16 rscID, Coord x, Coord y) + SYS_TRAP(sysTrapFrmNewBitmap); + +extern FormGadgetType *FrmNewGadget (FormType **formPP, UInt16 id, + Coord x, Coord y, Coord width, Coord height) + SYS_TRAP(sysTrapFrmNewGadget); + +extern Err FrmActiveState (FormActiveStateType *stateP, Boolean save) + SYS_TRAP(sysTrapFrmActiveState); + +extern UInt16 FrmCustomResponseAlert (UInt16 alertId, const Char *s1, const Char *s2, + const Char *s3, Char *entryStringBuf, Int16 entryStringBufLength, + FormCheckResponseFuncPtr callback) + SYS_TRAP(sysTrapFrmCustomResponseAlert); + +extern FrmGraffitiStateType *FrmNewGsi (FormType **formPP, Coord x, Coord y) + SYS_TRAP(sysTrapFrmNewGsi); + +#define FrmSaveActiveState(stateP) FrmActiveState(stateP, true) +#define FrmRestoreActiveState(stateP) FrmActiveState(stateP, false) + + + +#ifdef __cplusplus +} +#endif + +#endif // __FORM_H__ + diff --git a/sdk-3.5/include/Core/UI/GraffitiReference.h b/sdk-3.5/include/Core/UI/GraffitiReference.h new file mode 100644 index 0000000..f22cdd0 --- /dev/null +++ b/sdk-3.5/include/Core/UI/GraffitiReference.h @@ -0,0 +1,47 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: GraffitiReference.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __GRAFFITIREFERENCE_H__ +#define __GRAFFITIREFERENCE_H__ + +#include +#include + +typedef enum + { + referenceDefault = 0xff // based on graffiti mode + } ReferenceType; + +/************************************************************ + * Graffiti Reference procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +extern void SysGraffitiReferenceDialog (ReferenceType referenceType) + SYS_TRAP(sysTrapSysGraffitiReferenceDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __GRAFFITIREFERENCE_H__ + diff --git a/sdk-3.5/include/Core/UI/GraffitiShift.h b/sdk-3.5/include/Core/UI/GraffitiShift.h new file mode 100644 index 0000000..9634562 --- /dev/null +++ b/sdk-3.5/include/Core/UI/GraffitiShift.h @@ -0,0 +1,62 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: GraffitiShift.h + * + * Description: + * This file defines Griffiti shift state indicator routines. + * + * History: + * Aug 24, 1995 Created by Art Lamb + * mm/dd/yy initials - brief revision comment + * + *****************************************************************************/ + +#ifndef __GRAFFITISHIFT_H__ +#define __GRAFFITISHIFT_H__ + +#include +#include + +// Graffiti lock flags +#define glfCapsLock 0x01 +#define glfNumLock 0x02 + + +typedef enum { gsiShiftNone, // no indicator + gsiNumLock, // numeric lock + gsiCapsLock, // capital lock + gsiShiftPunctuation, // punctuation shift + gsiShiftExtended, // extented punctuation shift + gsiShiftUpper, // alpha upper case shift + gsiShiftLower // alpha lower case + } GsiShiftState; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void GsiInitialize (void) + SYS_TRAP(sysTrapGsiInitialize); + +extern void GsiSetLocation (const Int16 x, const Int16 y) + SYS_TRAP(sysTrapGsiSetLocation); + +extern void GsiEnable (const Boolean enableIt) + SYS_TRAP(sysTrapGsiEnable); + +extern Boolean GsiEnabled (void) + SYS_TRAP(sysTrapGsiEnabled); + +extern void GsiSetShiftState (const UInt16 lockFlags, const UInt16 tempShift) + SYS_TRAP(sysTrapGsiSetShiftState); + +#ifdef __cplusplus +} +#endif + +#endif //__GRAFFITISHIFT_H__ + diff --git a/sdk-3.5/include/Core/UI/InsPoint.h b/sdk-3.5/include/Core/UI/InsPoint.h new file mode 100644 index 0000000..1a67678 --- /dev/null +++ b/sdk-3.5/include/Core/UI/InsPoint.h @@ -0,0 +1,59 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: InsPoint.h + * + * Description: + * This file defines insertion point routines. + * + * History: + * Jan 25, 1995 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __INSPOINT_H__ +#define __INSPOINT_H__ + +#include +#include + +// Blink interval is half of a second +#define insPtBlinkInterval (sysTicksPerSecond / 2) +#define insPtWidth 2 + +#ifdef __cplusplus +extern "C" { +#endif + +extern void InsPtInitialize (void) + SYS_TRAP(sysTrapInsPtInitialize); + +extern void InsPtSetLocation (const Int16 x, const Int16 y) + SYS_TRAP(sysTrapInsPtSetLocation); + +extern void InsPtGetLocation (Int16 *x, Int16 *y) + SYS_TRAP(sysTrapInsPtGetLocation); + +extern void InsPtEnable (Boolean enableIt) + SYS_TRAP(sysTrapInsPtEnable); + +extern Boolean InsPtEnabled (void) + SYS_TRAP(sysTrapInsPtEnabled); + +extern void InsPtSetHeight (const Int16 height) + SYS_TRAP(sysTrapInsPtSetHeight); + +extern Int16 InsPtGetHeight (void) + SYS_TRAP(sysTrapInsPtGetHeight); + +extern void InsPtCheckBlink (void) + SYS_TRAP(sysTrapInsPtCheckBlink); + +#ifdef __cplusplus +} +#endif + +#endif //__INSPOINT_H__ + diff --git a/sdk-3.5/include/Core/UI/Keyboard.h b/sdk-3.5/include/Core/UI/Keyboard.h new file mode 100644 index 0000000..bce4182 --- /dev/null +++ b/sdk-3.5/include/Core/UI/Keyboard.h @@ -0,0 +1,63 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Keyboard.h + * + * Description: + * This file defines the keyboard's structures + * and routines. + * + * History: + * March 29, 1995 Created by Roger Flores + * + *****************************************************************************/ + +#ifndef __KEYBOARD_H__ +#define __KEYBOARD_H__ + +#include +#include + +#define kbdReturnKey linefeedChr +#define kbdTabKey tabChr +#define kbdBackspaceKey backspaceChr +#define kbdShiftKey 2 +#define kbdCapsKey 1 +#define kbdNoKey 0xff + + +typedef enum + { + kbdAlpha = 0, + kbdNumbersAndPunc = 1, + kbdAccent = 2, + kbdDefault = 0xff // based on graffiti mode (usually alphaKeyboard) + } KeyboardType; + + +/************************************************************ + * Keyboard procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// 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. + +extern void SysKeyboardDialogV10 () + SYS_TRAP(sysTrapSysKeyboardDialogV10); + +extern void SysKeyboardDialog (KeyboardType kbd) + SYS_TRAP(sysTrapSysKeyboardDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __KEYBOARD_H__ + diff --git a/sdk-3.5/include/Core/UI/Launcher.h b/sdk-3.5/include/Core/UI/Launcher.h new file mode 100644 index 0000000..9675554 --- /dev/null +++ b/sdk-3.5/include/Core/UI/Launcher.h @@ -0,0 +1,62 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Launcher.h + * + * Description: + * These are the routines for the launcher. + * + * History: + * April 27, 1995 Created by Roger Flores + * + *****************************************************************************/ + +#ifndef __LAUNCHER_H__ +#define __LAUNCHER_H__ + +#include +#include + +#include +#include +#include +#include +#include + +typedef struct { + FormPtr form; + Int16 numItems; // numItems of applications available via the launcher + Int16 columns; + Int16 rows; + Int16 topItem; + Int8 selection; + UInt8 reserved; + MemHandle appInfoH; // an array is to be allocated + TimeFormatType timeFormat; // Format to display time in + char timeString[timeStringLength]; + FormPtr savedForm; // the currently active dialog. +} LauncherType; + +typedef LauncherType *LauncherPtr; + + + +/************************************************************ + * Launcher procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +void SysAppLauncherDialog() + SYS_TRAP(sysTrapSysAppLauncherDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __LAUNCHER_H__ + diff --git a/sdk-3.5/include/Core/UI/List.h b/sdk-3.5/include/Core/UI/List.h new file mode 100644 index 0000000..65c491a --- /dev/null +++ b/sdk-3.5/include/Core/UI/List.h @@ -0,0 +1,135 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: List.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __LIST_H__ +#define __LIST_H__ + +#include +#include + +#include + +#define noListSelection -1 + +//------------------------------------------------------------------- +// List structures +//------------------------------------------------------------------- + +typedef struct { + 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; +} ListAttrType; + + +// Load data callback routine prototype +typedef void ListDrawDataFuncType (Int16 itemNum, RectangleType *bounds, + Char **itemsText); + +typedef ListDrawDataFuncType *ListDrawDataFuncPtr; + + +typedef struct ListType { + UInt16 id; + RectangleType bounds; + ListAttrType attr; + Char * *itemsText; + Int16 numItems; // number of choices in the list + Int16 currentItem; // currently display choice + Int16 topItem; // top item visible when poped up + FontID font; // font used to draw list + UInt8 reserved; + WinHandle popupWin; // used only by popup lists + ListDrawDataFuncPtr drawItemsCallback; // 0 indicates no function +} ListType; + +typedef ListType *ListPtr; + + +//------------------------------------------------------------------- +// List routines +//------------------------------------------------------------------- +#ifdef __cplusplus +extern "C" { +#endif + +extern void LstDrawList (ListType *listP) + SYS_TRAP(sysTrapLstDrawList); + +extern void LstEraseList (ListType *listP) + SYS_TRAP(sysTrapLstEraseList); + +extern Int16 LstGetSelection (const ListType *listP) + SYS_TRAP(sysTrapLstGetSelection); + +extern Char * LstGetSelectionText (const ListType *listP, Int16 itemNum) + SYS_TRAP(sysTrapLstGetSelectionText); + +extern Boolean LstHandleEvent (ListType *listP, const EventType *eventP) + SYS_TRAP(sysTrapLstHandleEvent); + +extern void LstSetHeight (ListType *listP, Int16 visibleItems) + SYS_TRAP(sysTrapLstSetHeight); + +extern void LstSetPosition (ListType *listP, Coord x, Coord y) + SYS_TRAP(sysTrapLstSetPosition); + +extern void LstSetSelection (ListType *listP, Int16 itemNum) + SYS_TRAP(sysTrapLstSetSelection); + +extern void LstSetListChoices (ListType *listP, Char **itemsText, Int16 numItems) + SYS_TRAP(sysTrapLstSetListChoices); + +extern void LstSetDrawFunction (ListType *listP, ListDrawDataFuncPtr func) + SYS_TRAP(sysTrapLstSetDrawFunction); + +extern void LstSetTopItem (ListType *listP, Int16 itemNum) + SYS_TRAP(sysTrapLstSetTopItem); + +extern void LstMakeItemVisible (ListType *listP, Int16 itemNum) + SYS_TRAP(sysTrapLstMakeItemVisible); + +extern Int16 LstGetNumberOfItems (const ListType *listP) + SYS_TRAP(sysTrapLstGetNumberOfItems); + +extern Int16 LstPopupList (ListType *listP) + SYS_TRAP(sysTrapLstPopupList); + +extern Boolean LstScrollList(ListType *listP, WinDirectionType direction, Int16 itemCount) + SYS_TRAP(sysTrapLstScrollList); + +extern Int16 LstGetVisibleItems (const ListType *listP) + SYS_TRAP(sysTrapLstGetVisibleItems); + +extern Err LstNewList (void **formPP, UInt16 id, + Coord x, Coord y, Coord width, Coord height, + FontID font, Int16 visibleItems, Int16 triggerId) + SYS_TRAP(sysTrapLstNewList); + + + +#ifdef __cplusplus +} +#endif + +#endif // __LIST_H__ + diff --git a/sdk-3.5/include/Core/UI/Menu.h b/sdk-3.5/include/Core/UI/Menu.h new file mode 100644 index 0000000..2f712a8 --- /dev/null +++ b/sdk-3.5/include/Core/UI/Menu.h @@ -0,0 +1,190 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Menu.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __MENU_H__ +#define __MENU_H__ + +#include +#include + +#include +#include +#include + +// Errors returned by Menu routines + +#define menuErrNoMenu (menuErrorClass | 1) +#define menuErrNotFound (menuErrorClass | 2) +#define menuErrSameId (menuErrorClass | 3) +#define menuErrTooManyItems (menuErrorClass | 4) +#define menuErrOutOfMemory (menuErrorClass | 5) + + +// Command bar structures + +typedef enum { + menuCmdBarResultNone, // send nothing (this'd be quite unusual but is allowed) + menuCmdBarResultChar, // char to send (with commandKeyMask bit set) + menuCmdBarResultMenuItem, // id of the menu item + menuCmdBarResultNotify // Nofication Manager notification type +} MenuCmdBarResultType; + +// maximum length of the prompt string to display in the command bar +#define menuCmdBarMaxTextLength 20 + +typedef struct { + UInt16 bitmapId; + Char name[menuCmdBarMaxTextLength]; + MenuCmdBarResultType resultType; + UInt8 reserved; // alignment padding + UInt32 result; +} MenuCmdBarButtonType; + +typedef struct MenuCmdBarType { + WinHandle bitsBehind; + Int32 timeoutTick; // tick to disappear on + Coord top; + Int16 numButtons; + Boolean insPtWasEnabled; + Boolean gsiWasEnabled; + Boolean feedbackMode; // set when just displaying confirmation feedback + MenuCmdBarButtonType * buttonsData; +} MenuCmdBarType; + +// to tell MenuCmdBarAddButton where to add the button: on right or left. +#define menuCmdBarOnRight 0 +#define menuCmdBarOnLeft 0xff + + + +////Menu-specific + +#define noMenuSelection -1 +#define noMenuItemSelection -1 +#define separatorItemSelection -2 + +// cause codes for menuOpen Event +#define menuButtonCause 0 +#define 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. +#define MenuSeparatorChar '-' + +typedef struct { + UInt16 id; // id of the menu item + Char command; // command key + UInt8 hidden: 1; // true if menu item is hidden + UInt8 reserved: 7; + Char * itemStr; // string to be displayed +} MenuItemType; + + +typedef struct { + WinHandle menuWin; // window of pull-down menu + RectangleType bounds; // bounds of the pulldown + WinHandle bitsBehind; // saving bits behind pull-down menu + RectangleType titleBounds; // bounds of the title in menu bar + Char * title; // menu title displayed in menu bar + UInt16 hidden: 1; // true if pulldown is hidden + UInt16 numItems: 15; // number of items in the menu + MenuItemType * items; // array of menu items +} MenuPullDownType; + +typedef MenuPullDownType *MenuPullDownPtr; + +typedef struct { + 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 +} MenuBarAttrType; + +typedef struct { + WinHandle barWin; // window of menu bar + WinHandle bitsBehind; // saving bits behind menu bar + WinHandle savedActiveWin; + WinHandle bitsBehindStatus; + MenuBarAttrType attr; + Int16 curMenu; // current menu or -1 if none + Int16 curItem; // current item in curMenu, -1 if none + Int32 commandTick; // + Int16 numMenus; // number of menus + MenuPullDownPtr menus; // array of menus +} MenuBarType; + +typedef MenuBarType *MenuBarPtr; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern MenuBarType *MenuInit (UInt16 resourceId) + SYS_TRAP(sysTrapMenuInit); + +extern MenuBarType *MenuGetActiveMenu (void) + SYS_TRAP(sysTrapMenuGetActiveMenu); + +extern MenuBarType *MenuSetActiveMenu (MenuBarType *menuP) + SYS_TRAP(sysTrapMenuSetActiveMenu); + +extern void MenuDispose (MenuBarType *menuP) + SYS_TRAP(sysTrapMenuDispose); + +extern Boolean MenuHandleEvent (MenuBarType *menuP, EventType *event, UInt16 *error) + SYS_TRAP(sysTrapMenuHandleEvent); + +extern void MenuDrawMenu (MenuBarType *menuP) + SYS_TRAP(sysTrapMenuDrawMenu); + +extern void MenuEraseStatus (MenuBarType *menuP) + SYS_TRAP(sysTrapMenuEraseStatus); + +extern void MenuSetActiveMenuRscID (UInt16 resourceId) + SYS_TRAP(sysTrapMenuSetActiveMenuRscID); + +extern Err MenuCmdBarAddButton(UInt8 where, UInt16 bitmapId, + MenuCmdBarResultType resultType, UInt32 result, Char *nameP) + SYS_TRAP(sysTrapMenuCmdBarAddButton); + +extern Boolean MenuCmdBarGetButtonData(Int16 buttonIndex, UInt16 *bitmapIdP, + MenuCmdBarResultType *resultTypeP, UInt32 *resultP, Char *nameP) + SYS_TRAP(sysTrapMenuCmdBarGetButtonData); + +extern void MenuCmdBarDisplay (void) + SYS_TRAP(sysTrapMenuCmdBarDisplay); + +extern Boolean MenuShowItem(UInt16 id) + SYS_TRAP(sysTrapMenuShowItem); + +extern Boolean MenuHideItem(UInt16 id) + SYS_TRAP(sysTrapMenuHideItem); + +extern Err MenuAddItem(UInt16 positionId, UInt16 id, Char cmd, const Char *textP) + SYS_TRAP(sysTrapMenuAddItem); + + + +#ifdef __cplusplus +} +#endif + +#endif //__MENU_H__ + diff --git a/sdk-3.5/include/Core/UI/PhoneLookup.h b/sdk-3.5/include/Core/UI/PhoneLookup.h new file mode 100644 index 0000000..e77ab4a --- /dev/null +++ b/sdk-3.5/include/Core/UI/PhoneLookup.h @@ -0,0 +1,37 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PhoneLookup.h + * + * Description: + * This file defines phone number lookup structures and routines. + * + * History: + * July 23, 1996 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __PHONE_LOOKUP_H__ +#define __PHONE_LOOKUP_H__ + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern void PhoneNumberLookup (FieldType *fldP) + SYS_TRAP(sysTrapPhoneNumberLookup); + +#ifdef __cplusplus +} +#endif + + +#endif // __PHONE_LOOKUP_H__ + diff --git a/sdk-3.5/include/Core/UI/PrivateRecords.h b/sdk-3.5/include/Core/UI/PrivateRecords.h new file mode 100644 index 0000000..0f19f33 --- /dev/null +++ b/sdk-3.5/include/Core/UI/PrivateRecords.h @@ -0,0 +1,47 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PrivateRecords.h + * + * Description: + * This header file defines a generic private record maintainance dialogs, etc. + * + * History: + * 6/23/99. Created by Craig Skinner + * + *****************************************************************************/ + +#ifndef __PRIVATERECORDS_H__ +#define __PRIVATERECORDS_H__ + +#include + +// Defines needed for hidden record visual determination. +typedef enum privateRecordViewEnum { +showPrivateRecords = 0x00, +maskPrivateRecords, +hidePrivateRecords +} privateRecordViewEnum; + +//----------------------------------------------------------------------- +// Prototypes +//----------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern privateRecordViewEnum SecSelectViewStatus (void) + SYS_TRAP(sysTrapSecSelectViewStatus); + +extern Boolean SecVerifyPW (privateRecordViewEnum newSecLevel) + SYS_TRAP(sysTrapSecVerifyPW); + +#ifdef __cplusplus +} +#endif + +#endif //__PRIVATERECORDS_H__ + diff --git a/sdk-3.5/include/Core/UI/Progress.h b/sdk-3.5/include/Core/UI/Progress.h new file mode 100644 index 0000000..30adfd3 --- /dev/null +++ b/sdk-3.5/include/Core/UI/Progress.h @@ -0,0 +1,218 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Progress.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __PROGRESS_H__ +#define __PROGRESS_H__ + +#include // Basic types +#include // Trap Numbers. + +#include +#include +#include + + +#define progressMaxMessage 128 +#define progressMaxTitle 31 // max size for title of progress dialog +#define 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... +typedef struct +{ + UInt16 stage; // <= current stage + Char *textP; // => buffer to hold text to display + UInt16 textLen; // <= length of text buffer + Char *message; // <= additional text for display + Err error; // <= current error + UInt16 bitmapId; // => resource ID of bitmap to display + 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 + UInt32 timeout; // <> timeout in ticks to force next update (for animation) + + //progress bar info (Not Implemented) + UInt32 barMaxValue; // the maximum value for the progress bar, if = 0 then the bar is + // not visible + UInt32 barCurValue; // the current value of the progress bar, the bar will be drawn + // filled the percentage of maxValue \ value + Char *barMessage; // additional text for display below the progress bar. + UInt16 barFlags; // reserved for future use. + + // + // *** The following fields were added in PalmOS 3.2 *** + // + + UInt16 delay:1; // => if true delay 1 second after updating form icon/msg + void * userDataP; // <= context pointer that caller passed to PrgStartDialog + +} PrgCallbackData, *PrgCallbackDataPtr; + +//typedef Boolean (*PrgCallbackFunc) (UInt16 stage,Boolean showDetails,Char *message,Boolean cancel,UInt16 error,Char *textP, UInt16 maxtextLen,UInt16 *bitmapID); +typedef Boolean (*PrgCallbackFunc) (PrgCallbackDataPtr cbP); + + + +//--------------------------------------------------------------------------- +// 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. +//--------------------------------------------------------------------------- + + +typedef struct { + + // This field contains a pointer to the open progress dialog + FormPtr frmP; // 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 + UInt32 timeout; // max time to wait in ticks + + + // 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. + UInt16 error; // 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. + UInt16 stage; // 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(). + Char message[progressMaxMessage+1]; // connection stage message. + + UInt8 reserved1; + + // Used to cache current icon number so we don't unnecessarily redraw it + UInt16 lastBitmapID; + + // 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. + Char ctlLabel[progressMaxButtonText+1]; + + Char * serviceNameP; + + //progress bar stuff (Not implemented) + UInt32 lastBarMaxValue; + UInt32 lastBarCurValue; + + // stuff for saving old window state + WinHandle oldDrawWinH; + WinHandle oldActiveWinH; + FormPtr oldFrmP; + Boolean oldInsPtState; + UInt8 reserved2; + PointType oldInsPtPos; + + PrgCallbackFunc textCallback; + + char title[progressMaxTitle+1]; + + // + // *** The following field was added in PalmOS 3.2 *** + // + + void *userDataP; + + } ProgressType, *ProgressPtr; + +// 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 +#define PrgUserCancel(prgP) (prgP)->cancel + +//----------------------------------------------------------------------- +// Prototypes +//----------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +ProgressPtr PrgStartDialogV31(Char *title,PrgCallbackFunc textCallback) + SYS_TRAP(sysTrapPrgStartDialogV31); + +ProgressPtr PrgStartDialog(Char *title,PrgCallbackFunc textCallback, void *userDataP) + SYS_TRAP(sysTrapPrgStartDialog); + +void PrgStopDialog(ProgressPtr prgP,Boolean force) + SYS_TRAP(sysTrapPrgStopDialog); + +void PrgUpdateDialog(ProgressPtr prgGP, UInt16 err, UInt16 stage, + Char * messageP,Boolean updateNow) + SYS_TRAP(sysTrapPrgUpdateDialog); + +Boolean PrgHandleEvent(ProgressPtr prgGP,EventType *eventP) + SYS_TRAP(sysTrapPrgHandleEvent); + +#ifdef __cplusplus +} +#endif + +#endif //__PROGRESS_H__ + diff --git a/sdk-3.5/include/Core/UI/ScrollBar.h b/sdk-3.5/include/Core/UI/ScrollBar.h new file mode 100644 index 0000000..7161dd0 --- /dev/null +++ b/sdk-3.5/include/Core/UI/ScrollBar.h @@ -0,0 +1,76 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ScrollBar.h + * + * Description: + * This file defines scroll bar structures and routines. + * + * History: + * Feb 6, 1996 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __SCROLLBAR_H__ +#define __SCROLLBAR_H__ + +#include +#include + +#include +#include + +typedef enum { sclUpArrow, sclDownArrow, sclUpPage, sclDownPage, sclCar } + ScrollBarRegionType; + + +typedef struct { + 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 +} ScrollBarAttrType; + + +typedef struct ScrollBarType { + RectangleType bounds; + UInt16 id; + ScrollBarAttrType attr; + Int16 value; + Int16 minValue; + Int16 maxValue; + Int16 pageSize; + Int16 penPosInCar; + Int16 savePos; +} ScrollBarType; + +typedef ScrollBarType *ScrollBarPtr; + +#ifdef __cplusplus +extern "C" { +#endif + +extern void SclGetScrollBar (const ScrollBarPtr bar, Int16 *valueP, + Int16 *minP, Int16 *maxP, Int16 *pageSizeP) + SYS_TRAP(sysTrapSclGetScrollBar); + +extern void SclSetScrollBar (const ScrollBarPtr bar, Int16 value, + const Int16 min, const Int16 max, const Int16 pageSize) + SYS_TRAP(sysTrapSclSetScrollBar); + +extern void SclDrawScrollBar (const ScrollBarPtr bar) + SYS_TRAP(sysTrapSclDrawScrollBar); + +extern Boolean SclHandleEvent (const ScrollBarPtr bar, const EventType *event) + SYS_TRAP(sysTrapSclHandleEvent); + +#ifdef __cplusplus +} +#endif + + +#endif //__SCROLLBAR_H__ + diff --git a/sdk-3.5/include/Core/UI/SelDay.h b/sdk-3.5/include/Core/UI/SelDay.h new file mode 100644 index 0000000..9c793f2 --- /dev/null +++ b/sdk-3.5/include/Core/UI/SelDay.h @@ -0,0 +1,45 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SelDay.h + * + * Description: + * This file defines the date picker month object's structures + * and routines. + * + * History: + * November 10, 1994 Created by Roger Flores + * + *****************************************************************************/ + +#ifndef __SELDAY_H__ +#define __SELDAY_H__ + +#include +#include + +#include + +#define daySelectorMinYear firstYear +#define daySelectorMaxYear lastYear + +#ifdef __cplusplus +extern "C" { +#endif + +extern Boolean SelectDayV10 (Int16 *month, Int16 *day, Int16 *year, + const Char *title) + SYS_TRAP(sysTrapSelectDayV10); + +extern Boolean SelectDay (const SelectDayType selectDayBy, Int16 *month, + Int16 *day, Int16 *year, const Char *title) + SYS_TRAP(sysTrapSelectDay); + +#ifdef __cplusplus +} +#endif + +#endif //__SELDAY_H__ + diff --git a/sdk-3.5/include/Core/UI/SelTime.h b/sdk-3.5/include/Core/UI/SelTime.h new file mode 100644 index 0000000..1e00caa --- /dev/null +++ b/sdk-3.5/include/Core/UI/SelTime.h @@ -0,0 +1,58 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SelTime.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __SELTIME_H__ +#define __SELTIME_H__ + +#include +#include + +#include +//------------------------------------------------------------------- +// structures +//------------------------------------------------------------------- + + +typedef struct { + UInt8 hours; + UInt8 minutes; + UInt8 seconds; + UInt8 reserved; +} HMSTime; + +#ifdef __cplusplus +extern "C" { +#endif + +// This is slated to be deleted in the next version. +extern Boolean SelectTimeV33 (TimeType *startTimeP, TimeType *EndTimeP, + Boolean untimed, const Char *titleP, Int16 startOfDay) + SYS_TRAP(sysTrapSelectTimeV33); + +extern Boolean SelectTime (TimeType *startTimeP, TimeType *EndTimeP, + Boolean untimed, const Char *titleP, Int16 startOfDay, Int16 endOfDay, + Int16 startOfDisplay) + SYS_TRAP(sysTrapSelectTime); + +extern Boolean SelectOneTime(Int16 *hour, Int16 *minute, const Char *titleP) + SYS_TRAP(sysTrapSelectOneTime); + +#ifdef __cplusplus +} +#endif + +#endif // __SELTIME_H__ + diff --git a/sdk-3.5/include/Core/UI/Table.h b/sdk-3.5/include/Core/UI/Table.h new file mode 100644 index 0000000..b17e4f5 --- /dev/null +++ b/sdk-3.5/include/Core/UI/Table.h @@ -0,0 +1,318 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: Table.h + * + * Description: + * This file defines table structures and routines. + * + * History: + * September 1, 1994 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __TABLE_H__ +#define __TABLE_H__ + +#include +#include + +#include + +//------------------------------------------------------------------- +// Table structures +//------------------------------------------------------------------- + +#define tableDefaultColumnSpacing 1 +#define tableNoteIndicatorWidth 7 +#define tableNoteIndicatorHeight 11 +#define tableMaxTextItemSize 255 // does not incude terminating null + +#define tblUnusableRow 0xffff + +// Display style of a table item +// +enum tableItemStyles { checkboxTableItem, + customTableItem, + dateTableItem, + labelTableItem, + numericTableItem, + popupTriggerTableItem, + textTableItem, + textWithNoteTableItem, + timeTableItem, + narrowTextTableItem + }; +typedef enum tableItemStyles TableItemStyleType; + + +typedef struct { + TableItemStyleType itemType; + FontID fontID; // font for drawing text + Int16 intValue; + Char * ptr; +} TableItemType; +typedef TableItemType *TableItemPtr; + + +// Draw item callback routine prototype, used only by customTableItem. +typedef void TableDrawItemFuncType + (void *tableP, Int16 row, Int16 column, RectangleType *bounds); + +typedef TableDrawItemFuncType *TableDrawItemFuncPtr; + + +// Load data callback routine prototype +typedef Err TableLoadDataFuncType + (void *tableP, Int16 row, Int16 column, Boolean editable, + MemHandle * dataH, Int16 *dataOffset, Int16 *dataSize, FieldPtr fld); + +typedef TableLoadDataFuncType *TableLoadDataFuncPtr; + + +// Save data callback routine prototype +typedef Boolean TableSaveDataFuncType + (void *tableP, Int16 row, Int16 column); + +typedef TableSaveDataFuncType *TableSaveDataFuncPtr; + +typedef struct { + Coord width; // width in pixels + UInt16 reserved1 : 5; + UInt16 masked : 1; // if both row + column masked, draw only grey box + UInt16 editIndicator : 1; + UInt16 usable : 1; + UInt16 reserved2 : 8; + Coord spacing; // space after column + TableDrawItemFuncPtr drawCallback; + TableLoadDataFuncPtr loadDataCallback; + TableSaveDataFuncPtr saveDataCallback; + +} TableColumnAttrType; + + +typedef struct { + UInt16 id; + Coord height; // row height in pixels + UInt32 data; + + 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; + + UInt16 reserved3; + +} TableRowAttrType; + + +typedef struct { + 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 reserved:11; +} TableAttrType; + + +typedef struct TableType { + UInt16 id; + RectangleType bounds; + TableAttrType attr; + Int16 numColumns; + Int16 numRows; + Int16 currentRow; + Int16 currentColumn; + Int16 topRow; + TableColumnAttrType * columnAttrs; + TableRowAttrType * rowAttrs; + TableItemPtr items; + FieldType currentField; +} TableType; + +typedef TableType *TablePtr; + + +//------------------------------------------------------------------- +// Table routines +//------------------------------------------------------------------- +#ifdef __cplusplus +extern "C" { +#endif + +extern void TblDrawTable (TableType *tableP) + SYS_TRAP(sysTrapTblDrawTable); + +extern void TblRedrawTable (TableType *tableP) + SYS_TRAP(sysTrapTblRedrawTable); + +extern void TblEraseTable (TableType *tableP) + SYS_TRAP(sysTrapTblEraseTable); + +extern Boolean TblHandleEvent (TableType *tableP, EventType *event) + SYS_TRAP(sysTrapTblHandleEvent); + +extern void TblGetItemBounds (const TableType *tableP, Int16 row, Int16 column, RectangleType *rP) + SYS_TRAP(sysTrapTblGetItemBounds); + +extern void TblSelectItem (TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblSelectItem); + +extern Int16 TblGetItemInt (const TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblGetItemInt); + +extern void TblSetItemInt (TableType *tableP, Int16 row, Int16 column, Int16 value) + SYS_TRAP(sysTrapTblSetItemInt); + +extern void TblSetItemPtr (TableType *tableP, Int16 row, Int16 column, void *value) + SYS_TRAP(sysTrapTblSetItemPtr); + +extern void TblSetItemStyle (TableType *tableP, Int16 row, Int16 column, TableItemStyleType type) + SYS_TRAP(sysTrapTblSetItemStyle); + +extern void TblUnhighlightSelection (TableType *tableP) + SYS_TRAP(sysTrapTblUnhighlightSelection); + +extern Boolean TblRowUsable (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRowUsable); + +extern void TblSetRowUsable (TableType *tableP, Int16 row, Boolean usable) + SYS_TRAP(sysTrapTblSetRowUsable); + +extern Int16 TblGetLastUsableRow (const TableType *tableP) + SYS_TRAP(sysTrapTblGetLastUsableRow); + +extern void TblSetColumnUsable (TableType *tableP, Int16 column, Boolean usable) + SYS_TRAP(sysTrapTblSetColumnUsable); + +extern void TblSetRowSelectable (TableType *tableP, Int16 row, Boolean selectable) + SYS_TRAP(sysTrapTblSetRowSelectable); + +extern Boolean TblRowSelectable (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRowSelectable); + +extern Int16 TblGetNumberOfRows (const TableType *tableP) + SYS_TRAP(sysTrapTblGetNumberOfRows); + +extern void TblSetCustomDrawProcedure (TableType *tableP, Int16 column, + TableDrawItemFuncPtr drawCallback) + SYS_TRAP(sysTrapTblSetCustomDrawProcedure); + +extern void TblSetLoadDataProcedure (TableType *tableP, Int16 column, + TableLoadDataFuncPtr loadDataCallback) + SYS_TRAP(sysTrapTblSetLoadDataProcedure); + +extern void TblSetSaveDataProcedure (TableType *tableP, Int16 column, + TableSaveDataFuncPtr saveDataCallback) + SYS_TRAP(sysTrapTblSetSaveDataProcedure); + +extern void TblGetBounds (const TableType *tableP, RectangleType *rP) + SYS_TRAP(sysTrapTblGetBounds); + +extern void TblSetBounds (TableType *tableP, const RectangleType *rP) + SYS_TRAP(sysTrapTblSetBounds); + +extern Coord TblGetRowHeight (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblGetRowHeight); + +extern void TblSetRowHeight (TableType *tableP, Int16 row, Coord height) + SYS_TRAP(sysTrapTblSetRowHeight); + +extern Coord TblGetColumnWidth (const TableType *tableP, Int16 column) + SYS_TRAP(sysTrapTblGetColumnWidth); + +extern void TblSetColumnWidth (TableType *tableP, Int16 column, Coord width) + SYS_TRAP(sysTrapTblSetColumnWidth); + +extern Coord TblGetColumnSpacing (const TableType *tableP, Int16 column) + SYS_TRAP(sysTrapTblGetColumnSpacing); + +extern void TblSetColumnSpacing (TableType *tableP, Int16 column, Coord spacing) + SYS_TRAP(sysTrapTblSetColumnSpacing); + +extern Boolean TblFindRowID (const TableType *tableP, UInt16 id, Int16 *rowP) + SYS_TRAP(sysTrapTblFindRowID); + +extern Boolean TblFindRowData (const TableType *tableP, UInt32 data, Int16 *rowP) + SYS_TRAP(sysTrapTblFindRowData); + +extern UInt16 TblGetRowID (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblGetRowID); + +extern void TblSetRowID (TableType *tableP, Int16 row, UInt16 id) + SYS_TRAP(sysTrapTblSetRowID); + +extern UInt32 TblGetRowData (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblGetRowData); + +extern void TblSetRowData (TableType *tableP, Int16 row, UInt32 data) + SYS_TRAP(sysTrapTblSetRowData); + +extern Boolean TblRowInvalid (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRowInvalid); + +extern void TblMarkRowInvalid (TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblMarkRowInvalid); + +extern void TblMarkTableInvalid (TableType *tableP) + SYS_TRAP(sysTrapTblMarkTableInvalid); + +extern Boolean TblGetSelection (const TableType *tableP, Int16 *rowP, Int16 *columnP) + SYS_TRAP(sysTrapTblGetSelection); + +extern void TblInsertRow (TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblInsertRow); + +extern void TblRemoveRow (TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRemoveRow); + +extern void TblReleaseFocus (TableType *tableP) + SYS_TRAP(sysTrapTblReleaseFocus); + +extern Boolean TblEditing (const TableType *tableP) + SYS_TRAP(sysTrapTblEditing); + +extern FieldPtr TblGetCurrentField (const TableType *tableP) + SYS_TRAP(sysTrapTblGetCurrentField); + +extern void TblGrabFocus (TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblGrabFocus); + +extern void TblSetColumnEditIndicator (TableType *tableP, Int16 column, Boolean editIndicator) + SYS_TRAP(sysTrapTblSetColumnEditIndicator); + +extern void TblSetRowStaticHeight (TableType *tableP, Int16 row, Boolean staticHeight) + SYS_TRAP(sysTrapTblSetRowStaticHeight); + +extern void TblHasScrollBar (TableType *tableP, Boolean hasScrollBar) + SYS_TRAP(sysTrapTblHasScrollBar); + +extern FontID TblGetItemFont (const TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblGetItemFont); + +extern void TblSetItemFont (TableType *tableP, Int16 row, Int16 column, FontID fontID) + SYS_TRAP(sysTrapTblSetItemFont); + +extern void *TblGetItemPtr (const TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblGetItemPtr); + +extern Boolean TblRowMasked (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRowMasked); + +extern void TblSetRowMasked (TableType *tableP, Int16 row, Boolean masked) + SYS_TRAP(sysTrapTblSetRowMasked); + +extern void TblSetColumnMasked (TableType *tableP, Int16 column, Boolean masked) + SYS_TRAP(sysTrapTblSetColumnMasked); +#ifdef __cplusplus +} +#endif + +#endif //__TABLE_H__ + diff --git a/sdk-3.5/include/Core/UI/UIColor.h b/sdk-3.5/include/Core/UI/UIColor.h new file mode 100644 index 0000000..9bfb98e --- /dev/null +++ b/sdk-3.5/include/Core/UI/UIColor.h @@ -0,0 +1,100 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: UIColor.h + * + * 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. + * + *****************************************************************************/ + +#ifndef __UICOLOR_H__ +#define __UICOLOR_H__ + +#include +#include + +#include + +typedef enum UIColorTableEntries { + UIObjectFrame = 0, + UIObjectFill, + UIObjectForeground, + UIObjectSelectedFill, + UIObjectSelectedForeground, + + UIMenuFrame, + UIMenuFill, + UIMenuForeground, + UIMenuSelectedFill, + UIMenuSelectedForeground, + + UIFieldBackground, + UIFieldText, + UIFieldTextLines, + UIFieldCaret, + UIFieldTextHighlightBackground, + UIFieldTextHighlightForeground, + UIFieldFepRawText, + UIFieldFepRawBackground, + UIFieldFepConvertedText, + UIFieldFepConvertedBackground, + UIFieldFepUnderline, + + UIFormFrame, + UIFormFill, + + UIDialogFrame, + UIDialogFill, + + UIAlertFrame, + UIAlertFill, + + UIOK, + UICaution, + UIWarning, + + UILastColorTableEntry +} UIColorTableEntries; + + + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------ +// UI Color Table Manipulation Routines +//------------------------------------------------------------ + +extern IndexedColorType UIColorGetTableEntryIndex(UIColorTableEntries which) + SYS_TRAP(sysTrapUIColorGetTableEntryIndex); + +extern void UIColorGetTableEntryRGB(UIColorTableEntries which, RGBColorType *rgbP) + SYS_TRAP(sysTrapUIColorGetTableEntryRGB); + +extern Err UIColorSetTableEntry(UIColorTableEntries which, const RGBColorType *rgbP) + SYS_TRAP(sysTrapUIColorSetTableEntry); + +extern Err UIColorPushTable(void) + SYS_TRAP(sysTrapUIColorPushTable); + +extern Err UIColorPopTable(void) + SYS_TRAP(sysTrapUIColorPopTable); + + +#ifdef __cplusplus +} +#endif + +#endif //__UICOLOR_H__ + diff --git a/sdk-3.5/include/Core/UI/UIControls.h b/sdk-3.5/include/Core/UI/UIControls.h new file mode 100644 index 0000000..c100647 --- /dev/null +++ b/sdk-3.5/include/Core/UI/UIControls.h @@ -0,0 +1,55 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: UIControls.h + * + * 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 + * + *****************************************************************************/ + +#ifndef __UICONTROLS_H__ +#define __UICONTROLS_H__ + +#include + +// for UIPickColor +#define UIPickColorStartPalette 0 +#define UIPickColorStartRGB 1 + +typedef UInt16 UIPickColorStartType; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void UIContrastAdjust() + SYS_TRAP(sysTrapUIContrastAdjust); + +extern void UIBrightnessAdjust() + SYS_TRAP(sysTrapUIBrightnessAdjust); + +Boolean UIPickColor(IndexedColorType *indexP, RGBColorType *rgbP, + UIPickColorStartType start, const Char *titleP, + const Char *tipP) + SYS_TRAP(sysTrapUIPickColor); + + +#ifdef __cplusplus +} +#endif + +#endif // __UICONTROLS_H__ + diff --git a/sdk-3.5/include/Core/UI/UIPublic.h b/sdk-3.5/include/Core/UI/UIPublic.h new file mode 100644 index 0000000..a924667 --- /dev/null +++ b/sdk-3.5/include/Core/UI/UIPublic.h @@ -0,0 +1,53 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: UIPublic.h + * + * Description: + * Group file, include this to get all public UI includes. + * + * History: + * 7/13/99 Created by Bob Ebert + * mm/dd/yy initials - brief revision comment + * + *****************************************************************************/ + +#ifndef __UIPUBLIC_H__ +#define __UIPUBLIC_H__ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // __UIPUBLIC_H__ + diff --git a/sdk-3.5/include/Core/UI/UIResDefs.r b/sdk-3.5/include/Core/UI/UIResDefs.r new file mode 100644 index 0000000..080938d --- /dev/null +++ b/sdk-3.5/include/Core/UI/UIResDefs.r @@ -0,0 +1,1070 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: UIResDefs.r + * + * Description: + * Type Declarations for Rez and DeRez + * + * Currently supported types: + * cnty, tAIB, taif, tAIN, tAIS, Talt, Tbmp, tbmf, tBTN, tCBX, + * tFBM, tFLD, tFRM, tgbn, tGDT, tgpb, tgrb, tGSI, tLBL, tLST, + * tPBN, tPUL, tPUT, tREP, tSCL, tSTL, tSTR, tTBL, tTTL, tver, + * tint, xprf, silk. + * + * Note: only *all lowercase* entries are reserved. We're OK with + * the existing ones, but newly added resource types should be + * all downcased. + * + * Conditionally supported types from MPW's SysTypes.r: + * NFNT, FONT + * (If you need SysTypes.r file, include it BEFORE UIResDefs.r) + * + * Conditionally supported types from MPW's Types.r: + * ICON, MBAR, MENU, PICT + * (If you need Types.r file, include it BEFORE UIResDefs.r) + * + * Other known but UNsupported types: + * feat (TMPL in ResEdit Preferences) + * tkbd (in keyboard.rsrc, created by MakeKbd.c.) + * + * Usage: + * Resource files can be DeRez'ed with the following command: + * derez MyRsrcFile.rsrc UIResDefs.r >MyRezSource.r + * + * Source files can be Rez'ed with the following command: + * rez UIResDefs.r MyRezSource.r -t rsrc -c RSED -o MyRsrcFile.rsrc + * + * Padding: + * For some reason, some cstring types are defined in the ResEdit + * templates as ECST and others are CSTR. It would appear that + * Rez aligns relative to the start of the resource, which doesn't + * quite jive with ResEdit's even padded cstring type. It's not clear + * that PalmOS (RezConvert.cp for example) requires even padding. + * All of the affected strings occur at the end of the resource type. + * If the ECST's are important, these rez templates should be tweaked. + * + * History: + * 08/29/96 SCL Created + * 09/03/96 SCL Added "Unique Currency Symbol" field to "cnty" resource + * 10/25/96 SCL Changed "tFLD" resource to new 2.0 definition + * 02/07/99 SCL Added largeBoldFont (new for Palm OS v3.0) + * 10/21/98 Bob Added tgbn, tgpb, rbmf, and taif types + * 12/23/98 Bob Added tAIB and Tbmp types + * 06/29/99 CS Added tint type to support ResLoadConstant + * 06/30/99 CS Added measurementSystem field to "cnty" type, + * and added align statements to remove compiler + * dependencies. + * 07/15/99 kwk Added 'silk' resource typedef. + * 09/20/99 gap added additional cXXXX country values. + * 09/20/99 gap cPRC -> cRepChina. + * + *****************************************************************************/ + +#define alertType informationAlert=0, confirmationAlert=1, \ + warningAlert=2, errorAlert=3 + +#define palmFont stdFont=0, boldFont=1, largeFont=2, \ + symbolFont=3, checkboxFont=4, symbol11Font=4, \ + symbol7Font=5, ledFont=6, largeBoldFont=7 + + +/*======================================================================================*/ +#ifndef __SYSTYPES_R__ /* If MPW's SysTypes.r was NOT included, */ + /* then define NFNT and FONT */ + +/*----------------------------FONT Ľ Font Description-----------------------------------*/ +/* PROBLEMS: the offset to the offset/width table has been changed to a longint, with the + high word stored in the neg descent field (if its not -1). Rez can't handle + this. */ +type 'FONT' { + /* Font Type Flags */ +FontType: + boolean = 1; /* Reserved */ + boolean doExpandFont, dontExpandFont; + boolean proportionalFont, fixedWidthFont; + boolean = 1; /* Reserved */ + unsigned bitstring[2] = 0; /* Reserved */ + boolean blackFont, colorFont; + boolean notSynthetic, isSynthetic; + boolean nofctbRsrc, hasfctbRsrc; + unsigned bitstring[3] = 0; /* Reserved */ + unsigned bitstring[2] oneBit, twoBit, /* Font depth */ + fourBit, eightBit; + boolean noCharWidthTable, hasCharWidthTable; + boolean noImageHeightTable, hasImageHeightTable; + + FirstChar: + integer; /* first char */ + LastChar: + integer; /* last char */ + integer; /* width max */ + integer; /* kern max */ + integer; /* neg descent */ + integer; /* font rect width */ + Height: + integer; /* font rect height */ + Offset: + unsigned integer = ((WidthTable-Offset)/16); /* offset to off/wid tab*/ + integer; /* ascent */ + integer; /* descent */ + integer; /* leading */ + RowWords: + integer; /* row width (in words) */ + + /* Tables */ + /* Bit image */ + hex string [($$Word(RowWords) <<($$BitField(FontType, 12, 2) + & 3) + 1) * $$Word(Height)]; + + /* Location Table */ + array [$$Word(LastChar) - $$Word(FirstChar) + 3] { + integer; + }; + + /* Offset/Width Table */ + WidthTable: + array [$$Word(LastChar) - $$Word(FirstChar) + 3] { + integer; + }; + + /* Optional Character Width Table */ + Array [($$Word(FontType) & 0x0002) != 0] { + array [$$Word(LastChar) - $$Word(FirstChar) + 3] { + integer; + }; + }; + + /* Optional Image Height Table */ + Array [($$Word(FontType) & 0x0001) != 0] { + array [$$Word(LastChar) - $$Word(FirstChar) + 3] { + integer; + }; + }; +}; + +/*----------------------------NFNT Ľ Font Description-----------------------------------*/ +type 'NFNT' as 'FONT'; + +#endif // __SYSTYPES_R__ + + +/*======================================================================================*/ +#ifndef __TYPES_R__ /* If MPW's Types.r was NOT included, */ + /* then define ICON, MENU, MBAR, and PICT */ + +/*----------------------------ICON Ľ Icon-----------------------------------------------*/ +type 'ICON' { + hex string[128]; /* Icon data */ +}; + + +/*----------------------------MENU Ľ Menu-----------------------------------------------*/ +type 'MENU' { + integer; /* Menu ID */ + fill word[2]; + integer textMenuProc = 0; /* ID of menu def proc */ + fill word; + unsigned hex bitstring[31] + allEnabled = 0x7FFFFFFF; /* Enable flags */ + boolean disabled, enabled; /* Menu enable */ + pstring apple = "\0x14"; /* Menu Title */ + wide array { + pstring; /* Item title */ + byte noIcon; /* Icon number */ + char noKey = "\0x00", /* Key equivalent or */ + hierarchicalMenu = "\0x1B"; /* hierarchical menu */ + char noMark = "\0x00", /* Marking char or id */ + check = "\0x12"; /* of hierarchical menu */ + fill bit; + unsigned bitstring[7] + plain; /* Style */ + }; + byte = 0; +}; + + +/*----------------------------MBAR Ľ Menu Bar-------------------------------------------*/ +type 'MBAR' { + integer = $$CountOf(MenuArray); /* Number of menus */ + wide array MenuArray{ + integer; /* Menu resource ID */ + }; +}; + +#ifndef __PICT_R__ +/*----------------------------PICT Ľ Quickdraw Picture----------------------------------*/ +type 'PICT' { + unsigned integer; /* Length */ + rect; /* Frame */ + hex string; /* Data */ +}; +#endif // __PICT_R__ +#endif // __TYPES_R__ + + +#ifndef __PALMTYPES_R__ +#define __PALMTYPES_R__ + + +/*======================================================================================*/ +type 'cnty' { + wide array CountryArray { + byte; /* Number */ + align word; + cstring[0x14]; /* Name */ + byte; /* Date Format */ + byte; /* Long Date Format */ + byte; /* Week Start Day */ + byte; /* Time Format */ + byte; /* Number Format */ + align word; + cstring[0x14]; /* Currency Name */ + cstring[0x06]; /* Currency Symbol */ +// Unique Currency Symbol field added 9/3/96 at Art's request... + cstring[0x06]; /* Unique Currency Symbol */ + byte; /* Currency Decimal Places */ + byte; /* Daylight Savings Type */ + longint; /* Minutes West of GMT */ + byte; /* Measurement system (e.g., English, Metric) */ + align word; + }; +}; /* end cnty */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tAIB' { + array Images { + switch { + case Uncompressed: + integer; /* width; */ + Height: integer; /* height; */ + RowBytes: integer; /* rowBytes; */ + key integer = 0; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffset: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + fill byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + hex string[$$Word(RowBytes[$$ArrayIndex(Images)]) * $$Word(Height[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed: + integer; /* width; */ + HeightComp: integer; /* height; */ + RowBytesComp: integer; /* rowBytes; */ + key integer = -32768; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetComp: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + fill byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + hex string[(($$Word(NextOffsetComp[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasTransparency: + integer; /* width; */ + HeightT: integer; /* height; */ + RowBytesT: integer; /* rowBytes; */ + key integer = 8192; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetT: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + unsigned byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + hex string[$$Word(RowBytesT[$$ArrayIndex(Images)]) * $$Word(HeightT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasTransparency: + integer; /* width; */ + HeightCompT: integer; /* height; */ + RowBytesCompT: integer; /* rowBytes; */ + key integer = -24576; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompT:integer; /* nextDepthOffset - # of DWords to next BitmapType */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + hex string[(($$Word(NextOffsetCompT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasColorTable: + integer; /* width; */ + HeightCT: integer; /* height; */ + RowBytesCT: integer; /* rowBytes; */ + key integer = 16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCT: integer; /* nextDepthOffset (dword) */ + fill byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[$$Word(RowBytesCT[$$ArrayIndex(Images)]) * $$Word(HeightCT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasColorTable: + integer; /* width; */ + HeightCompCT: integer; /* height; */ + RowBytesCompCT:integer; /* rowBytes; */ + key integer = -16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompCT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[(($$Word(NextOffsetCompCT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasColorTable_HasTransparency: + integer; /* width; */ + HeightCTT: integer; /* height; */ + RowBytesCTT: integer; /* rowBytes; */ + key integer = 16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCTT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[$$Word(RowBytesCTT[$$ArrayIndex(Images)]) * $$Word(HeightCTT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasColorTable_HasTransparency: + integer; /* width; */ + HeightCompCTT: integer; /* height; */ + RowBytesCompCTT:integer; /* rowBytes; */ + key integer = -16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompCTT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[(($$Word(NextOffsetCompCTT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + }; + }; +}; /* end tAIB */ + + +/*--------------------------------------------------------------------------------------*/ +type 'taif' { + integer; /* App Icon ID */ + integer; /* width */ + integer; /* height */ + integer = $$CountOf(PICTArray); /* Number of images */ + wide array PICTArray { + integer; /* depth */ + byte uncompressed=0, compressed=1; /* compression flag */ + fill byte; + byte noTransprency=0, hasTransparency=1; /* transparency flag */ + fill byte; + integer; /* PICT id for data */ + integer; /* compression type */ + integer; /* transparent index */ + integer reserved=0; /* reserved, must be 0 (colorTable) */ + }; +}; /* end taif */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tAIN' { + cstring; /* App Icon Name */ + align word; /* App Icon Name is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tAIN */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tAIS' { + /* dmRecNumCategories = 16 categories */ + cstring; /* Localize app info string[0] */ + cstring; /* Localize app info string[1] */ + cstring; /* Localize app info string[2] */ + cstring; /* Localize app info string[3] */ + cstring; /* Localize app info string[4] */ + cstring; /* Localize app info string[5] */ + cstring; /* Localize app info string[6] */ + cstring; /* Localize app info string[7] */ + cstring; /* Localize app info string[8] */ + cstring; /* Localize app info string[9] */ + cstring; /* Localize app info string[10] */ + cstring; /* Localize app info string[11] */ + cstring; /* Localize app info string[12] */ + cstring; /* Localize app info string[13] */ + cstring; /* Localize app info string[14] */ + cstring; /* Localize app info string[15] */ +}; /* end tAIS */ + + +/*--------------------------------------------------------------------------------------*/ +type 'Talt' { + integer alertType; /* Alert Type */ + integer; /* Help Rsc ID */ + integer; /* # Buttons */ + integer; /* Default Button ID */ + cstring; /* Title */ + cstring; /* Message */ + + array ButtonArray { + cstring; /* Button Text */ + }; +}; /* end Talt */ + + +/*--------------------------------------------------------------------------------------*/ +type 'Tbmp' { + array Images { + switch { + case Uncompressed: + integer; /* width; */ + Height: integer; /* height; */ + RowBytes: integer; /* rowBytes; */ + key integer = 0; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffset: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + fill byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + hex string[$$Word(RowBytes[$$ArrayIndex(Images)]) * $$Word(Height[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed: + integer; /* width; */ + HeightComp: integer; /* height; */ + RowBytesComp: integer; /* rowBytes; */ + key integer = -32768; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetComp: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + fill byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + hex string[(($$Word(NextOffsetComp[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasTransparency: + integer; /* width; */ + HeightT: integer; /* height; */ + RowBytesT: integer; /* rowBytes; */ + key integer = 8192; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetT: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + unsigned byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + hex string[$$Word(RowBytesT[$$ArrayIndex(Images)]) * $$Word(HeightT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasTransparency: + integer; /* width; */ + HeightCompT: integer; /* height; */ + RowBytesCompT: integer; /* rowBytes; */ + key integer = -24576; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompT:integer; /* nextDepthOffset - # of DWords to next BitmapType */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + hex string[(($$Word(NextOffsetCompT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasColorTable: + integer; /* width; */ + HeightCT: integer; /* height; */ + RowBytesCT: integer; /* rowBytes; */ + key integer = 16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCT: integer; /* nextDepthOffset (dword) */ + fill byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[$$Word(RowBytesCT[$$ArrayIndex(Images)]) * $$Word(HeightCT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasColorTable: + integer; /* width; */ + HeightCompCT: integer; /* height; */ + RowBytesCompCT:integer; /* rowBytes; */ + key integer = -16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompCT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[(($$Word(NextOffsetCompCT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasColorTable_HasTransparency: + integer; /* width; */ + HeightCTT: integer; /* height; */ + RowBytesCTT: integer; /* rowBytes; */ + key integer = 16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCTT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[$$Word(RowBytesCTT[$$ArrayIndex(Images)]) * $$Word(HeightCTT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasColorTable_HasTransparency: + integer; /* width; */ + HeightCompCTT: integer; /* height; */ + RowBytesCompCTT:integer; /* rowBytes; */ + key integer = -16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompCTT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[(($$Word(NextOffsetCompCTT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + }; + }; +}; /* end Tbmp */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tbmf' { + integer; /* Bitmap ID */ + integer; /* width */ + integer; /* height */ + integer = $$CountOf(PICTArray); /* Number of images */ + wide array PICTArray { + integer; /* depth */ + byte uncompressed=0, compressed=1; /* compression flag */ + fill byte; + byte noTransprency=0, hasTransparency=1; /* transparency flag */ + fill byte; + integer; /* PICT id for data */ + integer; /* compression type */ + integer; /* transparent index */ + integer reserved=0; /* reserved, must be 0 (colorTable) */ + }; +}; /* end tbmf */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tBTN' { + integer; /* Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte noFrame=0, frame=1; /* Frame */ + fill byte; + byte boldFrame=0, nonBoldFrame=1; /* Non-bold frame */ + fill byte; + byte palmFont; /* Font ID */ + cstring; /* Button Label */ +}; /* end tBTN */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tCBX' { + integer; /* Check Box ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte notSelected=0, selected=1; /* Selected */ + fill byte; + byte; /* Group ID */ + byte palmFont; /* Font ID */ + cstring; /* Check Box Label */ + align word; /* Check Box Label is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tCBX */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tclt' { + unsigned integer; /* numEntries */ + wide array { + unsigned byte; /* index/reserved */ + unsigned hex byte; /* red */ + unsigned hex byte; /* green */ + unsigned hex byte; /* blue */ + }; +}; /* end tclt */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tFBM' { + integer; /* X position */ + integer; /* Y position */ + integer; /* Bitmap Rsc ID */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; +}; /* end tFBM */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tFLD' { + integer; /* Field ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte notEditable=0, editable=1; /* Editable */ + fill byte; + byte notUnderlined=0, underlined=1; /* Underlined */ + fill byte; + fill word; /* Solid Underline (???) */ + byte notSingleLine=0, singleLine=1; /* Single Line */ + fill byte; + byte notDynamicSize=0, dynamicSize=1; /* Dynamic Size */ + fill byte; + byte notLeftJustified=0, leftJustified=1; /* Left Justified */ + fill byte; + integer; /* Max chars */ + byte palmFont; /* Font ID */ + fill byte; + byte notAutoShift=0, autoShift=1; /* Autoshift */ + fill byte; + byte notHasScrollbar=0, hasScrollbar=1; /* Has Scrollbar */ + fill byte; + byte notNumeric=0, numeric=1; /* Numeric */ + fill byte; +}; /* end tFLD */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tFRM' { + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte notModal=0, modal=1; /* Modal */ + fill byte; + byte noSaveBehind=0, saveBehind=1; /* Save behind */ + fill byte; + fill word; + fill word; + integer; /* Form ID */ + integer; /* Help Rsc ID */ + integer; /* Menu Rsc ID */ + integer; /* Default Button ID */ + fill word; + fill word; + + integer = $$Countof(ObjectArray); /* Item count */ + wide array ObjectArray { + integer; /* Object ID */ + string[4]; /* Object Type */ + }; +}; /* end tFRM */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tgbn' { + integer; /* Graphic Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte noFrame=0, frame=1; /* Frame */ + fill byte; + byte boldFrame=0, nonBoldFrame=1; /* Non-bold frame */ + fill byte; + integer; /* Bitmap (Tbmp) ID */ + integer; /* Selected Bitmap ID (0 for none) */ +}; /* end tgbn */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tGDT' { + integer; /* Gadget ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; +}; /* end tGDT */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tgpb' { + integer; /* Graphic Push Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte; /* Group ID */ + fill byte; + integer; /* Bitmap (Tbmp) ID */ + integer; /* Selected Bitmap ID (0 for none) */ +}; /* end tgpb */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tgrb' { + integer; /* Graphic Repeating Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte noFrame=0, frame=1; /* Frame */ + fill byte; + byte boldFrame=0, nonBoldFrame=1; /* Non-bold frame */ + fill byte; + integer; /* Bitmap (Tbmp) ID */ + integer; /* Selected Bitmap ID (0 for none) */ +}; /* end tgrb */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tGSI' { + integer; /* X position */ + integer; /* Y position */ +}; /* end tGSI */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tLBL' { + integer; /* Label ID */ + integer; /* Left */ + integer; /* Top */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte palmFont; /* Font ID */ + cstring; /* Label */ +}; /* end tLBL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tLST' { + integer; /* Label ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte palmFont; /* Font ID */ + fill byte; + integer; /* Visible Items */ + integer = $$Countof(StringArray); /* Item count */ + array StringArray { + cstring; /* Label */ + }; +}; /* end tLST */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tPBN' { + integer; /* Push Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte; /* Group ID */ + byte palmFont; /* Font ID */ + cstring; /* Button Label */ +}; /* end tPBN */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tPUL' { + integer; /* Control ID */ + integer; /* List ID */ +}; /* end tPUL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tPUT' { + integer; /* Popup Trigger */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte palmFont; /* Font ID */ + cstring; /* Popup Label */ + align word; /* Popup Label is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tPUT */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tREP' { + integer; /* Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte noFrame=0, frame=1; /* Frame */ + fill byte; + byte boldFrame=0, nonBoldFrame=1; /* Non-bold frame */ + fill byte; + byte palmFont; /* Font ID */ + cstring; /* Button Label */ +}; /* end tREP */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tSCL' { + integer; /* Scroll Bar ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + integer; /* Value */ + integer; /* Minimum Value */ + integer; /* Maximum Value */ + integer; /* Page Size */ +}; /* end tSCL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tsld' { + integer; /* Slider ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + integer; /* Value */ + integer; /* Minimum Value */ + integer; /* Maximum Value */ + integer; /* Page Size */ + byte horizontal=0, vertical=1; /* Horizontal? */ + fill byte; + integer; /* Thumb (Tbmp) ID, 0 for default */ + integer; /* Background (Tbmp) ID, 0 for default */ +}; /* end tSCL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tslf' { + integer; /* Feedback Slider ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + integer; /* Value */ + integer; /* Minimum Value */ + integer; /* Maximum Value */ + integer; /* Page Size */ + byte horizontal=0, vertical=1; /* Horizontal? */ + fill byte; + integer; /* Thumb (Tbmp) ID, 0 for default */ + integer; /* Background (Tbmp) ID, 0 for default */ +}; /* end tSCL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tSTL' { // Beware - Item count is one-based, but the system routine + // must be passed a zero-based value to retrieve strings... + cstring; /* Prefix */ + + integer = $$Countof(StringArray); /* Item count */ + array StringArray { + cstring; /* Text */ + }; +}; /* end tSTL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tSTR' { + cstring; /* The String */ + /* TMPL allows additional hex data */ +}; /* end tSTR */ + + +/*----------------------------tint Ľ Soft Constant--------------------------------------*/ +type 'tint' { + unsigned longint; /* The Constant */ +}; /* end tint */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tTBL' { + integer; /* Table ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notEditable=0, editable=1; /* Editable */ + fill byte; + fill word; /* reserved 1 */ + fill word; /* reserved 2 */ + fill word; /* reserved 3 */ + integer; /* Rows */ + integer = $$Countof(ColumnArray); /* Columns */ + array ColumnArray { + integer; /* Column Width */ + }; +}; /* end tTBL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tTTL' { + cstring; /* Title */ + align word; /* Title string is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tTTL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tver' { + cstring; /* Version String */ + align word; /* Version String is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tver */ + + +/*--------------------------------------------------------------------------------------*/ +type 'xprf' { + integer = 0x0001; /* Version number */ + fill bit[31]; /* Reserved flags */ + boolean allowOverlays, disableOverlays; /* T->disable overlays */ +}; /* end xprf */ + + +/*--------------------------------------------------------------------------------------*/ +#define alphaGraffitiSilkscreenArea 0 +#define numericGraffitiSilkscreenArea 1 + +type 'silk' { + integer = 0x0001; // version + + literal longint; // vendor creator ('psys' for 3Com) + + integer // locale language + lEnglish=0, + lFrench, + lGerman, + lItalian, + lSpanish, + lJapanese=6; + + integer // locale country + cAustralia=0, + cAustria, + cBelgium, + cBrazil, + cCanada, + cDenmark, + cFinland, + cFrance, + cGermany, + cHongKong, + cIceland, + cIreland, + cItaly, + cJapan, + cLuxembourg, + cMexico, + cNetherlands, + cNewZealand, + cNorway, + cSpain, + cSweden, + cSwitzerland, + cUnitedKingdom, + cUnitedStates, + cIndia, + cIndonesia, + cKorea, + cMalaysia, + cRepChina, + cPhilippines, + cSingapore, + cThailand, + cTaiwan; + + integer = $$Countof(RectArray); // rectangle count + wide array RectArray { + point; // topLeft of bounds. + point; // extent of bounds. + + literal longint // area type + screenArea = 'scrn', + graffitiArea = 'graf'; + + integer; // area index + }; + + integer = $$Countof(ButtonArray); + wide array ButtonArray { + point; // topLeft of bounds. + point; // extent of bounds. + + hex integer // keyDown.chr + vchrMenu = 0x0105, + vchrLaunch = 0x0108, + vchrKeyboard = 0x0109, + vchrFind = 0x010a, + vchrCalc = 0x010b, + vchrKeyboardAlpha = 0x0110, + vchrKeyboardNumeric = 0x0111, + vchrTsm1 = 0x0118, + vchrTsm2 = 0x0119, + vchrTsm3 = 0x011a, + vchrTsm4 = 0x011b; + hex integer; // keyDown.keyCode + hex integer // keyDown.modifiers + commandKeyMask = 0x0008; + }; +}; + +#endif // __PALMTYPES_R__ + diff --git a/sdk-3.5/include/Core/UI/UIResources.h b/sdk-3.5/include/Core/UI/UIResources.h new file mode 100644 index 0000000..b88c738 --- /dev/null +++ b/sdk-3.5/include/Core/UI/UIResources.h @@ -0,0 +1,314 @@ +/****************************************************************************** + * + * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: UIResources.h + * + * 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. + * + *****************************************************************************/ + +#ifndef __UIRESOURCES_H__ +#define __UIRESOURCES_H__ + +#include + +// System Default app icon (for apps missing a tAIB) +#define defaultAppIconBitmap 10000 +#define defaultAppSmallIconBitmap 10001 + +// System version string ID - this is hidden in +// the SystemVersion.rsrc resource, because the 'system' resources +// don't have ResEdit formats. +#define systemVersionID 10000 + + +//------------------------------------------------------------ +// Resource Type Constants +//------------------------------------------------------------ + +#define strRsc 'tSTR' +#define ainRsc 'tAIN' +#define iconType 'tAIB' +#define bitmapRsc 'Tbmp' +#define bsBitmapRsc 'Tbsb' +#define alertRscType 'Talt' +#define kbdRscType 'tkbd' +#define MenuRscType 'MBAR' +#define fontRscType 'NFNT' +#define verRsc 'tver' +#define appInfoStringsRsc 'tAIS' +#define fontIndexType 'fnti' +#define midiRsc 'MIDI' +#define colorTableRsc 'tclt' +#define MenuCtlRsc 'tcbr' +#define constantRscType 'tint' +#define formRscType 'tFRM' +#define silkscreenRscType 'silk' +#define strListRscType 'tSTL' +#define wrdListRscType 'wrdl' +#define defaultCategoryRscType 'taic' + + +//------------------------------------------------------------ +// App Version Constants +//------------------------------------------------------------ + +#define appVersionID 1 // our apps use tver 1 resource +#define appVersionAlternateID 1000 // CW Constructor uses tver 1000 resource + // so we'll look for ours first, then try theirs +#define ainID 1000 + +#define oemVersionID 10001 // Per-DB version provided by OEMs + + +//------------------------------------------------------------ +// System Information Constants +//------------------------------------------------------------ + +#define fepFieldExtraBytesID 10000 // Extra bytes for expanded field if FEP is active. +#define maxCategoryWidthID 10001 // Max pixel width for category trigger. +#define extraStackSpaceID 10002 // Extra stack space for non-English locales + +//------------------------------------------------------------ +// System Alerts +//------------------------------------------------------------ + +#define SelectACategoryAlert 10000 + +// This alert broke 1.0 applications and is now disabled until later. +// It is redefined below (10015). +//#define RemoveCategoryAlert 10001 +//#define RemoveCategoryRecordsButton 0 +//#define RemoveCategoryNameButton 1 +//#define RemoveCategoryCancelButton 2 + +#define LowBatteryAlert 10002 +#define VeryLowBatteryAlert 10003 +#define UndoAlert 10004 +#define UndoCancelButton 1 + +#define MergeCategoryAlert 10005 +#define MergeCategoryYes 0 +#define MergeCategoryNo 1 + +#define privateRecordInfoAlert 10006 + +#define ClipboardLimitAlert 10007 + +#define CategoryExistsAlert 10012 + +#define DeviceFullAlert 10013 + +#define categoryAllUsedAlert 10014 + +#define RemoveCategoryAlert 10015 // See alert 10001 +#define RemoveCategoryYes 0 +#define RemoveCategoryNo 1 + +#define DemoUnitAlert 10016 + +#define NoDataToBeamAlert 10017 + +// New for PalmOS 3.1 +#define LowCradleChargedBatteryAlert 10018 // (Not present in Palm VII) +#define VeryLowCradleChargedBatteryAlert 10019 // (Not present in Palm VII) + +// New for PalmOS 3.1 (Instant Karma only) +#define CategoryTooLongAlert 10020 // (Not present in Palm VII) + +// New for PalmOS 3.2 - Alerts used by the ErrAlertCustom() call. +#define ErrOKAlert 10021 // Error Alert with just an OK button +#define ErrOKCancelAlert 10022 // Error Alert with an OK & Cancel button +#define ErrCancelAlert 10023 // Error Alert with just Cancel button. Special case for antenna down alert. +#define InfoOKAlert 10024 // Info alert with just an OK button +#define InfoOKCancelAlert 10025 // Info alert with an OK & Cancel button +#define InfoCancelAlert 10026 // Info alert with just a Cancel button +#define PrivacyWarningAlert 10027 // Privacy warning for weblib +#define ConfirmationOKAlert 10028 // Confirmation alert with just an OK button +#define ConfirmationOKCancelAlert 10029 // Confirmation alert with an OK & Cancel button +#define ConfirmationCancelAlert 10030 // Confirmation alert with just a Cancel button +#define WarningOKAlert 10031 // Warning Alert with just an OK button +#define WarningOKCancelAlert 10032 // Warning Alert with an OK & Cancel button +#define WarningCancelAlert 10033 // Warning Alert with just Cancel button. Special case for antenna down alert. + +// New for PalmOS 3.5 - Launch error alerts +#define StrippedBaseLaunchErrAlert 10034 // Launch error because of stripped base. +#define GenericLaunchErrAlert 10035 // Generic launch error. + +// New for PalmOS 3.5 - Fatal Alert template +#define sysFatalAlert 10100 // Template for fatal alert + +// New for PalmOS 3.5 - Alerts used by new security traps +#define secInvalidPasswordAlert 13250 +#define secGotoInvalidRecordAlert 13251 +#define secShowPrivatePermanentPassEntryAlert 13261 +#define secShowMaskedPrivatePermanentPassEntryAlert 13265 +#define secHideRecordsAlert 13268 +#define secMaskRecordsAlert 13269 +#define secHideMaskRecordsOK 0 +#define secHideMaskRecordsCancel 1 + +// command-bar bitmaps +#define BarCutBitmap 10030 +#define BarCopyBitmap 10031 +#define BarPasteBitmap 10032 +#define BarUndoBitmap 10033 +#define BarBeamBitmap 10034 +#define BarSecureBitmap 10035 +#define BarDeleteBitmap 10036 +#define BarInfoBitmap 10037 + +//Masking bitmaps +#define SecLockBitmap 10050 +#define SecLockWidth 6 +#define SecLockHeight 8 + +// System Menu Bar and Menus +#define sysEditMenuID 10000 +#define sysEditMenuUndoCmd 10000 +#define sysEditMenuCutCmd 10001 +#define sysEditMenuCopyCmd 10002 +#define sysEditMenuPasteCmd 10003 +#define sysEditMenuSelectAllCmd 10004 +#define sysEditMenuSeparator 10005 +#define sysEditMenuKeyboardCmd 10006 +#define sysEditMenuGraffitiCmd 10007 + +// Dynamically added to System Edit menu at runtime +#define sysEditMenuJapAddWord 10100 +#define sysEditMenuJapLookupWord 10101 + +// Note View Menu Bar and Menus +#define noteMenuID 10200 // Old NoteView MenuBar +#define noteUndoCmd sysEditMenuUndoCmd +#define noteCutCmd sysEditMenuCutCmd +#define noteCopyCmd sysEditMenuCopyCmd +#define notePasteCmd sysEditMenuPasteCmd +#define noteSelectAllCmd sysEditMenuSelectAllCmd +#define noteSeparator sysEditMenuSeparator +#define noteKeyboardCmd sysEditMenuKeyboardCmd +#define noteGraffitiCmd sysEditMenuKeyboardCmd + +#define noteFontCmd 10200 // These are here for backwards +#define noteTopOfPageCmd 10201 // compatibility. The built-in +#define noteBottomOfPageCmd 10202 // apps no longer use them. +#define notePhoneLookupCmd 10203 + +#define newNoteMenuID 10300 // The Edit Menu for the new NoteView. +#define newNoteFontCmd 10300 // MenuBar is the same as it is for +#define newNotePhoneLookupCmd 10301 // the old NoteView MenuBar. + +// Note View (used by Datebook, To Do, Address, and Expense apps) +#define NoteView 10900 // The new NoteView is "new" as of Palm OS 3.5. +#define NewNoteView 10950 // Same as old NoteView, but points to newNoteMenuID and doesn't ref UI objects listed below. +#define NoteField 10901 +#define NoteDoneButton 10902 +#define NoteSmallFontButton 10903 // Not in NewNoteView, use FontCmd instead. +#define NoteLargeFontButton 10904 // Not in NewNoteView, use FontCmd instead. +#define NoteDeleteButton 10905 +#define NoteUpButton 10906 // Not in NewNoteView, use scrollbars now. +#define NoteDownButton 10907 // Not in NewNoteView, use scrollbars now. +#define NoteScrollBar 10908 +#define NoteFontGroup 1 +#define noteViewMaxLength 4096 // not including null, tied to tFLD rsrc 10901 + + +// About Box - used by Datebook, Memo, Address, To Do, & others +#define aboutDialog 11000 +#define aboutNameLabel 11001 +#define aboutVersionLabel 11002 +#define aboutErrorStr 11003 + + +// Category New Name Dialog (used for new and renamed categories) +#define categoryNewNameDialog 11100 +#define categoryNewNameField 11103 +#define categoryNewNameOKButton 11104 + + +// Categories Edit Dialog +#define CategoriesEditForm 10000 +#define CategoriesEditList 10002 +#define CategoriesEditOKButton 10003 +#define CategoriesEditNewButton 10004 +#define CategoriesEditRenameButton 10005 +#define CategoriesEditDeleteButton 10006 + + +// Graffiti Reference Dialog +#define graffitiReferenceDialog 11200 +#define graffitiReferenceDoneButton 11202 +#define graffitiReferenceUpButton 11203 +#define graffitiReferenceDownButton 11204 +#define graffitiReferenceFirstBitmap 11205 + + +// System string resources +#define daysOfWeekStrID 10000 // OBSOLETE - use daysOfWeekStdStrListID +#define dayFullNamesStrID 10001 // OBSOLETE - use daysOfWeekLongStrListID +#define monthNamesStrID 10002 // OBSOLETE - use monthNamesStdStrListID +#define monthFullNamesStrID 10003 // OBSOLETE - use monthNamesLongStrListID +#define categoryAllStrID 10004 +#define categoryEditStrID 10005 +#define menuCommandStrID 10006 +#define launcherBatteryStrID 10007 +#define systemNameStrID 10008 +#define phoneLookupTitleStrID 10009 +#define phoneLookupAddStrID 10010 +#define phoneLookupFormatStrID 10011 + +// System string list resources +#define daysOfWeekShortStrListID 10200 +#define daysOfWeekStdStrListID 10201 +#define daysOfWeekLongStrListID 10202 +#define monthNamesShortStrListID 10203 +#define monthNamesStdStrListID 10204 +#define monthNamesLongStrListID 10205 +#define prefDateFormatsStrListID 10206 +#define prefDOWDateFormatsStrListID 10207 + + +//------------------------------------------------------------ +// Misc. resource routines +//------------------------------------------------------------ +#ifdef __cplusplus +extern "C" { +#endif + +void * ResLoadForm (UInt16 rscID) + SYS_TRAP(sysTrapResLoadForm); + +void * ResLoadMenu (UInt16 rscID) + SYS_TRAP(sysTrapResLoadMenu); + + +Char * ResLoadString (UInt16 rscID); + +UInt32 ResLoadConstant (UInt16 rscID) + SYS_TRAP(sysTrapResLoadConstant); + +#ifdef __cplusplus +} +#endif + +#endif // __UIRESOURCES_H__ + diff --git a/sdk-3.5/include/Dynamic/PalmOptErrorCheckLevel.Debug b/sdk-3.5/include/Dynamic/PalmOptErrorCheckLevel.Debug new file mode 100644 index 0000000..aceb45f --- /dev/null +++ b/sdk-3.5/include/Dynamic/PalmOptErrorCheckLevel.Debug @@ -0,0 +1,25 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOptErrorCheckLevel.Debug + * + *****************************************************************************/ + +#ifndef __PALMOPTERRORCHECKLEVEL_H__ +#define __PALMOPTERRORCHECKLEVEL_H__ + +#include + + #ifdef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL + #endif + + #ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL ERROR_CHECK_FULL + #endif + +#endif + diff --git a/sdk-3.5/include/Dynamic/PalmOptErrorCheckLevel.Release b/sdk-3.5/include/Dynamic/PalmOptErrorCheckLevel.Release new file mode 100644 index 0000000..42663e3 --- /dev/null +++ b/sdk-3.5/include/Dynamic/PalmOptErrorCheckLevel.Release @@ -0,0 +1,25 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOptErrorCheckLevel.Release + * + *****************************************************************************/ + +#ifndef __PALMOPTERRORCHECKLEVEL_H__ +#define __PALMOPTERRORCHECKLEVEL_H__ + +#include + + #ifdef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL + #endif + + #ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL ERROR_CHECK_PARTIAL + #endif + +#endif + diff --git a/sdk-3.5/include/Dynamic/PalmOptErrorCheckLevel.h b/sdk-3.5/include/Dynamic/PalmOptErrorCheckLevel.h new file mode 100644 index 0000000..42663e3 --- /dev/null +++ b/sdk-3.5/include/Dynamic/PalmOptErrorCheckLevel.h @@ -0,0 +1,25 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOptErrorCheckLevel.Release + * + *****************************************************************************/ + +#ifndef __PALMOPTERRORCHECKLEVEL_H__ +#define __PALMOPTERRORCHECKLEVEL_H__ + +#include + + #ifdef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL + #endif + + #ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL ERROR_CHECK_PARTIAL + #endif + +#endif + diff --git a/sdk-3.5/include/Libraries/INet/INetMgr.h b/sdk-3.5/include/Libraries/INet/INetMgr.h new file mode 100644 index 0000000..2621b14 --- /dev/null +++ b/sdk-3.5/include/Libraries/INet/INetMgr.h @@ -0,0 +1,983 @@ +/****************************************************************************** + * + * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: INetMgr.h + * + * 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) + * + *****************************************************************************/ + +#ifndef __INETLIB_H__ +#define __INETLIB_H__ + +#include +#include +#include +#include + +#pragma mark Constants + +// Creator. Used for both the database that contains the INet Library and +// it's features for the feature manager. +#define inetCreator sysFileCINetLib // The Net Library creator + +// INet Library features have this creator +#define inetLibFtrCreator sysFileCINetLib // creatorID of INet Lib features. + +// Name of the InetLib +#define 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 +#define inetFtrNumVersion 0 + +#define inetLibType sysFileTLibrary // Our Net Code Resources Database type + + +// ID for proxy IP address in flash +#define inetFlashProxyID 'IP' +#define 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 +//----------------------------------------------------------------------------- +#define netProxyIPManhattanHGA 0x0A0186A5 // Manhattan HGA = 10.1.134.165 or MAN 100005 +#define netProxyIPTuscanyHGA 0x0A0186A3 // Tuscany HGA = 10.1.134.163 or MAN 100003 +#define netProxyIPRonsHGA 0x0A0186A4 // Ron's HGA = 10.1.134.164 or MAN 100004 +#define netProxyIPDefaultHGA netProxyIPManhattanHGA +#define netProxyIPDefaultHGAStr "10.1.134.165" //Should correspond to above value +#define netProxyIPDefaultHGACanada netProxyIPManhattanHGA +#define netProxyIPDefaultHGAStrCanada "10.1.134.165" //Should correspond to above value + + +#pragma mark ErrorCodes +/******************************************************************** + * Error codes + ********************************************************************/ +#define inetErrNone 0 +#define inetErrTooManyClients (inetErrorClass | 1) // Too many clients already +#define inetErrHandleInvalid (inetErrorClass | 2) // Invalid inetH or sockH +#define inetErrParamsInvalid (inetErrorClass | 3) // +#define inetErrURLVersionInvalid (inetErrorClass | 4) // +#define inetErrURLBufTooSmall (inetErrorClass | 5) // +#define inetErrURLInvalid (inetErrorClass | 6) // +#define inetErrTooManySockets (inetErrorClass | 7) // +#define inetErrNoRequestCreated (inetErrorClass | 8) +#define inetErrNotConnected (inetErrorClass | 9) +#define inetErrInvalidRequest (inetErrorClass | 10) +#define inetErrNeedTime (inetErrorClass | 11) +#define inetErrHostnameInvalid (inetErrorClass | 12) +#define inetErrInvalidPort (inetErrorClass | 13) +#define inetErrInvalidHostAddr (inetErrorClass | 14) +#define inetErrNilBuffer (inetErrorClass | 15) +#define inetErrConnectTimeout (inetErrorClass | 16) +#define inetErrResolveTimeout (inetErrorClass | 17) +#define inetErrSendReqTimeout (inetErrorClass | 18) +#define inetErrReadTimeout (inetErrorClass | 19) +#define inetErrBufTooSmall (inetErrorClass | 20) +#define inetErrSchemeNotSupported (inetErrorClass | 21) +#define inetErrInvalidResponse (inetErrorClass | 22) +#define inetErrSettingTooLarge (inetErrorClass | 25) +#define inetErrSettingSizeInvalid (inetErrorClass | 26) +#define inetErrRequestTooLong (inetErrorClass | 27) +#define inetErrSettingNotImplemented (inetErrorClass | 28) + +// Configuration errors +#define inetErrConfigNotFound (inetErrorClass | 29) +#define inetErrConfigCantDelete (inetErrorClass | 30) +#define inetErrConfigTooMany (inetErrorClass | 31) +#define inetErrConfigBadName (inetErrorClass | 32) +#define inetErrConfigNotAlias (inetErrorClass | 33) +#define inetErrConfigCantPointToAlias (inetErrorClass | 34) +#define inetErrConfigEmpty (inetErrorClass | 35) +#define inetErrConfigAliasErr (inetErrorClass | 37) + +#define inetErrNoWirelessInterface (inetErrorClass | 38) + +// Encryption related errors +#define inetErrEncryptionNotAvail (inetErrorClass | 39) + // Need to re-send transaction because server told us to reset our + // encryption sequence number +#define inetErrNeedRetryEncSeqNum (inetErrorClass | 40) + // Need to re-send transaction because server sent us a new + // public key to use. +#define inetErrNeedRetryEncPublicKey (inetErrorClass | 41) + +#define inetErrResponseTooShort (inetErrorClass | 42) + +// errors specific to handling Mobitex ILLEGAL responses +#define inetErrMobitexIllegalOKHost (inetErrorClass | 43) +#define inetErrMobitexIllegalBadHost (inetErrorClass | 44) +// see error 92 also + +// HTTP errors +#define inetErrHTTPBadRequest (inetErrorClass | 45) +#define inetErrHTTPUnauthorized (inetErrorClass | 46) +#define inetErrHTTPForbidden (inetErrorClass | 47) +#define inetErrHTTPNotFound (inetErrorClass | 48) +#define inetErrHTTPMethodNotAllowed (inetErrorClass | 49) +#define inetErrHTTPNotAcceptable (inetErrorClass | 50) +#define inetErrHTTPProxyAuthRequired (inetErrorClass | 51) +#define inetErrHTTPRequestTimeout (inetErrorClass | 52) +#define inetErrHTTPConflict (inetErrorClass | 53) +#define inetErrHTTPGone (inetErrorClass | 54) +#define inetErrHTTPLengthRequired (inetErrorClass | 55) +#define inetErrHTTPPreconditionFailed (inetErrorClass | 56) +#define inetErrHTTPRequestTooLarge (inetErrorClass | 57) +#define inetErrHTTPRequestURITooLong (inetErrorClass | 58) +#define inetErrHTTPUnsupportedType (inetErrorClass | 59) +#define inetErrHTTPServerError (inetErrorClass | 60) + +// CTP errors +#define inetErrCTPServerError (inetErrorClass | 61) + +// Cache errors +#define inetErrTypeNotCached (inetErrorClass | 62) +#define inetErrCacheInvalid (inetErrorClass | 63) + +// Palm: and PalmCall: scheme errors +#define inetErrURLDispatched (inetErrorClass | 64) +#define inetErrDatabaseNotFound (inetErrorClass | 65) + +#define inetErrCTPMalformedRequest (inetErrorClass | 66) +#define inetErrCTPUnknownCommand (inetErrorClass | 67) +#define inetErrCTPTruncated (inetErrorClass | 68) +#define inetErrCTPUnknownError (inetErrorClass | 69) +#define inetErrCTPProxyError (inetErrorClass | 70) +#define inetErrCTPSocketErr (inetErrorClass | 71) + +#define inetErrCTPInvalidURL (inetErrorClass | 72) +#define inetErrCTPReferringPageOutOfDate (inetErrorClass | 73) +#define inetErrCTPBadRequest (inetErrorClass | 74) +#define inetErrUNUSED (inetErrorClass | 75) +#define inetErrCTPMailServerDown (inetErrorClass | 76) +#define inetErrCTPHostNotFound (inetErrorClass | 77) + + +// Content Conversion Errors +#define inetErrCTPContentInvalidTag (inetErrorClass | 78) +#define inetErrCTPContentInternal (inetErrorClass | 79) +#define inetErrCTPContentDataEnd (inetErrorClass | 80) +#define inetErrCTPContentResourceTooBig (inetErrorClass | 81) +#define inetErrCTPContentNoNoFrames (inetErrorClass | 82) +#define inetErrCTPContentUnsupportedContent (inetErrorClass | 83) +#define inetErrCTPContentUnsupportedEncoding (inetErrorClass | 84) +#define inetErrCTPContentBadForm (inetErrorClass | 85) +#define inetErrCTPContentBadFormMissingAction (inetErrorClass | 86) +#define inetErrCTPContentBadFormMissingMethod (inetErrorClass | 87) +#define inetErrCTPContentNoSourceData (inetErrorClass | 88) +#define inetErrCTPContentBadImage (inetErrorClass | 89) +#define inetErrCTPContentImageTooLarge (inetErrorClass | 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. +#define inetErrMobitexErrorHandled (inetErrorClass | 91) + +// Proxy down, non-default host, show dialog asking to revert to default +#define inetErrProxyDownBadHost (inetErrorClass | 92) + +// A second type of readtime. This should occur only when some data is received +// and the connection is lost. +#define inetErrHostConnectionLost (inetErrorClass | 93) + +// Unable to locate link record within a PQA file +#define inetErrLinkNotFound (inetErrorClass | 94) +// + +#pragma mark Types + +/******************************************************************** + * Input flags + ********************************************************************/ +//----------------------------------------------------------------------------- +// flag word definitions for INetLibURLOpen +//----------------------------------------------------------------------------- +#define inetOpenURLFlagLookInCache 0x0001 +#define inetOpenURLFlagKeepInCache 0x0002 +#define inetOpenURLFlagForceEncOn 0x0008 // use encryption even if + // scheme does not desire it +#define inetOpenURLFlagForceEncOff 0x0010 // 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() +//----------------------------------------------------------------------------- +#define inetURLInfoFlagIsSecure 0x0001 +#define inetURLInfoFlagIsRemote 0x0002 +#define inetURLInfoFlagIsInCache 0x0004 + + +/******************************************************************** + * Configuration Support + ********************************************************************/ +//----------------------------------------------------------------------------- +// Names of built-in configuration aliases available through the +// INetLibConfigXXX calls +//----------------------------------------------------------------------------- +#define inetCfgNameDefault ".Default" // The default configuration +#define inetCfgNameDefWireline ".DefWireline" // The default wireline configuration +#define inetCfgNameDefWireless ".DefWireless" // The default wireless configuration +#define inetCfgNameCTPDefault ".CTPDefault" // Points to either .CTPWireline or .CTPWireless +#define inetCfgNameCTPWireline ".CTPWireline" // Wireline through the Jerry Proxy +#define inetCfgNameCTPWireless ".CTPWireless" // Wireless through the Jerry Proxy + + +//-------------------------------------------------------------------- +// Structure of a configuration name. Used by INetLibConfigXXX calls +//--------------------------------------------------------------------- +#define inetConfigNameSize 32 +typedef struct { + Char name[inetConfigNameSize]; // name of configuration + } INetConfigNameType, *INetConfigNamePtr; + + + + +/******************************************************************** + * Scheme Types + ********************************************************************/ +typedef enum { + inetSchemeUnknown = -1, + inetSchemeDefault = 0, + + inetSchemeHTTP, // http: + inetSchemeHTTPS, // https: + inetSchemeFTP, // ftp: + inetSchemeGopher, // gopher: + inetSchemeFile, // file: + inetSchemeNews, // news: + inetSchemeMailTo, // mailto: + inetSchemePalm, // palm: + inetSchemePalmCall, // palmcall: + + inetSchemeMail, // not applicable to URLS, but used + // for the INetLibSockOpen call when + // creating a socket for mail IO + inetSchemeMac, // mac: - Mac file system HTML + + inetSchemeFirst = inetSchemeHTTP, // first one + inetSchemeLast = inetSchemeMail // last one + } INetSchemeEnum; + + +/******************************************************************** + * Scheme Ports + ********************************************************************/ +#define inetPortFTP 21 +#define inetPortHTTP 80 +#define inetPortGopher 70 +#define inetPortNews 119 +#define inetPortHTTPS 44 + + + +/******************************************************************** + * Structure of a cracked URL. + ********************************************************************/ +typedef struct { + UInt16 version; // should be 0, for future compatibility + + UInt8 * schemeP; // ptr to scheme portion + UInt16 schemeLen; // size of scheme portion + UInt16 schemeEnum; // INetSchemEnum + + UInt8 * usernameP; // ptr to username portion + UInt16 usernameLen; // size of username + + UInt8 * passwordP; // ptr to password portion + UInt16 passwordLen; // size of password + + UInt8 * hostnameP; // ptr to host name portion + UInt16 hostnameLen; // size of host name + + UInt16 port; // port number + + UInt8 * pathP; // ptr to path portion + UInt16 pathLen; // size of path + + UInt8 * paramP; // param (;param) + UInt16 paramLen; // size of param + + UInt8 * queryP; // query (?query) + UInt16 queryLen; // size of query + + UInt8 * fragP; // fragment (#frag) + UInt16 fragLen; // size of fragment + } INetURLType; + + + +/******************************************************************** + * Structure for INetURLInfo. This structure is filled in with info + * about a URL. + ********************************************************************/ +typedef struct { + UInt16 version; // should be 0, for future compatibility + + UInt16 flags; // flags word, one or ore of + // inetURLInfoFlagXXX flags + UInt32 undefined; // reserved for future use + } INetURLInfoType; + + + +/******************************************************************** + * Content and Compression Type Enums(from proxy server or PQA Builder) + ********************************************************************/ +typedef enum { + inetContentTypeTextPlain = 0, + inetContentTypeTextHTML, + inetContentTypeImageGIF, + inetContentTypeImageJPEG, + inetContentTypeApplicationCML, + inetContentTypeImagePalmOS, + inetContentTypeOther + } INetContentTypeEnum; + +typedef enum { + inetCompressionTypeNone = 0, + inetCompressionTypeBitPacked, + inetCompressionTypeLZ77 + } INetCompressionTypeEnum; + +/******************************************************************** + * Proxy Types + ********************************************************************/ +typedef enum { + inetProxyNone = 0, // no proxy + inetProxyCTP = 1 // CTP (Jerry) proxy + } INetProxyEnum; + + + +/******************************************************************** + * Settings for the INetLibSettingSet/Get call. + ********************************************************************/ +typedef enum { + inetSettingProxyType, // (RW) UInt32, INetProxyEnum + + inetSettingProxyName, // (RW) Char[], name of proxy + inetSettingProxyPort, // (RW) UInt32, TCP port # of proxy + + inetSettingProxySocketType, // (RW) UInt32, which type of socket to use + // netSocketTypeXXX + + inetSettingCacheSize, // (RW) UInt32, max size of cache + inetSettingCacheRef, // (R) DmOpenRef, ref of cache DB + + inetSettingNetLibConfig, // (RW) UInt32, Which NetLib config to use. + + inetSettingRadioID, // (R) UInt32[2], the 64-bit radio ID + inetSettingBaseStationID, // (R) UInt32, the radio base station ID + + inetSettingMaxRspSize, // (W) UInt32 (in bytes) + inetSettingConvAlgorithm, // (W) UInt32 (CTPConvEnum) + inetSettingContentWidth, // (W) UInt32 (in pixels) + inetSettingContentVersion, // (W) UInt32 Content version (encoder version) + + inetSettingNoPersonalInfo, // (RW) UInt32 send no deviceID/zipcode + + inetSettingUserName, + + inetSettingLast + } INetSettingEnum; + + +/******************************************************************** + * Settings for the INetLibSockSettingSet/Get call. + ********************************************************************/ +typedef enum { + inetSockSettingScheme, // (R) UInt32, INetSchemeEnum + inetSockSettingSockContext, // (RW) UInt32, + + inetSockSettingCompressionType, // (R) Char[] + inetSockSettingCompressionTypeID, // (R) UInt32 (INetCompressionTypeEnum) + inetSockSettingContentType, // (R) Char[] + inetSockSettingContentTypeID, // (R) UInt32 (INetContentTypeEnum) + inetSockSettingData, // (R) UInt32, pointer to data + inetSockSettingDataHandle, // (R) UInt32, MemHandle to data + inetSockSettingDataOffset, // (R) UInt32, offset to data from MemHandle + + inetSockSettingTitle, // (RW) Char[] + inetSockSettingURL, // (R) Char[] + inetSockSettingIndexURL, // (RW) Char[] + + inetSockSettingFlags, // (W) UInt16, one or more of + // inetOpenURLFlagXXX flags + + inetSockSettingReadTimeout, // (RW) UInt32. Read timeout in ticks + + inetSockSettingContentVersion, // (R) UInt32, version number for content + + inetSockSettingLast + } INetSockSettingEnum; + + + + +/******************************************************************** + * Possible socket status values that can be returned from INetLibSockStatus + ********************************************************************/ +typedef enum { + inetStatusNew, // just opened + inetStatusResolvingName, // looking up host address + inetStatusNameResolved, // found host address + inetStatusConnecting, // connecting to host + inetStatusConnected, // connected to host + inetStatusSendingRequest, // sending request + inetStatusWaitingForResponse, // waiting for response + inetStatusReceivingResponse, // receiving response + inetStatusResponseReceived, // response received + inetStatusClosingConnection, // closing connection + inetStatusClosed, // closed + inetStatusAcquiringNetwork, // network temporarily + // unreachable; socket on hold + inetStatusPrvInvalid = 30 // internal value, not + // returned by INetMgr. Should + // be last. + } INetStatusEnum; + + + +/******************************************************************** + * 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 + ********************************************************************/ +typedef enum { + + // local error trying to communicate with server, if any + inetHTTPAttrCommErr, // (R) UInt32, read-only + + // object attributes, defined at creation + inetHTTPAttrEntityURL, // (-) Char[], which resource was requested + + + //----------------------------------------------------------- + // Request only attributes + //----------------------------------------------------------- + inetHTTPAttrReqAuthorization, // (-) Char[] + inetHTTPAttrReqFrom, // (-) Char[] + inetHTTPAttrReqIfModifiedSince, // (-) UInt32 + inetHTTPAttrReqReferer, // (-) Char[] + + // The following are ignored unless going through a CTP proxy + inetHTTPAttrWhichPart, // (W) UInt32 (0 -> N) + inetHTTPAttrIncHTTP, // (W) UInt32 (Boolean) only applicable + // when inetHTTPAttrConvAlgorithm set to + // ctpConvNone + inetHTTPAttrCheckMailHi, // (W) UInt32 + inetHTTPAttrCheckMailLo, // (W) UInt32 + inetHTTPAttrReqContentVersion, // (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, // (-) Char[] - entire HTTP response including + // data + inetHTTPAttrRspSize, // (R) UInt32 - entire HTTP Response size including + // header and data + inetHTTPAttrRspVersion, // (-) Char[] + inetHTTPAttrResult, // (R) UInt32 (ctpErrXXX when using CTP Proxy) + inetHTTPAttrErrDetail, // (R) UInt32 (server/proxy err code when + // using CTP Proxy) + inetHTTPAttrReason, // (R) Char[] + inetHTTPAttrDate, // (-) UInt32 + inetHTTPAttrNoCache, // (-) UInt32 + inetHTTPAttrPragma, // (-) Char[] + inetHTTPAttrServer, // (-) Char[] + inetHTTPAttrWWWAuthentication, // (-) Char[] + + + // Returned entity attributes + inetHTTPAttrContentAllow, // (-) Char[] + inetHTTPAttrContentLength, // (R) UInt32 + inetHTTPAttrContentLengthUncompressed, // (R) UInt32 (in bytes) + inetHTTPAttrContentPtr, // (-) Char * + inetHTTPAttrContentExpires, // (-) UInt32 + inetHTTPAttrContentLastModified, // (-) UInt32 + inetHTTPAttrContentLocation, // (-) Char[] + inetHTTPAttrContentLengthUntruncated, // (R) UInt32 + inetHTTPAttrContentVersion, // (R) UInt32, actual content version. Represented + // as 2 low bytes. Lowest byte is minor version, + // next higher byte is major version. + inetHTTPAttrContentCacheID, // (R) UInt32, cacheID for this item + inetHTTPAttrReqSize // (R) UInt32 size of request sent + + + } INetHTTPAttrEnum; + + + + +/******************************************************************** + * 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.... + ********************************************************************/ +#define inetSockReadyEvent firstINetLibEvent +#define inetSockStatusChangeEvent (firstINetLibEvent+1) +#define inetLastEvent (firstINetLibEvent+1) + +typedef struct { + UInt16 eType; + Boolean penDown; + UInt8 reserved; + Int16 screenX; + Int16 screenY; + union { + struct { + UInt16 datum[8]; + } generic; + + struct { + MemHandle sockH; // socket MemHandle + UInt32 context; // application defined + Boolean inputReady; // true if ready for reads + Boolean outputReady; // true if ready for writes + } inetSockReady; + + struct { + MemHandle sockH; // socket MemHandle + UInt32 context; // application defined + UInt16 status; // new status + Err sockErr; // socket err, if any + }inetSockStatusChange; + } data; + } INetEventType; + +/******************************************************************** + * Commands for InetLibWiCmd + ********************************************************************/ +typedef enum { + wiCmdInit =0, + wiCmdClear, + wiCmdSetEnabled, + wiCmdDraw, + wiCmdEnabled, + wiCmdSetLocation, + wiCmdErase +} WiCmdEnum; + +/******************************************************************** + * INet Library functions. + ********************************************************************/ + +#ifdef __GNUC__ + +#define inetLibTrapSettingGet (sysLibTrapCustom) +#define inetLibTrapSettingSet (sysLibTrapCustom+1) + +#define inetLibTrapGetEvent (sysLibTrapCustom+2) + +#define inetLibTrapURLOpen (sysLibTrapCustom+3) + +#define inetLibTrapSockRead (sysLibTrapCustom+4) +#define inetLibTrapSockWrite (sysLibTrapCustom+5) + +#define inetLibTrapSockOpen (sysLibTrapCustom+6) +#define inetLibTrapSockClose (sysLibTrapCustom+7) +#define inetLibTrapSockStatus (sysLibTrapCustom+8) +#define inetLibTrapSockSettingGet (sysLibTrapCustom+9) +#define inetLibTrapSockSettingSet (sysLibTrapCustom+10) +#define inetLibTrapSockConnect (sysLibTrapCustom+11) + + // Utilities +#define inetLibTrapURLCrack (sysLibTrapCustom+12) +#define inetLibTrapURLsAdd (sysLibTrapCustom+13) +#define inetLibTrapURLsCompare (sysLibTrapCustom+14) +#define inetLibTrapURLGetInfo (sysLibTrapCustom+15) + + // HTTP calls +#define inetLibTrapSockHTTPReqCreate (sysLibTrapCustom+16) +#define inetLibTrapSockHTTPAttrSet (sysLibTrapCustom+17) +#define inetLibTrapSockHTTPReqSend (sysLibTrapCustom+18) +#define inetLibTrapSockHTTPAttrGet (sysLibTrapCustom+19) + + // Mail traps +#define inetLibTrapSockMailReqCreate (sysLibTrapCustom+20) +#define inetLibTrapSockMailAttrSet (sysLibTrapCustom+21) +#define inetLibTrapSockMailReqAdd (sysLibTrapCustom+22) +#define inetLibTrapSockMailReqSend (sysLibTrapCustom+23) +#define inetLibTrapSockMailAttrGet (sysLibTrapCustom+24) +#define inetLibTrapSockMailQueryProgress (sysLibTrapCustom+25) + + // Cache calls +#define inetLibTrapCacheList (sysLibTrapCustom+26) +#define inetLibTrapCacheGetObject (sysLibTrapCustom+27) + + // Config calls +#define inetLibConfigMakeActive (sysLibTrapCustom+28) +#define inetLibConfigList (sysLibTrapCustom+29) +#define inetLibConfigIndexFromName (sysLibTrapCustom+30) +#define inetLibConfigDelete (sysLibTrapCustom+31) +#define inetLibConfigSaveAs (sysLibTrapCustom+32) +#define inetLibConfigRename (sysLibTrapCustom+33) +#define inetLibConfigAliasSet (sysLibTrapCustom+34) +#define inetLibConfigAliasGet (sysLibTrapCustom+35) + + //wireless Indicator +#define inetLibTrapWiCmd (sysLibTrapCustom+36) + + // File Calls +#define inetLibTrapSockFileGetByIndex (sysLibTrapCustom+37) + +#define inetLibTrapCheckAntennaState (sysLibTrapCustom+38) + +#define inetLibTrapLast (sysLibTrapCustom+39) + +#else + +#pragma mark Traps +typedef enum { + inetLibTrapSettingGet = sysLibTrapCustom, + inetLibTrapSettingSet, + + inetLibTrapGetEvent, + + inetLibTrapURLOpen, + + inetLibTrapSockRead, + inetLibTrapSockWrite, + + inetLibTrapSockOpen, + inetLibTrapSockClose, + inetLibTrapSockStatus, + inetLibTrapSockSettingGet, + inetLibTrapSockSettingSet, + inetLibTrapSockConnect, + + // Utilities + inetLibTrapURLCrack, + inetLibTrapURLsAdd, + inetLibTrapURLsCompare, + inetLibTrapURLGetInfo, + + // HTTP calls + inetLibTrapSockHTTPReqCreate, + inetLibTrapSockHTTPAttrSet, + inetLibTrapSockHTTPReqSend, + inetLibTrapSockHTTPAttrGet, + + // Mail traps + inetLibTrapSockMailReqCreate, + inetLibTrapSockMailAttrSet, + inetLibTrapSockMailReqAdd, + inetLibTrapSockMailReqSend, + inetLibTrapSockMailAttrGet, + inetLibTrapSockMailQueryProgress, + + // Cache calls + inetLibTrapCacheList, + inetLibTrapCacheGetObject, + + // Config calls + inetLibConfigMakeActive, + inetLibConfigList, + inetLibConfigIndexFromName, + inetLibConfigDelete, + inetLibConfigSaveAs, + inetLibConfigRename, + inetLibConfigAliasSet, + inetLibConfigAliasGet, + + //wireless Indicator + inetLibTrapWiCmd, + + // File Calls + inetLibTrapSockFileGetByIndex, + + inetLibTrapCheckAntennaState, + + inetLibTrapLast + } INetLibTrapNumberEnum; + +#endif + + +/******************************************************************** + * 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 + ********************************************************************/ +typedef struct { + UInt8 * urlP; + UInt16 urlLen; + + UInt8 * titleP; + UInt16 titleLen; + + UInt32 lastViewed; // seconds since 1/1/1904 + UInt32 firstViewed; // seconds since 1/1/1904 +} INetCacheEntryType, *INetCacheEntryP; + +/******************************************************************** + * Structure for INetLibCacheGetObject. This structure is filled in with info + * about a cache entry. + ********************************************************************/ +typedef struct { + MemHandle recordH; + INetContentTypeEnum contentType; + INetCompressionTypeEnum encodingType; + UInt32 uncompressedDataSize; + UInt8 flags; + UInt8 reserved; + UInt16 dataOffset; // offset to content + UInt16 dataLength; // size of content + UInt16 urlOffset; // offset to URL + UInt32 viewTime; // time last viewed + UInt32 createTime; // time entry was created + UInt16 murlOffset; // offset to master URL + } INetCacheInfoType, *INetCacheInfoPtr; + + + +#pragma mark Functions + +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +Err INetLibOpen (UInt16 libRefnum, UInt16 config, UInt32 flags, + DmOpenRef cacheRef, UInt32 cacheSize, + MemHandle* inetHP) + SYS_TRAP(sysLibTrapOpen); + +Err INetLibClose (UInt16 libRefnum, MemHandle inetH) + SYS_TRAP(sysLibTrapClose); + +Err INetLibSleep (UInt16 libRefnum) + SYS_TRAP(sysLibTrapSleep); + +Err INetLibWake (UInt16 libRefnum) + SYS_TRAP(sysLibTrapWake); + +//-------------------------------------------------- +// Settings +//-------------------------------------------------- +Err INetLibSettingGet(UInt16 libRefnum, MemHandle inetH, + UInt16 /*INetSettingEnum */ setting, + void * bufP, UInt16 * bufLenP) + SYS_TRAP(inetLibTrapSettingGet); + +Err INetLibSettingSet(UInt16 libRefnum, MemHandle inetH, + UInt16 /*INetSettingEnum*/ setting, + void * bufP, UInt16 bufLen) + SYS_TRAP(inetLibTrapSettingSet); + + +//-------------------------------------------------- +// Event Management +//-------------------------------------------------- + +void INetLibGetEvent(UInt16 libRefnum, MemHandle inetH, + INetEventType* eventP, Int32 timeout) + SYS_TRAP(inetLibTrapGetEvent); + + + +//-------------------------------------------------- +// High level calls +//-------------------------------------------------- + +Err INetLibURLOpen(UInt16 libRefnum, MemHandle inetH, UInt8 * urlP, + UInt8 * cacheIndexURLP, MemHandle* sockHP, Int32 timeout, UInt16 flags) + SYS_TRAP(inetLibTrapURLOpen); + + +Err INetLibSockClose(UInt16 libRefnum, MemHandle socketH) + SYS_TRAP(inetLibTrapSockClose); + + +//-------------------------------------------------- +// Read/Write +//-------------------------------------------------- + +Err INetLibSockRead(UInt16 libRefnum, MemHandle sockH, void * bufP, + UInt32 reqBytes, UInt32 * actBytesP, Int32 timeout) + SYS_TRAP(inetLibTrapSockRead); + +Err INetLibSockWrite(UInt16 libRefnum, MemHandle sockH, void * bufP, + UInt32 reqBytes, UInt32 * actBytesP, Int32 timeout) + SYS_TRAP(inetLibTrapSockWrite); + + +//-------------------------------------------------- +// Low level Socket calls +//-------------------------------------------------- + +Err INetLibSockOpen(UInt16 libRefnum, MemHandle inetH, + UInt16 /*INetSchemEnum*/ scheme, MemHandle* sockHP) + SYS_TRAP(inetLibTrapSockOpen); + +Err INetLibSockStatus(UInt16 libRefnum, MemHandle socketH, UInt16 * statusP, + Err* sockErrP, Boolean* inputReadyP, Boolean* outputReadyP) + SYS_TRAP(inetLibTrapSockStatus); + + +Err INetLibSockSettingGet(UInt16 libRefnum, MemHandle socketH, + UInt16 /*INetSockSettingEnum*/ setting, + void * bufP, UInt16 * bufLenP) + SYS_TRAP(inetLibTrapSockSettingGet); + +Err INetLibSockSettingSet(UInt16 libRefnum, MemHandle socketH, + UInt16 /*INetSockSettingEnum*/ setting, + void * bufP, UInt16 bufLen) + SYS_TRAP(inetLibTrapSockSettingSet); + + +Err INetLibSockConnect(UInt16 libRefnum, MemHandle sockH, UInt8 * hostnameP, + UInt16 port, Int32 timeou) + SYS_TRAP(inetLibTrapSockConnect); + +//-------------------------------------------------- +// HTTP specific calls +//-------------------------------------------------- + +Err INetLibSockHTTPReqCreate(UInt16 libRefnum, MemHandle sockH, + UInt8 * verbP, UInt8 * resNameP, UInt8 * refererP) + SYS_TRAP(inetLibTrapSockHTTPReqCreate); + +Err INetLibSockHTTPAttrSet(UInt16 libRefnum, MemHandle sockH, + UInt16 /*inetHTTPAttrEnum*/ attr, UInt16 attrIndex, + UInt8 * bufP, UInt16 bufLen, UInt16 flags) + SYS_TRAP(inetLibTrapSockHTTPAttrSet); + +Err INetLibSockHTTPReqSend(UInt16 libRefnum, MemHandle sockH, + void * writeP, UInt32 writeLen, + Int32 timeout) + SYS_TRAP(inetLibTrapSockHTTPReqSend); + +Err INetLibSockHTTPAttrGet(UInt16 libRefnum, MemHandle sockH, + UInt16 /*inetHTTPAttrEnum*/ attr, UInt16 attrIndex, + void * bufP, UInt32 * bufLenP) + SYS_TRAP(inetLibTrapSockHTTPAttrGet); + + + +//-------------------------------------------------- +// Utilities +//-------------------------------------------------- + +Err INetLibURLCrack(UInt16 libRefnum, UInt8 * urlTextP, INetURLType* urlP) + SYS_TRAP(inetLibTrapURLCrack); + +Err INetLibURLsAdd(UInt16 libRefnum, Char * baseURLStr, Char * embeddedURLStr, + Char * resultURLStr, UInt16 * resultLenP) + SYS_TRAP(inetLibTrapURLsAdd); + +Int16 INetLibURLsCompare(UInt16 libRefnum, Char * URLStr1, Char * URLStr2) + SYS_TRAP(inetLibTrapURLsCompare); + +Err INetLibURLGetInfo(UInt16 libRefnum, MemHandle inetH, + UInt8 * urlTextP, INetURLInfoType* urlInfoP) + SYS_TRAP(inetLibTrapURLGetInfo); + +Boolean INetLibWiCmd (UInt16 refNum, UInt16 /*WiCmdEnum*/ cmd, int enableOrX, int y) + SYS_TRAP(inetLibTrapWiCmd); + +Err INetLibCheckAntennaState(UInt16 refNum) + SYS_TRAP(inetLibTrapCheckAntennaState); + +//-------------------------------------------------- +// Cache interface +//-------------------------------------------------- + +Err INetLibCacheList(UInt16 libRefnum, MemHandle inetH, + UInt8 * cacheIndexURLP, UInt16 * indexP, UInt32 * uidP, + INetCacheEntryP cacheP) + SYS_TRAP(inetLibTrapCacheList); + +Err INetLibCacheGetObject(UInt16 libRefnum, MemHandle clientParamH, UInt8 * urlTextP, + UInt32 uniqueID, INetCacheInfoPtr cacheInfoP ) + SYS_TRAP(inetLibTrapCacheGetObject); + +//-------------------------------------------------- +// Configuration Calls +//-------------------------------------------------- +Err INetLibConfigMakeActive( UInt16 refNum, MemHandle inetH, + UInt16 configIndex) + SYS_TRAP(inetLibConfigMakeActive); + +Err INetLibConfigList( UInt16 refNum, INetConfigNameType nameArray[], + UInt16 * arrayEntriesP) + SYS_TRAP(inetLibConfigList); + +Err INetLibConfigIndexFromName( UInt16 refNum, INetConfigNamePtr nameP, + UInt16 * indexP) + SYS_TRAP(inetLibConfigIndexFromName); + +Err INetLibConfigDelete( UInt16 refNum, UInt16 index) + SYS_TRAP(inetLibConfigDelete); + +Err INetLibConfigSaveAs( UInt16 refNum, MemHandle inetH, + INetConfigNamePtr nameP) + SYS_TRAP(inetLibConfigSaveAs); + +Err INetLibConfigRename( UInt16 refNum, UInt16 index, + INetConfigNamePtr newNameP) + SYS_TRAP(inetLibConfigRename); + +Err INetLibConfigAliasSet( UInt16 refNum, UInt16 configIndex, + UInt16 aliasToIndex) + SYS_TRAP(inetLibConfigAliasSet); + +Err INetLibConfigAliasGet( UInt16 refNum, UInt16 aliasIndex, + UInt16 * indexP, Boolean * isAnotherAliasP) + SYS_TRAP(inetLibConfigAliasGet); + +//-------------------------------------------------- +// File specific calls +//-------------------------------------------------- + +Err INetLibSockFileGetByIndex(UInt16 libRefnum, MemHandle sockH, + UInt32 index, MemHandle *handleP, UInt32 * offsetP, UInt32 * lengthP) + SYS_TRAP(inetLibTrapSockFileGetByIndex); + +#ifdef __cplusplus +} +#endif + +#endif //__INETLIB_H__ + diff --git a/sdk-3.5/include/Libraries/LibTraps.h b/sdk-3.5/include/Libraries/LibTraps.h new file mode 100644 index 0000000..dfac0f6 --- /dev/null +++ b/sdk-3.5/include/Libraries/LibTraps.h @@ -0,0 +1,56 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: LibTraps.h + * + * Description: + * Palm OS Shared Library 'default' traps. + * + * History: + * 7/15/99 Created by Bob Ebert + * mm/dd/yy initials - brief revision comment + * + *****************************************************************************/ + + #ifndef __LIBTRAPS_H_ + #define __LIBTRAPS_H_ + +// Include elementary types +#include + +#if CPU_TYPE == CPU_68K +#include +#endif + +//-------------------------------------------------------------------- +// Define Library Trap Numbers +//-------------------------------------------------------------------- +// Library traps start here and go up by 1's +#define sysLibTrapBase 0xA800 + +#ifdef __GNUC__ + +#define sysLibTrapName 0xA800 +#define sysLibTrapOpen 0xA801 +#define sysLibTrapClose 0xA802 +#define sysLibTrapSleep 0xA803 +#define sysLibTrapWake 0xA804 +#define sysLibTrapCustom 0xA805 + +#else + +typedef enum { + sysLibTrapName = sysLibTrapBase, + sysLibTrapOpen, + sysLibTrapClose, + sysLibTrapSleep, + sysLibTrapWake, + sysLibTrapCustom + } SysLibTrapNumber; + +#endif + +#endif //__LIBTRAPS_H_ + diff --git a/sdk-3.5/include/Libraries/PalmOSGlue/DateGlue.h b/sdk-3.5/include/Libraries/PalmOSGlue/DateGlue.h new file mode 100644 index 0000000..8d3a8b9 --- /dev/null +++ b/sdk-3.5/include/Libraries/PalmOSGlue/DateGlue.h @@ -0,0 +1,42 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: DateGlue.h + * + * Description: + * Header file for DateGlue library routines. + * + * DateGlue provides compatibility for applications that wish to make + * calls to date routines, but which might actually be running on devices + * with roms that do not have newer routines available. + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 06/18/99 kwk New today. + * + *****************************************************************************/ + +#ifndef __DATEGLUE_H__ +#define __DATEGLUE_H__ + +#ifdef __cplusplus + extern "C" { +#endif + +void DateGlueToAscii(UInt8 months, UInt8 days, UInt16 years, DateFormatType dateFormat, + Char* pString); + +void DateGlueToDOWDMFormat(UInt8 month, UInt8 day, UInt16 year, DateFormatType dateFormat, + Char* pString); + + +#ifdef __cplusplus + } +#endif + +#endif // __DATEGLUE_H__ + diff --git a/sdk-3.5/include/Libraries/PalmOSGlue/FntGlue.h b/sdk-3.5/include/Libraries/PalmOSGlue/FntGlue.h new file mode 100644 index 0000000..054f0da --- /dev/null +++ b/sdk-3.5/include/Libraries/PalmOSGlue/FntGlue.h @@ -0,0 +1,45 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: FntGlue.h + * + * Description: + * Glue providing compatibility for applications that wish + * to make calls to the Font Mgr, but which might actually be running + * on a system which does not support newer calls. + * + * History: + * 06/18/99 kwk Created by Ken Krugler. + * 06/27/99 kwk Added defaultBoldFont. + * 09/25/99 kwk Added FntGlueWidthToOffset. + * + *****************************************************************************/ + +#ifndef __FNTGLUE_H__ +#define __FNTGLUE_H__ + +enum fontDefaults { + defaultSmallFont = 0, + defaultLargeFont, + defaultBoldFont, + defaultSystemFont +}; +typedef enum fontDefaults FontDefaultType; + +#ifdef __cplusplus + extern "C" { +#endif + +FontID FntGlueGetDefaultFontID(FontDefaultType inFontType); + +Int16 FntGlueWidthToOffset(const Char* charsP, UInt16 length, Int16 pixelWidth, + Boolean* leadingEdge, Int16* truncWidth); + +#ifdef __cplusplus + } +#endif + +#endif // __FNTGLUE_H__ + diff --git a/sdk-3.5/include/Libraries/PalmOSGlue/IntlGlue.h b/sdk-3.5/include/Libraries/PalmOSGlue/IntlGlue.h new file mode 100644 index 0000000..ab0da86 --- /dev/null +++ b/sdk-3.5/include/Libraries/PalmOSGlue/IntlGlue.h @@ -0,0 +1,61 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: IntlGlue.h + * + * Description: + * Header file for IntlGlue library routines. + * + * IntlGlue provides compatibility for applications that wish to make + * calls to Text Manager, but which might actually be running on devices + * with roms that do not have this support available, in which case the glue + * code executes the standard (Latin only) routines instead. This library + * can only be used on post-1.0 roms!!! + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 14 Sep 98 CSS Added this header and changed name (from IntlMgrLib.h). + * CSS Added new Text library-using macros. + * CSS All the Txt macros #defined in TextMgr.h are + * now #undef'ed here (#ifndef DIRECT_INTLMGR_CALLS) and + * then redefined to use our Text library-using macros. + * CSS Added an extern "C" wrapper around the routine + * declarations so non-C++ guys will see them. + * 15 Sep 98 kwk Sync'd with latest TextMgr.h header file. + * 15 Oct 98 kwk Sync'd again with latest TextMgr.h header file. + * kwk Added some missing macros for remapping Txt->Text routine names. + * kwk Added GetIntlRoutineAddress routine declaration. + * 02 Jun 99 kwk Changed names of routines to TxtGlueXXXX. + * + *****************************************************************************/ + +#ifndef __INTLGLUE_H__ +#define __INTLGLUE_H__ + +// Library versions of all the Intl Mgr routines: + +#ifdef __cplusplus + extern "C" { +#endif + +// IntlGlueGetRoutineAddress must be passed the address of one of the glue routines +// listed above. If the Int'l Mgr (and the appropriate Text Mgr routines) exists, +// then the result will be the same as calling IntlGetRoutineAddress() with the +// appropriate routine selector. If Text Mgr support is not available, then this +// call returns the address of the corresponding glue code routine. Note that the +// address returned is only valid so long as the application stays locked in memory, +// thus this routine should be called at or after your StartApplication routine, and +// only used up to the point where your application terminates. + +void* IntlGlueGetRoutineAddress(const void* inGlueRoutineAddress); + +#ifdef __cplusplus + } +#endif + +#endif // __INTLGLUE_H__ + diff --git a/sdk-3.5/include/Libraries/PalmOSGlue/TsmGlue.h b/sdk-3.5/include/Libraries/PalmOSGlue/TsmGlue.h new file mode 100644 index 0000000..573975d --- /dev/null +++ b/sdk-3.5/include/Libraries/PalmOSGlue/TsmGlue.h @@ -0,0 +1,39 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: TsmGlue.h + * + * Description: + * Header file for TsmGlueXXX library routines. + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 02 Jun 99 kwk New today. + * + *****************************************************************************/ + +#ifndef __TSMGLUE_H__ +#define __TSMGLUE_H__ + +// Library versions of all the Text Services Mgr routines: + +#ifdef __cplusplus + extern "C" { +#endif + +TsmFepModeType +TsmGlueGetFepMode(const TsmFepStatusType* inStatusP); + +TsmFepModeType +TsmGlueSetFepMode(TsmFepStatusType* ioStatusP, TsmFepModeType inNewMode); + +#ifdef __cplusplus + } +#endif + +#endif // __TSMGLUE_H__ + diff --git a/sdk-3.5/include/Libraries/PalmOSGlue/TxtGlue.h b/sdk-3.5/include/Libraries/PalmOSGlue/TxtGlue.h new file mode 100644 index 0000000..480793a --- /dev/null +++ b/sdk-3.5/include/Libraries/PalmOSGlue/TxtGlue.h @@ -0,0 +1,147 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: TxtGlue.h + * + * Description: + * Header file for TxtGlue library routines. + * + * TxtGlue provides compatibility for applications that wish to make + * calls to Text Manager, but which might actually be running on devices + * with roms that do not have this support available, in which case the glue + * code executes the standard (Latin only) routines instead. This library + * can only be used on post-1.0 roms!!! + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 14 Sep 98 CSS Added this header and changed name (from IntlMgrLib.h). + * CSS Added new Text library-using macros. + * CSS All the Txt macros #defined in TextMgr.h are + * now #undef'ed here (#ifndef DIRECT_INTLMGR_CALLS) and + * then redefined to use our Text library-using macros. + * CSS Added an extern "C" wrapper around the routine + * declarations so non-C++ guys will see them. + * 15 Sep 98 kwk Sync'd with latest TextMgr.h header file. + * 15 Oct 98 kwk Sync'd again with latest TextMgr.h header file. + * kwk Added some missing macros for remapping Txt->Text routine names. + * kwk Added GetIntlRoutineAddress routine declaration. + * 02 Jun 99 kwk Changed names of routines to TxtGlueXXXX. + * 14 Jul 99 kek Deleted TxtGluePrepFindString. + * 06 Nov 99 kwk Put back in TxtGluePrepFindString, using the old API. + * + *****************************************************************************/ + +#ifndef __TXTGLUE_H__ +#define __TXTGLUE_H__ + +// Duplicate versions of all of the macros in TextMgr.h that call the library +// routines instead: + +#define TxtGlueCharIsSpace(ch) ((TxtGlueCharAttr(ch) & charAttrSpace) != 0) +#define TxtGlueCharIsPrint(ch) ((TxtGlueCharAttr(ch) & charAttrPrint) != 0) +#define TxtGlueCharIsDigit(ch) ((TxtGlueCharAttr(ch) & _DI) != 0) +#define TxtGlueCharIsAlNum(ch) ((TxtGlueCharAttr(ch) & charAttrAlNum) != 0) +#define TxtGlueCharIsAlpha(ch) ((TxtGlueCharAttr(ch) & charAttrAlpha) != 0) +#define TxtGlueCharIsCntrl(ch) ((TxtGlueCharAttr(ch) & charAttrCntrl) != 0) +#define TxtGlueCharIsGraph(ch) ((TxtGlueCharAttr(ch) & charAttrGraph) != 0) +#define TxtGlueCharIsLower(ch) ((TxtGlueCharAttr(ch) & _LO) != 0) +#define TxtGlueCharIsPunct(ch) ((TxtGlueCharAttr(ch) & _PU) != 0) +#define TxtGlueCharIsUpper(ch) ((TxtGlueCharAttr(ch) & _UP) != 0) +#define TxtGlueCharIsHex(ch) ((TxtGlueCharAttr(ch) & _XD) != 0) +#define TxtGlueCharIsDelim(ch) ((TxtGlueCharAttr(ch) & charAttrDelim) != 0) + +#define TxtGluePreviousCharSize(inText, inOffset) TxtGlueGetPreviousChar((inText), (inOffset), NULL) +#define TxtGlueNextCharSize(inText, inOffset) TxtGlueGetNextChar((inText), (inOffset), NULL) + +#ifdef __cplusplus + extern "C" { +#endif + +UInt8 TxtGlueByteAttr(UInt8 inByte); + +UInt16 TxtGlueCharAttr(WChar inChar); + +UInt16 TxtGlueCharXAttr(WChar inChar); + +UInt16 TxtGlueCharSize(WChar inChar); + +Int16 TxtGlueCharWidth(WChar inChar); + +UInt16 TxtGlueGetPreviousChar(const Char* inText, UInt32 inOffset, WChar* outChar); + +UInt16 TxtGlueGetNextChar(const Char* inText, UInt32 inOffset, WChar* outChar); + +WChar TxtGlueGetChar(const Char* inText, UInt32 inOffset); + +UInt16 TxtGlueReplaceStr(Char* ioStr, UInt16 inMaxLen, const Char* inParamStr, UInt16 inParamNum); + +UInt16 TxtGlueSetNextChar(Char* ioText, UInt32 inOffset, WChar inChar); + +WChar TxtGlueCharBounds(const Char* inText, UInt32 inOffset, UInt32* outStart, UInt32* outEnd); + +Boolean TxtGlueFindString(const Char* inSourceStr, const Char* inTargetStr, + UInt32* outPos, UInt16* outLength); + +Boolean TxtGlueWordBounds(const Char* inText, UInt32 inLength, UInt32 inOffset, + UInt32* outStart, UInt32* outEnd); + +CharEncodingType TxtGlueCharEncoding(WChar inChar); + +CharEncodingType TxtGlueStrEncoding(const Char* inStr); + +CharEncodingType TxtGlueMaxEncoding(CharEncodingType a, CharEncodingType b); + +const Char* TxtGlueEncodingName(CharEncodingType inEncoding); + +Err TxtGlueTransliterate(const Char* inSrcText, UInt16 inSrcLength, Char* outDstText, + UInt16* ioDstLength, TranslitOpType inOp); + +void TxtGlueUpperStr(Char* ioString, UInt16 inMaxLength); + +void TxtGlueLowerStr(Char* ioString, UInt16 inMaxLength); + +WChar TxtGlueUpperChar(WChar inChar); + +WChar TxtGlueLowerChar(WChar inChar); + +UInt32 TxtGlueGetTruncationOffset(const Char* inText, UInt32 inOffset); + +Boolean TxtGlueCharIsValid(WChar inChar); + +Int16 TxtGlueCaselessCompare(const Char* s1, UInt16 s1Len, UInt16* s1MatchLen, + const Char* s2, UInt16 s2Len, UInt16* s2MatchLen); + +Int16 TxtGlueCompare(const Char* s1, UInt16 s1Len, UInt16* s1MatchLen, + const Char* s2, UInt16 s2Len, UInt16* s2MatchLen); + +void TxtGlueUpperStr(Char* ioString, UInt16 inMaxLength); + +void TxtGlueLowerStr(Char *ioString, UInt16 inMaxLength); + +WChar TxtGlueUpperChar(WChar inChar); + +WChar TxtGlueLowerChar(WChar inChar); + +WChar TxtGlueGetNumericSpaceChar(void); + +WChar TxtGlueGetHorizEllipsisChar(void); + +Boolean TxtGlueCharIsVirtual(UInt16 inModifiers, WChar inChar); + +Char* TxtGlueStripSpaces(Char* ioStr, Boolean leading, Boolean trailing); + +Char* TxtGlueParamString(const Char* inTemplate, const Char* param0, + const Char* param1, const Char* param2, const Char* param3); + +void TxtGluePrepFindString(const Char* inSrcP, Char* outDstP, UInt16 inDstSize); + +#ifdef __cplusplus + } +#endif + +#endif // __TXTGLUE_H__ + diff --git a/sdk-3.5/include/Libraries/PalmOSGlue/WinGlue.h b/sdk-3.5/include/Libraries/PalmOSGlue/WinGlue.h new file mode 100644 index 0000000..f802116 --- /dev/null +++ b/sdk-3.5/include/Libraries/PalmOSGlue/WinGlue.h @@ -0,0 +1,39 @@ +/****************************************************************************** + * + * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: WinGlue.h + * + * Description: + * Header file for WinGlue library routines. + * + * WinGlue provides compatibility for applications that wish to make + * calls to Window routines, but which might actually be running on devices + * with roms that do not have newer routines available. + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 06/18/99 kwk New today. + * + *****************************************************************************/ + +#ifndef __WINGLUE_H__ +#define __WINGLUE_H__ + +#ifdef __cplusplus + extern "C" { +#endif + +void WinGlueDrawChar(WChar theChar, Int16 x, Int16 y); + +void WinGlueDrawTruncChars(const Char* pChars, UInt16 length, Int16 x, Int16 y, Int16 maxWidth); + +#ifdef __cplusplus + } +#endif + +#endif // __WINGLUE_H__ + diff --git a/sdk-3.5/include/PalmCompatibility.h b/sdk-3.5/include/PalmCompatibility.h new file mode 100644 index 0000000..a86bdeb --- /dev/null +++ b/sdk-3.5/include/PalmCompatibility.h @@ -0,0 +1,186 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CoreCompatibility.h + * + * Description: + * Constant definitions for atrap compatibility between + * new function names and old function names. + * + * 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. + * + *****************************************************************************/ + +// 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. + +typedef Int8 SByte; +#if __DEFINE_TYPES_ +typedef UInt8 Byte; +#endif + +typedef Int16 SWord; +typedef UInt16 Word; + +typedef Int32 SDWord; +typedef UInt32 DWord; + + +// Logical data types +typedef Int8 SChar; +typedef UInt8 UChar; + +typedef Int16 Short; +typedef UInt16 UShort; + +typedef Int16 Int; +typedef UInt16 UInt; + +typedef Int32 Long; +typedef UInt32 ULong; + + +// Pointer Types +typedef MemPtr VoidPtr; +typedef MemHandle VoidHand; + +#if __DEFINE_TYPES_ +typedef MemPtr Ptr; +typedef MemHandle Handle; +#endif + + +// 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 *"!) + +typedef SByte* SBytePtr; +#if __DEFINE_TYPES_ +typedef Byte* BytePtr; +#endif + +typedef SWord* SWordPtr; +typedef Word* WordPtr; +typedef UInt16* UInt16Ptr; + +typedef SDWord* SDWordPtr; +typedef DWord* DWordPtr; + +// Logical data types +typedef Boolean* BooleanPtr; + +typedef Char* CharPtr; +typedef SChar* SCharPtr; +typedef UChar* UCharPtr; + +typedef WChar* WCharPtr; + +typedef Short* ShortPtr; +typedef UShort* UShortPtr; + +typedef Int* IntPtr; +typedef UInt* UIntPtr; + +typedef Long* LongPtr; +typedef ULong* ULongPtr; + + +/******************************************************************** + * + * Deprecated screen stuff + * + ********************************************************************/ + +#define scrCopy winPaint +#define scrAND winErase +#define scrANDNOT winMask +#define scrXOR winInvert +#define scrOR winOverlay +#define scrCopyNOT winPaintInverse + +#define scrDisplayModeGetDefaults winScreenModeGetDefaults +#define scrDisplayModeGet winScreenModeGet +#define scrDisplayModeSetToDefaults winScreenModeSetToDefaults +#define scrDisplayModeSet winScreenModeSet +#define scrDisplayModeGetSupportedDepths winScreenModeGetSupportedDepths +#define scrDisplayModeGetSupportsColor winScreenModeGetSupportsColor + +#define ScrOperation WinDrawOperation + +#define ScrDisplayMode(op, widthP, heightP, depthP, enableColorP) \ + WinScreenMode(op, widthP, heightP, depthP, enableColorP) + +#define ScrInit() WinScreenInit() + + +/******************************************************************** + * + * Deprecated SYS_TRAP macro machinery + * + ********************************************************************/ + +// This nWORD_INLINE stuff was never really portable to GCC. See the +// new SYS_TRAP framework in PalmTypes.h for most uses of these macros. +// Generally if you just want to use CodeWarrior, you can use these +// macros or just use the = { x, y, z} notation directly. To be +// portable between CodeWarrior and m68k-palmos-gcc, you should use +// the ={x,y,z} notation on the CW side and __attribute__((callseq)) +// on the GCC side (see the Palm OS-specific manual). + +#if USE_TRAPS == 0 +// Disable Palm OS System and Library trap inline code +// Header files become function prototypes for direct-linking +#define ONEWORD_INLINE(trapNum) +#define TWOWORD_INLINE(w1, w2) +#define THREEWORD_INLINE(w1, w2, w3) +#define FOURWORD_INLINE(w1, w2, w3, w4) +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) + +#else +// Enable Palm OS System and Library trap inline code +// Header files contain inline glue (opcodes) to be inserted in calling code +#define ONEWORD_INLINE(trapNum) \ + = trapNum +#define TWOWORD_INLINE(w1, w2) \ + = {w1,w2} +#define THREEWORD_INLINE(w1, w2, w3) \ + = {w1,w2,w3} +#define FOURWORD_INLINE(w1, w2, w3, w4) \ + = {w1,w2,w3,w4} +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) \ + = {w1,w2,w3,w4,w5} +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) \ + = {w1,w2,w3,w4,w5,w6} +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) \ + = {w1,w2,w3,w4,w5,w6,w7} +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) \ + = {w1,w2,w3,w4,w5,w6,w7,w8} +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9} +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10} +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11} +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12} + +#endif + diff --git a/sdk-3.5/include/PalmOS.h b/sdk-3.5/include/PalmOS.h new file mode 100644 index 0000000..c79abb2 --- /dev/null +++ b/sdk-3.5/include/PalmOS.h @@ -0,0 +1,29 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOS.h + * + * Description: + * Public includes for the whole core OS, generally apps/panels/libraries + * only need to include this. + * + * History: + * 6/ 6/95 RM - Created by Ron Marianetti + * 2/24/97 RF - Changed to handle c++ versions. + * 4/24/97 SL - Changes for PalmOS 2.0 SDK + * 5/19/97 SL - Now includes only in MWERKS environments + * 7/14/99 bob - Created from Pilot.h + * + *****************************************************************************/ + +#ifndef __PALMOS_H__ +#define __PALMOS_H__ + +#include +#include +#include + +#endif // __PALMOS_H__ + diff --git a/sdk-3.5/include/PalmOS.pch b/sdk-3.5/include/PalmOS.pch new file mode 100644 index 0000000..4d31f7f --- /dev/null +++ b/sdk-3.5/include/PalmOS.pch @@ -0,0 +1,47 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOS.pch + * + * Description: + * Precompiled header file for PalmOS.h. + * + * To use precompiled headers, add this file to your application project, + * and add the output filename ("PalmOS_Headers" for device builds, or + * "PalmOS_Sim_Headers" for simulator builds) to the "Prefix File" field + * of the "C/C++ Language" project settings panel. + * + * To use a custom prefix file in your project, #include "StarterPrefix.h" and + * in "StarterPrefix.h" add: #include "PalmOS_Headers" (or PalmOS_Sim_Headers) + * as the FIRST #include line. + * + * To override values (such as the ERROR_CHECK_LEVEL define), see comments below + * regarding modifying this file or creating your own version. + * + * History: + * 12/ 3/99 SCL - Created by Steve Lemke + * + *****************************************************************************/ + +#ifndef __PALMOS_PCH__ +#define __PALMOS_PCH__ + +// To override certain build options, modify this file or create your own copy of it, +// and do something like the following to customize the #define options... +// +//#include +//#define ERROR_CHECK_LEVEL ERROR_CHECK_PARTIAL + +// Include the Palm OS public header files +#include + +#if EMULATION_LEVEL == EMULATION_NONE + #pragma precompile_target ":Obj:PalmOS_Headers" +#else + #pragma precompile_target ":Obj:PalmOS_Headers_Sim" +#endif + +#endif // __PALMOS_PCH__ + diff --git a/sdk-3.5/include/PalmOS.win.pch b/sdk-3.5/include/PalmOS.win.pch new file mode 100644 index 0000000..6d44468 --- /dev/null +++ b/sdk-3.5/include/PalmOS.win.pch @@ -0,0 +1,47 @@ +/****************************************************************************** + * + * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOS.pch + * + * Description: + * Precompiled header file for PalmOS.h. + * + * To use precompiled headers, add this file to your application project, + * and add the output filename ("PalmOS_Headers" for device builds, or + * "PalmOS_Sim_Headers" for simulator builds) to the "Prefix File" field + * of the "C/C++ Language" project settings panel. + * + * To use a custom prefix file in your project, #include "StarterPrefix.h" and + * in "StarterPrefix.h" add: #include "PalmOS_Headers" (or PalmOS_Sim_Headers) + * as the FIRST #include line. + * + * To override values (such as the ERROR_CHECK_LEVEL define), see comments below + * regarding modifying this file or creating your own version. + * + * History: + * 12/ 3/99 SCL - Created by Steve Lemke + * + *****************************************************************************/ + +#ifndef __PALMOS_PCH__ +#define __PALMOS_PCH__ + +// To override certain build options, modify this file or create your own copy of it, +// and do something like the following to customize the #define options... +// +//#include +//#define ERROR_CHECK_LEVEL ERROR_CHECK_PARTIAL + +// Include the Palm OS public header files +#include + +#if EMULATION_LEVEL == EMULATION_NONE + #pragma precompile_target "PalmOS_Headers" +#else + #pragma precompile_target "PalmOS_Headers_Sim" +#endif + +#endif // __PALMOS_PCH__ + diff --git a/sdk-3.5/include/PalmTypes.h b/sdk-3.5/include/PalmTypes.h new file mode 100644 index 0000000..7821129 --- /dev/null +++ b/sdk-3.5/include/PalmTypes.h @@ -0,0 +1,298 @@ +/****************************************************************************** + * + * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmTypes.h + * + * Description: + * Common header file for all Palm OS components. + * Contains elementary data types + * + * History: + * 10/19/94 Created by Ron Marianetti + * 04/24/97 SCL Changes for PalmOS 2.0 SDK + * 08/21/98 SCL Merged WChar & WCharPtr typedefs from Sumo. + * 07/13/99 bob Created from Common.h, lots of cleanup of types + * + *****************************************************************************/ + +#ifndef __PALMTYPES_H__ +#define __PALMTYPES_H__ + + +/************************************************************ + * Environment configuration + *************************************************************/ +// must be included here, rather than in +// because they must be included for ALL builds. +// Not every build includes . + +// To override build options in a local component, include +// first, then define switches as need, and THEN include . +// This new mechanism supercedes the old "AppBuildRules.h" approach. +// More details available in . +#include + + +/************************************************************ + * Useful Macros + *************************************************************/ +#if defined(__GNUC__) && defined(__UNIX__) // used to be in + // Ensure that structure elements are 16-bit aligned + // Other [host] development platforms may need this as well... + #pragma pack(2) +#endif + + +/******************************************************************** + * Elementary data types + ********************************************************************/ +// Determine if we need to define our basic types or not +#ifndef __TYPES__ // (Already defined in CW11) +#ifndef __MACTYPES__ // (Already defined in CWPro3) +#define __DEFINE_TYPES_ 1 +#endif +#endif + + +// Fixed size data types +typedef signed char Int8; +typedef signed short Int16; +typedef signed long Int32; + +#if __DEFINE_TYPES_ +typedef unsigned char UInt8; +typedef unsigned short UInt16; +typedef unsigned long UInt32; +#endif + + +// Logical data types +#if __DEFINE_TYPES_ +typedef unsigned char Boolean; +#endif + +typedef char Char; +typedef UInt16 WChar; // 'wide' int'l character type. + +typedef UInt16 Err; + +typedef UInt32 LocalID; // local (card relative) chunk ID + +typedef Int16 Coord; // screen/window coordinate + + +typedef void * MemPtr; // global pointer +typedef struct _opaque *MemHandle; // global handle + + +#if __DEFINE_TYPES_ +typedef Int32 (*ProcPtr)(); +#endif + + +/************************************************************ + * Useful Macros + *************************************************************/ +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define max(a, b) (((a) > (b)) ? (a) : (b)) + +#define OffsetOf(type, member) ((UInt32) &(((type *) 0)->member)) + + + + +/************************************************************ + * Common constants + *************************************************************/ +#ifndef NULL +#define NULL 0 +#endif // NULL + +#ifndef bitsInByte +#define bitsInByte 8 +#endif // bitsInByte + + +// Include the following typedefs if types.h wasn't read. +#if __DEFINE_TYPES_ + #ifdef __MWERKS__ + #if !__option(bool) + #ifndef true + #define true 1 + #endif + #ifndef false + #define false 0 + #endif + #endif + #else + #ifndef __cplusplus + #ifndef true + enum {false, true}; + #endif + #endif + #endif +#endif /* __TYPES__ */ + + + + +/************************************************************ + * Misc + *************************************************************/ + +// Standardized infinite loop notation +// Use in place of while(1), while(true), while(!0), ... +#define loop_forever for (;;) + + +// Include M68KHwr.h: +#if EMULATION_LEVEL == EMULATION_NONE +#if CPU_TYPE == CPU_68K +#include +//#pragma warn_no_side_effect on +#endif +#endif + +/************************************************************ + * Metrowerks will substitute strlen and strcpy with inline + * 68K assembly code. Prevent this. + *************************************************************/ + +#ifdef __MC68K__ +#define _NO_FAST_STRING_INLINES_ 0 +#endif + + +/************************************************************ + * Define whether or not we are direct linking, or going through + * traps. + * + * When eumulating we use directy linking. + * When running under native mode, we use traps EXCEPT for the + * modules that actually install the routines into the trap table. + * These modules will set the DIRECT_LINK define to 1 + *************************************************************/ +#ifndef EMULATION_LEVEL +#error "This should not happen!" +#endif + +#ifndef USE_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_TRAPS 1 // use Pilot traps + #else + #define USE_TRAPS 0 // direct link (Simulator) + #endif +#endif + + +/******************************************************************** + * Palm OS System and Library trap macro definitions: + ********************************************************************/ + +#define _DIRECT_CALL(table, vector) +#define _DIRECT_CALL_WITH_SELECTOR(table, vector, selector) +#define _DIRECT_CALL_WITH_16BIT_SELECTOR(table, vector, selector) + +#ifndef _STRUCTURE_PICTURES + +#define _SYSTEM_TABLE 15 +#define _HAL_TABLE 15 + +#ifdef __GNUC__ + + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) + + #ifndef _Str + #define _Str(X) #X + #endif + + #define _OS_CALL(table, vector) \ + __attribute__ ((__callseq__ ( \ + "trap #" _Str(table) "; dc.w " _Str(vector)))) + + #define _OS_CALL_WITH_SELECTOR(table, vector, selector) \ + __attribute__ ((__callseq__ ( \ + "moveq #" _Str(selector) ",%%d2; " \ + "trap #" _Str(table) "; dc.w " _Str(vector)))) + + #define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) \ + __attribute__ ((__callseq__ ( \ + "move.w #" _Str(selector) ",-(%%sp); " \ + "trap #" _Str(table) "; dc.w " _Str(vector) "; " \ + "addq.w #2,%%sp"))) + + #else + + #define _OS_CALL(table, vector) __attribute__ ((systrap (vector))) + #define _OS_CALL_WITH_SELECTOR(table, vector, selector) + #define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) + + #endif + +#elif defined (__MWERKS__) /* The equivalent in CodeWarrior syntax */ + + #define _OS_CALL(table, vector) \ + = { 0x4E40 + table, vector } + + #define _OS_CALL_WITH_SELECTOR(table, vector, selector) \ + = { 0x7400 + selector, 0x4E40 + table, vector } + + #define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) \ + = { 0x3F3C, selector, 0x4E40 + table, vector, 0x544F } + +#endif + +#else + +#define _SYSTEM_TABLE "systrap" +#define _HAL_TABLE "hal" + +#define _OS_CALL(table, vector) \ + __SPIC__("simple", table, vector, 0) + +#define _OS_CALL_WITH_SELECTOR(table, vector, selector) \ + __SPIC__("selector", table, vector, selector) + +#define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) \ + __SPIC__("16bit_selector", table, vector, selector) + +#endif + + +#if EMULATION_LEVEL != EMULATION_NONE + +#define _HAL_API(kind) _DIRECT##kind +#define _SYSTEM_API(kind) _DIRECT##kind + +#elif USE_TRAPS == 0 + +#define _HAL_API(kind) _OS##kind +#define _SYSTEM_API(kind) _DIRECT##kind + +#else + +#define _HAL_API(kind) _OS##kind +#define _SYSTEM_API(kind) _OS##kind + +#endif + + +/************************************************************ + * Palm specific TRAP instruction numbers + *************************************************************/ +#define sysDbgBreakpointTrapNum 0 // For soft breakpoints +#define sysDbgTrapNum 8 // For compiled breakpoints +#define sysDispatchTrapNum 15 // Trap dispatcher + + +#define SYS_TRAP(trapNum) _SYSTEM_API(_CALL)(_SYSTEM_TABLE, trapNum) + +#define ASM_SYS_TRAP(trapNum) \ + DC.W m68kTrapInstr+sysDispatchTrapNum; \ + DC.W trapNum + + +#endif //__PALMTYPES_H__ + diff --git a/sdk-3.5/include/header.gcc b/sdk-3.5/include/header.gcc new file mode 100644 index 0000000..28aab7f --- /dev/null +++ b/sdk-3.5/include/header.gcc @@ -0,0 +1,11 @@ +PalmOptErrorCheckLevel.h Dynamic/PalmOptErrorCheckLevel.h +IMCUtils.h Core/System/ImcUtils.h +INetMgr.h Libraries/INet/INetMgr.h +LibTraps.h Libraries/LibTraps.h +DateGlue.h Libraries/PalmOSGlue/DateGlue.h +FntGlue.h Libraries/PalmOSGlue/FntGlue.h +IntlGlue.h Libraries/PalmOSGlue/IntlGlue.h +TsmGlue.h Libraries/PalmOSGlue/TsmGlue.h +TxtGlue.h Libraries/PalmOSGlue/TxtGlue.h +WinGlue.h Libraries/PalmOSGlue/WinGlue.h + diff --git a/sdk-3.5/lib/m68k-palmos-coff/libNetSocket.a b/sdk-3.5/lib/m68k-palmos-coff/libNetSocket.a new file mode 100644 index 0000000..ee255fc Binary files /dev/null and b/sdk-3.5/lib/m68k-palmos-coff/libNetSocket.a differ diff --git a/sdk-3.5/lib/m68k-palmos-coff/libPalmOSGlue-debug.a b/sdk-3.5/lib/m68k-palmos-coff/libPalmOSGlue-debug.a new file mode 100644 index 0000000..d134937 Binary files /dev/null and b/sdk-3.5/lib/m68k-palmos-coff/libPalmOSGlue-debug.a differ diff --git a/sdk-3.5/lib/m68k-palmos-coff/libPalmOSGlue.a b/sdk-3.5/lib/m68k-palmos-coff/libPalmOSGlue.a new file mode 100644 index 0000000..5f0d762 Binary files /dev/null and b/sdk-3.5/lib/m68k-palmos-coff/libPalmOSGlue.a differ diff --git a/sdk-4/include/BuildDefaults.h b/sdk-4/include/BuildDefaults.h new file mode 100644 index 0000000..f540ee8 --- /dev/null +++ b/sdk-4/include/BuildDefaults.h @@ -0,0 +1,307 @@ +/****************************************************************************** + * + * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: BuildDefaults.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Build variable defaults for Palm OS. + * + * This file is included by . + * This file supercedes the old file. + * + * History: + * 07/16/99 SCL So many changes the old history is obsolete. + * 07/29/99 kwk Deleted TEXT_SERVICES & INTERNATIONAL_MGR defines. + * 09/15/99 kwk Changed COUNTRY & LANGUAGE defines into #errors. + * 10/04/99 grant Added LOCALE define (defaults to #error). + * 10/05/99 kwk Added LOCALE_SUFFIX define (defaults to ""). + * + *****************************************************************************/ + +#ifndef __BUILDDEFAULTS_H__ +#define __BUILDDEFAULTS_H__ + +#include + +// To override build options in a local component, include +// first, then define switches as need, and then include . + +// Some projects used to have a local copy of a file called "AppBuildRules.h" +// or "AppBuildRulesMSC.h", which was automatically included by +// to override certain system default compile-time switches. These local +// "prefix" files can still be used. The project source files should be changed +// to include , then "AppBuildRules.MSC.h", then +// instead of the previous + + +/************************************************************ + * Include the following when running under the CodeWarrior + * IDE so that default build options can be overriden. The default + * version of this file is in the Incs: directory. If an app wishes + * to override the default options, it should create a copy of this + * include file in its own local directory. This include file + * is never used when building from MPW since MPW can specify compiler + * defines from the command line. + * + * Other environments can override all of these settings by simply + * pre-defining CMD_LINE_BUILD and any other desired settings. + *************************************************************/ + +#ifndef CMD_LINE_BUILD // typically pre-defined only from MPW + + #if !defined(__MWERKS__) && !defined(__PALMOS_TRAPS__) && !defined(_MSC_VER) + + // assume other environments generally build only PalmOS executables + #define __PALMOS_TRAPS__ 1 + + #endif + + + #if __PALMOS_TRAPS__ // defined by CodeWarrior IDE or above + + // Settings to build a PalmOS executable + #ifndef EMULATION_LEVEL + #define EMULATION_LEVEL EMULATION_NONE // building Palm OS executable + #endif + + #ifndef USE_TRAPS + #define USE_TRAPS 1 // use Palm OS traps + #endif + + #endif + + +#endif + + + +/************************************************************ + * Settings that can be overriden in the makefile (for MPW) + * OR (for CodeWarrior) in "AppBuildRules.h". If there is no + * local copy of "AppBuildRules.h" within the project directory, + * the one in the Incs directory will be used instead. + *************************************************************/ +// This default option is probably ok for now +#ifndef EMULATION_LEVEL + #define EMULATION_LEVEL EMULATION_MAC +#endif + +// This default option is probably ok for now +#if EMULATION_LEVEL == EMULATION_NONE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +// This default option is probably ok for now +#ifndef MEMORY_TYPE + #define MEMORY_TYPE MEMORY_LOCAL +#endif + +// This default option is probably ok for now +#ifndef ENVIRONMENT + #define ENVIRONMENT ENVIRONMENT_CW +#endif + +// This default option is probably ok to leave as a default +#ifndef PLATFORM_TYPE + #define PLATFORM_TYPE PLATFORM_VIEWER +#endif + +#ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL #error "ERROR_CHECK_LEVEL not defined; Try including ''PalmOptErrorCheckLevel.h''!" + // The following allows to redefine ERROR_CHECK_LEVEL + // without letting it change ERROR_CHECK_LEVEL if it was already defined, + // such as would be the case when using a project prefix file... + #define ERROR_CHECK_LEVEL_OK_TO_REDEFINE +#endif + +// This default option is probably ok for now +#ifndef CPU_TYPE + #if defined(__INTEL__) || defined(__i386__) + #define CPU_TYPE CPU_x86 + #else + #define CPU_TYPE CPU_68K + #endif +#endif + +// add additional checking to the build + + +#ifndef MODEL + #define MODEL #error "MODEL not defined; Try including ''PalmOptModel.h''!" +#endif + +// This default option is probably ok to leave as a default +#ifndef MEMORY_FORCE_LOCK + #define MEMORY_FORCE_LOCK MEMORY_FORCE_LOCK_ON +#endif + +// Must be defined (-d or prefix file) before using. See comment in . +#ifndef DEBUG_LEVEL + #define DEBUG_LEVEL #error "DEBUG_LEVEL must be defined before using!" +#endif + +#ifndef DEFAULT_LIB_ENTRIES + #define DEFAULT_LIB_ENTRIES 12 // space for 12 libraries in library table +#endif + +#ifndef USER_MODE + #define USER_MODE #error "USER_MODE not defined; Try including ''PalmOptUserMode.h''!" +#endif + +#ifndef INTERNAL_COMMANDS + #define INTERNAL_COMMANDS #error "INTERNAL_COMMANDS must be defined before using!" +#endif + +#ifndef INCLUDE_DES + #define INCLUDE_DES INCLUDE_DES_ON +#endif + +// Unless otherwise specified, assume CML_ENCODER is off +#ifndef CML_ENCODER + #define CML_ENCODER CML_ENCODER_OFF +#endif + +// Derive the path for resource files. +#ifndef RESOURCE_FILE_PREFIX + #define RESOURCE_FILE_PREFIX "" +#endif + +// LOCALE_SUFFIX is used for the name of merged resource files, +// and also sys.tres. +#ifndef LOCALE_SUFFIX + #define LOCALE_SUFFIX "" +#endif + + + +// Set these according to which Shell commands you want to +// link with. These are often overridden by other components +// in a local "AppBuildRules.h" which is currently obsolete. +#ifndef SHELL_COMMAND_DB + #define SHELL_COMMAND_DB 0 // Not Available +#endif + +#ifndef SHELL_COMMAND_UI + #define SHELL_COMMAND_UI 1 // Available +#endif + +#ifndef SHELL_COMMAND_APP + #define SHELL_COMMAND_APP 1 // Available +#endif + +#ifndef SHELL_COMMAND_EMULATOR + #define SHELL_COMMAND_EMULATOR 1 // Available +#endif + + +#ifndef TRACE_OUTPUT + #define TRACE_OUTPUT_OK_TO_REDEFINE + #define TRACE_OUTPUT TRACE_OUTPUT_OFF +#endif + + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef DYN_MEM_SIZE_MAX + #define DYN_MEM_SIZE_MAX #error "DYN_MEM_SIZE_MAX is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef SMALL_ROM_SIZE + #define SMALL_ROM_SIZE #error "SMALL_ROM_SIZE is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef CONSOLE_SERIAL_LIB + #define CONSOLE_SERIAL_LIB #error "CONSOLE_SERIAL_LIB is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef PILOT_SERIAL_MGR + // Palm OS 3.5 code now assumes PILOT_SERIAL_MGR == PILOT_SERIAL_MGR_NEW + #define PILOT_SERIAL_MGR #error "PILOT_SERIAL_MGR is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef MEMORY_VERSION + // Palm OS 3.5 code now assumes MEMORY_VERSION == MEMORY_VERSION_2 + #define MEMORY_VERSION #error "MEMORY_VERSION is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef GRAPHICS_VERSION + // Palm OS 3.5 code now assumes GRAPHICS_VERSION == GRAPHICS_VERSION_2 + #define GRAPHICS_VERSION #error "GRAPHICS_VERSION is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef HW_TARGET + // Palm OS 3.5 is now hardware independent; HAL should handle this + #define HW_TARGET #error "HW_TARGET is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef HW_REV + // Palm OS 3.5 is now hardware independent; HAL should handle this + #define HW_REV #error "HW_REV is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef RMP_LIB_INCLUDE + #define RMP_LIB_INCLUDE #error "RMP_LIB_INCLUDE is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +#ifndef OEM_PRODUCT + #define OEM_PRODUCT #error "OEM_PRODUCT is an obsolete build flag!" +#endif + +// Obsolete option; this is left here to catch any stragglers (test code, etc.)... +// LANGUAGE/COUNTRY are no longer supported. If absolutely necessary, use LOCALE instead, but +// build-time dependencies on the target LOCALE are a _really_ bad idea. +#ifdef LANGUAGE + #undef LANGUAGE +#endif +#define LANGUAGE #error "LANGUAGE is now obsolete; use LOCALE and include PalmOptLocale.h" + +#ifdef COUNTRY + #undef COUNTRY +#endif +#define COUNTRY #error "COUNTRY is now obsolete; use LOCALE and include PalmOptLocale.h" + +// Moved to : +//#if defined(__GNUC__) && defined(__UNIX__) +// // Ensure that structure elements are 16-bit aligned +// #pragma pack(2) +//#endif + +// Default to allow access to internal data structures exposed in system/ui header files. +// If you want to verify that your app does not access data structure internals then define +// DO_NOT_ALLOW_ACCESS_TO_INTERNALS_OF_STRUCTS before including this file. +#ifndef DO_NOT_ALLOW_ACCESS_TO_INTERNALS_OF_STRUCTS + +#define ALLOW_ACCESS_TO_INTERNALS_OF_CLIPBOARDS +#define ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS +#define ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS +#define ALLOW_ACCESS_TO_INTERNALS_OF_FINDPARAMS +#define ALLOW_ACCESS_TO_INTERNALS_OF_FORMS +#define ALLOW_ACCESS_TO_INTERNALS_OF_LISTS +#define ALLOW_ACCESS_TO_INTERNALS_OF_MENUS +#define ALLOW_ACCESS_TO_INTERNALS_OF_PROGRESS +#define ALLOW_ACCESS_TO_INTERNALS_OF_SCROLLBARS +#define ALLOW_ACCESS_TO_INTERNALS_OF_TABLES + +#define ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS +#define ALLOW_ACCESS_TO_INTERNALS_OF_FONTS +#define ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS + +#endif + +// This is defined to allow support of deprecated API function names. The API header files +// map old function names to new function names if ALLOW_OLD_API_NAMES is defined. +#define ALLOW_OLD_API_NAMES 1 + +#endif diff --git a/sdk-4/include/BuildDefines.h b/sdk-4/include/BuildDefines.h new file mode 100644 index 0000000..6d71c4e --- /dev/null +++ b/sdk-4/include/BuildDefines.h @@ -0,0 +1,142 @@ +/****************************************************************************** + * + * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: BuildDefines.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Build variable defines for Palm OS. + * + * This file is included by . + * It should be included by any local component that wishes + * to override any system default compile-time switches. + * For more details, refer to . + * + * This file supercedes the old file. + * + * History: + * 07/16/99 SCL So many changes the old history is obsolete. + * 07/29/99 kwk Deleted TEXT_SERVICES & INTERNATIONAL_MGR & VENDOR. + * 10/04/99 grant Added LOCALE definitions. + * + *****************************************************************************/ + +#ifndef __BUILDDEFINES_H__ +#define __BUILDDEFINES_H__ + + +/************************************************************ + * Compilation Control Options + *************************************************************/ + +// The makefile should set the define EMULATION_LEVEL to one of the following +// constants: +#define EMULATION_NONE 0 // native environment +#define EMULATION_WINDOWS 1 // emulate on Windows +#define EMULATION_DOS 2 // emulate on DOS +#define EMULATION_MAC 3 // emulate on Macintosh +#define EMULATION_UNIX 4 // emulate on Linux + + +// If emulation is not EMULATION_NONE, the following define controls +// whether we are talking to a touchdown device over the serial port, +// or if we are emulating a memory card in local RAM. +// +// The makefile should set the define MEMORY_TYPE to one of the following +// constants +#define MEMORY_LOCAL 0 // Emulate using local memory card image +#define MEMORY_REMOTE 1 // Pass calls through serial port to the device + + +// The makefile should set the define ENVIRONMENT to one of the following: +#define ENVIRONMENT_CW 0 // CodeWarrior compiler/linker (IDE or MPW) +#define ENVIRONMENT_MPW 1 // Apple's MPW compiler/linker + + +// The makefile should set the define PLATFORM_TYPE to one of the following +// constants: +#define PLATFORM_VIEWER 0 // PalmPilot Viewer +#define PLATFORM_SERVER 1 // Server code + + +// The makefile should set the define ERROR_CHECK_LEVEL to one of the +// following constants: +#define ERROR_CHECK_NONE 0 // compile no error checking code +#define ERROR_CHECK_PARTIAL 1 // display for fatal errors only +#define ERROR_CHECK_FULL 2 // display fatal or non-fatal errors + + +// The makefile should set the define CPU_TYPE to one of the +// following constants: +#define CPU_68K 0 // Motorola 68K type +#define CPU_x86 1 // Intel x86 type + + + + +// The makefile should set the define MODEL to one of the +// following constants. This equate is currently only use by +// special purpose applications like Setup that need to install different +// files for each type of product. Normally, model dependent behavior +// should be run-time based off of Features using FtrGet(). +#define MODEL_GENERIC 0 // Not one of the specific models that follow +#define MODEL_ELEVEN 1 // Eleven (Palm Seven) +#define MODEL_SUMO 2 // EZ product + + +// The makefile should set the define MEMORY_FORCE_LOCK to one of the +// following. +#define MEMORY_FORCE_LOCK_OFF 0 // Don't force all handles to be locked +#define MEMORY_FORCE_LOCK_ON 1 // Force all handles to be locked before usage + + +// The makefile should set the define DEBUG_LEVEL to one of the +// following. THIS DEFINE IS ONLY USED BY A COUPLE MODULES SO WE +// DON'T GIVE IT A DEFAULT VALUE BELOW... +// ANY MODULE THAT USES THIS DEFINE SHOULD VERIFY THAT IT IS DEFINED!! +#define DEBUG_LEVEL_NONE 1 // None: Does not auto-launch Console or Debugger +#define DEBUG_LEVEL_PARTIAL 2 // Partial: Auto-Launches Console but skips debugger +#define DEBUG_LEVEL_FULL 3 // Full: Waits in debugger on reset + + +// The makefile should set the define DEFAULT_DATA to one of the following: +// Setting this define to USE_DEFAULT_DATA will cause the core apps to include default +// data in the build. +#define DO_NOT_USE_DEFAULT_DATA 0 +#define USE_DEFAULT_DATA 1 + + +// The makefile should set the define USER_MODE to one of the +// following constants: +#define USER_MODE_NORMAL 0 // normal operation +#define USER_MODE_DEMO 1 // demo mode - Graffiti and pop-up keyboard disabled + + +// The makefile should set the define INTERNAL_COMMANDS to one of the +// following constants: +#define INTERNAL_COMMANDS_EXCLUDE 0 +#define INTERNAL_COMMANDS_INCLUDE 1 // Include internal shell commands + + +// The makefile should set the define INCLUDE_DES to one of the +// following constants: +#define INCLUDE_DES_OFF 0 +#define INCLUDE_DES_ON 1 // include it + + +// Used by Net Library to link in the CML encoder +#define CML_ENCODER_OFF 0 +#define CML_ENCODER_ON 1 + +// The makefile should set the define TRACE_OUTPUT to one of the following +// constants: +#define TRACE_OUTPUT_OFF 0 +#define TRACE_OUTPUT_ON 1 + + + + +#endif diff --git a/sdk-4/include/Core/CoreTraps.h b/sdk-4/include/Core/CoreTraps.h new file mode 100644 index 0000000..809b7a7 --- /dev/null +++ b/sdk-4/include/Core/CoreTraps.h @@ -0,0 +1,1505 @@ +/****************************************************************************** + * + * 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 externalize the routine + * to fix 3.5-specific issues. + * 11/22/00 bob Added FldSetMaxVisibleLines trap + * + *****************************************************************************/ + + #ifndef __CORETRAPS_H_ + #define __CORETRAPS_H_ + +// Include elementary types +#include + +#if CPU_TYPE == CPU_68K +#include +#endif + +// Regular traps start here and go up by 1's +#define sysTrapBase 0xA000 + + +#define sysTrapMemInit 0xA000 +#define sysTrapMemInitHeapTable 0xA001 +#define sysTrapMemStoreInit 0xA002 +#define sysTrapMemCardFormat 0xA003 +#define sysTrapMemCardInfo 0xA004 +#define sysTrapMemStoreInfo 0xA005 +#define sysTrapMemStoreSetInfo 0xA006 +#define sysTrapMemNumHeaps 0xA007 +#define sysTrapMemNumRAMHeaps 0xA008 +#define sysTrapMemHeapID 0xA009 +#define sysTrapMemHeapPtr 0xA00A +#define sysTrapMemHeapFreeBytes 0xA00B +#define sysTrapMemHeapSize 0xA00C +#define sysTrapMemHeapFlags 0xA00D +#define sysTrapMemHeapCompact 0xA00E +#define sysTrapMemHeapInit 0xA00F +#define sysTrapMemHeapFreeByOwnerID 0xA010 +#define sysTrapMemChunkNew 0xA011 +#define sysTrapMemChunkFree 0xA012 +#define sysTrapMemPtrNew 0xA013 +#define sysTrapMemPtrRecoverHandle 0xA014 +#define sysTrapMemPtrFlags 0xA015 +#define sysTrapMemPtrSize 0xA016 +#define sysTrapMemPtrOwner 0xA017 +#define sysTrapMemPtrHeapID 0xA018 +#define sysTrapMemPtrCardNo 0xA019 +#define sysTrapMemPtrToLocalID 0xA01A +#define sysTrapMemPtrSetOwner 0xA01B +#define sysTrapMemPtrResize 0xA01C +#define sysTrapMemPtrResetLock 0xA01D +#define sysTrapMemHandleNew 0xA01E +#define sysTrapMemHandleLockCount 0xA01F +#define sysTrapMemHandleToLocalID 0xA020 +#define sysTrapMemHandleLock 0xA021 +#define sysTrapMemHandleUnlock 0xA022 +#define sysTrapMemLocalIDToGlobal 0xA023 +#define sysTrapMemLocalIDKind 0xA024 +#define sysTrapMemLocalIDToPtr 0xA025 +#define sysTrapMemMove 0xA026 +#define sysTrapMemSet 0xA027 +#define sysTrapMemStoreSearch 0xA028 +#define sysTrapSysReserved10Trap1 0xA029 /* "Reserved" trap in Palm OS 1.0 and later (was sysTrapMemPtrDataStorage) */ + +#define sysTrapMemKernelInit 0xA02A +#define sysTrapMemHandleFree 0xA02B +#define sysTrapMemHandleFlags 0xA02C +#define sysTrapMemHandleSize 0xA02D +#define sysTrapMemHandleOwner 0xA02E +#define sysTrapMemHandleHeapID 0xA02F +#define sysTrapMemHandleDataStorage 0xA030 +#define sysTrapMemHandleCardNo 0xA031 +#define sysTrapMemHandleSetOwner 0xA032 +#define sysTrapMemHandleResize 0xA033 +#define sysTrapMemHandleResetLock 0xA034 +#define sysTrapMemPtrUnlock 0xA035 +#define sysTrapMemLocalIDToLockedPtr 0xA036 +#define sysTrapMemSetDebugMode 0xA037 +#define sysTrapMemHeapScramble 0xA038 +#define sysTrapMemHeapCheck 0xA039 +#define sysTrapMemNumCards 0xA03A +#define sysTrapMemDebugMode 0xA03B +#define sysTrapMemSemaphoreReserve 0xA03C +#define sysTrapMemSemaphoreRelease 0xA03D +#define sysTrapMemHeapDynamic 0xA03E +#define sysTrapMemNVParams 0xA03F + + +#define sysTrapDmInit 0xA040 +#define sysTrapDmCreateDatabase 0xA041 +#define sysTrapDmDeleteDatabase 0xA042 +#define sysTrapDmNumDatabases 0xA043 +#define sysTrapDmGetDatabase 0xA044 +#define sysTrapDmFindDatabase 0xA045 +#define sysTrapDmDatabaseInfo 0xA046 +#define sysTrapDmSetDatabaseInfo 0xA047 +#define sysTrapDmDatabaseSize 0xA048 +#define sysTrapDmOpenDatabase 0xA049 +#define sysTrapDmCloseDatabase 0xA04A +#define sysTrapDmNextOpenDatabase 0xA04B +#define sysTrapDmOpenDatabaseInfo 0xA04C +#define sysTrapDmResetRecordStates 0xA04D +#define sysTrapDmGetLastErr 0xA04E +#define sysTrapDmNumRecords 0xA04F +#define sysTrapDmRecordInfo 0xA050 +#define sysTrapDmSetRecordInfo 0xA051 +#define sysTrapDmAttachRecord 0xA052 +#define sysTrapDmDetachRecord 0xA053 +#define sysTrapDmMoveRecord 0xA054 +#define sysTrapDmNewRecord 0xA055 +#define sysTrapDmRemoveRecord 0xA056 +#define sysTrapDmDeleteRecord 0xA057 +#define sysTrapDmArchiveRecord 0xA058 +#define sysTrapDmNewHandle 0xA059 +#define sysTrapDmRemoveSecretRecords 0xA05A +#define sysTrapDmQueryRecord 0xA05B +#define sysTrapDmGetRecord 0xA05C +#define sysTrapDmResizeRecord 0xA05D +#define sysTrapDmReleaseRecord 0xA05E +#define sysTrapDmGetResource 0xA05F +#define sysTrapDmGet1Resource 0xA060 +#define sysTrapDmReleaseResource 0xA061 +#define sysTrapDmResizeResource 0xA062 +#define sysTrapDmNextOpenResDatabase 0xA063 +#define sysTrapDmFindResourceType 0xA064 +#define sysTrapDmFindResource 0xA065 +#define sysTrapDmSearchResource 0xA066 +#define sysTrapDmNumResources 0xA067 +#define sysTrapDmResourceInfo 0xA068 +#define sysTrapDmSetResourceInfo 0xA069 +#define sysTrapDmAttachResource 0xA06A +#define sysTrapDmDetachResource 0xA06B +#define sysTrapDmNewResource 0xA06C +#define sysTrapDmRemoveResource 0xA06D +#define sysTrapDmGetResourceIndex 0xA06E +#define sysTrapDmQuickSort 0xA06F +#define sysTrapDmQueryNextInCategory 0xA070 +#define sysTrapDmNumRecordsInCategory 0xA071 +#define sysTrapDmPositionInCategory 0xA072 +#define sysTrapDmSeekRecordInCategory 0xA073 +#define sysTrapDmMoveCategory 0xA074 +#define sysTrapDmOpenDatabaseByTypeCreator 0xA075 +#define sysTrapDmWrite 0xA076 +#define sysTrapDmStrCopy 0xA077 +#define sysTrapDmGetNextDatabaseByTypeCreator 0xA078 +#define sysTrapDmWriteCheck 0xA079 +#define sysTrapDmMoveOpenDBContext 0xA07A +#define sysTrapDmFindRecordByID 0xA07B +#define sysTrapDmGetAppInfoID 0xA07C +#define sysTrapDmFindSortPositionV10 0xA07D +#define sysTrapDmSet 0xA07E +#define sysTrapDmCreateDatabaseFromImage 0xA07F + + +#define sysTrapDbgSrcMessage 0xA080 +#define sysTrapDbgMessage 0xA081 +#define sysTrapDbgGetMessage 0xA082 +#define sysTrapDbgCommSettings 0xA083 + +#define sysTrapErrDisplayFileLineMsg 0xA084 +#define sysTrapErrSetJump 0xA085 +#define sysTrapErrLongJump 0xA086 +#define sysTrapErrThrow 0xA087 +#define sysTrapErrExceptionList 0xA088 + +#define sysTrapSysBroadcastActionCode 0xA089 +#define sysTrapSysUnimplemented 0xA08A +#define sysTrapSysColdBoot 0xA08B +#define sysTrapSysReset 0xA08C +#define sysTrapSysDoze 0xA08D +#define sysTrapSysAppLaunch 0xA08E +#define sysTrapSysAppStartup 0xA08F +#define sysTrapSysAppExit 0xA090 +#define sysTrapSysSetA5 0xA091 +#define sysTrapSysSetTrapAddress 0xA092 +#define sysTrapSysGetTrapAddress 0xA093 +#define sysTrapSysTranslateKernelErr 0xA094 +#define sysTrapSysSemaphoreCreate 0xA095 +#define sysTrapSysSemaphoreDelete 0xA096 +#define sysTrapSysSemaphoreWait 0xA097 +#define sysTrapSysSemaphoreSignal 0xA098 +#define sysTrapSysTimerCreate 0xA099 +#define sysTrapSysTimerWrite 0xA09A +#define sysTrapSysTaskCreate 0xA09B +#define sysTrapSysTaskDelete 0xA09C +#define sysTrapSysTaskTrigger 0xA09D +#define sysTrapSysTaskID 0xA09E +#define sysTrapSysTaskUserInfoPtr 0xA09F +#define sysTrapSysTaskDelay 0xA0A0 +#define sysTrapSysTaskSetTermProc 0xA0A1 +#define sysTrapSysUILaunch 0xA0A2 +#define sysTrapSysNewOwnerID 0xA0A3 +#define sysTrapSysSemaphoreSet 0xA0A4 +#define sysTrapSysDisableInts 0xA0A5 +#define sysTrapSysRestoreStatus 0xA0A6 +#define sysTrapSysUIAppSwitch 0xA0A7 +#define sysTrapSysCurAppInfoPV20 0xA0A8 +#define sysTrapSysHandleEvent 0xA0A9 +#define sysTrapSysInit 0xA0AA +#define sysTrapSysQSort 0xA0AB +#define sysTrapSysCurAppDatabase 0xA0AC +#define sysTrapSysFatalAlert 0xA0AD +#define sysTrapSysResSemaphoreCreate 0xA0AE +#define sysTrapSysResSemaphoreDelete 0xA0AF +#define sysTrapSysResSemaphoreReserve 0xA0B0 +#define sysTrapSysResSemaphoreRelease 0xA0B1 +#define sysTrapSysSleep 0xA0B2 +#define sysTrapSysKeyboardDialogV10 0xA0B3 +#define sysTrapSysAppLauncherDialog 0xA0B4 +#define sysTrapSysSetPerformance 0xA0B5 +#define sysTrapSysBatteryInfoV20 0xA0B6 +#define sysTrapSysLibInstall 0xA0B7 +#define sysTrapSysLibRemove 0xA0B8 +#define sysTrapSysLibTblEntry 0xA0B9 +#define sysTrapSysLibFind 0xA0BA +#define sysTrapSysBatteryDialog 0xA0BB +#define sysTrapSysCopyStringResource 0xA0BC +#define sysTrapSysKernelInfo 0xA0BD +#define sysTrapSysLaunchConsole 0xA0BE +#define sysTrapSysTimerDelete 0xA0BF +#define sysTrapSysSetAutoOffTime 0xA0C0 +#define sysTrapSysFormPointerArrayToStrings 0xA0C1 +#define sysTrapSysRandom 0xA0C2 +#define sysTrapSysTaskSwitching 0xA0C3 +#define sysTrapSysTimerRead 0xA0C4 + + +#define sysTrapStrCopy 0xA0C5 +#define sysTrapStrCat 0xA0C6 +#define sysTrapStrLen 0xA0C7 +#define sysTrapStrCompare 0xA0C8 +#define sysTrapStrIToA 0xA0C9 +#define sysTrapStrCaselessCompare 0xA0CA +#define sysTrapStrIToH 0xA0CB +#define sysTrapStrChr 0xA0CC +#define sysTrapStrStr 0xA0CD +#define sysTrapStrAToI 0xA0CE +#define sysTrapStrToLower 0xA0CF + +#define sysTrapSerReceiveISP 0xA0D0 + +#define sysTrapSlkOpen 0xA0D1 +#define sysTrapSlkClose 0xA0D2 +#define sysTrapSlkOpenSocket 0xA0D3 +#define sysTrapSlkCloseSocket 0xA0D4 +#define sysTrapSlkSocketRefNum 0xA0D5 +#define sysTrapSlkSocketSetTimeout 0xA0D6 +#define sysTrapSlkFlushSocket 0xA0D7 +#define sysTrapSlkSetSocketListener 0xA0D8 +#define sysTrapSlkSendPacket 0xA0D9 +#define sysTrapSlkReceivePacket 0xA0DA +#define sysTrapSlkSysPktDefaultResponse 0xA0DB +#define sysTrapSlkProcessRPC 0xA0DC + + +#define sysTrapConPutS 0xA0DD +#define sysTrapConGetS 0xA0DE + +#define sysTrapFplInit 0xA0DF /* Obsolete, here for compatibilty only! */ +#define sysTrapFplFree 0xA0E0 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplFToA 0xA0E1 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplAToF 0xA0E2 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplBase10Info 0xA0E3 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplLongToFloat 0xA0E4 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplFloatToLong 0xA0E5 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplFloatToULong 0xA0E6 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplMul 0xA0E7 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplAdd 0xA0E8 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplSub 0xA0E9 /* Obsolete, here for compatibilty only! */ +#define sysTrapFplDiv 0xA0EA /* Obsolete, here for compatibilty only! */ + +#define sysTrapWinScreenInit 0xA0EB /* was sysTrapScrInit */ +#define sysTrapScrCopyRectangle 0xA0EC +#define sysTrapScrDrawChars 0xA0ED +#define sysTrapScrLineRoutine 0xA0EE +#define sysTrapScrRectangleRoutine 0xA0EF +#define sysTrapScrScreenInfo 0xA0F0 +#define sysTrapScrDrawNotify 0xA0F1 +#define sysTrapScrSendUpdateArea 0xA0F2 +#define sysTrapScrCompressScanLine 0xA0F3 +#define sysTrapScrDeCompressScanLine 0xA0F4 + + +#define sysTrapTimGetSeconds 0xA0F5 +#define sysTrapTimSetSeconds 0xA0F6 +#define sysTrapTimGetTicks 0xA0F7 +#define sysTrapTimInit 0xA0F8 +#define sysTrapTimSetAlarm 0xA0F9 +#define sysTrapTimGetAlarm 0xA0FA +#define sysTrapTimHandleInterrupt 0xA0FB +#define sysTrapTimSecondsToDateTime 0xA0FC +#define sysTrapTimDateTimeToSeconds 0xA0FD +#define sysTrapTimAdjust 0xA0FE +#define sysTrapTimSleep 0xA0FF +#define sysTrapTimWake 0xA100 + +#define sysTrapCategoryCreateListV10 0xA101 +#define sysTrapCategoryFreeListV10 0xA102 +#define sysTrapCategoryFind 0xA103 +#define sysTrapCategoryGetName 0xA104 +#define sysTrapCategoryEditV10 0xA105 +#define sysTrapCategorySelectV10 0xA106 +#define sysTrapCategoryGetNext 0xA107 +#define sysTrapCategorySetTriggerLabel 0xA108 +#define sysTrapCategoryTruncateName 0xA109 + +#define sysTrapClipboardAddItem 0xA10A +#define sysTrapClipboardCheckIfItemExist 0xA10B +#define sysTrapClipboardGetItem 0xA10C + +#define sysTrapCtlDrawControl 0xA10D +#define sysTrapCtlEraseControl 0xA10E +#define sysTrapCtlHideControl 0xA10F +#define sysTrapCtlShowControl 0xA110 +#define sysTrapCtlGetValue 0xA111 +#define sysTrapCtlSetValue 0xA112 +#define sysTrapCtlGetLabel 0xA113 +#define sysTrapCtlSetLabel 0xA114 +#define sysTrapCtlHandleEvent 0xA115 +#define sysTrapCtlHitControl 0xA116 +#define sysTrapCtlSetEnabled 0xA117 +#define sysTrapCtlSetUsable 0xA118 +#define sysTrapCtlEnabled 0xA119 + + +#define sysTrapEvtInitialize 0xA11A +#define sysTrapEvtAddEventToQueue 0xA11B +#define sysTrapEvtCopyEvent 0xA11C +#define sysTrapEvtGetEvent 0xA11D +#define sysTrapEvtGetPen 0xA11E +#define sysTrapEvtSysInit 0xA11F +#define sysTrapEvtGetSysEvent 0xA120 +#define sysTrapEvtProcessSoftKeyStroke 0xA121 +#define sysTrapEvtGetPenBtnList 0xA122 +#define sysTrapEvtSetPenQueuePtr 0xA123 +#define sysTrapEvtPenQueueSize 0xA124 +#define sysTrapEvtFlushPenQueue 0xA125 +#define sysTrapEvtEnqueuePenPoint 0xA126 +#define sysTrapEvtDequeuePenStrokeInfo 0xA127 +#define sysTrapEvtDequeuePenPoint 0xA128 +#define sysTrapEvtFlushNextPenStroke 0xA129 +#define sysTrapEvtSetKeyQueuePtr 0xA12A +#define sysTrapEvtKeyQueueSize 0xA12B +#define sysTrapEvtFlushKeyQueue 0xA12C +#define sysTrapEvtEnqueueKey 0xA12D +#define sysTrapEvtDequeueKeyEvent 0xA12E +#define sysTrapEvtWakeup 0xA12F +#define sysTrapEvtResetAutoOffTimer 0xA130 +#define sysTrapEvtKeyQueueEmpty 0xA131 +#define sysTrapEvtEnableGraffiti 0xA132 + + +#define sysTrapFldCopy 0xA133 +#define sysTrapFldCut 0xA134 +#define sysTrapFldDrawField 0xA135 +#define sysTrapFldEraseField 0xA136 +#define sysTrapFldFreeMemory 0xA137 +#define sysTrapFldGetBounds 0xA138 +#define sysTrapFldGetTextPtr 0xA139 +#define sysTrapFldGetSelection 0xA13A +#define sysTrapFldHandleEvent 0xA13B +#define sysTrapFldPaste 0xA13C +#define sysTrapFldRecalculateField 0xA13D +#define sysTrapFldSetBounds 0xA13E +#define sysTrapFldSetText 0xA13F +#define sysTrapFldGetFont 0xA140 +#define sysTrapFldSetFont 0xA141 +#define sysTrapFldSetSelection 0xA142 +#define sysTrapFldGrabFocus 0xA143 +#define sysTrapFldReleaseFocus 0xA144 +#define sysTrapFldGetInsPtPosition 0xA145 +#define sysTrapFldSetInsPtPosition 0xA146 +#define sysTrapFldSetScrollPosition 0xA147 +#define sysTrapFldGetScrollPosition 0xA148 +#define sysTrapFldGetTextHeight 0xA149 +#define sysTrapFldGetTextAllocatedSize 0xA14A +#define sysTrapFldGetTextLength 0xA14B +#define sysTrapFldScrollField 0xA14C +#define sysTrapFldScrollable 0xA14D +#define sysTrapFldGetVisibleLines 0xA14E +#define sysTrapFldGetAttributes 0xA14F +#define sysTrapFldSetAttributes 0xA150 +#define sysTrapFldSendChangeNotification 0xA151 +#define sysTrapFldCalcFieldHeight 0xA152 +#define sysTrapFldGetTextHandle 0xA153 +#define sysTrapFldCompactText 0xA154 +#define sysTrapFldDirty 0xA155 +#define sysTrapFldWordWrap 0xA156 +#define sysTrapFldSetTextAllocatedSize 0xA157 +#define sysTrapFldSetTextHandle 0xA158 +#define sysTrapFldSetTextPtr 0xA159 +#define sysTrapFldGetMaxChars 0xA15A +#define sysTrapFldSetMaxChars 0xA15B +#define sysTrapFldSetUsable 0xA15C +#define sysTrapFldInsert 0xA15D +#define sysTrapFldDelete 0xA15E +#define sysTrapFldUndo 0xA15F +#define sysTrapFldSetDirty 0xA160 +#define sysTrapFldSendHeightChangeNotification 0xA161 +#define sysTrapFldMakeFullyVisible 0xA162 + + +#define sysTrapFntGetFont 0xA163 +#define sysTrapFntSetFont 0xA164 +#define sysTrapFntGetFontPtr 0xA165 +#define sysTrapFntBaseLine 0xA166 +#define sysTrapFntCharHeight 0xA167 +#define sysTrapFntLineHeight 0xA168 +#define sysTrapFntAverageCharWidth 0xA169 +#define sysTrapFntCharWidth 0xA16A +#define sysTrapFntCharsWidth 0xA16B +#define sysTrapFntDescenderHeight 0xA16C +#define sysTrapFntCharsInWidth 0xA16D +#define sysTrapFntLineWidth 0xA16E + + +#define sysTrapFrmInitForm 0xA16F +#define sysTrapFrmDeleteForm 0xA170 +#define sysTrapFrmDrawForm 0xA171 +#define sysTrapFrmEraseForm 0xA172 +#define sysTrapFrmGetActiveForm 0xA173 +#define sysTrapFrmSetActiveForm 0xA174 +#define sysTrapFrmGetActiveFormID 0xA175 +#define sysTrapFrmGetUserModifiedState 0xA176 +#define sysTrapFrmSetNotUserModified 0xA177 +#define sysTrapFrmGetFocus 0xA178 +#define sysTrapFrmSetFocus 0xA179 +#define sysTrapFrmHandleEvent 0xA17A +#define sysTrapFrmGetFormBounds 0xA17B +#define sysTrapFrmGetWindowHandle 0xA17C +#define sysTrapFrmGetFormId 0xA17D +#define sysTrapFrmGetFormPtr 0xA17E +#define sysTrapFrmGetNumberOfObjects 0xA17F +#define sysTrapFrmGetObjectIndex 0xA180 +#define sysTrapFrmGetObjectId 0xA181 +#define sysTrapFrmGetObjectType 0xA182 +#define sysTrapFrmGetObjectPtr 0xA183 +#define sysTrapFrmHideObject 0xA184 +#define sysTrapFrmShowObject 0xA185 +#define sysTrapFrmGetObjectPosition 0xA186 +#define sysTrapFrmSetObjectPosition 0xA187 +#define sysTrapFrmGetControlValue 0xA188 +#define sysTrapFrmSetControlValue 0xA189 +#define sysTrapFrmGetControlGroupSelection 0xA18A +#define sysTrapFrmSetControlGroupSelection 0xA18B +#define sysTrapFrmCopyLabel 0xA18C +#define sysTrapFrmSetLabel 0xA18D +#define sysTrapFrmGetLabel 0xA18E +#define sysTrapFrmSetCategoryLabel 0xA18F +#define sysTrapFrmGetTitle 0xA190 +#define sysTrapFrmSetTitle 0xA191 +#define sysTrapFrmAlert 0xA192 +#define sysTrapFrmDoDialog 0xA193 +#define sysTrapFrmCustomAlert 0xA194 +#define sysTrapFrmHelp 0xA195 +#define sysTrapFrmUpdateScrollers 0xA196 +#define sysTrapFrmGetFirstForm 0xA197 +#define sysTrapFrmVisible 0xA198 +#define sysTrapFrmGetObjectBounds 0xA199 +#define sysTrapFrmCopyTitle 0xA19A +#define sysTrapFrmGotoForm 0xA19B +#define sysTrapFrmPopupForm 0xA19C +#define sysTrapFrmUpdateForm 0xA19D +#define sysTrapFrmReturnToForm 0xA19E +#define sysTrapFrmSetEventHandler 0xA19F +#define sysTrapFrmDispatchEvent 0xA1A0 +#define sysTrapFrmCloseAllForms 0xA1A1 +#define sysTrapFrmSaveAllForms 0xA1A2 +#define sysTrapFrmGetGadgetData 0xA1A3 +#define sysTrapFrmSetGadgetData 0xA1A4 +#define sysTrapFrmSetCategoryTrigger 0xA1A5 + + +#define sysTrapUIInitialize 0xA1A6 +#define sysTrapUIReset 0xA1A7 + +#define sysTrapInsPtInitialize 0xA1A8 +#define sysTrapInsPtSetLocation 0xA1A9 +#define sysTrapInsPtGetLocation 0xA1AA +#define sysTrapInsPtEnable 0xA1AB +#define sysTrapInsPtEnabled 0xA1AC +#define sysTrapInsPtSetHeight 0xA1AD +#define sysTrapInsPtGetHeight 0xA1AE +#define sysTrapInsPtCheckBlink 0xA1AF + +#define sysTrapLstSetDrawFunction 0xA1B0 +#define sysTrapLstDrawList 0xA1B1 +#define sysTrapLstEraseList 0xA1B2 +#define sysTrapLstGetSelection 0xA1B3 +#define sysTrapLstGetSelectionText 0xA1B4 +#define sysTrapLstHandleEvent 0xA1B5 +#define sysTrapLstSetHeight 0xA1B6 +#define sysTrapLstSetSelection 0xA1B7 +#define sysTrapLstSetListChoices 0xA1B8 +#define sysTrapLstMakeItemVisible 0xA1B9 +#define sysTrapLstGetNumberOfItems 0xA1BA +#define sysTrapLstPopupList 0xA1BB +#define sysTrapLstSetPosition 0xA1BC + +#define sysTrapMenuInit 0xA1BD +#define sysTrapMenuDispose 0xA1BE +#define sysTrapMenuHandleEvent 0xA1BF +#define sysTrapMenuDrawMenu 0xA1C0 +#define sysTrapMenuEraseStatus 0xA1C1 +#define sysTrapMenuGetActiveMenu 0xA1C2 +#define sysTrapMenuSetActiveMenu 0xA1C3 + + +#define sysTrapRctSetRectangle 0xA1C4 +#define sysTrapRctCopyRectangle 0xA1C5 +#define sysTrapRctInsetRectangle 0xA1C6 +#define sysTrapRctOffsetRectangle 0xA1C7 +#define sysTrapRctPtInRectangle 0xA1C8 +#define sysTrapRctGetIntersection 0xA1C9 + + +#define sysTrapTblDrawTable 0xA1CA +#define sysTrapTblEraseTable 0xA1CB +#define sysTrapTblHandleEvent 0xA1CC +#define sysTrapTblGetItemBounds 0xA1CD +#define sysTrapTblSelectItem 0xA1CE +#define sysTrapTblGetItemInt 0xA1CF +#define sysTrapTblSetItemInt 0xA1D0 +#define sysTrapTblSetItemStyle 0xA1D1 +#define sysTrapTblUnhighlightSelection 0xA1D2 +#define sysTrapTblSetRowUsable 0xA1D3 +#define sysTrapTblGetNumberOfRows 0xA1D4 +#define sysTrapTblSetCustomDrawProcedure 0xA1D5 +#define sysTrapTblSetRowSelectable 0xA1D6 +#define sysTrapTblRowSelectable 0xA1D7 +#define sysTrapTblSetLoadDataProcedure 0xA1D8 +#define sysTrapTblSetSaveDataProcedure 0xA1D9 +#define sysTrapTblGetBounds 0xA1DA +#define sysTrapTblSetRowHeight 0xA1DB +#define sysTrapTblGetColumnWidth 0xA1DC +#define sysTrapTblGetRowID 0xA1DD +#define sysTrapTblSetRowID 0xA1DE +#define sysTrapTblMarkRowInvalid 0xA1DF +#define sysTrapTblMarkTableInvalid 0xA1E0 +#define sysTrapTblGetSelection 0xA1E1 +#define sysTrapTblInsertRow 0xA1E2 +#define sysTrapTblRemoveRow 0xA1E3 +#define sysTrapTblRowInvalid 0xA1E4 +#define sysTrapTblRedrawTable 0xA1E5 +#define sysTrapTblRowUsable 0xA1E6 +#define sysTrapTblReleaseFocus 0xA1E7 +#define sysTrapTblEditing 0xA1E8 +#define sysTrapTblGetCurrentField 0xA1E9 +#define sysTrapTblSetColumnUsable 0xA1EA +#define sysTrapTblGetRowHeight 0xA1EB +#define sysTrapTblSetColumnWidth 0xA1EC +#define sysTrapTblGrabFocus 0xA1ED +#define sysTrapTblSetItemPtr 0xA1EE +#define sysTrapTblFindRowID 0xA1EF +#define sysTrapTblGetLastUsableRow 0xA1F0 +#define sysTrapTblGetColumnSpacing 0xA1F1 +#define sysTrapTblFindRowData 0xA1F2 +#define sysTrapTblGetRowData 0xA1F3 +#define sysTrapTblSetRowData 0xA1F4 +#define sysTrapTblSetColumnSpacing 0xA1F5 + + + +#define sysTrapWinCreateWindow 0xA1F6 +#define sysTrapWinCreateOffscreenWindow 0xA1F7 +#define sysTrapWinDeleteWindow 0xA1F8 +#define sysTrapWinInitializeWindow 0xA1F9 +#define sysTrapWinAddWindow 0xA1FA +#define sysTrapWinRemoveWindow 0xA1FB +#define sysTrapWinSetActiveWindow 0xA1FC +#define sysTrapWinSetDrawWindow 0xA1FD +#define sysTrapWinGetDrawWindow 0xA1FE +#define sysTrapWinGetActiveWindow 0xA1FF +#define sysTrapWinGetDisplayWindow 0xA200 +#define sysTrapWinGetFirstWindow 0xA201 +#define sysTrapWinEnableWindow 0xA202 +#define sysTrapWinDisableWindow 0xA203 +#define sysTrapWinGetWindowFrameRect 0xA204 +#define sysTrapWinDrawWindowFrame 0xA205 +#define sysTrapWinEraseWindow 0xA206 +#define sysTrapWinSaveBits 0xA207 +#define sysTrapWinRestoreBits 0xA208 +#define sysTrapWinCopyRectangle 0xA209 +#define sysTrapWinScrollRectangle 0xA20A +#define sysTrapWinGetDisplayExtent 0xA20B +#define sysTrapWinGetWindowExtent 0xA20C +#define sysTrapWinDisplayToWindowPt 0xA20D +#define sysTrapWinWindowToDisplayPt 0xA20E +#define sysTrapWinGetClip 0xA20F +#define sysTrapWinSetClip 0xA210 +#define sysTrapWinResetClip 0xA211 +#define sysTrapWinClipRectangle 0xA212 +#define sysTrapWinDrawLine 0xA213 +#define sysTrapWinDrawGrayLine 0xA214 +#define sysTrapWinEraseLine 0xA215 +#define sysTrapWinInvertLine 0xA216 +#define sysTrapWinFillLine 0xA217 +#define sysTrapWinDrawRectangle 0xA218 +#define sysTrapWinEraseRectangle 0xA219 +#define sysTrapWinInvertRectangle 0xA21A +#define sysTrapWinDrawRectangleFrame 0xA21B +#define sysTrapWinDrawGrayRectangleFrame 0xA21C +#define sysTrapWinEraseRectangleFrame 0xA21D +#define sysTrapWinInvertRectangleFrame 0xA21E +#define sysTrapWinGetFramesRectangle 0xA21F +#define sysTrapWinDrawChars 0xA220 +#define sysTrapWinEraseChars 0xA221 +#define sysTrapWinInvertChars 0xA222 +#define sysTrapWinGetPattern 0xA223 +#define sysTrapWinSetPattern 0xA224 +#define sysTrapWinSetUnderlineMode 0xA225 +#define sysTrapWinDrawBitmap 0xA226 +#define sysTrapWinModal 0xA227 +#define sysTrapWinGetDrawWindowBounds 0xA228 +#define sysTrapWinFillRectangle 0xA229 +#define sysTrapWinDrawInvertedChars 0xA22A + + + +#define sysTrapPrefOpenPreferenceDBV10 0xA22B +#define sysTrapPrefGetPreferences 0xA22C +#define sysTrapPrefSetPreferences 0xA22D +#define sysTrapPrefGetAppPreferencesV10 0xA22E +#define sysTrapPrefSetAppPreferencesV10 0xA22F + + +#define sysTrapSndInit 0xA230 +#define sysTrapSndSetDefaultVolume 0xA231 +#define sysTrapSndGetDefaultVolume 0xA232 +#define sysTrapSndDoCmd 0xA233 +#define sysTrapSndPlaySystemSound 0xA234 + + +#define sysTrapAlmInit 0xA235 +#define sysTrapAlmCancelAll 0xA236 +#define sysTrapAlmAlarmCallback 0xA237 +#define sysTrapAlmSetAlarm 0xA238 +#define sysTrapAlmGetAlarm 0xA239 +#define sysTrapAlmDisplayAlarm 0xA23A +#define sysTrapAlmEnableNotification 0xA23B + + +#define sysTrapHwrGetRAMMapping 0xA23C +#define sysTrapHwrMemWritable 0xA23D +#define sysTrapHwrMemReadable 0xA23E +#define sysTrapHwrDoze 0xA23F +#define sysTrapHwrSleep 0xA240 +#define sysTrapHwrWake 0xA241 +#define sysTrapHwrSetSystemClock 0xA242 +#define sysTrapHwrSetCPUDutyCycle 0xA243 +#define sysTrapHwrDisplayInit 0xA244 /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDInit */ +#define sysTrapHwrDisplaySleep 0xA245 /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDSleep, */ +#define sysTrapHwrTimerInit 0xA246 +#define sysTrapHwrCursorV33 0xA247 /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapHwrBatteryLevel 0xA248 +#define sysTrapHwrDelay 0xA249 +#define sysTrapHwrEnableDataWrites 0xA24A +#define sysTrapHwrDisableDataWrites 0xA24B +#define sysTrapHwrLCDBaseAddrV33 0xA24C /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapHwrDisplayDrawBootScreen 0xA24D /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDDrawBitmap */ +#define sysTrapHwrTimerSleep 0xA24E +#define sysTrapHwrTimerWake 0xA24F +#define sysTrapHwrDisplayWake 0xA250 /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDWake */ +#define sysTrapHwrIRQ1Handler 0xA251 +#define sysTrapHwrIRQ2Handler 0xA252 +#define sysTrapHwrIRQ3Handler 0xA253 +#define sysTrapHwrIRQ4Handler 0xA254 +#define sysTrapHwrIRQ5Handler 0xA255 +#define sysTrapHwrIRQ6Handler 0xA256 +#define sysTrapHwrDockSignals 0xA257 +#define sysTrapHwrPluggedIn 0xA258 + + +#define sysTrapCrc16CalcBlock 0xA259 + + +#define sysTrapSelectDayV10 0xA25A +#define sysTrapSelectTimeV33 0xA25B + +#define sysTrapDayDrawDaySelector 0xA25C +#define sysTrapDayHandleEvent 0xA25D +#define sysTrapDayDrawDays 0xA25E +#define sysTrapDayOfWeek 0xA25F +#define sysTrapDaysInMonth 0xA260 +#define sysTrapDayOfMonth 0xA261 + +#define sysTrapDateDaysToDate 0xA262 +#define sysTrapDateToDays 0xA263 +#define sysTrapDateAdjust 0xA264 +#define sysTrapDateSecondsToDate 0xA265 +#define sysTrapDateToAscii 0xA266 +#define sysTrapDateToDOWDMFormat 0xA267 +#define sysTrapTimeToAscii 0xA268 + + +#define sysTrapFind 0xA269 +#define sysTrapFindStrInStr 0xA26A +#define sysTrapFindSaveMatch 0xA26B +#define sysTrapFindGetLineBounds 0xA26C +#define sysTrapFindDrawHeader 0xA26D + +#define sysTrapPenOpen 0xA26E +#define sysTrapPenClose 0xA26F +#define sysTrapPenGetRawPen 0xA270 +#define sysTrapPenCalibrate 0xA271 +#define sysTrapPenRawToScreen 0xA272 +#define sysTrapPenScreenToRaw 0xA273 +#define sysTrapPenResetCalibration 0xA274 +#define sysTrapPenSleep 0xA275 +#define sysTrapPenWake 0xA276 + + +#define sysTrapResLoadForm 0xA277 +#define sysTrapResLoadMenu 0xA278 + +#define sysTrapFtrInit 0xA279 +#define sysTrapFtrUnregister 0xA27A +#define sysTrapFtrGet 0xA27B +#define sysTrapFtrSet 0xA27C +#define sysTrapFtrGetByIndex 0xA27D + + + +#define sysTrapGrfInit 0xA27E +#define sysTrapGrfFree 0xA27F +#define sysTrapGrfGetState 0xA280 +#define sysTrapGrfSetState 0xA281 +#define sysTrapGrfFlushPoints 0xA282 +#define sysTrapGrfAddPoint 0xA283 +#define sysTrapGrfInitState 0xA284 +#define sysTrapGrfCleanState 0xA285 +#define sysTrapGrfMatch 0xA286 +#define sysTrapGrfGetMacro 0xA287 +#define sysTrapGrfFilterPoints 0xA288 +#define sysTrapGrfGetNumPoints 0xA289 +#define sysTrapGrfGetPoint 0xA28A +#define sysTrapGrfFindBranch 0xA28B +#define sysTrapGrfMatchGlyph 0xA28C +#define sysTrapGrfGetGlyphMapping 0xA28D +#define sysTrapGrfGetMacroName 0xA28E +#define sysTrapGrfDeleteMacro 0xA28F +#define sysTrapGrfAddMacro 0xA290 +#define sysTrapGrfGetAndExpandMacro 0xA291 +#define sysTrapGrfProcessStroke 0xA292 +#define sysTrapGrfFieldChange 0xA293 + + +#define sysTrapGetCharSortValue 0xA294 +#define sysTrapGetCharAttr 0xA295 +#define sysTrapGetCharCaselessValue 0xA296 + + +#define sysTrapPwdExists 0xA297 +#define sysTrapPwdVerify 0xA298 +#define sysTrapPwdSet 0xA299 +#define sysTrapPwdRemove 0xA29A + +#define sysTrapGsiInitialize 0xA29B +#define sysTrapGsiSetLocation 0xA29C +#define sysTrapGsiEnable 0xA29D +#define sysTrapGsiEnabled 0xA29E +#define sysTrapGsiSetShiftState 0xA29F + +#define sysTrapKeyInit 0xA2A0 +#define sysTrapKeyHandleInterrupt 0xA2A1 +#define sysTrapKeyCurrentState 0xA2A2 +#define sysTrapKeyResetDoubleTap 0xA2A3 +#define sysTrapKeyRates 0xA2A4 +#define sysTrapKeySleep 0xA2A5 +#define sysTrapKeyWake 0xA2A6 + + +#define sysTrapDlkControl 0xA2A7 /* was sysTrapCmBroadcast */ + +#define sysTrapDlkStartServer 0xA2A8 +#define sysTrapDlkGetSyncInfo 0xA2A9 +#define sysTrapDlkSetLogEntry 0xA2AA + +#define sysTrapIntlDispatch 0xA2AB /* REUSED IN v3.1 (was sysTrapPsrInit in 1.0, removed in 2.0) */ +#define sysTrapSysLibLoad 0xA2AC /* REUSED IN v2.0 (was sysTrapPsrClose) */ +#define sysTrapSndPlaySmf 0xA2AD /* REUSED IN v3.0 (was sysTrapPsrGetCommand in 1.0, removed in 2.0) */ +#define sysTrapSndCreateMidiList 0xA2AE /* REUSED IN v3.0 (was sysTrapPsrSendReply in 1.0, removed in 2.0) */ + +#define sysTrapAbtShowAbout 0xA2AF + +#define sysTrapMdmDial 0xA2B0 +#define sysTrapMdmHangUp 0xA2B1 + +#define sysTrapDmSearchRecord 0xA2B2 + +#define sysTrapSysInsertionSort 0xA2B3 +#define sysTrapDmInsertionSort 0xA2B4 + +#define sysTrapLstSetTopItem 0xA2B5 + + +// Palm OS 2.X traps Palm Pilot and 2.0 Upgrade Card + +#define sysTrapSclSetScrollBar 0xA2B6 +#define sysTrapSclDrawScrollBar 0xA2B7 +#define sysTrapSclHandleEvent 0xA2B8 + +#define sysTrapSysMailboxCreate 0xA2B9 +#define sysTrapSysMailboxDelete 0xA2BA +#define sysTrapSysMailboxFlush 0xA2BB +#define sysTrapSysMailboxSend 0xA2BC +#define sysTrapSysMailboxWait 0xA2BD + +#define sysTrapSysTaskWait 0xA2BE +#define sysTrapSysTaskWake 0xA2BF +#define sysTrapSysTaskWaitClr 0xA2C0 +#define sysTrapSysTaskSuspend 0xA2C1 +#define sysTrapSysTaskResume 0xA2C2 + +#define sysTrapCategoryCreateList 0xA2C3 +#define sysTrapCategoryFreeList 0xA2C4 +#define sysTrapCategoryEditV20 0xA2C5 +#define sysTrapCategorySelect 0xA2C6 + +#define sysTrapDmDeleteCategory 0xA2C7 + +#define sysTrapSysEvGroupCreate 0xA2C8 +#define sysTrapSysEvGroupSignal 0xA2C9 +#define sysTrapSysEvGroupRead 0xA2CA +#define sysTrapSysEvGroupWait 0xA2CB + +#define sysTrapEvtEventAvail 0xA2CC +#define sysTrapEvtSysEventAvail 0xA2CD +#define sysTrapStrNCopy 0xA2CE + +#define sysTrapKeySetMask 0xA2CF + +#define sysTrapSelectDay 0xA2D0 + +#define sysTrapPrefGetPreference 0xA2D1 +#define sysTrapPrefSetPreference 0xA2D2 +#define sysTrapPrefGetAppPreferences 0xA2D3 +#define sysTrapPrefSetAppPreferences 0xA2D4 + +#define sysTrapFrmPointInTitle 0xA2D5 + +#define sysTrapStrNCat 0xA2D6 + +#define sysTrapMemCmp 0xA2D7 + +#define sysTrapTblSetColumnEditIndicator 0xA2D8 + +#define sysTrapFntWordWrap 0xA2D9 + +#define sysTrapFldGetScrollValues 0xA2DA + +#define sysTrapSysCreateDataBaseList 0xA2DB +#define sysTrapSysCreatePanelList 0xA2DC + +#define sysTrapDlkDispatchRequest 0xA2DD + +#define sysTrapStrPrintF 0xA2DE +#define sysTrapStrVPrintF 0xA2DF + +#define sysTrapPrefOpenPreferenceDB 0xA2E0 + +#define sysTrapSysGraffitiReferenceDialog 0xA2E1 + +#define sysTrapSysKeyboardDialog 0xA2E2 + +#define sysTrapFntWordWrapReverseNLines 0xA2E3 +#define sysTrapFntGetScrollValues 0xA2E4 + +#define sysTrapTblSetRowStaticHeight 0xA2E5 +#define sysTrapTblHasScrollBar 0xA2E6 + +#define sysTrapSclGetScrollBar 0xA2E7 + +#define sysTrapFldGetNumberOfBlankLines 0xA2E8 + +#define sysTrapSysTicksPerSecond 0xA2E9 +#define sysTrapHwrBacklightV33 0xA2EA /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapDmDatabaseProtect 0xA2EB + +#define sysTrapTblSetBounds 0xA2EC + +#define sysTrapStrNCompare 0xA2ED +#define sysTrapStrNCaselessCompare 0xA2EE + +#define sysTrapPhoneNumberLookup 0xA2EF + +#define sysTrapFrmSetMenu 0xA2F0 + +#define sysTrapEncDigestMD5 0xA2F1 + +#define sysTrapDmFindSortPosition 0xA2F2 + +#define sysTrapSysBinarySearch 0xA2F3 +#define sysTrapSysErrString 0xA2F4 +#define sysTrapSysStringByIndex 0xA2F5 + +#define sysTrapEvtAddUniqueEventToQueue 0xA2F6 + +#define sysTrapStrLocalizeNumber 0xA2F7 +#define sysTrapStrDelocalizeNumber 0xA2F8 +#define sysTrapLocGetNumberSeparators 0xA2F9 + +#define sysTrapMenuSetActiveMenuRscID 0xA2FA + +#define sysTrapLstScrollList 0xA2FB + +#define sysTrapCategoryInitialize 0xA2FC + +#define sysTrapEncDigestMD4 0xA2FD +#define sysTrapEncDES 0xA2FE + +#define sysTrapLstGetVisibleItems 0xA2FF + +#define sysTrapWinSetBounds 0xA300 + +#define sysTrapCategorySetName 0xA301 + +#define sysTrapFldSetInsertionPoint 0xA302 + +#define sysTrapFrmSetObjectBounds 0xA303 + +#define sysTrapWinSetColors 0xA304 + +#define sysTrapFlpDispatch 0xA305 +#define sysTrapFlpEmDispatch 0xA306 + + +// Palm OS 3.0 traps Palm III and 3.0 Upgrade Card + +#define sysTrapExgInit 0xA307 +#define sysTrapExgConnect 0xA308 +#define sysTrapExgPut 0xA309 +#define sysTrapExgGet 0xA30A +#define sysTrapExgAccept 0xA30B +#define sysTrapExgDisconnect 0xA30C +#define sysTrapExgSend 0xA30D +#define sysTrapExgReceive 0xA30E +#define sysTrapExgRegisterData 0xA30F +#define sysTrapExgNotifyReceiveV35 0xA310 +#define sysTrapSysReserved30Trap2 0xA311 /* "Reserved" trap in Palm OS 3.0 and later (was sysTrapExgControl) */ + +#define sysTrapPrgStartDialogV31 0xA312 /* Updated in v3.2 */ +#define sysTrapPrgStopDialog 0xA313 +#define sysTrapPrgUpdateDialog 0xA314 +#define sysTrapPrgHandleEvent 0xA315 + +#define sysTrapImcReadFieldNoSemicolon 0xA316 +#define sysTrapImcReadFieldQuotablePrintable 0xA317 +#define sysTrapImcReadPropertyParameter 0xA318 +#define sysTrapImcSkipAllPropertyParameters 0xA319 +#define sysTrapImcReadWhiteSpace 0xA31A +#define sysTrapImcWriteQuotedPrintable 0xA31B +#define sysTrapImcWriteNoSemicolon 0xA31C +#define sysTrapImcStringIsAscii 0xA31D + +#define sysTrapTblGetItemFont 0xA31E +#define sysTrapTblSetItemFont 0xA31F + +#define sysTrapFontSelect 0xA320 +#define sysTrapFntDefineFont 0xA321 + +#define sysTrapCategoryEdit 0xA322 + +#define sysTrapSysGetOSVersionString 0xA323 +#define sysTrapSysBatteryInfo 0xA324 +#define sysTrapSysUIBusy 0xA325 + +#define sysTrapWinValidateHandle 0xA326 +#define sysTrapFrmValidatePtr 0xA327 +#define sysTrapCtlValidatePointer 0xA328 +#define sysTrapWinMoveWindowAddr 0xA329 +#define sysTrapFrmAddSpaceForObject 0xA32A +#define sysTrapFrmNewForm 0xA32B +#define sysTrapCtlNewControl 0xA32C +#define sysTrapFldNewField 0xA32D +#define sysTrapLstNewList 0xA32E +#define sysTrapFrmNewLabel 0xA32F +#define sysTrapFrmNewBitmap 0xA330 +#define sysTrapFrmNewGadget 0xA331 + +#define sysTrapFileOpen 0xA332 +#define sysTrapFileClose 0xA333 +#define sysTrapFileDelete 0xA334 +#define sysTrapFileReadLow 0xA335 +#define sysTrapFileWrite 0xA336 +#define sysTrapFileSeek 0xA337 +#define sysTrapFileTell 0xA338 +#define sysTrapFileTruncate 0xA339 +#define sysTrapFileControl 0xA33A + +#define sysTrapFrmActiveState 0xA33B + +#define sysTrapSysGetAppInfo 0xA33C +#define sysTrapSysGetStackInfo 0xA33D + +#define sysTrapWinScreenMode 0xA33E /* was sysTrapScrDisplayMode */ +#define sysTrapHwrLCDGetDepthV33 0xA33F /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapHwrGetROMToken 0xA340 + +#define sysTrapDbgControl 0xA341 + +#define sysTrapExgDBRead 0xA342 +#define sysTrapExgDBWrite 0xA343 + +#define sysTrapHostControl 0xA344 /* Renamed from sysTrapSysGremlins, functionality generalized */ +#define sysTrapFrmRemoveObject 0xA345 + +#define sysTrapSysReserved30Trap1 0xA346 /* "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! +#define sysTrapExpansionDispatch 0xA347 /* Reserved for ExpansionMgr (was sysTrapSysReserved2) */ +#define sysTrapFileSystemDispatch 0xA348 /* Reserved for FileSystemMgr (was sysTrapSysReserved3) */ + +#define sysTrapOEMDispatch 0xA349 /* OEM trap in Palm OS 3.0 and later trap table (formerly sysTrapSysReserved4) */ + + +// Palm OS 3.1 traps Palm IIIx and Palm V + +#define sysTrapHwrLCDContrastV33 0xA34A /* This trap obsoleted for OS 3.5 and later */ +#define sysTrapSysLCDContrast 0xA34B +#define sysTrapUIContrastAdjust 0xA34C /* Renamed from sysTrapContrastAdjust */ +#define sysTrapHwrDockStatus 0xA34D + +#define sysTrapFntWidthToOffset 0xA34E +#define sysTrapSelectOneTime 0xA34F +#define sysTrapWinDrawChar 0xA350 +#define sysTrapWinDrawTruncChars 0xA351 + +#define sysTrapSysNotifyInit 0xA352 /* Notification Manager traps */ +#define sysTrapSysNotifyRegister 0xA353 +#define sysTrapSysNotifyUnregister 0xA354 +#define sysTrapSysNotifyBroadcast 0xA355 +#define sysTrapSysNotifyBroadcastDeferred 0xA356 +#define sysTrapSysNotifyDatabaseAdded 0xA357 +#define sysTrapSysNotifyDatabaseRemoved 0xA358 + +#define sysTrapSysWantEvent 0xA359 + +#define sysTrapFtrPtrNew 0xA35A +#define sysTrapFtrPtrFree 0xA35B +#define sysTrapFtrPtrResize 0xA35C + +#define sysTrapSysReserved31Trap1 0xA35D /* "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) + +#define sysTrapHwrNVPrefSet 0xA35E /* mapped to FlashParmsWrite */ +#define sysTrapHwrNVPrefGet 0xA35F /* mapped to FlashParmsRead */ +#define sysTrapFlashInit 0xA360 +#define sysTrapFlashCompress 0xA361 +#define sysTrapFlashErase 0xA362 +#define sysTrapFlashProgram 0xA363 + +#define sysTrapAlmTimeChange 0xA364 +#define sysTrapErrAlertCustom 0xA365 +#define sysTrapPrgStartDialog 0xA366 /* New version of sysTrapPrgStartDialogV31 */ + +#define sysTrapSerialDispatch 0xA367 +#define sysTrapHwrBattery 0xA368 +#define sysTrapDmGetDatabaseLockState 0xA369 + +#define sysTrapCncGetProfileList 0xA36A +#define sysTrapCncGetProfileInfo 0xA36B +#define sysTrapCncAddProfile 0xA36C +#define sysTrapCncDeleteProfile 0xA36D + +#define sysTrapSndPlaySmfResource 0xA36E + +#define sysTrapMemPtrDataStorage 0xA36F /* Never actually installed until now. */ + +#define sysTrapClipboardAppendItem 0xA370 + +#define sysTrapWiCmdV32 0xA371 /* Code moved to INetLib; trap obsolete */ + + +// Palm OS 3.5 traps Palm IIIc and other products + +// HAL Display-layer new traps +#define sysTrapHwrDisplayAttributes 0xA372 +#define sysTrapHwrDisplayDoze 0xA373 +#define sysTrapHwrDisplayPalette 0xA374 + +// Screen driver new traps +#define sysTrapBltFindIndexes 0xA375 +#define sysTrapBmpGetBits 0xA376 /* was BltGetBitsAddr */ +#define sysTrapBltCopyRectangle 0xA377 +#define sysTrapBltDrawChars 0xA378 +#define sysTrapBltLineRoutine 0xA379 +#define sysTrapBltRectangleRoutine 0xA37A + +// ScrUtils new traps +#define sysTrapScrCompress 0xA37B +#define sysTrapScrDecompress 0xA37C + +// System Manager new traps +#define sysTrapSysLCDBrightness 0xA37D + +// WindowColor new traps +#define sysTrapWinPaintChar 0xA37E +#define sysTrapWinPaintChars 0xA37F +#define sysTrapWinPaintBitmap 0xA380 +#define sysTrapWinGetPixel 0xA381 +#define sysTrapWinPaintPixel 0xA382 +#define sysTrapWinDrawPixel 0xA383 +#define sysTrapWinErasePixel 0xA384 +#define sysTrapWinInvertPixel 0xA385 +#define sysTrapWinPaintPixels 0xA386 +#define sysTrapWinPaintLines 0xA387 +#define sysTrapWinPaintLine 0xA388 +#define sysTrapWinPaintRectangle 0xA389 +#define sysTrapWinPaintRectangleFrame 0xA38A +#define sysTrapWinPaintPolygon 0xA38B +#define sysTrapWinDrawPolygon 0xA38C +#define sysTrapWinErasePolygon 0xA38D +#define sysTrapWinInvertPolygon 0xA38E +#define sysTrapWinFillPolygon 0xA38F +#define sysTrapWinPaintArc 0xA390 +#define sysTrapWinDrawArc 0xA391 +#define sysTrapWinEraseArc 0xA392 +#define sysTrapWinInvertArc 0xA393 +#define sysTrapWinFillArc 0xA394 +#define sysTrapWinPushDrawState 0xA395 +#define sysTrapWinPopDrawState 0xA396 +#define sysTrapWinSetDrawMode 0xA397 +#define sysTrapWinSetForeColor 0xA398 +#define sysTrapWinSetBackColor 0xA399 +#define sysTrapWinSetTextColor 0xA39A +#define sysTrapWinGetPatternType 0xA39B +#define sysTrapWinSetPatternType 0xA39C +#define sysTrapWinPalette 0xA39D +#define sysTrapWinRGBToIndex 0xA39E +#define sysTrapWinIndexToRGB 0xA39F +#define sysTrapWinScreenLock 0xA3A0 +#define sysTrapWinScreenUnlock 0xA3A1 +#define sysTrapWinGetBitmap 0xA3A2 + +// UIColor new traps +#define sysTrapUIColorInit 0xA3A3 +#define sysTrapUIColorGetTableEntryIndex 0xA3A4 +#define sysTrapUIColorGetTableEntryRGB 0xA3A5 +#define sysTrapUIColorSetTableEntry 0xA3A6 +#define sysTrapUIColorPushTable 0xA3A7 +#define sysTrapUIColorPopTable 0xA3A8 + +// misc cleanup and API additions + +#define sysTrapCtlNewGraphicControl 0xA3A9 + +#define sysTrapTblGetItemPtr 0xA3AA + +#define sysTrapUIBrightnessAdjust 0xA3AB +#define sysTrapUIPickColor 0xA3AC + +#define sysTrapEvtSetAutoOffTimer 0xA3AD + +// Misc int'l/overlay support. +#define sysTrapTsmDispatch 0xA3AE +#define sysTrapOmDispatch 0xA3AF +#define sysTrapDmOpenDBNoOverlay 0xA3B0 +#define sysTrapDmOpenDBWithLocale 0xA3B1 +#define sysTrapResLoadConstant 0xA3B2 + +// new boot-time SmallROM HAL additions +#define sysTrapHwrPreDebugInit 0xA3B3 +#define sysTrapHwrResetNMI 0xA3B4 +#define sysTrapHwrResetPWM 0xA3B5 + +#define sysTrapKeyBootKeys 0xA3B6 + +#define sysTrapDbgSerDrvOpen 0xA3B7 +#define sysTrapDbgSerDrvClose 0xA3B8 +#define sysTrapDbgSerDrvControl 0xA3B9 +#define sysTrapDbgSerDrvStatus 0xA3BA +#define sysTrapDbgSerDrvWriteChar 0xA3BB +#define sysTrapDbgSerDrvReadChar 0xA3BC + +// new boot-time BigROM HAL additions +#define sysTrapHwrPostDebugInit 0xA3BD +#define sysTrapHwrIdentifyFeatures 0xA3BE +#define sysTrapHwrModelSpecificInit 0xA3BF +#define sysTrapHwrModelInitStage2 0xA3C0 +#define sysTrapHwrInterruptsInit 0xA3C1 + +#define sysTrapHwrSoundOn 0xA3C2 +#define sysTrapHwrSoundOff 0xA3C3 + +// Kernel clock tick routine +#define sysTrapSysKernelClockTick 0xA3C4 + +// MenuEraseMenu is exposed as of PalmOS 3.5, but there are +// no public interfaces for it yet. Perhaps in a later release. +#define sysTrapMenuEraseMenu 0xA3C5 + +#define sysTrapSelectTime 0xA3C6 + +// Menu Command Bar traps +#define sysTrapMenuCmdBarAddButton 0xA3C7 +#define sysTrapMenuCmdBarGetButtonData 0xA3C8 +#define sysTrapMenuCmdBarDisplay 0xA3C9 + +// Silkscreen info +#define sysTrapHwrGetSilkscreenID 0xA3CA +#define sysTrapEvtGetSilkscreenAreaList 0xA3CB + +#define sysTrapSysFatalAlertInit 0xA3CC +#define sysTrapDateTemplateToAscii 0xA3CD + +// New traps dealing with masking private records +#define sysTrapSecVerifyPW 0xA3CE +#define sysTrapSecSelectViewStatus 0xA3CF +#define sysTrapTblSetColumnMasked 0xA3D0 +#define sysTrapTblSetRowMasked 0xA3D1 +#define sysTrapTblRowMasked 0xA3D2 + +// New form trap for dialogs with text entry field +#define sysTrapFrmCustomResponseAlert 0xA3D3 +#define sysTrapFrmNewGsi 0xA3D4 + +// New dynamic menu functions +#define sysTrapMenuShowItem 0xA3D5 +#define sysTrapMenuHideItem 0xA3D6 +#define sysTrapMenuAddItem 0xA3D7 + +// New form traps for "smart gadgets" +#define sysTrapFrmSetGadgetHandler 0xA3D8 + +// More new control functions +#define sysTrapCtlSetGraphics 0xA3D9 +#define sysTrapCtlGetSliderValues 0xA3DA +#define sysTrapCtlSetSliderValues 0xA3DB +#define sysTrapCtlNewSliderControl 0xA3DC + +// Bitmap manager functions +#define sysTrapBmpCreate 0xA3DD +#define sysTrapBmpDelete 0xA3DE +#define sysTrapBmpCompress 0xA3DF +// sysTrapBmpGetBits defined in Screen driver traps +#define sysTrapBmpGetColortable 0xA3E0 +#define sysTrapBmpSize 0xA3E1 +#define sysTrapBmpBitsSize 0xA3E2 +#define sysTrapBmpColortableSize 0xA3E3 +// extra window namager +#define sysTrapWinCreateBitmapWindow 0xA3E4 +// Ask for a null event sooner (replaces a macro which Poser hated) +#define sysTrapEvtSetNullEventTick 0xA3E5 + +// Exchange manager call to allow apps to select destination categories +#define sysTrapExgDoDialog 0xA3E6 + +// this call will remove temporary UI like popup lists +#define sysTrapSysUICleanup 0xA3E7 + +// The following 4 traps were "Reserved" traps, present only in SOME post-release builds of Palm OS 3.5 +#define sysTrapWinSetForeColorRGB 0xA3E8 +#define sysTrapWinSetBackColorRGB 0xA3E9 +#define sysTrapWinSetTextColorRGB 0xA3EA +#define sysTrapWinGetPixelRGB 0xA3EB + +// 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. + +#define sysTrapSysReserved40Trap1 0xA3EC +#define sysTrapSysReserved40Trap2 0xA3ED +#define sysTrapSysReserved40Trap3 0xA3EE +#define sysTrapSysReserved40Trap4 0xA3EF + + +// 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 +#define sysTrapCncMgrDispatch 0xA3F0 + +// new trap for notify from interrupt, implemented in SysEvtMgr.c +#define sysTrapSysNotifyBroadcastFromInterrupt 0xA3F1 + +// new trap for waking the UI without generating a null event +#define sysTrapEvtWakeupWithoutNilEvent 0xA3F2 + +// new trap for doing stable, fast, 7-bit string compare +#define sysTrapStrCompareAscii 0xA3F3 + +// New trap for accessors available thru PalmOS glue +#define sysTrapAccessorDispatch 0xA3F4 + +#define sysTrapBltGetPixel 0xA3F5 +#define sysTrapBltPaintPixel 0xA3F6 +#define sysTrapScrScreenInit 0xA3F7 +#define sysTrapScrUpdateScreenBitmap 0xA3F8 +#define sysTrapScrPalette 0xA3F9 +#define sysTrapScrGetColortable 0xA3FA +#define sysTrapScrGetGrayPat 0xA3FB +#define sysTrapScrScreenLock 0xA3FC +#define sysTrapScrScreenUnlock 0xA3FD +#define sysTrapFntPrvGetFontList 0xA3FE + +// Exchange manager functions +#define sysTrapExgRegisterDatatype 0xA3FF +#define sysTrapExgNotifyReceive 0xA400 +#define sysTrapExgNotifyGoto 0xA401 +#define sysTrapExgRequest 0xA402 +#define sysTrapExgSetDefaultApplication 0xA403 +#define sysTrapExgGetDefaultApplication 0xA404 +#define sysTrapExgGetTargetApplication 0xA405 +#define sysTrapExgGetRegisteredApplications 0xA406 +#define sysTrapExgGetRegisteredTypes 0xA407 +#define sysTrapExgNotifyPreview 0xA408 +#define sysTrapExgControl 0xA409 + +// 04/30/00 CS - New Locale Manager handles access to region-specific info like date formats +#define sysTrapLmDispatch 0xA40A + +// 05/10/00 kwk - New Memory Manager trap for retrieving ROM NVParam values (sys use only) +#define sysTrapMemGetRomNVParams 0xA40B + +// 05/12/00 kwk - Safe character width Font Mgr call +#define sysTrapFntWCharWidth 0xA40C + +// 05/17/00 kwk - Faster DmFindDatabase +#define sysTrapDmFindDatabaseWithTypeCreator 0xA40D + +// New Trap selectors added for time zone picker API +#define sysTrapSelectTimeZone 0xA40E +#define sysTrapTimeZoneToAscii 0xA40F + +// 08/18/00 kwk - trap for doing stable, fast, 7-bit string compare. +// 08/21/00 kwk - moved here in place of sysTrapSelectDaylightSavingAdjustment. +#define sysTrapStrNCompareAscii 0xA410 + +// New Trap selectors added for time zone conversion API +#define sysTrapTimTimeZoneToUTC 0xA411 +#define sysTrapTimUTCToTimeZone 0xA412 + +// New trap implemented in PhoneLookup.c +#define sysTrapPhoneNumberLookupCustom 0xA413 + +// new trap for selecting debugger path. +#define sysTrapHwrDebugSelect 0xA414 + +#define sysTrapBltRoundedRectangle 0xA415 +#define sysTrapBltRoundedRectangleFill 0xA416 +#define sysTrapWinPrvInitCanvas 0xA417 + +#define sysTrapHwrCalcDynamicHeapSize 0xA418 +#define sysTrapHwrDebuggerEnter 0xA419 +#define sysTrapHwrDebuggerExit 0xA41A + +#define sysTrapLstGetTopItem 0xA41B + +#define sysTrapHwrModelInitStage3 0xA41C + +// 06/21/00 peter - New Attention Manager +#define sysTrapAttnIndicatorAllow 0xA41D +#define sysTrapAttnIndicatorAllowed 0xA41E +#define sysTrapAttnIndicatorEnable 0xA41F +#define sysTrapAttnIndicatorEnabled 0xA420 +#define sysTrapAttnIndicatorSetBlinkPattern 0xA421 +#define sysTrapAttnIndicatorGetBlinkPattern 0xA422 +#define sysTrapAttnIndicatorTicksTillNextBlink 0xA423 +#define sysTrapAttnIndicatorCheckBlink 0xA424 +#define sysTrapAttnInitialize 0xA425 +#define sysTrapAttnGetAttention 0xA426 +#define sysTrapAttnUpdate 0xA427 +#define sysTrapAttnForgetIt 0xA428 +#define sysTrapAttnGetCounts 0xA429 +#define sysTrapAttnListOpen 0xA42A +#define sysTrapAttnHandleEvent 0xA42B +#define sysTrapAttnEffectOfEvent 0xA42C +#define sysTrapAttnIterate 0xA42D +#define sysTrapAttnDoSpecialEffects 0xA42E +#define sysTrapAttnDoEmergencySpecialEffects 0xA42F +#define sysTrapAttnAllowClose 0xA430 +#define sysTrapAttnReopen 0xA431 +#define sysTrapAttnEnableNotification 0xA432 +#define sysTrapHwrLEDAttributes 0xA433 +#define sysTrapHwrVibrateAttributes 0xA434 + +// Trap for getting and setting the device password hint. +#define sysTrapSecGetPwdHint 0xA435 +#define sysTrapSecSetPwdHint 0xA436 + +#define sysTrapHwrFlashWrite 0xA437 + +#define sysTrapKeyboardStatusNew 0xA438 +#define sysTrapKeyboardStatusFree 0xA439 +#define sysTrapKbdSetLayout 0xA43A +#define sysTrapKbdGetLayout 0xA43B +#define sysTrapKbdSetPosition 0xA43C +#define sysTrapKbdGetPosition 0xA43D +#define sysTrapKbdSetShiftState 0xA43E +#define sysTrapKbdGetShiftState 0xA43F +#define sysTrapKbdDraw 0xA440 +#define sysTrapKbdErase 0xA441 +#define sysTrapKbdHandleEvent 0xA442 + +#define sysTrapOEMDispatch2 0xA443 +#define sysTrapHwrCustom 0xA444 + +// 08/28/00 kwk - Trap for getting form's active field. +#define sysTrapFrmGetActiveField 0xA445 + +// 9/18/00 rkr - Added for playing sounds regardless of interruptible flag +#define sysTrapSndPlaySmfIrregardless 0xA446 +#define sysTrapSndPlaySmfResourceIrregardless 0xA447 +#define sysTrapSndInterruptSmfIrregardless 0xA448 + +// 10/14/00 ABa: UDA manager +#define sysTrapUdaMgrDispatch 0xA449 + +// WK: private traps for PalmOS +#define sysTrapPalmPrivate1 0xA44A +#define sysTrapPalmPrivate2 0xA44B +#define sysTrapPalmPrivate3 0xA44C +#define sysTrapPalmPrivate4 0xA44D + + +// 11/07/00 tlw: Added accessors +#define sysTrapBmpGetDimensions 0xA44E +#define sysTrapBmpGetBitDepth 0xA44F +#define sysTrapBmpGetNextBitmap 0xA450 +#define sysTrapTblGetNumberOfColumns 0xA451 +#define sysTrapTblGetTopRow 0xA452 +#define sysTrapTblSetSelection 0xA453 +#define sysTrapFrmGetObjectIndexFromPtr 0xA454 + +// 11/10/00 acs +#define sysTrapBmpGetSizes 0xA455 +#define sysTrapWinGetBounds 0xA456 + + +#define sysTrapBltPaintPixels 0xA457 + +// 11/22/00 bob +#define sysTrapFldSetMaxVisibleLines 0xA458 + +// 01/09/01 acs +#define sysTrapScrDefaultPaletteState 0xA459 + +// 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!!!!!!!!! + + + +#define sysTrapLastTrapNumber 0xA45A + + + +#define sysNumTraps (sysTrapLastTrapNumber - sysTrapBase) + + + +#endif //__CORETRAPS_H_ diff --git a/sdk-4/include/Core/Hardware/HAL.h b/sdk-4/include/Core/Hardware/HAL.h new file mode 100644 index 0000000..89e9491 --- /dev/null +++ b/sdk-4/include/Core/Hardware/HAL.h @@ -0,0 +1,76 @@ +/****************************************************************************** + * + * 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" + * + *****************************************************************************/ + + +// #ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HAL_H__ +#define __HAL_H__ + +//#include +#include + +/*********************************************************************** + * Hardware Manager (HAL) constants + **********************************************************************/ + +// Error codes related to HwrCustom() API +#define hwrErrHwrCustomNotImplemented (hwrErrorClass | 1) +#define hwrErrCreatorNotSupported (hwrErrorClass | 2) +#define hwrErrSelectorNotSupported (hwrErrorClass | 3) +#define hwrErrParamTooSmall (hwrErrorClass | 4) + + +/************************************************************ + * HAL trap macros + *************************************************************/ + +#if DISABLE_HAL_TRAPS + #define HAL_CALL(trapNum) +#else + #define HAL_CALL(trapNum) \ + _HAL_API(_CALL)(_HAL_TABLE, trapNum) +#endif + + +/************************************************************************** + * Prototypes of functions used only when running on the real hardware + ***************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// 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. +Err HwrCustom(UInt32 creator, UInt32 opCode, void * paramP, UInt16 * paramSizeP) + HAL_CALL(sysTrapHwrCustom); + + +#ifdef __cplusplus +} +#endif + + +#endif //__HAL_H__ + +// #endif // NON_PORTABLE diff --git a/sdk-4/include/Core/Hardware/HwrMiscFlags.h b/sdk-4/include/Core/Hardware/HwrMiscFlags.h new file mode 100644 index 0000000..8b8597f --- /dev/null +++ b/sdk-4/include/Core/Hardware/HwrMiscFlags.h @@ -0,0 +1,220 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifdef NON_PORTABLE // So app's don't mistakenly include this + +#ifndef __HWR_MISCFLAGS_H__ +#define __HWR_MISCFLAGS_H__ + + + +/************************************************************************** + * 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 . +// 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) +#define hwrMiscFlagHasBacklight 0x0001 // set if backlight is present +#define hwrMiscFlagHasMbdIrDA 0x0002 // set if IrDA is present (on main board) +#define hwrMiscFlagHasCardIrDA 0x0004 // set if IrDA is present (on memory card) +#define hwrMiscFlagHasBurrBrown 0x0008 // set if BurrBrown A/D is present +#define hwrMiscFlagHasJerryHW 0x0010 // set if Jerry Hardware is present +#define hwrMiscFlagNoRTCBug 0x0020 // set if using rev of DragonBall (3G or later) + // that doesn't require the RealTimeClock + // bug work-around (see TimeMgr68328.c). + // +#define hwrMiscFlagHas3vRef 0x0040 // set if switchable 3v reference is present +#define hwrMiscFlagHasAntennaSw 0x0080 // set if viewer has an antenna raised switch +#define hwrMiscFlagHasCradleDetect 0x0100 // set if we have an A/D converter on hotsync port used for ID'ing the attached device +#define hwrMiscFlagHasSWContrast 0x0200 // set if UI should support software contrast +#define hwrMiscFlagInvertLCDForBL 0x0400 // set if we need to invert LCD w/Backlight +#define hwrMiscFlagHasMiscFlagExt 0x0800 // 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... +#define hwrMiscFlagID1 0x1000 // set if ID bit keyBitHard1 was set +#define hwrMiscFlagID2 0x2000 // set if ID bit keyBitHard2 was set +#define hwrMiscFlagID3 0x4000 // set if ID bit keyBitHard3 was set +#define hwrMiscFlagID4 0x8000 // set if ID bit keyBitHard4 was set +#define hwrMiscFlagIDMask 0xF000 +#define 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 for details. +// This ID is also reported when booting on PalmPilot devices (aka 2.0 hardware). +#define hwrMiscFlagIDCheckROMToken (0) // used to be hwrMiscFlagIDOther +#define 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). +#define 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. +#define hwrMiscFlagIDCheckOEMFtrs (hwrMiscFlagID2) // used to be hwrMiscFlagIDUnused2 + +// Old-style Hardware IDs for DragonBall '328 based products +#define hwrMiscFlagIDThumper (hwrMiscFlagID4 | hwrMiscFlagID2) +#define hwrMiscFlagIDJerry (hwrMiscFlagID4 | hwrMiscFlagID3) +#define hwrMiscFlagIDRocky (hwrMiscFlagID4 | hwrMiscFlagID3 | hwrMiscFlagID2) +#define hwrMiscFlagIDTouchdown (hwrMiscFlagID4 | hwrMiscFlagID3 | hwrMiscFlagID2 | hwrMiscFlagID1) + +// Old-style Hardware IDs for DragonBall 'EZ based products +#define hwrMiscFlagIDJerryEZ (hwrMiscFlagID3 | hwrMiscFlagID2) +#define hwrMiscFlagIDSumo (hwrMiscFlagID4 | hwrMiscFlagID2 | hwrMiscFlagID1) +#define hwrMiscFlagIDBrad (hwrMiscFlagID4 | hwrMiscFlagID3 | hwrMiscFlagID1) +#define hwrMiscFlagIDAustin (hwrMiscFlagID4 | hwrMiscFlagID1) +#define hwrMiscFlagIDCobra2 (hwrMiscFlagID2 | hwrMiscFlagID1) +#define hwrMiscFlagIDCalvin (hwrMiscFlagID3 | hwrMiscFlagID1) + + +// Hardware SubIDs used to detect hardware type early in boot process +#define hwrMiscFlagExtSubIDBrad 0x0 +#define hwrMiscFlagExtSubIDSumo 0x2 +#define hwrMiscFlagExtSubIDCobra 0x4 +#define hwrMiscFlagExtSubIDCobra2_16 0x6 +#define hwrMiscFlagExtSubIDCobra2_20 0x7 + + + +// Old-style Hardware IDs still unused +#define hwrMiscFlagIDUnused4 (hwrMiscFlagID3) +#define hwrMiscFlagIDUnused5 (hwrMiscFlagID3 | hwrMiscFlagID1) +#define hwrMiscFlagIDUnused7 (hwrMiscFlagID3 | hwrMiscFlagID2 | hwrMiscFlagID1) +#define hwrMiscFlagIDUnused8 (hwrMiscFlagID4) + + +// Bits in the low memory global GHwrMiscFlagsExt (UInt32) +#define hwrMiscFlagExtSubID1 0x00000001 // subtype ID (for feature select in device) +#define hwrMiscFlagExtSubID2 0x00000002 // subtype ID (for feature select in device) +#define hwrMiscFlagExtSubID3 0x00000004 // subtype ID (for feature select in device) +#define hwrMiscFlagExtSubIDMask 0x00000007 // sybtype ID Mask + +#define hwrMiscFlagExtHasLiIon 0x00000010 // set if we have Lithium Ion battery rechargable in the cradle +#define hwrMiscFlagExtHasRailIO 0x00000020 // set if we have Rail I/O hardware +#define hwrMiscFlagExtHasFlash 0x00000040 // set (by OS or HAL) if we have Flash ROM +#define hwrMiscFlagExtHasFParms 0x00000080 // set (by OS or HAL) if we have Flash parms area + +#define hwrMiscFlagExt115KIrOK 0x00000100 // device supports 115K IR transfers +#define hwrMiscFlagExtHasExtLCD 0x00000200 // device has external LCD controller +#define hwrMiscFlagExtHasSWBright 0x00000400 // device has software controlled brightness + +// Added by BGT, 08/01/2000 +#define hwrMiscFlagExtNeedsLpr 0x00000800 // 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. + +#define hwrOEMCompanyIDUnspecified 0x00000000 // hwrOEMCompanyID not specified by HAL +#define hwrOEMHALIDUnspecified 0x00000000 // hwrOEMHALID not specified by HAL +#define hwrOEMDeviceIDUnspecified 0x00000000 // hwrOEMDeviceID not specified by HAL + +#define hwrOEMCompanyIDPalmPlatform 'psys' // Reference Platforms made by Palm Computing +#define hwrOEMCompanyIDPalmDevices 'palm' // Devices made by Palm Computing + +#define hwrOEMCompanyIDSymbol 'smbl' // Devices made by Symbol Technologies +#define hwrOEMCompanyIDQualcomm 'qcom' // Devices made by Qualcomm +#define hwrOEMCompanyIDTRG 'trgp' // Devices made by TRG Products +#define hwrOEMCompanyIDHandspring 'hspr' // Devices made by Handspring +#define hwrOEMCompanyIDSony 'sony' // Devices made by Sony + +// 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 +#define hwrOEMHALIDEZRef 'eref' // (Mono) EZ Reference Platform (Palm Computing) +#define hwrOEMHALIDEZRefColor 'cref' // Color EZ Reference Platform (Palm Computing) + +// HALs that belong to hwrOEMCompanyIDPalmPlatform +#define hwrOEMHALIDVZRef 'vref' // (Mono) VZ Reference Platform (Palm Computing) +#define hwrOEMHALIDVZRefColor 'cvrf' // Color VZ Reference Platform (Palm Computing) + +// HALs that belong to hwrOEMCompanyIDPalmDevices +#define hwrOEMHALID328Jerry 'jery' // Palm VII HAL (Palm Computing) +#define hwrOEMHALID328Rocky 'rcky' // Pilot, PalmPilot, Palm III HAL (Palm Computing) +#define hwrOEMHALIDEZSumo 'sumo' // Palm IIIx/V/Vx HAL (Palm Computing) +#define hwrOEMHALIDEZAustin 'astn' // Palm IIIc (Palm Computing) +#define hwrOEMHALIDEZCalvin 'clvn' // Palm m100 (Palm Computing) + + +#endif //__HWR_MISCFLAGS_H__ + +#endif // NON_PORTABLE diff --git a/sdk-4/include/Core/Hardware/M68KHwr.h b/sdk-4/include/Core/Hardware/M68KHwr.h new file mode 100644 index 0000000..ee322c4 --- /dev/null +++ b/sdk-4/include/Core/Hardware/M68KHwr.h @@ -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 + * + *****************************************************************************/ + +#ifndef __M68KHWR_H +#define __M68KHWR_H + +// Pilot common definitions +#include + + +/*********************************************************************** + * Breakpoint words we use + ***********************************************************************/ +#define m68kTrapInstr 0x4E40 +#define m68kTrapVectorMask 0x000F + +/*********************************************************************** + * 68000 Exception Vector table + ***********************************************************************/ +typedef struct M68KExcTableType { + UInt32 initStack; // initial stack pointer + UInt32 initPC; // initial PC + + UInt32 busErr; // 08 + UInt32 addressErr; // 0C + UInt32 illegalInstr; // 10 + UInt32 divideByZero; // 14 + UInt32 chk; // 18 + UInt32 trap; // 1C + UInt32 privilege; // 20 + UInt32 trace; // 24 + UInt32 aTrap; // 28 + UInt32 fTrap; // 2C + UInt32 reserved12; // 30 + UInt32 coproc; // 34 + UInt32 formatErr; // 38 + UInt32 unitializedInt; // 3C + + UInt32 reserved[8]; // 40-5C + + UInt32 spuriousInt; // 60 + UInt32 autoVec1; // 64 + UInt32 autoVec2; // 68 + UInt32 autoVec3; // 6C + UInt32 autoVec4; // 70 + UInt32 autoVec5; // 74 + UInt32 autoVec6; // 78 + UInt32 autoVec7; // 7C + + UInt32 trapN[16]; // 80 - BC + + UInt32 unassigned[16]; // C0 - FC + } M68KExcTableType; + + + +/************************************************************************************** + * 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. + * + **************************************************************************************/ +typedef struct M68KRegsType { + UInt32 d[8]; /* data registers */ + UInt32 a[7]; /* address registers */ + UInt32 usp; /* user stack pointer */ + UInt32 ssp; /* supervisor stack pointer */ + UInt32 pc; /* program counter */ + UInt16 sr; /* status register */ +} M68KRegsType; + + + + +/************************************************************************************** + * bit masks for testing M68000 status register fields + **************************************************************************************/ + +/* trace mode */ +#define m68kSrTraceMask 0x08000 +#define m68kSrTraceBit 15 + +/* supervisor state */ +#define m68kSrSupervisorMask 0x02000 + +/* interrupt mask */ +#define m68kSrInterruptMask 0x00700 +#define m68kSrInterruptOffset 8 /* offset for right-shifting interrupt mask */ + +/* condition codes */ +#define m68kSrExtendMask 0x00010 +#define m68kSrNegativeMask 0x00008 +#define m68kSrZeroMask 0x00004 +#define m68kSrOverflowMask 0x00002 +#define m68kSrCarryMask 0x00001 + + + +#endif //__M68KHWR_H diff --git a/sdk-4/include/Core/System/AlarmMgr.h b/sdk-4/include/Core/System/AlarmMgr.h new file mode 100644 index 0000000..c8e36b8 --- /dev/null +++ b/sdk-4/include/Core/System/AlarmMgr.h @@ -0,0 +1,268 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __ALARM_MGR_H__ +#define __ALARM_MGR_H__ + + +// Include elementary types +#include +#include +#include + + + + +/************************************************************ + * Alarm Manager result codes + * (almErrorClass is defined in ErrorBase) + *************************************************************/ +#define almErrMemory (almErrorClass | 1) // ran out of memory +#define almErrFull (almErrorClass | 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. +typedef struct SysAlarmTriggeredParamType { + UInt32 ref; // --> alarm reference value passed by caller; + UInt32 alarmSeconds; // --> alarm date/time in seconds since 1/1/1904; + + Boolean purgeAlarm; // <-- 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 + UInt8 padding; + } SysAlarmTriggeredParamType; + +// 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. +typedef struct SysDisplayAlarmParamType { + UInt32 ref; // alarm reference value passed by caller; + UInt32 alarmSeconds; // alarm date/time in seconds since 1/1/1904; + Boolean soundAlarm; // non-zero if alarm needs to be sounded; + UInt8 padding; + } SysDisplayAlarmParamType; + + + + +/************************************************************ + * + * + * 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. + * + *************************************************************/ +typedef enum { + almProcCmdTriggered = 0, // Alarm triggered + almProcCmdReschedule, // Reschedule (usually as a result of time change) + + // Alarm manager reserves all enums up to almProcCmdCustom + almProcCmdCustom = 0x8000 + } AlmProcCmdEnum; + +typedef void (*AlmAlarmProcPtr)(UInt16 /* AlmProcCmdEnum*/ almProcCmd, + SysAlarmTriggeredParamType *paramP); + + +#define almProcAlarmCardNo 0x8000 // passed in cardNo to AlmSetAlarm + // and AlmGetAlarm + +#define AlmSetProcAlarm(/*AlmAlarmProcPtr*/ procP, /*UInt32*/ ref, \ + /*UInt32*/alarmSeconds) \ + AlmSetAlarm(almProcAlarmCardNo, (LocalID)procP, ref, \ + alarmSeconds, true) + +#define AlmGetProcAlarm(/*AlmAlarmProcPtr*/ procP, /*UInt32 **/ refP) \ + AlmGetAlarm(almProcAlarmCardNo, (LocalID)procP, refP) \ + + + + +/******************************************************************** + * Alarm Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// 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. +// +Err AlmInit(void) + SYS_TRAP(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. +// +Err AlmSetAlarm(UInt16 cardNo, LocalID dbID, UInt32 ref, + UInt32 alarmSeconds, Boolean quiet) + SYS_TRAP(sysTrapAlmSetAlarm); + + +// AlmGetAlarm() +// +// Gets the alarm seconds for a given app. +// Zero is returned if there is no alarm setting for the app. +UInt32 AlmGetAlarm(UInt16 cardNo, LocalID dbID, UInt32 *refP) + SYS_TRAP(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. +// +void AlmEnableNotification(Boolean enable) + SYS_TRAP(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. +Boolean AlmDisplayAlarm(Boolean okToDisplay) + SYS_TRAP(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. +// +void AlmCancelAll(void) + SYS_TRAP(sysTrapAlmCancelAll); + + + +// AlmAlarmCallback() +// +// This function is called at interrupt time by the Time Manager when +// an alarm goes off. +// +void AlmAlarmCallback(void) + SYS_TRAP(sysTrapAlmAlarmCallback); + + +// AlmTimeChange() +// +// This function gets called by TimSetSeconds() and gives the alarm manager +// a chance to notify all procedure alarms of the time change. +// +void AlmTimeChange(void) + SYS_TRAP(sysTrapAlmTimeChange); + +#ifdef __cplusplus +} +#endif + + + +#endif // __ALARM_MGR_H__ diff --git a/sdk-4/include/Core/System/AppLaunchCmd.h b/sdk-4/include/Core/System/AppLaunchCmd.h new file mode 100644 index 0000000..0d71723 --- /dev/null +++ b/sdk-4/include/Core/System/AppLaunchCmd.h @@ -0,0 +1,297 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + + #ifndef __APPLAUNCHCMD_H__ + #define __APPLAUNCHCMD_H__ + +// Include elementary types +#include + + +#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. +typedef enum { + addrLookupName, + addrLookupFirstName, + addrLookupCompany, + addrLookupAddress, + addrLookupCity, + addrLookupState, + addrLookupZipCode, + addrLookupCountry, + addrLookupTitle, + addrLookupCustom1, + addrLookupCustom2, + addrLookupCustom3, + addrLookupCustom4, + addrLookupNote, // This field is assumed to be < 4K + addrLookupWork, + addrLookupHome, + addrLookupFax, + addrLookupOther, + addrLookupEmail, + addrLookupMain, + addrLookupPager, + addrLookupMobile, + addrLookupSortField, + addrLookupListPhone, + addrLookupFieldCount, // add new fields above this one + + addrLookupNoField = 0xff +} AddressLookupFields; + + +#define addrLookupStringLength 12 + +typedef struct + { + Char *title; + // Title to appear in the title bar. If NULL the default is used. + + Char *pasteButtonText; + // Text to appear in paste button. If NULL "paste" is used. + + Char lookupString[addrLookupStringLength]; + // 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. + + AddressLookupFields field1; + // 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). + + AddressLookupFields field2; + // 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. + + Boolean field2Optional; + // 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. + + Boolean userShouldInteract; + // 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; + + Char *formatStringP; + // 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. + + MemHandle resultStringH; + // If there is a format string a result string is allocated on + // the dynamic heap and its handle is returned here. + + UInt32 uniqueID; + // The unique ID of the found record or 0 if none was found. + + } AddrLookupParamsType; + +typedef AddrLookupParamsType *AddrLookupParamsPtr; + + + + +/************************************************************ + * Param Block passsed with the sysAppLaunchCmdSetActivePanel Command + *************************************************************/ + +#define prefAppLaunchCmdSetActivePanel (sysAppLaunchCmdCustomBase + 1) + // Record this panel so switching to the Prefs app + // causes this panel to execute. + +typedef struct + { + UInt32 activePanel; + // 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. + + } PrefActivePanelParamsType; + +typedef PrefActivePanelParamsType *PrefActivePanelParamsPtr; + + + +/************************************************************ + * Param Block passsed with the sysAppLaunchCmdAddRecord Command + *************************************************************/ + +//------------------------------------------------------------------- +// sysAppLaunchCmdAddRecord parameter block for the Mail application +//------------------------------------------------------------------- +// Param Block passsed with the sysAppLaunchCmdAddRecord Command + +typedef enum { mailPriorityHigh, mailPriorityNormal, mailPriorityLow } MailMsgPriorityType; + +typedef struct { + Boolean secret; + // True means that the message should be marked secret + + Boolean signature; + // True means that signature from the Mail application's preferences + // should be attached to the message. + + Boolean confirmRead; + // True means that a comfirmation should be sent when the message + // is read. + + Boolean confirmDelivery; + // True means that a comfirmation should be sent when the message + // is deliveried + + MailMsgPriorityType priority; + // high, normial, or low. + + UInt8 padding; + + Char * subject; + // Message's subject, a null-terminated string (optional). + + Char * from; + // Message's send, a null-terminated string (not currently used). + + Char * to; + // Address the the recipient, a null-terminated string (required). + + Char * cc; + // Copy Addresses, a null-terminated string (required). + + Char * bcc; + // Blind copy Addresses, a null-terminated string (required). + + Char * replyTo; + // Reply to address, a null-terminated string (required). + + Char * body; + // The text of the message, a null-terminated string (required). + +} MailAddRecordParamsType; + +typedef MailAddRecordParamsType *MailAddRecordParamsPtr; + + + +//------------------------------------------------------------------- +// sysAppLaunchCmdAddRecord parameter block for the Messaging application +//------------------------------------------------------------------- +// Param Block passsed with the sysAppLaunchCmdAddRecord Command + +//category defines +#define MsgInboxCategory 0 +#define MsgOutboxCategory 1 +#define MsgDeletedCategory 2 +#define MsgFiledCategory 3 +#define MsgDraftCategory 4 + +typedef struct + { + UInt16 category; + //is this an outgoing mesage? Or should it be put into a different category + + Boolean edit; + // True means that the message should be opened in the editor,instead of + // just dropped into the category (only applies to outBox category) + + Boolean signature; + // True means that signature from the Mail application's preferences + // should be attached to the message. + + Char * subject; + // Message's subject, a null-terminated string (optional). + + Char * from; + // Message's send, a null-terminated string (not currently used). + + Char * to; + // Address the the recipient, a null-terminated string (required). + + Char * replyTo; + // Reply to address, a null-terminated string (required). + + Char * body; + // The text of the message, a null-terminated string (required). + + } MsgAddRecordParamsType; + +typedef MsgAddRecordParamsType *MsgAddRecordParamsPtr; + +#endif //__APPLAUNCHCMD_H__ diff --git a/sdk-4/include/Core/System/Bitmap.h b/sdk-4/include/Core/System/Bitmap.h new file mode 100644 index 0000000..68cfeb3 --- /dev/null +++ b/sdk-4/include/Core/System/Bitmap.h @@ -0,0 +1,208 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __BITMAP_H__ +#define __BITMAP_H__ + +#include +#include + +#include // #define ERROR_CHECK_LEVEL + + +//----------------------------------------------- +// The Bitmap Structure. +//----------------------------------------------- + +// bitmap version numbers +#define BitmapVersionZero 0 +#define BitmapVersionOne 1 +#define BitmapVersionTwo 2 + +// Compression Types for BitmapVersionTwo +typedef enum + { + BitmapCompressionTypeScanLine = 0, + BitmapCompressionTypeRLE, + BitmapCompressionTypePackBits, + + BitmapCompressionTypeEnd, // must follow last compression algorithm + + BitmapCompressionTypeBest = 0x64, + BitmapCompressionTypeNone = 0xFF + } BitmapCompressionType; + + +typedef struct BitmapFlagsType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS // These fields will not be available in the next OS release! +{ + 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 +BitmapFlagsType; + + +// this definition correspond to the 'Tbmp' and 'tAIB' resource types +typedef struct BitmapType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS // These fields will not be available in the next OS release! +{ + Int16 width; + Int16 height; + UInt16 rowBytes; + BitmapFlagsType flags; + UInt8 pixelSize; // bits/pixel + UInt8 version; // version of bitmap. This is vers 2 + UInt16 nextDepthOffset; // # of DWords to next BitmapType + // from beginnning of this one + UInt8 transparentIndex; // v2 only, if flags.hasTransparency is true, + // index number of transparent color + UInt8 compressionType; // v2 only, if flags.compressed is true, this is + // the type, see BitmapCompressionType + + UInt16 reserved; // for future use, must be zero! + + // 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 +BitmapType; + +typedef BitmapType* BitmapPtr; + + + +// ----------------------------------------------- +// This is the structure of a color table. It maps pixel values into +// RGB colors. Each element in the table corresponds to the next +// index, starting at 0. +// ----------------------------------------------- +typedef struct RGBColorType +{ + UInt8 index; // index of color or best match to cur CLUT or unused. + UInt8 r; // amount of red, 0->255 + UInt8 g; // amount of green, 0->255 + UInt8 b; // amount of blue, 0->255 +} +RGBColorType; + + + +// ----------------------------------------------- +// 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. +// ----------------------------------------------- +typedef struct BitmapDirectInfoType +{ + UInt8 redBits; // # of red bits in each pixel + UInt8 greenBits; // # of green bits in each pixel + UInt8 blueBits; // # of blue bits in each pixel + UInt8 reserved; // must be zero + RGBColorType transparentColor; // transparent color (index field ignored) +} +BitmapDirectInfoType; + + +// ----------------------------------------------- +// Color Table +// ----------------------------------------------- +typedef struct ColorTableType +{ + // high bits (numEntries > 256) reserved + UInt16 numEntries; // number of entries in table + // RGBColorType entry[]; array 0..numEntries-1 of colors + // starts immediately after numEntries +} +ColorTableType; + + +// get start of color table entries aray given pointer to ColorTableType +#define ColorTableEntries(ctP) ((RGBColorType *)((ColorTableType *)(ctP)+1)) + +#ifdef __cplusplus +extern "C" +{ +#endif + +// ----------------------------------------------- +// Routines relating to bitmap management +// ----------------------------------------------- + +extern BitmapType* BmpCreate (Coord width, Coord height, UInt8 depth, ColorTableType * colortableP, UInt16 * error) + SYS_TRAP (sysTrapBmpCreate); + +extern Err BmpDelete (BitmapType * bitmapP) + SYS_TRAP (sysTrapBmpDelete); + +extern Err BmpCompress (BitmapType * bitmapP, BitmapCompressionType compType) + SYS_TRAP (sysTrapBmpCompress); + +extern void* BmpGetBits (BitmapType * bitmapP) + SYS_TRAP (sysTrapBmpGetBits); + +extern ColorTableType* BmpGetColortable (BitmapType * bitmapP) + SYS_TRAP (sysTrapBmpGetColortable); + +extern UInt16 BmpSize (const BitmapType * bitmapP) + SYS_TRAP (sysTrapBmpSize); + +extern UInt16 BmpBitsSize (const BitmapType * bitmapP) + SYS_TRAP (sysTrapBmpBitsSize); + +extern void BmpGetSizes (const BitmapType * bitmapP, UInt32 * dataSizeP, UInt32 * headerSizeP) + SYS_TRAP (sysTrapBmpGetSizes); + +extern UInt16 BmpColortableSize (const BitmapType * bitmapP) + SYS_TRAP (sysTrapBmpColortableSize); + +extern void BmpGetDimensions (const BitmapType * bitmapP, Coord * widthP, Coord * heightP, UInt16 * rowBytesP) + SYS_TRAP (sysTrapBmpGetDimensions); + +extern UInt8 BmpGetBitDepth (const BitmapType * bitmapP) + SYS_TRAP (sysTrapBmpGetBitDepth); + +extern BitmapType* BmpGetNextBitmap (BitmapType * bitmapP) + SYS_TRAP (sysTrapBmpGetNextBitmap); + +#ifdef __cplusplus +} +#endif + + +#endif // __BITMAP_H__ diff --git a/sdk-4/include/Core/System/CMCommon.h b/sdk-4/include/Core/System/CMCommon.h new file mode 100644 index 0000000..2da99ca --- /dev/null +++ b/sdk-4/include/Core/System/CMCommon.h @@ -0,0 +1,367 @@ +/****************************************************************************** + * + * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CMCommon.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Connection Management Protocol common definitions. + * + * History: + * 9/14/95 vmk Created by Vitaly Marty Kruglikov + * 11/19/96 vmk Added CM v1.1 receive timeout override extensions + * + *****************************************************************************/ + +#ifndef __CM_COMMON_H__ +#define __CM_COMMON_H__ + +#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS + + // Pilot common definitions + #include "PalmTypes.h" + +#else // EMULATION_LEVEL != EMULATION_WINDOWS + + // Pilot common definitions + #include + +#endif // EMULATION_LEVEL == EMULATION_WINDOWS + +#if EMULATION_WINDOWS != 1 + LOGIC ERROR +#endif + + + +/******************************************************************** + * CMP 1.0 Command Format + ********************************************************************/ + +// IT IS ANTICIPATED THAT the 1.0 PACKET FORMAT WILL BE USED TO INITIATE +// HOT SYNC "WAKE-UP" MESSAGE INDEFINITELY. BASED ON THE COMMUNICATIONS +// VERSION NUMBER PROVIDED IN THIS BASIC COMMAND STRUCTURE, FUTURE VERSIONS +// OF DESKTOP AND PILOT SOFTWARE MAY SUPPORT ADDITIONAL CONNECTION MANAGEMENT +// COMMANDS/FEATURES AS THE NEED ARISES. FOR EXAMPLE, TCP-ENABLED HOTSYNCS +// MAY PROVIDE ADDITIONAL INFORMATION, SUCH AS THE INTERNET ADDRESS OF THE +// PREFERRED HOTSYNC PC. THIS DESIGN PROVIDES FOR BACKWARD COMPATIBILITY +// WITH OLDER VERSIONS OF THE SOFTWARE. FUTURE COMMANDS WILL BE ADDED +// FOLLOWING THIS BASIC COMMAND SET. + +// The CMP packets are used for transmitting data for the Pilot CMP protocol layer. +// The structure of the CMP packet is built into the data part of the SLP packet and is, +// therefore, constrained by the SLP packet data size limitations. + + +// Packet type values used in the CMP packet body "type" field: +// +typedef enum CmpType { + cmpWakeup = 1, // CMP Wakeup packet sent from server to client + cmpInit, // CMP Init packet sent from client to server + cmpAbort, // CMP Abort packet sent from client to server + cmpExtended // For future command extensions + } CmpType; + + +// cmpInit and cmpWakeup packet body structure: +// +typedef struct CmpBodyType { + UInt8 type; // CMP packet type + + UInt8 flags; // in cmpInit packets: indicates which values were adjusted by + // the client(defined below); in cmpWakeup pakcets: null; + // in cmpAbort packets: reason for abort. + + UInt8 verMajor; // Major PAD version number + UInt8 verMinor; // Minor PAD version number + UInt16 wReserved; // RESERVED -- set to NULL!!! + //UInt32 commVersion; // in cmpWakeup: server comm software version number; + // in cmpInit: client comm version + + UInt32 baudRate; // in cmpWakeup: max server baud rate; + // in cmpInit packets: the prescribed baud rate + } CmpBodyType; + +typedef CmpBodyType* CmpBodyPtr; + +// Flags used in the packet body "flags" field of cmpInit +// packets. These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpInitFlagChangeBaudRate 0x80 // signals that the baud rate was adjusted by the client + +// CM v1.1 extensions +#define cmpInitFlagRcvTOut1Min 0x40 // instructs the Pilot to set its receive timeout to 1 minute +#define cmpInitFlagRcvTOut2Min 0x20 // instructs the Pilot to set its receive timeout to 1 minute + +// CM v1.2 extensions +#define cmpInitFlagLongPacketEnable 0x10 // Instructs the device to enable long packet support. + +// Flags used in the packet body "flags" field of cmpAbort packets. +// These values are additive in the sense that they can be +// added or or'ed to form a composite value: +#define cmpAbortFlagVersionError 0x80 // signals incompatible comm versions + +// Flags used in the packert body "flags" field of cmpWakeup packets. +// These values are additive in the sense that they can be +// added or or'ed to form a composite value: + +// CM v1.2 extensions +#define cmpWakeupFlagLongPacketEnable 0x10 // Instructs the desktop that the device supports long + // packets. + +/******************************************************************** + * CMP Protocol Parameters + ********************************************************************/ + +// This transaction id is used by cmpWakeup packets. cmpInit and cmpAbort +// packets MUST use a different transaction id. +// +#define cmpWakeupTransactionID 0xFF + +// This is the baud rate at which CMP connections are initiated +// +#define cmpInitialBaudRate 9600L + +// This is the time limit for trying to initiate a connection +// +#define cmpMaxInitiateSec 20 + + +/******************************************************************** + * CMP v2.0 Extensible Command Format + ********************************************************************/ + +// THE v2.0 COMMANDS USE A MORE FLEXIBLE STRUCTURE TO ANTICIPATE DYNAMIC +// ADDITION OF NEW ARGUMENTS. THE COMMAND HEADER AND ARGUMENT IDENTIFIERS +// AND THEIR STRUCTURES WILL BE SPECIFIED IN THIS INCLUDE FILE. THE PACKAGING +// OF THE ARGUMENTS WILL BE SPECIFIED IN THE TRANSPORT IMPLEMENTATION +// WHICH PROVIDES THE UTILITY ROUTINES TO PACKAGE DYNAMIC ARGUMENTS. + +typedef struct CmpCommandHeaderType { + UInt8 hdrType; // set to cmpExtended + UInt8 cmd; // extended command/response id + UInt16 errorCode; // used in replies; set to null in commands! + UInt8 argCount; // number of arguments + UInt8 reserved1; // RESERVED - SET TO NULL! + UInt32 reserved2; // RESERVED - SET TO NULL! + } CmpCommandHeaderType; + + +// Generic command type for +typedef union CmpGenericCommandType { + UInt8 hdrType; // command header type(CmpType) + CmpBodyType body10; // v1.0 command/response body + CmpCommandHeaderType exHdr; // v2.0 extended command/response header + } CmpGenericCommandType; + +typedef CmpGenericCommandType* CmpGenericCommandPtr; + + +// cmpRespBit is used to form a response ID from a +// command ID by or'ing it with the function ID. +#define cmpRespBit 0x80 + +// cmpCmdIDMask is used to mask out the command/response ID value +#define cmpCmdIDMask 0x7f + +// Command/Response argument id's begin at this value +#define cmpFirstArgID 0x20 + + +//------------------------------------------------------------------------- +// Connection Management error codes returned in the response errorCode +// field. +//------------------------------------------------------------------------- +typedef enum CmpRespErrEnum { + cmpRespErrNone = 0, // reserve 0 for no error + cmpRespErrSystem, // general Pilot system error + cmpRespErrUnknownCmd, // unknown command ID + cmpRespErrMemory, // insufficient memory + cmpRespErrParam, // invalid parameter + + cmpRespErrLast // *KEEP THIS ENTRY LAST* + } CmpRespErrEnum; + + +//------------------------------------------------------------------------- +// Connection Management Extended Command ID's +//------------------------------------------------------------------------- +typedef enum CmpCmdEnum { + + cmpCmdReserved = 0x0F, // range reserved for internal use + + //---------------------------- + // v2.0 COMMANDS + //---------------------------- + cmpCmdXCommPrefs, // exchange communications protocol preferences + cmpCmdHShakeComplete, // hand-shake completion command + + cmpCmdLast // *KEEP THIS ENTRY LAST* + } CmpCmdEnum; + + + +//------------------------------------------------------------------------- +// v2.0 Connection Management Command/Response Structures +//------------------------------------------------------------------------- + +// CmpCommPrefsType: common data structure shared by cmpCmdXCommPrefs and +// cmpCmdHShakeComplete. In cmpCmdXCommPrefs, the data structure is used +// to exchange capabilities. In cmpCmdHShakeComplete, the structure is +// used to instruct the Pilot on which settings/features to use. Some +// fields apply to direct PAD-based connections only and should be ignored +// by other transports such as TCP. +// +typedef struct CmpCommPrefsType { + // OFFSET + UInt32 maxPktDataSize;// 0; maximum supported packet data size + UInt32 maxDataBlkSize;// 4; maximum supported data block size + UInt32 maxBaudRate; // 8; maximum supported baud rate/baud rate to use + UInt32 hwHShakeAbove; // 12; requires hardware handshake above this baud rate + UInt32 flags; // 16; flags + UInt32 version; // 20; transport version (comm version) + UInt32 reserved2; // 24; RESERVED - SET TO NULL! + UInt32 reserved3; // 28; RESERVED - SET TO NULL! + // TOTAL: 32 bytes; + } CmpCommPrefsType; + + +//-------------------------------------- +// Packet-level CRC preferences +//-------------------------------------- + +// cmpCommPrefsFlagSupportPktCRC16: if set, the transport layer is capable of +// CRC-16 protection of every data packet(v2.0 extension). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportPktCRC16 0x80000000L + +// cmpCommPrefsFlagUsePktCRC16: if set, instructs the transport layer to use +// the CRC-16 protection of every data packet(v2.0 extension). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUsePktCRC16 0x00008000L + +//-------------------------------------- +// Data offset size preferences +//-------------------------------------- + +// NOTE: +// If specifying Int16 offsets, Int16 argument wrappers will be used. +// If specifying long offsets, long argument wrappers will be used. + +// cmpCommPrefsFlagSupportShortOffsets: if set, indicates that the transport layer +// supports Int16(single-word) offsets/sizes in its data packets. The smaller +// field does not permit bigger blocks to be transmitted(v1.0-compatible). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportShortOffsets 0x40000000L + +// cmpCommPrefsFlagUseShortOffsets: if set, instructs the transport layer to use +// Int16(single-word) offsets/sizes in its data packets(v1.0-compatible). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUseShortOffsets 0x00004000L + +// cmpCommPrefsFlagSupportLongOffsets: if set, indicates that the transport layer +// supports long(double-word) offsets/sizes in its data packets. The larger +// field permits bigger blocks to be transmitted(v2.0 extension). (cmpCmdXCommPrefs) +#define cmpCommPrefsFlagSupportLongOffsets 0x20000000L + +// cmpCommPrefsFlagUseLongOffsets: if set, instructs the transport layer to use +// long(double-word) offsets/sizes in its data packets(v2.0 extension). (cmpCmdHShakeComplete) +#define cmpCommPrefsFlagUseLongOffsets 0x00002000L + + + +////////////////////////////////////////////////////////////////////////// +// cmpCmdXCommPrefs +////////////////////////////////////////////////////////////////////////// +// +// Description: +// Exchange communications preferences. +// +// Possible error codes +// cmpRespErrSystem, +// cmpRespErrMemory, +// cmpRespErrParam, + +//--------------------- +// Command arguments: +//--------------------- +enum { + cmpXCommPrefsReqArgID = cmpFirstArgID + }; + + +// cmpXCommPrefsReqArgID argument structure: +// +typedef struct CmpXCommPrefsReqType { + // OFFSET + CmpCommPrefsType prefs; // 0; CMP comm preferences + // TOTAL: 32 bytes; + } CmpXCommPrefsReqType; + + +//--------------------- +// Response arguments: +//--------------------- +enum { + cmpXCommPrefsPrefsRespArgID = cmpFirstArgID, // preferences argument + cmpXCommPrefsIPAddrRespArgID // preferred PC IP Address/host name + }; + + +// cmpXCommPrefsPrefsRespArgID argument structure: +// +typedef struct CmpXCommPrefsPrefsRespType { + // OFFSET + CmpCommPrefsType prefs; // 0; CMP comm preferences + // TOTAL: 32 bytes; + } CmpXCommPrefsPrefsRespType; + + +// cmpXCommPrefsIPAddrRespArgID argument structure: +// +typedef struct CmpXCommPrefsIPAddrRespType { + // OFFSET + UInt8 ipAddr[2]; // 0; IP address/host name string, zero-terminated + // TOTAL: variable size; + } CmpXCommPrefsIPAddrRespType; + + + +////////////////////////////////////////////////////////////////////////// +// cmpCmdHShakeComplete +////////////////////////////////////////////////////////////////////////// +// +// Description: +// Completes the Extended Connection Management hand-shake. Instructs +// the Pilot on which settings/features to use. +// +// Possible error codes +// cmpRespErrSystem, +// cmpRespErrMemory, +// cmpRespErrParam + +//--------------------- +// Command arguments: +//--------------------- +enum { + cmpHShakeCompleteReqArgID = cmpFirstArgID + }; + + +// cmpHShakeCompleteReqArgID argument structure: +// +typedef struct CmpHShakeCompleteReqType { + // OFFSET + CmpCommPrefsType final; // 0; final settings/features to use + // TOTAL: 32 bytes; + } CmpHShakeCompleteReqType; + + +//--------------------- +// Response arguments: +//--------------------- + +// No response arguments; the response consists of the command header only + + + +#endif // __CM_COMMON_H__ diff --git a/sdk-4/include/Core/System/CMLConst.h b/sdk-4/include/Core/System/CMLConst.h new file mode 100644 index 0000000..2c2de1f --- /dev/null +++ b/sdk-4/include/Core/System/CMLConst.h @@ -0,0 +1,269 @@ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CMLConst.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * CML data structures definition file. + * + *****************************************************************************/ + +#ifndef __CMLCONST_H__ +#define __CMLCONST_H__ + +#define cmlEncodingTypeStrNULL "" + +typedef enum { + cmlCompressionTypeNone, + cmlCompressionTypeBitPacked, + cmlCompressionTypeLZ77, + cmlCompressionTypeBest, + cmlCompressionTypeLZ77Primer1, + cmlCompressionTypeMax = cmlCompressionTypeLZ77Primer1 /* end of valid range */ +} CmlCompressionType; +// +#define cmlCompressionTypeDef cmlCompressionTypeBitPacked + + +#define cmlContentTypeStrTextPlain "text/plain" +#define cmlContentTypeStrTextHTML "text/html" +#define cmlContentTypeStrImageGIF "image/gif" +#define cmlContentTypeStrImageJPEG "image/jpeg" +#define cmlContentTypeStrApplicationCml "application/cml" +#define cmlContentTypeStrImagePalmOS "image/palmos" +#define cmlContentTypeStrBinDefault "application/octet-stream" + +#define cmlContentTypeTextPlain 0 +#define cmlContentTypeTextHTML 1 +#define cmlContentTypeImageGIF 2 +#define cmlContentTypeImageJPEG 3 +#define cmlContentTypeTextCml 4 +#define cmlContentTypeImagePalmOS 5 +#define cmlContentTypeOther 6 + +// Tag sizes +#define cmlCharSize 5 +#define cmlAsciiCharSize 8 +#define cmlShortTagSize 7 +#define cmlLongTagSize 15 +#define cmlShortTagMax 127 + +// Size in bits of various Tag data types +#define cmlFlagSize 1 +#define cmlColorSize 8 +#define cmlAlignSize 2 +#define cmlAlignISize 3 +#define cmlClearSize 2 +#define cmlFormatSize 4 +#define cmlListTypeSize 3 +#define cmlImageTypeSize 1 +#define cmlLinkColorTypeSize 2 +#define cmlTextSizeSize 3 +#define cmlListItemSize 2 +#define cmlFormSize 3 +#define cmlInputTextSize 2 +#define cmlInputPasswordSize 2 +#define cmlInputRadioSize 4 +#define cmlInputCheckBoxSize 4 +#define cmlInputSubmitSize 2 +#define cmlInputResetSize 1 +#define cmlInputHiddenSize 2 +#define cmlInputTextAreaSize 1 +#define cmlSelectSize 2 +#define cmlSelectItemCustomSize 2 +#define cmlDatePickerSize 1 +#define cmlTimePickerSize 1 +#define cmlTableSize 7 +#define cmlTableCellSize 7 +#define cmlHyperlinkSize 10 +#define cmlHorizontalRuleSize 5 + +// Flag values +#define cmlFlagHRCustom 0x01 +#define cmlFlagHRAlign 0x06 +#define cmlFlagHRNoShade 0x08 +#define cmlFlagHRIsPercent 0x10 + +#define cmlFlagListModType 0x01 +#define cmlFlagListModValue 0x02 + +#define cmlFlagLinkIsButton 0x01 +#define cmlFlagLinkHasTitle 0x02 +#define cmlFlagLinkInternal 0x04 +#define cmlFlagLinkIsFragment 0x08 +#define cmlFlagLinkIsSecure 0x10 +#define cmlFlagLinkHasHref 0x20 +#define cmlFlagLinkIsSameDoc 0x40 +#define cmlFlagLinkIsFakeRemote 0x80 +#define cmlFlagLinkIsLocalRef 0x100 +#define cmlFlagLinkIsBinary 0x200 + +#define cmlFlagFormIsStandalone 0x01 +#define cmlFlagFormIsSecure 0x02 +#define cmlFlagFormIsLocalAction 0x04 + +#define cmlFlagInputHasName 0x01 +#define cmlFlagInputHasValue 0x02 +#define cmlFlagInputChecked 0x04 +#define cmlFlagInputHasText 0x08 +#define cmlFlagInputMultiple 0x02 +#define cmlFlagInputSelected 0x01 + +#define cmlFlagImageEmbedded 0x01 +#define cmlFlagImageHasAlign 0x02 +#define cmlFlagImageHasBorder 0x04 +#define cmlFlagImageHasHSpace 0x08 +#define cmlFlagImageHasVSpace 0x10 +#define cmlFlagImageHasSrc 0x20 +#define cmlFlagImageHasAlt 0x40 +#define cmlFlagImageLocalPQA 0x80 +#define cmlFlagImageLocalPQF cmlFlagImageLocalPQA /* old name; deprecated... */ + +#define cmlFlagTableHasAlign 0x01 +#define cmlFlagTableHasWidth 0x02 +#define cmlFlagTableHasBorder 0x04 +#define cmlFlagTableHasCellSpacing 0x08 +#define cmlFlagTableHasCellPadding 0x10 +#define cmlFlagTableHasKeepRow 0x20 +#define cmlFlagTableHasKeepCol 0x40 + +#define cmlFlagCellHasHAlign 0x01 +#define cmlFlagCellHasVAlign 0x02 +#define cmlFlagCellHasColSpan 0x04 +#define cmlFlagCellHasRowSpan 0x08 +#define cmlFlagCellHasHeight 0x10 +#define cmlFlagCellHasWidth 0x20 +#define cmlFlagCellNoWrap 0x40 + +enum CMLTag +{ + cmlTagAnchor, + cmlTagBGColor, + cmlTagTextColor, + cmlTagLinkColor, + cmlTagTextSize, + cmlTagTextBold, + cmlTagTextItalic, + cmlTagTextUnderline, + cmlTagParagraphAlign, // 0x08 + cmlTagHorizontalRule, + cmlTagH1, + cmlTagH2, + cmlTagH3, + cmlTagH4, + cmlTagH5, + cmlTagH6, + cmlTagBlockQuote, // 0x10 + cmlTagHyperlink, + cmlTagAddress, + cmlTagTextStrike, + cmlTagTextMono, + cmlTagTextSub, + cmlTagTextSup, + cmlTagClear, + cmlTagHistoryListText, // 0x18 + cmlTagIsIndex, + cmlTagListOrdered, + cmlTagListUnordered, + cmlTagListDefinition, + cmlTagListItemCustom, + cmlTagListItemNormal, + cmlTagListItemTerm, + cmlTagListItemDefinition, // 0x20 + cmlTagForm, + cmlTagInputTextLine, + cmlTagInputPassword, + cmlTagInputRadio, + cmlTagInputCheckBox, + cmlTagInputSubmit, + cmlTagInputReset, + cmlTagInputHidden, // 0x28 + cmlTagInputTextArea, + cmlTagSelect, + cmlTagSelectItemNormal, + cmlTagSelectItemCustom, + cmlTagInputDatePicker, + cmlTagInputTimePicker, + cmlTagTable, + cmlTagTableRow, // 0x30 + cmlTagCaption, + cmlTagTableData, + cmlTagTableHeader, + cmlTagImage, // 0x34 + //cmlTagHorizontalScrollBar, + + + // Special CML cmlTags. + cmlTag8BitEncoding = 0x70, + cmlTagCMLEnd, + + // cmlTags not passed to output + cmlTagTextFont = 0x100, + cmlTagBody, + cmlTagBase, + cmlTagTextBaseFont, + cmlTagListItem, + cmlTagInput, + cmlTagSelectItem, + cmlTagMeta, + cmlTagLastInList // Not used as a tag; marks the end of the enum. +}; + +#define cmlMaxTag cmlTagLastInList +#define cmlTagNull cmlTagLastInList + //Used internally by CmlEncoder; not sent. + +// CML 5 Bit character equates +typedef enum { + cmlCharEnd, + cmlCharStart, + cmlCharEsc, + cmlCharFormFeed, + cmlCharLineBreak, + cmlCharSpace, + + // the lower case letters 'a' - 'z' follow.... + cmlCharA + + } CMLCharEnum; + +// Regular Ascii characters +#define cmlAsciiCR 0x0D +#define cmlAsciiLineFeed 0x0A +#define cmlAsciiFormFeed 0x0C +#define cmlAsciiSpace 0x20 + + +// List types for ordered and unordered lists +typedef enum { + cmlListTDisc, cmlListTSquare, cmlListTCircle, + cmlListT1, cmlListTa, cmlListTA, cmlListTi, cmlListTI + } CmlListEnum; + +// Align types +typedef enum { + cmlAlignLeft, cmlAlignCenter, cmlAlignRight, cmlAlignNone + } CmlAlignEnum; + +typedef enum { + cmlVAlignTop, cmlVAlignCenter, cmlVAlignBottom, cmlVAlignNone + } CmlVAlignEnum; + +typedef enum { + cmlIAlignLeft, cmlIAlignCenter, cmlIAlignRight, cmlIAlignTop, + cmlIAlignMiddle, cmlIAlignBottom, cmlIAlignNone + } CmlIAlignEnum; + +typedef enum { + cmlClearLeft, cmlClearAll, cmlClearRight, cmlClearLine + } CmlClearEnum; + +typedef enum { + cmlLinkColor, cmlLinkColorVisited, cmlLinkColorActive + } CmlLinkColorEnum; + +#endif //__CMLCONST_H__ diff --git a/sdk-4/include/Core/System/CTP.h b/sdk-4/include/Core/System/CTP.h new file mode 100644 index 0000000..9069924 --- /dev/null +++ b/sdk-4/include/Core/System/CTP.h @@ -0,0 +1,417 @@ +/****************************************************************************** + * + * Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CTP.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header for the CTP Proxy service component of Elaine. + * + * History: + * 6/24/97 Created by Ron Marianetti + * 6/6/00 Added Cookies variables by Najeeb + * + *****************************************************************************/ + +#ifndef _CTP_H_ +#define _CTP_H_ + +#include "PalmLocRawData.h" + +//########################################################## +// CTP Commands +// This is the CTP command UIntV which is sent in every +// CTP Request in the common area (CTPReqCommon) +//########################################################## +typedef enum { + ctpCmdReqURL = 0, // request URL + ctpCmdReqMail = 1, // request mail + ctpCmdEcho = 2, + ctpCmdMsgGen = 3, + ctpCmdDiscard = 4, + ctpCmdReqSessionID = 5 + } CTPCmdEnum; + + +//########################################################## +// CTP Content Conversion Types +// The requestor can pass one of these constants in the +// ctpExtConvertTo extension in order to specify the +// the type of content conversion desired. +// If the extension is missing, then ctpConvCML is assumed. +//########################################################## +typedef enum { + ctpConvCML = 0, // CML + ctpConvCML8Bit, // CML in 8-bit debug form + ctpConvNoneLZ77, // Raw data with LZ77 (No primer) + ctpConvNone, // Return in native web format. + // When this is specified, then the response + // will include the ctpRspExtContentType + // and ctpRspExtContentEncoding extensions + ctpConvBest, // Best compression between ctpConvCML, ctpConvCML8Bit & ctpConvCMLLZ77Primer1 + // Used together: ctpConvBest, ctpExtCompressSupported & CtpExtCompressedWith + ctpConvCMLLZ77Primer1 // Lz77 Primer#1 (English Clipper) + } CTPConvEnum; + +// ctpExtCompressSupported Bits definition +#define ctpSupportCml5Bit 0x01 +#define ctpSupportCml8Bit 0x02 +#define ctpSupportLZ77Primer1 0x04 +#define ctpSupportLZ77 0x08 +// This device supports cml5bit, cml8bit and Lz77 Primer #1 +#define ctpSupportDecompress (ctpSupportCml5Bit | ctpSupportCml8Bit | ctpSupportLZ77Primer1) + +// inetFtrNumCtpDeviceBits1 feature Bits definition (See INetMgr.h for the feature definition) +#define ctpDeviceBits1Ctp1252Secondary 0x00000001 // Cp1252 is supported in Clipper as a secondary charset for Japanese devices + + +// default CTP header request values +#define ctpHeaderVersion 0 // current version of CTP header +#define ctpConvAlgorithm ctpConvCML // encoding type +#define ctpMaxResponseSize 1024 // max response size +#define ctpContentWidth 160 // displayable width +#define ctpContentDepth 1 // 1 = 2 bit default display depth, 2 = 4 bit, 3 = 8 bit + +#define ctpContentVersion1 0x8001 +#define ctpContentVersion2 0x8002 +#define ctpContentVersionFirst ctpContentVersion1 +#define ctpContentVersionLast ctpContentVersion2 +#define ctpContentVersion ctpContentVersionLast // encoding version (must be kept up to date!!!) + +#define ctpCharsEscapedByClient "=&/%:?#+;@*[" + + +//----------------------------------------------------------------------------- +// %WCDevCaps bits definition Palm OS 4.0 and after +//----------------------------------------------------------------------------- +#define wcDevCaps1ScreenBits 0x0000007F + #define wcDevCaps1ScreenBitShift 0 + #define wcDevCaps1ScreenBitDepth1 0x01 + #define wcDevCaps1ScreenBitDepth2 0x02 + #define wcDevCaps1ScreenBitDepth4 0x04 + #define wcDevCaps1ScreenBitDepth8 0x08 + #define wcDevCaps1ScreenBitDepth16 0x10 +#define wcDevCaps1Lz77 0x00000080 + #define wcDevCaps1Reserved1Shift 7 +#define wcDevCaps1CommBandwidthBits 0x00000F00 + #define wcDevCaps1CommBandwidthBitsShift 8 +#define wcDevCaps1MemOSFreeBits 0x0000F000 + #define wcDevCaps1MemOSFreeBitsShift 12 +#define wcDevCaps1PalmOSVerBits 0x001F0000 + #define wcDevCaps1PalmOSVerBitsShift 16 +#define wcDevCaps1PalmOSHeapSizeBits 0x00E00000 + #define wcDevCaps1PalmOSHeapSizeBitsShift 21 +#define wcDevCaps1Reserved2 0xFF000000 + #define wcDevCaps1Reserved2Shift 24 + + +//########################################################## +// CTP Request Extensions +// These are the defined extension IDs that can appear +// in the extensions area of a CTP request +//########################################################## + +// Extensions defined for the ctpCmdReqMail command.... +typedef enum { + ctpExtIncHTTPResponse = 1, // include HTTP response header in data + // only applicable if ctpExtConvertTo + // is set to ctpConvNone + + ctpExtEnableCookies = 2, // Cookies are enabled on the device + // If only this flag is on, the cookies + // are to be sent to the device + + ctpExtNetID = 128, // Followed by length byte of 4 and + // 4 byte networkID.. + // Must be specified when using TCP + // because tunneler is not used. + + ctpExtUserID = 129, // Followed by length byte of 4 and + // 4 byte userID. + // Must be specified when using TCP + // because Mobitex MAN# is not available + + ctpExtUserPW = 130, // Followed by length byte of 16 and + // 128 bit (16 byte) MD5 hashed password. + // Must be specified when using TCP + // because Mobitex MAN# is not available + + ctpExtUserName = 131, // Followed by length byte and + // ascii user name string. + // This or ctpExtUserID must be specified + // when using TCP because Mobitex MAN# + // is not available + + ctpExtServer = 132, // Followed by a length byte of 1 and + // 8 bits (1 byte) of server behavior + // flags. + + ctpExtConvertTo = 133, // Followed by length byte of 1 and + // a 1 byte conversion identifier + // ctpConvXXX. If not present then + // ctpConvCML is assumed. + + ctpExtLocale = 134, // Followed by length byte of 3; + // 1 byte Country as defined by CountryType in Preferences.h + // 1 byte Language as defined by LanguageType in Preferences.h + // 1 byte CharsetID as defined by CharEncodingType in TextMgr.h + // Extension must not be sent if Local = + // ( cUnitedStates, lEnglish, charEncodingPalmLatin ) + + ctpExtCompressSupported = 135, // During Implementation of LZ77 + // Used together: ctpConvBest, ctpExtCompressSupported & CtpExtCompressedWith + // Followed by length byte of 1 and + // 8 compression support bits + + ctpExtDeviceBits1 = 136, // Device may send bits to the server + // Followed by a length byte of 4 + // and 4 bytes specifying the bits + // See bellow for a set of bits. + + ctpExtSendRawLocationInfo = 137, // Raw data information as returned by the connected hardware + // Followed by a length byte and the data + + ctpExtCookie = 138, // Cookie Request Header from the device + + ctpExtContTypeDevice = 139, // Device may send Content Type to the server + // Followed by a length byte and the data + + ctpExtWCDevCaps = 140, // Web Clipping device Capabilities available through %WCDevCaps + // Followed by a variable length byte and the data + + ctpExtPalmUserID = 141, // Followed by a length of 16 bytes + // containing 8 bytes of PalmUserID + // and 8 bytes of DeviceID + + ctpExtLastReqExtEnum = 255 // The last legal extension id. + } CTPReqExtEnum; + +// Enumerations for ctp extened extensions +// These extensions have a 16-bit length field +typedef enum { + ctpExtExtCookie = 0 // used when the device must send a large cookie to the web-clipping proxy server +} CTPReqExtExtEnum; + +// Bits definition for ctpExtDeviceBits1: +// initialized by the inetFtrNumCtpDeviceBits1 feature Bits definition +// (See INetmgr.h for the feature definition) +#define ctpDeviceBits1Cp1252Secondary 0x00000001 // Cp1252 is supported in Clipper as a secondary charset +// +#define ctpDeviceBits1PostCharsetBitShift 1 // Shift bits left by 1 bit +#define ctpDeviceBits1PostCharsetBitMask 0x000001FE + + +//########################################################## +// CTP Response Extensions +// These are the defined extension IDs that can appear +// in the extensions area of a CTP response +//########################################################## +// Extensions defined for the ctpCmdReqURL response +typedef enum { + ctpExtContentType = 128, // Followed by length byte of 'len' and + // a 'len' byte string containing the + // MIME type of the content. This extension + // is only returned when the request has + // a ctpReqExtConverTo value of ctpConvNone + + ctpExtContentEncoding = 129, // Followed by length byte of 'len' and + // a 'len' byte string containing the + // encoding type ("x-gzip, "compress", "lz77", + // etc.) + // This extension is only returned when the + // request has a ctpReqExtConverTo value of + // ctpConvNone + + ctpExtUncompressSize = 130, // Followed by length byte of 4 and + // a UInt32 containing the uncompressed + // size of the content. Currently only + // sent when the requested content conversion + // type is ctpConvCMLLZSS + + ctpExtUntruncatedSize = 131, // Followed by length byte of 4 and + // a UInt32 containing the untruncated + // size of the content. Currently only + // sent when the CTP result is ctpWarnTruncated + + ctpExtContentVersion = 132, // Followed by length byte of 2 + // and 2 byte desired version number of content + + ctpExtCompressedWith = 133, // During Implementation of LZ77 + // Used together: ctpConvBest, ctpExtCompressSupported & CtpExtCompressedWith + // Followed by a length byte of 1 + // and 1 byte specifying the specific CTPConvEnum used + + ctpExtServerBits1 = 134, // Server may send bits to the device + // Followed by a length byte of 4 + // and 4 bytes specifying the bits + // See bellow for a set of bits. + + ctpExtSetCookie = 135, // SetCookie http response header + // Variable length data which is tagged by field lengths + + ctpExtLastRspExtURLEnum = 255 // The last ctp extension; + } CTPRspExtURLEnum; + +// Enumerations for ctp extened extensions +// These extensions have a 16-bit length field +typedef enum { + ctpExtExtSetCookie = 0 // Used to send large cookies to the device +} CTPRspExtExtURLEnum; + +// Bits definition for ctpExtServerBits1: +#define ctpServerBits1SecondaryCharsetUsed 0x00000001 +// +#define ctpServerBits1DocumentCharsetBitShift 1 // Shift bits left by 1 bit +#define ctpServerBits1DocumentCharsetBitMask 0x000001FE + +#define ctpServerBits1DoNotCache 0x00000200 +//########################################################## +// CTP Network IDs. +// These are used along with the userID to identify a user's +// mailbox account. All mailboxes created for the Mobitex +// network with have a network ID of 0. The network ID +// is passed along with the userID to the mail proxy. +// For wireless networks, the tunneler fills in the network +// ID into the ?? field of the tunneled IP packets. For wireline +// access, the client must include the network ID in the extensions +// field of the CTP mail request. +//########################################################## +typedef enum { + ctpNetIDMobitex = 0, + ctpNetIDUnknown = 0xFFFF + } CTPNetIDEnum; + + +//########################################################## +// CTP Schemes +// This is the scheme encoding which is used as a field +// in the document address portion in a URL request +//########################################################## +typedef enum { + ctpSchemeHTTP = 0, // http:// + ctpSchemeHTTPS = 1, // https:// + ctpSchemeFTP = 2, // ftp:// + ctpSchemeEmpty = 7 + } CTPSchemeEnum; + + + + +//########################################################## +// CTP Errors +// These are the possible error codes returned in a CTP response +//########################################################## +typedef enum { + ctpErrNone = 0, + ctpErrMalformedRequest, // malformed CTP-layer request from + // client + // Optional Data: + // UInt32 ctpErr + // Char errMsg[] + // + ctpErrUnknownCmd, // unsupported CTP command + // no extra data + // + ctpErrProxy, // content or other err specific to + // a Palm Proxy Server + // (ie, messaging or clipping proxy) + // Data: + // UInt32 proxyErr + // Char errMsg[] + // + ctpErrServer, // err on WEB Server + // Data: + // UInt32 serverErr + // Char errMsg[] + // + ctpErrSecReplayIDBad, // encrypted request had an + // invalid sequence number + // or sessionID, or anything + // for replay attack + // no extra data + // + ctpErrSecPublicKeyBad, // encrypted request is using an + // invalid server public key + // Data: + // UInt8 newPubKey[] + // + // GT, 01-04-99. + ctpErrMsgProxy, // messaging proxy specific error + // Data: + // UInt32 proxyErr + // Char errMsg[] + // + ctpErrRedirectURL, // Redirecting the URL all the way to + // the device, + // Data: + // UInt8 redirectedURL[] + // + ctpWarnTruncated = 0x8000 // response is truncated + } CTPErrEnum; + + +// NOTE: +// ctpErrMalformedRequest is an error at the outer CTP +// layer of the protocol - i.e. the outer wrapper around either a Web or Mail +// request. Errors at this level are very basic, akin to errors at the IP layer +// over TCP/IP networks. This kind of error is discovered before Elaine even +// knows if it's a web or mail request. + +// The ctpErrProxy errors are errors discovered in the "insides" of a CTP request, +// akin to having bad data in an FTP request for example. These aren't +// discovered until the CTP request wrapper has been stripped off and the guts +// of the request have been passed to the portion of Elaine that handles web +// or mail requests specifically. + + +//===================================================== +// Functions +//==================================================== +#ifdef __cplusplus +extern "C" { +#endif + +// +// NOTE: The following routines are no longer "public" system calls. +// They are now static private functions in :Libraries:INet:Src:INetLibWebCTP.c +// that can be included into another source file if needed. +// The only place they are used is in the INetLib and some test code. +// +// UInt32 PrvCTPURLEncode(Char * urlP, UInt8 * dstP, UInt32 * dstBitOffsetP, +// UInt32 dstBitLen); + +// UInt32 PrvCTPURLDecode(UInt8 * srcP, UInt32 * srcBitOffsetP, +// Char * urlP, UInt32 urlBufSize); + +// Convert a base26 ascii string as used in a CTP URL into an +// integer. Return's 0 if no error, updates *strPP to point +// to next character past base26 ascii string. +// UInt32 PrvCTPBase26AToI(Char ** strPP, UInt32 * intP); + + +// MACRO: CtpMaxEncodedURLSize(UInt32 srcByteCount) +// +// Given a source URL size, including terminating zero-byte, returns +// the buffer size (in bytes) that is required to hold the encoded URL; +// +// This value is arrived at as follows: We use the 5-bit encoding with every +// byte escaped as the limit; this consists of 3 scheme bits, 1 encoding bit +// and the string characters where each character is preceded with a 5-bit escape, +// and the terminating zero-byte; plus, we add 10 bytes as a fudge factor for good +// measure. (in this model, every string byte has 5/8ths byte overhead; we +// increase this to 6/8 to get a total of 1 6/8 or 7/4 result bytes for every +// source byte) +// +// *IMPORTANT* if the encoding method changes, this macro will need to be updated. +// +#define CtpMaxEncodedURLSize(srcByteCount) (1 + (srcByteCount * 7 / 4) + 10) + + +#ifdef __cplusplus +} +#endif + +#endif /* _CTP_H_ */ diff --git a/sdk-4/include/Core/System/CharAttr.h b/sdk-4/include/Core/System/CharAttr.h new file mode 100644 index 0000000..5124e4b --- /dev/null +++ b/sdk-4/include/Core/System/CharAttr.h @@ -0,0 +1,121 @@ +/****************************************************************************** + * + * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CharAttr.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This file defines character classification and character + * conversion macros + * + * History: + * April 21, 1995 Created by Art Lamb + * + *****************************************************************************/ + +#ifndef __CHARATTR_H__ +#define __CHARATTR_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + +#ifdef NON_INTERNATIONAL +#define sizeofchar(c) sizeof((char) (c)) +#define lastAsciiChr 0x00FF +#else +#define sizeofchar(c) _Obsolete__use_sizeOf7BitChar +#define lastAsciiChr _Obsolete__lastAsciiChr_does_not_work_for_Japanese +#endif + +// Character attribute code bits. + +#define _XA 0x0200 // extra alphabetic +#define _XS 0x0100 // extra space +#define _BB 0x0080 // BEL, BS, etc. +#define _CN 0x0040 // CR, FF, HT, NL, VT +#define _DI 0x0020 // '0'-'9' +#define _LO 0x0010 // 'a'-'z' and lowercase extended chars. +#define _PU 0x0008 // punctuation +#define _SP 0x0004 // space +#define _UP 0x0002 // 'A'-'Z' and uppercase extended chars. +#define _XD 0x0001 // '0'-'9', 'A'-'F', 'a'-'f' + + +// These macros have all been deprecated and replaced by corresponding TxtCharXXXX +// macros found in TextMgr.h. The main problem is that these all assume 8-bit character +// codes, and thus won't work with Shift JIS and other multi-byte encodings. + +// Character classification macros. + +#ifdef NON_INTERNATIONAL +#define IsAscii(c) (c <= 255) +#define IsAlNum(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_UP|_XA)) +#define IsAlpha(attr,c) (attr[(UInt8)(c)] & (_LO|_UP|_XA)) +#define IsCntrl(attr,c) (attr[(UInt8)(c)] & (_BB|_CN)) +#define IsDigit(attr,c) (attr[(UInt8)(c)] & _DI) +#define IsGraph(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_PU|_UP|_XA)) +#define IsLower(attr,c) (attr[(UInt8)(c)] & _LO) +#define IsPrint(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_PU|_SP|_UP|_XA)) +#define IsPunct(attr,c) (attr[(UInt8)(c)] & _PU) +#define IsSpace(attr,c) (attr[(UInt8)(c)] & (_CN|_SP|_XS)) +#define IsUpper(attr,c) (attr[(UInt8)(c)] & _UP) +#define IsHex(attr,c) (attr[(UInt8)(c)] & _XD) +#define IsDelim(attr,c) (attr[(UInt8)(c)] & _SP|_PU) +#else +#define IsAscii(c) _Obsolete__use_TxtCharIsValid +#define IsAlNum(attr,c) _Obsolete__use_TxtCharIsAlNum +#define IsAlpha(attr,c) _Obsolete__use_TxtCharIsAlpha +#define IsCntrl(attr,c) _Obsolete__use_TxtCharIsCntrl +#define IsDigit(attr,c) _Obsolete__use_TxtCharIsDigit +#define IsGraph(attr,c) _Obsolete__use_TxtCharIsGraph +#define IsLower(attr,c) _Obsolete__use_TxtCharIsLower +#define IsPrint(attr,c) _Obsolete__use_TxtCharIsPrint +#define IsPunct(attr,c) _Obsolete__use_TxtCharIsPunct +#define IsSpace(attr,c) _Obsolete__use_TxtCharIsSpace +#define IsUpper(attr,c) _Obsolete__use_TxtCharIsUpper +#define IsHex(attr,c) _Obsolete__use_TxtCharIsHex +#define IsDelim(attr,c) _Obsolete__use_TxtCharIsDelim +#endif + +// This macro is deprecated because it relies on character code ranges, versus checking +// to ensure that the keydown event has the command bit set in the modifiers field. Use +// the TxtCharIsHardKey macro found in TextMgr.h. + +#ifdef NON_INTERNATIONAL +#define ChrIsHardKey(c) ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr)) +#else +#define ChrIsHardKey(c) _Obsolete__use_TxtCharIsHardKey +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// In 3.1 and later versions of Palm OS, these routines have all been replaced by new +// Text Manager routines found in TextMgr.h + +#ifdef NON_INTERNATIONAL +const UInt16 *GetCharAttr (void) + SYS_TRAP(sysTrapGetCharAttr); + +const UInt8 *GetCharSortValue (void) + SYS_TRAP(sysTrapGetCharSortValue); + +const UInt8 *GetCharCaselessValue (void) + SYS_TRAP(sysTrapGetCharCaselessValue); +#else +#define GetCharAttr() _Obsolete__use_TxtCharIs_macros +#define GetCharSortValue() _Obsolete__use_TxtCompare +#define GetCharCaselessValue() _Obsolete__use_TxtCaselessCompare +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* __CHARATTR_H__ */ diff --git a/sdk-4/include/Core/System/CharLatin.h b/sdk-4/include/Core/System/CharLatin.h new file mode 100644 index 0000000..0375d9a --- /dev/null +++ b/sdk-4/include/Core/System/CharLatin.h @@ -0,0 +1,342 @@ +/****************************************************************************** + * + * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CharLatin.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This file defines the characters found in the Palm OS Latin + * character encoding, which is based on the Microsoft code page + * 1252 character encoding (Microsoft extension to ISO 8859-1 + * character encoding). + * + * History: + * March 5th, 1998 Created by Ken Krugler + * 02 Dec 00 CS Got rid of NON_INTERNATIONAL, since anyone including this + * file is obviously doing so to gain locale-specific info. + * + *****************************************************************************/ + +#ifndef __CHARLATIN_H__ +#define __CHARLATIN_H__ + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Characters found in Chars.h are guaranteed to exist in the regular +// (stdFont, boldFont, largeFont, largeBoldFont) fonts on the device, +// even if the character encoding supported by the device is not Latin. + +// The characters listed below are those from the Palm OS Latin character +// encoding which are not part of every possible character encoding that +// will be supported by the Palm OS, and thus should ONLY be used when +// you have first verified that the device's character encoding is +// +// Characters that are part of code page 1252, but not guaranteed +// to exist in every possible PalmOS encoding. These names are based on +// the Unicode 2.0 standard. + +#define chrReverseSolidus 0x005C // Is yen char in Japanese fonts. + +#define chrEuroSign 0x0080 // Was numeric space (valid thru 3.2) +// Undefined 0x0081 +#define chrSingleLow9QuotationMark 0x0082 +#define chrSmall_F_Hook 0x0083 +#define chrDoubleLow9QuotationMark 0x0084 +#define chrHorizontalEllipsis 0x0085 // Also at 0x18 in 3.1 and later roms. +#define chrDagger 0x0086 +#define chrDoubleDagger 0x0087 +#define chrModifierCircumflexAccent 0x0088 +#define chrPerMilleSign 0x0089 +#define chrCapital_S_Caron 0x008A +#define chrSingleLeftPointingAngleQuotationMark 0x008B +#define chrCapital_OE 0x008C +// Undefined 0x008D // Was diamondChr (valid thru 3.0) +// Undefined 0x008E // Was clubChr (valid thru 3.0) + // Will become chrCapital_Z_Caron +// Undefined 0x008F // Was heartChr (valid thru 3.0) +// Undefined 0x0090 // Was spadeChr (valid thru 3.0) +#define chrLeftSingleQuotationMark 0x0091 +#define chrRightSingleQuotationMark 0x0092 +#define chrLeftDoubleQuotationMark 0x0093 +#define chrRightDoubleQuotationMark 0x0094 +#define chrBullet 0x0095 +#define chrEnDash 0x0096 +#define chrEmDash 0x0097 +#define chrSmallTilde 0x0098 +#define chrTradeMarkSign 0x0099 +#define chrSmall_S_Caron 0x009A +#define chrSingleRightPointingAngleQuotationMark 0x009B +#define chrSmall_OE 0x009C +// Undefined 0x009D // Was command stroke (valid thru 3.0) +// Undefined 0x009E // Was shortcut stroke (valid thru 3.0) + // Will become chrSmall_Z_Caron +#define chrCapital_Y_Diaeresis 0x009F +#define chrNoBreakSpace 0x00A0 +#define chrInvertedExclamationMark 0x00A1 +#define chrCentSign 0x00A2 +#define chrPoundSign 0x00A3 +#define chrCurrencySign 0x00A4 +#define chrYenSign 0x00A5 +#define chrBrokenBar 0x00A6 +#define chrSectionSign 0x00A7 +#define chrDiaeresis 0x00A8 +#define chrCopyrightSign 0x00A9 +#define chrFeminineOrdinalIndicator 0x00AA +#define chrLeftPointingDoubleAngleQuotationMark 0x00AB +#define chrNotSign 0x00AC +#define chrSoftHyphen 0x00AD +#define chrRegisteredSign 0x00AE +#define chrMacron 0x00AF +#define chrDegreeSign 0x00B0 +#define chrPlusMinusSign 0x00B1 +#define chrSuperscriptTwo 0x00B2 +#define chrSuperscriptThree 0x00B3 +#define chrAcuteAccent 0x00B4 +#define chrMicroSign 0x00B5 +#define chrPilcrowSign 0x00B6 +#define chrMiddleDot 0x00B7 +#define chrCedilla 0x00B8 +#define chrSuperscriptOne 0x00B9 +#define chrMasculineOrdinalIndicator 0x00BA +#define chrRightPointingDoubleAngleQuotationMark 0x00BB +#define chrVulgarFractionOneQuarter 0x00BC +#define chrVulgarFractionOneHalf 0x00BD +#define chrVulgarFractionThreeQuarters 0x00BE +#define chrInvertedQuestionMark 0x00BF +#define chrCapital_A_Grave 0x00C0 +#define chrCapital_A_Acute 0x00C1 +#define chrCapital_A_Circumflex 0x00C2 +#define chrCapital_A_Tilde 0x00C3 +#define chrCapital_A_Diaeresis 0x00C4 +#define chrCapital_A_RingAbove 0x00C5 +#define chrCapital_AE 0x00C6 +#define chrCapital_C_Cedilla 0x00C7 +#define chrCapital_E_Grave 0x00C8 +#define chrCapital_E_Acute 0x00C9 +#define chrCapital_E_Circumflex 0x00CA +#define chrCapital_E_Diaeresis 0x00CB +#define chrCapital_I_Grave 0x00CC +#define chrCapital_I_Acute 0x00CD +#define chrCapital_I_Circumflex 0x00CE +#define chrCapital_I_Diaeresis 0x00CF +#define chrCapital_Eth 0x00D0 +#define chrCapital_N_Tilde 0x00D1 +#define chrCapital_O_Grave 0x00D2 +#define chrCapital_O_Acute 0x00D3 +#define chrCapital_O_Circumflex 0x00D4 +#define chrCapital_O_Tilde 0x00D5 +#define chrCapital_O_Diaeresis 0x00D6 +#define chrMultiplicationSign 0x00D7 +#define chrCapital_O_Stroke 0x00D8 +#define chrCapital_U_Grave 0x00D9 +#define chrCapital_U_Acute 0x00DA +#define chrCapital_U_Circumflex 0x00DB +#define chrCapital_U_Diaeresis 0x00DC +#define chrCapital_Y_Acute 0x00DD +#define chrCapital_Thorn 0x00DE +#define chrSmall_SharpS 0x00DF +#define chrSmall_A_Grave 0x00E0 +#define chrSmall_A_Acute 0x00E1 +#define chrSmall_A_Circumflex 0x00E2 +#define chrSmall_A_Tilde 0x00E3 +#define chrSmall_A_Diaeresis 0x00E4 +#define chrSmall_A_RingAbove 0x00E5 +#define chrSmall_AE 0x00E6 +#define chrSmall_C_Cedilla 0x00E7 +#define chrSmall_E_Grave 0x00E8 +#define chrSmall_E_Acute 0x00E9 +#define chrSmall_E_Circumflex 0x00EA +#define chrSmall_E_Diaeresis 0x00EB +#define chrSmall_I_Grave 0x00EC +#define chrSmall_I_Acute 0x00ED +#define chrSmall_I_Circumflex 0x00EE +#define chrSmall_I_Diaeresis 0x00EF +#define chrSmall_Eth 0x00F0 +#define chrSmall_N_Tilde 0x00F1 +#define chrSmall_O_Grave 0x00F2 +#define chrSmall_O_Acute 0x00F3 +#define chrSmall_O_Circumflex 0x00F4 +#define chrSmall_O_Tilde 0x00F5 +#define chrSmall_O_Diaeresis 0x00F6 +#define chrDivisionSign 0x00F7 +#define chrSmall_O_Stroke 0x00F8 +#define chrSmall_U_Grave 0x00F9 +#define chrSmall_U_Acute 0x00FA +#define chrSmall_U_Circumflex 0x00FB +#define chrSmall_U_Diaeresis 0x00FC +#define chrSmall_Y_Acute 0x00FD +#define chrSmall_Thorn 0x00FE +#define chrSmall_Y_Diaeresis 0x00FF + +// Alternative names for some characters. + +#define chrBackslash chrReverseSolidus; +#define chrNonBreakingSpace chrNoBreakSpace; + +// Old character names. + +#define lowSingleCommaQuoteChr chrSingleLow9QuotationMark // 0x0082 +#define scriptFChr chrSmall_F_Hook // 0x0083 +#define lowDblCommaQuoteChr chrDoubleLow9QuotationMark // 0x0084 +#define daggerChr chrDagger // 0x0086 +#define dblDaggerChr chrDoubleDagger // 0x0087 +#define circumflexChr chrModifierCircumflexAccent // 0x0088 +#define perMilleChr chrPerMilleSign // 0x0089 +#define upSHacekChr chrCapital_S_Caron // 0x008A +#define leftSingleGuillemetChr chrSingleLeftPointingAngleQuotationMark // 0x008B +#define upOEChr chrCapital_OE // 0x008C +#define singleOpenCommaQuoteChr chrLeftSingleQuotationMark // 0x0091 +#define singleCloseCommaQuoteChr chrRightSingleQuotationMark // 0x0092 +#define dblOpenCommaQuoteChr chrLeftDoubleQuotationMark // 0x0093 +#define dblCloseCommaQuoteChr chrRightDoubleQuotationMark // 0x0094 +#define bulletChr chrBullet // 0x0095 +#define enDashChr chrEnDash // 0x0096 +#define emDashChr chrEmDash // 0x0097 +#define spacingTildeChr chrSmallTilde // 0x0098 +#define trademarkChr chrTradeMarkSign // 0x0099 +#define lowSHacekChr chrSmall_S_Caron // 0x009A +#define rightSingleGuillemetChr chrSingleRightPointingAngleQuotationMark // 0x009B +#define lowOEChr chrSmall_OE // 0x009C +#define upYDiaeresisChr chrCapital_Y_Diaeresis // 0x009F +#define nonBreakSpaceChr chrNoBreakSpace // 0x00A0 +#define invertedExclamationChr chrInvertedExclamationMark // 0x00A1 +#define centChr chrCentSign // 0x00A2 +#define poundChr chrPoundSign // 0x00A3 +#define currencyChr chrCurrencySign // 0x00A4 +#define yenChr chrYenSign // 0x00A5 +#define brokenVertBarChr chrBrokenBar // 0x00A6 +#define sectionChr chrSectionSign // 0x00A7 +#define spacingDiaeresisChr chrDiaeresis // 0x00A8 +#define copyrightChr chrCopyrightSign // 0x00A9 +#define feminineOrdinalChr chrFeminineOrdinalIndicator // 0x00AA +#define leftGuillemetChr chrLeftPointingDoubleAngleQuotationMark // 0x00AB +#define notChr chrNotSign // 0x00AC +#define softHyphenChr chrSoftHyphen // 0x00AD +#define registeredChr chrRegisteredSign // 0x00AE +#define spacingMacronChr chrMacron // 0x00AF +#define degreeChr chrDegreeSign // 0x00B0 +#define plusMinusChr chrPlusMinusSign // 0x00B1 +#define superscript2Chr chrSuperscriptTwo // 0x00B2 +#define superscript3Chr chrSuperscriptThree // 0x00B3 +#define spacingAcuteChr chrAcuteAccent // 0x00B4 +#define microChr chrMicroSign // 0x00B5 +#define paragraphChr chrPilcrowSign // 0x00B6 +#define middleDotChr chrMiddleDot // 0x00B7 +#define spacingCedillaChr chrCedilla // 0x00B8 +#define superscript1Chr chrSuperscriptOne // 0x00B9 +#define masculineOrdinalChr chrMasculineOrdinalIndicator // 0x00BA +#define rightGuillemetChr chrRightPointingDoubleAngleQuotationMark // 0x00BB +#define fractOneQuarterChr chrVulgarFractionOneQuarter // 0x00BC +#define fractOneHalfChr chrVulgarFractionOneHalf // 0x00BD +#define fractThreeQuartersChr chrVulgarFractionThreeQuarters // 0x00BE +#define invertedQuestionChr chrInvertedQuestionMark // 0x00BF +#define upAGraveChr chrCapital_A_Grave // 0x00C0 +#define upAAcuteChr chrCapital_A_Acute // 0x00C1 +#define upACircumflexChr chrCapital_A_Circumflex // 0x00C2 +#define upATildeChr chrCapital_A_Tilde // 0x00C3 +#define upADiaeresisChr chrCapital_A_Diaeresis // 0x00C4 +#define upARingChr chrCapital_A_RingAbove // 0x00C5 +#define upAEChr chrCapital_AE // 0x00C6 +#define upCCedillaChr chrCapital_C_Cedilla // 0x00C7 +#define upEGraveChr chrCapital_E_Grave // 0x00C8 +#define upEAcuteChr chrCapital_E_Acute // 0x00C9 +#define upECircumflexChr chrCapital_E_Circumflex // 0x00CA +#define upEDiaeresisChr chrCapital_E_Diaeresis // 0x00CB +#define upIGraveChr chrCapital_I_Grave // 0x00CC +#define upIAcuteChr chrCapital_I_Acute // 0x00CD +#define upICircumflexChr chrCapital_I_Circumflex // 0x00CE +#define upIDiaeresisChr chrCapital_I_Diaeresis // 0x00CF +#define upEthChr chrCapital_Eth // 0x00D0 +#define upNTildeChr chrCapital_N_Tilde // 0x00D1 +#define upOGraveChr chrCapital_O_Grave // 0x00D2 +#define upOAcuteChr chrCapital_O_Acute // 0x00D3 +#define upOCircumflexChr chrCapital_O_Circumflex // 0x00D4 +#define upOTildeChr chrCapital_O_Tilde // 0x00D5 +#define upODiaeresisChr chrCapital_O_Diaeresis // 0x00D6 +#define multiplyChr chrMultiplicationSign // 0x00D7 +#define upOSlashChr chrCapital_O_Stroke // 0x00D8 +#define upUGraveChr chrCapital_U_Grave // 0x00D9 +#define upUAcuteChr chrCapital_U_Acute // 0x00DA +#define upUCircumflexChr chrCapital_U_Circumflex // 0x00DB +#define upUDiaeresisChr chrCapital_U_Diaeresis // 0x00DC +#define upYAcuteChr chrCapital_Y_Acute // 0x00DD +#define upThorn chrCapital_Thorn // 0x00DE +#define lowSharpSChr chrSmall_SharpS // 0x00DF +#define lowAGraveChr chrSmall_A_Grave // 0x00E0 +#define lowAAcuteChr chrSmall_A_Acute // 0x00E1 +#define lowACircumflexChr chrSmall_A_Circumflex // 0x00E2 +#define lowATildeChr chrSmall_A_Tilde // 0x00E3 +#define lowADiaeresisChr chrSmall_A_Diaeresis // 0x00E4 +#define lowARingChr chrSmall_A_RingAbove // 0x00E5 +#define lowAEChr chrSmall_AE // 0x00E6 +#define lowCCedillaChr chrSmall_C_Cedilla // 0x00E7 +#define lowEGraveChr chrSmall_E_Grave // 0x00E8 +#define lowEAcuteChr chrSmall_E_Acute // 0x00E9 +#define lowECircumflexChr chrSmall_E_Circumflex // 0x00EA +#define lowEDiaeresisChr chrSmall_E_Diaeresis // 0x00EB +#define lowIGraveChr chrSmall_I_Grave // 0x00EC +#define lowIAcuteChr chrSmall_I_Acute // 0x00ED +#define lowICircumflexChr chrSmall_I_Circumflex // 0x00EE +#define lowIDiaeresisChr chrSmall_I_Diaeresis // 0x00EF +#define lowEthChr chrSmall_Eth // 0x00F0 +#define lowNTildeChr chrSmall_N_Tilde // 0x00F1 +#define lowOGraveChr chrSmall_O_Grave // 0x00F2 +#define lowOAcuteChr chrSmall_O_Acute // 0x00F3 +#define lowOCircumflexChr chrSmall_O_Circumflex // 0x00F4 +#define lowOTildeChr chrSmall_O_Tilde // 0x00F5 +#define lowODiaeresisChr chrSmall_O_Diaeresis // 0x00F6 +#define divideChr chrDivisionSign // 0x00F7 +#define lowOSlashChr chrSmall_O_Stroke // 0x00F8 +#define lowUGraveChr chrSmall_U_Grave // 0x00F9 +#define lowUAcuteChr chrSmall_U_Acute // 0x00FA +#define lowUCircumflexChr chrSmall_U_Circumflex // 0x00FB +#define lowUDiaeresisChr chrSmall_U_Diaeresis // 0x00FC +#define lowYAcuteChr chrSmall_Y_Acute // 0x00FD +#define lowThorn chrSmall_Thorn // 0x00FE +#define lowYDiaeresisChr chrSmall_Y_Diaeresis // 0x00FF + +// The horizEllipsisChr (0x85) still exists in the font, but (in 3.1 and later roms) +// has been duplicated at location 0x18, so that it will be available with all future +// character encodings. If you are running on pre-3.1 roms, then you should use the +// chrHorizontalEllipsis character constant name (0x85), otherwise use chrEllipsis (0x18). +// The ChrHorizEllipsis macro in Chars.h can be used to determine the correct character code. + +#define horizEllipsisChr _Obsolete__use_ChrHorizEllipsis_macro + +// The following characters were moved in the four standard fonts with the +// 3.1 release of PalmOS; they still exist in their old positions in the +// font, but eventually will be removed: +// +// Old character name Old position New character name New position +// +// numericSpaceChr 0x80 chrNumericSpace 0x19 +// commandStrokeChr 0x9D chrCommandStroke 0x16 +// shortcutStrokeChr 0x9E chrShortcutStroke 0x17 + +#define numericSpaceChrV30 0x80 // ** COPIED TO 0x19; will be removed ** +#define commandStrokeChrV30 0x9D // ** COPIED TO 0x16; will be removed ** +#define shortcutStrokeChrV30 0x9E // ** COPIED TO 0x17; will be removed ** + +#define numericSpaceChr _Obsolete__use_ChrNumericSpace_macro +#define commandStrokeChr _Obsolete__use_commandStrokeChrV30_or_chrCommandStroke +#define shortcutStrokeChr _Obsolete__use_shortcutStrokeChrV30_or_chrShortcutStroke + +// The following characters were removed from the four standard fonts and +// placed in the 9pt symbol font (see Chars.h). +// +// diamondChr 0x8D +// clubChr 0x8E +// heartChr 0x8F +// spadeChr 0x90 + +#define diamondChrV30 0x8D // As of PalmOS v3.2, these characters are +#define clubChrV30 0x8E // now available in the Symbol-9 font. They +#define heartChrV30 0x8F // still appear in the regular fonts for now, +#define spadeChrV30 0x90 // but they WILL be removed in a future release. + +#endif // __CHARLATIN_H__ diff --git a/sdk-4/include/Core/System/CharShiftJIS.h b/sdk-4/include/Core/System/CharShiftJIS.h new file mode 100644 index 0000000..8cb3874 --- /dev/null +++ b/sdk-4/include/Core/System/CharShiftJIS.h @@ -0,0 +1,844 @@ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CharShiftJIS.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header file for Shift-JIS (code page 932) Japanese character + * encoding. These are based on Windows-J implementation of the + * Shift-JIS standard. + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 12 Mar 98 kwk New today. + * 06 Apr 98 kwk Reverted back to #define instead of const values. + * 07 Apr 98 kwk Added TxtCharIsHiragana & TxtCharIsKatakana macros. + * 09 Apr 98 kwk Made this entire file conditional on NON_INTERNATIONAL. + * 15 Apr 98 kwk Filled out full set of character names (from Unicode + * 2.0 standard). + * 17 Apr 98 kwk Resolved duplicated names (thanks Microsoft). + * 28 May 98 kwk Put in horizEllipsisChr & numericSpaceChr. + * 29 Jun 98 kwk Changed name from CharCP932.h to CharShiftJIS.h. + * 15 Aug 98 CSS Reworked the extended character attribute #defines so + * we've now got a MicroSoft bit and a bunch of field + * values specifying kana, romaji, kanji, greek, etc. + * that don't overlap with the standard attributes. + * CSS Recoded the TxtCharIsHiragana/Katakana macros to + * AND with class mask and compare with class. + * 23 Aug 98 kwk Added charXClassKanaSound. + * 02 Dec 00 CS Got rid of NON_INTERNATIONAL, since anyone including this + * file is obviously doing so to gain locale-specific info. + * + *****************************************************************************/ + +#ifndef __CHARSHIFTJIS_H__ +#define __CHARSHIFTJIS_H__ + +/*********************************************************************** + * Public macros + ***********************************************************************/ + +#define TxtCharIsHiragana(ch) ( (TxtCharXAttr(ch) & charXClassMask) \ + == charXClassHiragana) +#define TxtCharIsKatakana(ch) ( (TxtCharXAttr(ch) & charXClassMask) \ + == charXClassKatakana) + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Transliteration operations that are not universal, but can be applied +// to Japanese text. + +#define translitOpFullToHalfKatakana (translitOpCustomBase+0) +#define translitOpHalfToFullKatakana (translitOpCustomBase+1) +#define translitOpFullToHalfRomaji (translitOpCustomBase+2) +#define translitOpHalfToFullRomaji (translitOpCustomBase+3) +#define translitOpKatakanaToHiragana (translitOpCustomBase+4) +#define translitOpHiraganaToKatakana (translitOpCustomBase+5) +#define translitOpCombineSoundMark (translitOpCustomBase+6) +#define translitOpDivideSoundMark (translitOpCustomBase+7) +#define translitOpRomajiToHiragana (translitOpCustomBase+8) +#define translitOpHiraganaToRomaji (translitOpCustomBase+9) + +// Extended character attributes for the Shift-JIS (CP932) code page. +// Note that these attributes have to be on an encoding basis, since +// they're shared across all languages which use this encoding. For +// Japanese there's only one language, so we're OK to encode wrapping +// info here, which is often language-dependent. + +#define charXAttrMask 0x00ff +#define charXAttrFollowing 0x0001 +#define charXAttrLeading 0x0002 +#define charXAttrBreak 0x0004 +#define charXAttrMicroSoft 0x0008 + +#define charXClassMask 0x0f00 +#define charXClassRomaji 0x0100 +#define charXClassHiragana 0x0200 +#define charXClassKatakana 0x0300 +#define charXClassKanaSound 0x0400 +#define charXClassGreek 0x0500 +#define charXClassCyrillic 0x0600 +#define charXClassKanjiL1 0x0700 +#define charXClassKanjiL2 0x0800 +#define charXClassKanjiOther 0x0900 +#define charXClassOther 0x0a00 +#define charXClassUndefined 0x0b00 + +// Some ShiftJIS-specific combinations. Every byte in a stream of +// ShiftJIS data must be either a single byte, a single/low byte, +// or a high/low byte. + +#define byteAttrSingleLow (byteAttrSingle | byteAttrLast) +#define byteAttrHighLow (byteAttrFirst | byteAttrLast) + +#define kFirstHighByte 0x81 +#define kFirstLowByte 0x40 + +// Character codes that are specific to Shift JIS. These names +// are generated from the Unicode 2.0 data files. + +#define chrYenSign 0x005c + +#define chrFirstSJISDoubleByte 0x8140 + +#define chrHalfwidthIdeographicFullStop 0x00A1 +#define chrHalfwidthLeftCornerBracket 0x00A2 +#define chrHalfwidthRightCornerBracket 0x00A3 +#define chrHalfwidthIdeographicComma 0x00A4 +#define chrHalfwidthKatakanaMiddleDot 0x00A5 +#define chrHalfwidthKatakana_WO 0x00A6 +#define chrHalfwidthKatakanaSmall_A 0x00A7 +#define chrHalfwidthKatakanaSmall_I 0x00A8 +#define chrHalfwidthKatakanaSmall_U 0x00A9 +#define chrHalfwidthKatakanaSmall_E 0x00AA +#define chrHalfwidthKatakanaSmall_O 0x00AB +#define chrHalfwidthKatakanaSmall_YA 0x00AC +#define chrHalfwidthKatakanaSmall_YU 0x00AD +#define chrHalfwidthKatakanaSmall_YO 0x00AE +#define chrHalfwidthKatakanaSmall_TU 0x00AF +#define chrHalfwidthKatakanaHiraganaProlongedSoundMark 0x00B0 +#define chrHalfwidthKatakana_A 0x00B1 +#define chrHalfwidthKatakana_I 0x00B2 +#define chrHalfwidthKatakana_U 0x00B3 +#define chrHalfwidthKatakana_E 0x00B4 +#define chrHalfwidthKatakana_O 0x00B5 +#define chrHalfwidthKatakana_KA 0x00B6 +#define chrHalfwidthKatakana_KI 0x00B7 +#define chrHalfwidthKatakana_KU 0x00B8 +#define chrHalfwidthKatakana_KE 0x00B9 +#define chrHalfwidthKatakana_KO 0x00BA +#define chrHalfwidthKatakana_SA 0x00BB +#define chrHalfwidthKatakana_SI 0x00BC +#define chrHalfwidthKatakana_SU 0x00BD +#define chrHalfwidthKatakana_SE 0x00BE +#define chrHalfwidthKatakana_SO 0x00BF +#define chrHalfwidthKatakana_TA 0x00C0 +#define chrHalfwidthKatakana_TI 0x00C1 +#define chrHalfwidthKatakana_TU 0x00C2 +#define chrHalfwidthKatakana_TE 0x00C3 +#define chrHalfwidthKatakana_TO 0x00C4 +#define chrHalfwidthKatakana_NA 0x00C5 +#define chrHalfwidthKatakana_NI 0x00C6 +#define chrHalfwidthKatakana_NU 0x00C7 +#define chrHalfwidthKatakana_NE 0x00C8 +#define chrHalfwidthKatakana_NO 0x00C9 +#define chrHalfwidthKatakana_HA 0x00CA +#define chrHalfwidthKatakana_HI 0x00CB +#define chrHalfwidthKatakana_HU 0x00CC +#define chrHalfwidthKatakana_HE 0x00CD +#define chrHalfwidthKatakana_HO 0x00CE +#define chrHalfwidthKatakana_MA 0x00CF +#define chrHalfwidthKatakana_MI 0x00D0 +#define chrHalfwidthKatakana_MU 0x00D1 +#define chrHalfwidthKatakana_ME 0x00D2 +#define chrHalfwidthKatakana_MO 0x00D3 +#define chrHalfwidthKatakana_YA 0x00D4 +#define chrHalfwidthKatakana_YU 0x00D5 +#define chrHalfwidthKatakana_YO 0x00D6 +#define chrHalfwidthKatakana_RA 0x00D7 +#define chrHalfwidthKatakana_RI 0x00D8 +#define chrHalfwidthKatakana_RU 0x00D9 +#define chrHalfwidthKatakana_RE 0x00DA +#define chrHalfwidthKatakana_RO 0x00DB +#define chrHalfwidthKatakana_WA 0x00DC +#define chrHalfwidthKatakana_N 0x00DD +#define chrHalfwidthKatakanaVoicedSoundMark 0x00DE +#define chrHalfwidthKatakanaSemiVoicedSoundMark 0x00DF + +#define chrIdeographicSpace 0x8140 +#define chrIdeographicComma 0x8141 +#define chrIdeographicFullStop 0x8142 +#define chrFullwidthComma 0x8143 +#define chrFullwidthFullStop 0x8144 +#define chrKatakanaMiddleDot 0x8145 +#define chrFullwidthColon 0x8146 +#define chrFullwidthSemicolon 0x8147 +#define chrFullwidthQuestionMark 0x8148 +#define chrFullwidthExclamationMark 0x8149 +#define chrKatakanaHiraganaVoicedSoundMark 0x814A +#define chrKatakanaHiraganaSemiVoicedSoundMark 0x814B +#define chrAcuteAccent 0x814C +#define chrFullwidthGraveAccent 0x814D +#define chrDiaeresis 0x814E +#define chrFullwidthCircumflexAccent 0x814F +#define chrFullwidthMacron 0x8150 +#define chrFullwidthLowLine 0x8151 +#define chrKatakanaIterationMark 0x8152 +#define chrKatakanaVoicedIterationMark 0x8153 +#define chrHiraganaIterationMark 0x8154 +#define chrHiraganaVoicedIterationMark 0x8155 +#define chrDittoMark 0x8156 +#define chrIdeographicIterationMark 0x8158 +#define chrIdeographicClosingMark 0x8159 +#define chrIdeographicNumberZero 0x815A +#define chrKatakanaHiraganaProlongedSoundMark 0x815B +#define chrHorizontalBar 0x815C +#define chrHyphen 0x815D +#define chrFullwidthSolidus 0x815E +#define chrFullwidthReverseSolidus 0x815F +#define chrFullwidthTilde 0x8160 +#define chrParallelTo 0x8161 +#define chrFullwidthVerticalLine 0x8162 +#define chrFullwidthHorizontalEllipsis 0x8163 +#define chrTwoDotLeader 0x8164 +#define chrLeftSingleQuotationMark 0x8165 +#define chrRightSingleQuotationMark 0x8166 +#define chrLeftDoubleQuotationMark 0x8167 +#define chrRightDoubleQuotationMark 0x8168 +#define chrFullwidthLeftParenthesis 0x8169 +#define chrFullwidthRightParenthesis 0x816A +#define chrLeftTortoiseShellBracket 0x816B +#define chrRightTortoiseShellBracket 0x816C +#define chrFullwidthLeftSquareBracket 0x816D +#define chrFullwidthRightSquareBracket 0x816E +#define chrFullwidthLeftCurlyBracket 0x816F +#define chrFullwidthRightCurlyBracket 0x8170 +#define chrLeftAngleBracket 0x8171 +#define chrRightAngleBracket 0x8172 +#define chrLeftDoubleAngleBracket 0x8173 +#define chrRightDoubleAngleBracket 0x8174 +#define chrLeftCornerBracket 0x8175 +#define chrRightCornerBracket 0x8176 +#define chrLeftWhiteCornerBracket 0x8177 +#define chrRightWhiteCornerBracket 0x8178 +#define chrLeftBlackLenticularBracket 0x8179 +#define chrRightBlackLenticularBracket 0x817A +#define chrFullwidthPlusSign 0x817B +#define chrFullwidthHyphenMinus 0x817C +#define chrPlusMinusSign 0x817D +#define chrMultiplicationSign 0x817E +#define chrDivisionSign 0x8180 +#define chrFullwidthEqualsSign 0x8181 +#define chrNotEqualTo 0x8182 +#define chrFullwidthLessThanSign 0x8183 +#define chrFullwidthGreaterThanSign 0x8184 +#define chrLessThanOverEqualTo 0x8185 +#define chrGreaterThanOverEqualTo 0x8186 +#define chrInfinity 0x8187 +#define chrTherefore 0x8188 +#define chrMaleSign 0x8189 +#define chrFemaleSign 0x818A +#define chrDegreeSign 0x818B +#define chrPrime 0x818C +#define chrDoublePrime 0x818D +#define chrDegreeCelsius 0x818E +#define chrFullwidthYenSign 0x818F +#define chrFullwidthDollarSign 0x8190 +#define chrFullwidthCentSign 0x8191 +#define chrFullwidthPoundSign 0x8192 +#define chrFullwidthPercentSign 0x8193 +#define chrFullwidthNumberSign 0x8194 +#define chrFullwidthAmpersand 0x8195 +#define chrFullwidthAsterisk 0x8196 +#define chrFullwidthCommercialAt 0x8197 +#define chrSectionSign 0x8198 +#define chrWhiteStar 0x8199 +#define chrBlackStar 0x819A +#define chrWhiteCircle 0x819B +#define chrBlackCircle 0x819C +#define chrBullseye 0x819D +#define chrWhiteDiamond 0x819E +#define chrBlackDiamond 0x819F +#define chrWhiteSquare 0x81A0 +#define chrBlackSquare 0x81A1 +#define chrWhiteUpPointingTriangle 0x81A2 +#define chrBlackUpPointingTriangle 0x81A3 +#define chrWhiteDownPointingTriangle 0x81A4 +#define chrBlackDownPointingTriangle 0x81A5 +#define chrReferenceMark 0x81A6 +#define chrPostalMark 0x81A7 +#define chrRightwardsArrow 0x81A8 +#define chrLeftwardsArrow 0x81A9 +#define chrUpwardsArrow 0x81AA +#define chrDownwardsArrow 0x81AB +#define chrGetaMark 0x81AC +#define chrElementOf 0x81B8 +#define chrContainsAsMember 0x81B9 +#define chrSubsetOfOrEqualTo 0x81BA +#define chrSupersetOfOrEqualTo 0x81BB +#define chrSubsetOf 0x81BC +#define chrSupersetOf 0x81BD +#define chrUnion 0x81BE +#define chrIntersection 0x81BF +#define chrLogicalAnd 0x81C8 +#define chrLogicalOr 0x81C9 +#define chrFullwidthNotSign 0x81CA +#define chrRightwardsDoubleArrow 0x81CB +#define chrLeftRightDoubleArrow 0x81CC +#define chrForAll 0x81CD +#define chrThereExists 0x81CE +#define chrAngle 0x81DA +#define chrUpTack 0x81DB +#define chrArc 0x81DC +#define chrPartialDifferential 0x81DD +#define chrNabla 0x81DE +#define chrIdenticalTo 0x81DF +#define chrApproximatelyEqualToOrTheImageOf 0x81E0 +#define chrMuchLessThan 0x81E1 +#define chrMuchGreaterThan 0x81E2 +#define chrSquareRoot 0x81E3 +#define chrReversedTilde 0x81E4 +#define chrProportionalTo 0x81E5 +#define chrBecause 0x81E6 +#define chrIntegral 0x81E7 +#define chrDoubleIntegral 0x81E8 +#define chrAngstromSign 0x81F0 +#define chrPerMilleSign 0x81F1 +#define chrMusicSharpSign 0x81F2 +#define chrMusicFlatSign 0x81F3 +#define chrEighthNote 0x81F4 +#define chrDagger 0x81F5 +#define chrDoubleDagger 0x81F6 +#define chrPilcrowSign 0x81F7 +#define chrLargeCircle 0x81FC + +#define chrFullwidthDigitZero 0x824F +#define chrFullwidthDigitOne 0x8250 +#define chrFullwidthDigitTwo 0x8251 +#define chrFullwidthDigitThree 0x8252 +#define chrFullwidthDigitFour 0x8253 +#define chrFullwidthDigitFive 0x8254 +#define chrFullwidthDigitSix 0x8255 +#define chrFullwidthDigitSeven 0x8256 +#define chrFullwidthDigitEight 0x8257 +#define chrFullwidthDigitNine 0x8258 +#define chrFullwidthCapital_A 0x8260 +#define chrFullwidthCapital_B 0x8261 +#define chrFullwidthCapital_C 0x8262 +#define chrFullwidthCapital_D 0x8263 +#define chrFullwidthCapital_E 0x8264 +#define chrFullwidthCapital_F 0x8265 +#define chrFullwidthCapital_G 0x8266 +#define chrFullwidthCapital_H 0x8267 +#define chrFullwidthCapital_I 0x8268 +#define chrFullwidthCapital_J 0x8269 +#define chrFullwidthCapital_K 0x826A +#define chrFullwidthCapital_L 0x826B +#define chrFullwidthCapital_M 0x826C +#define chrFullwidthCapital_N 0x826D +#define chrFullwidthCapital_O 0x826E +#define chrFullwidthCapital_P 0x826F +#define chrFullwidthCapital_Q 0x8270 +#define chrFullwidthCapital_R 0x8271 +#define chrFullwidthCapital_S 0x8272 +#define chrFullwidthCapital_T 0x8273 +#define chrFullwidthCapital_U 0x8274 +#define chrFullwidthCapital_V 0x8275 +#define chrFullwidthCapital_W 0x8276 +#define chrFullwidthCapital_X 0x8277 +#define chrFullwidthCapital_Y 0x8278 +#define chrFullwidthCapital_Z 0x8279 +#define chrFullwidthSmall_A 0x8281 +#define chrFullwidthSmall_B 0x8282 +#define chrFullwidthSmall_C 0x8283 +#define chrFullwidthSmall_D 0x8284 +#define chrFullwidthSmall_E 0x8285 +#define chrFullwidthSmall_F 0x8286 +#define chrFullwidthSmall_G 0x8287 +#define chrFullwidthSmall_H 0x8288 +#define chrFullwidthSmall_I 0x8289 +#define chrFullwidthSmall_J 0x828A +#define chrFullwidthSmall_K 0x828B +#define chrFullwidthSmall_L 0x828C +#define chrFullwidthSmall_M 0x828D +#define chrFullwidthSmall_N 0x828E +#define chrFullwidthSmall_O 0x828F +#define chrFullwidthSmall_P 0x8290 +#define chrFullwidthSmall_Q 0x8291 +#define chrFullwidthSmall_R 0x8292 +#define chrFullwidthSmall_S 0x8293 +#define chrFullwidthSmall_T 0x8294 +#define chrFullwidthSmall_U 0x8295 +#define chrFullwidthSmall_V 0x8296 +#define chrFullwidthSmall_W 0x8297 +#define chrFullwidthSmall_X 0x8298 +#define chrFullwidthSmall_Y 0x8299 +#define chrFullwidthSmall_Z 0x829A + +#define chrHiraganaSmall_A 0x829F +#define chrHiragana_A 0x82A0 +#define chrHiraganaSmall_I 0x82A1 +#define chrHiragana_I 0x82A2 +#define chrHiraganaSmall_U 0x82A3 +#define chrHiragana_U 0x82A4 +#define chrHiraganaSmall_E 0x82A5 +#define chrHiragana_E 0x82A6 +#define chrHiraganaSmall_O 0x82A7 +#define chrHiragana_O 0x82A8 +#define chrHiragana_KA 0x82A9 +#define chrHiragana_GA 0x82AA +#define chrHiragana_KI 0x82AB +#define chrHiragana_GI 0x82AC +#define chrHiragana_KU 0x82AD +#define chrHiragana_GU 0x82AE +#define chrHiragana_KE 0x82AF +#define chrHiragana_GE 0x82B0 +#define chrHiragana_KO 0x82B1 +#define chrHiragana_GO 0x82B2 +#define chrHiragana_SA 0x82B3 +#define chrHiragana_ZA 0x82B4 +#define chrHiragana_SI 0x82B5 +#define chrHiragana_ZI 0x82B6 +#define chrHiragana_SU 0x82B7 +#define chrHiragana_ZU 0x82B8 +#define chrHiragana_SE 0x82B9 +#define chrHiragana_ZE 0x82BA +#define chrHiragana_SO 0x82BB +#define chrHiragana_ZO 0x82BC +#define chrHiragana_TA 0x82BD +#define chrHiragana_DA 0x82BE +#define chrHiragana_TI 0x82BF +#define chrHiragana_DI 0x82C0 +#define chrHiraganaSmall_TU 0x82C1 +#define chrHiragana_TU 0x82C2 +#define chrHiragana_DU 0x82C3 +#define chrHiragana_TE 0x82C4 +#define chrHiragana_DE 0x82C5 +#define chrHiragana_TO 0x82C6 +#define chrHiragana_DO 0x82C7 +#define chrHiragana_NA 0x82C8 +#define chrHiragana_NI 0x82C9 +#define chrHiragana_NU 0x82CA +#define chrHiragana_NE 0x82CB +#define chrHiragana_NO 0x82CC +#define chrHiragana_HA 0x82CD +#define chrHiragana_BA 0x82CE +#define chrHiragana_PA 0x82CF +#define chrHiragana_HI 0x82D0 +#define chrHiragana_BI 0x82D1 +#define chrHiragana_PI 0x82D2 +#define chrHiragana_HU 0x82D3 +#define chrHiragana_BU 0x82D4 +#define chrHiragana_PU 0x82D5 +#define chrHiragana_HE 0x82D6 +#define chrHiragana_BE 0x82D7 +#define chrHiragana_PE 0x82D8 +#define chrHiragana_HO 0x82D9 +#define chrHiragana_BO 0x82DA +#define chrHiragana_PO 0x82DB +#define chrHiragana_MA 0x82DC +#define chrHiragana_MI 0x82DD +#define chrHiragana_MU 0x82DE +#define chrHiragana_ME 0x82DF +#define chrHiragana_MO 0x82E0 +#define chrHiraganaSmall_YA 0x82E1 +#define chrHiragana_YA 0x82E2 +#define chrHiraganaSmall_YU 0x82E3 +#define chrHiragana_YU 0x82E4 +#define chrHiraganaSmall_YO 0x82E5 +#define chrHiragana_YO 0x82E6 +#define chrHiragana_RA 0x82E7 +#define chrHiragana_RI 0x82E8 +#define chrHiragana_RU 0x82E9 +#define chrHiragana_RE 0x82EA +#define chrHiragana_RO 0x82EB +#define chrHiraganaSmall_WA 0x82EC +#define chrHiragana_WA 0x82ED +#define chrHiragana_WI 0x82EE +#define chrHiragana_WE 0x82EF +#define chrHiragana_WO 0x82F0 +#define chrHiragana_N 0x82F1 + +#define chrKatakanaSmall_A 0x8340 +#define chrKatakana_A 0x8341 +#define chrKatakanaSmall_I 0x8342 +#define chrKatakana_I 0x8343 +#define chrKatakanaSmall_U 0x8344 +#define chrKatakana_U 0x8345 +#define chrKatakanaSmall_E 0x8346 +#define chrKatakana_E 0x8347 +#define chrKatakanaSmall_O 0x8348 +#define chrKatakana_O 0x8349 +#define chrKatakana_KA 0x834A +#define chrKatakana_GA 0x834B +#define chrKatakana_KI 0x834C +#define chrKatakana_GI 0x834D +#define chrKatakana_KU 0x834E +#define chrKatakana_GU 0x834F +#define chrKatakana_KE 0x8350 +#define chrKatakana_GE 0x8351 +#define chrKatakana_KO 0x8352 +#define chrKatakana_GO 0x8353 +#define chrKatakana_SA 0x8354 +#define chrKatakana_ZA 0x8355 +#define chrKatakana_SI 0x8356 +#define chrKatakana_ZI 0x8357 +#define chrKatakana_SU 0x8358 +#define chrKatakana_ZU 0x8359 +#define chrKatakana_SE 0x835A +#define chrKatakana_ZE 0x835B +#define chrKatakana_SO 0x835C +#define chrKatakana_ZO 0x835D +#define chrKatakana_TA 0x835E +#define chrKatakana_DA 0x835F +#define chrKatakana_TI 0x8360 +#define chrKatakana_DI 0x8361 +#define chrKatakanaSmall_TU 0x8362 +#define chrKatakana_TU 0x8363 +#define chrKatakana_DU 0x8364 +#define chrKatakana_TE 0x8365 +#define chrKatakana_DE 0x8366 +#define chrKatakana_TO 0x8367 +#define chrKatakana_DO 0x8368 +#define chrKatakana_NA 0x8369 +#define chrKatakana_NI 0x836A +#define chrKatakana_NU 0x836B +#define chrKatakana_NE 0x836C +#define chrKatakana_NO 0x836D +#define chrKatakana_HA 0x836E +#define chrKatakana_BA 0x836F +#define chrKatakana_PA 0x8370 +#define chrKatakana_HI 0x8371 +#define chrKatakana_BI 0x8372 +#define chrKatakana_PI 0x8373 +#define chrKatakana_HU 0x8374 +#define chrKatakana_BU 0x8375 +#define chrKatakana_PU 0x8376 +#define chrKatakana_HE 0x8377 +#define chrKatakana_BE 0x8378 +#define chrKatakana_PE 0x8379 +#define chrKatakana_HO 0x837A +#define chrKatakana_BO 0x837B +#define chrKatakana_PO 0x837C +#define chrKatakana_MA 0x837D +#define chrKatakana_MI 0x837E +#define chrKatakana_MU 0x8380 +#define chrKatakana_ME 0x8381 +#define chrKatakana_MO 0x8382 +#define chrKatakanaSmall_YA 0x8383 +#define chrKatakana_YA 0x8384 +#define chrKatakanaSmall_YU 0x8385 +#define chrKatakana_YU 0x8386 +#define chrKatakanaSmall_YO 0x8387 +#define chrKatakana_YO 0x8388 +#define chrKatakana_RA 0x8389 +#define chrKatakana_RI 0x838A +#define chrKatakana_RU 0x838B +#define chrKatakana_RE 0x838C +#define chrKatakana_RO 0x838D +#define chrKatakanaSmall_WA 0x838E +#define chrKatakana_WA 0x838F +#define chrKatakana_WI 0x8390 +#define chrKatakana_WE 0x8391 +#define chrKatakana_WO 0x8392 +#define chrKatakana_N 0x8393 +#define chrKatakana_VU 0x8394 +#define chrKatakanaSmall_KA 0x8395 +#define chrKatakanaSmall_KE 0x8396 + +#define chrGreekCapitalAlpha 0x839F +#define chrGreekCapitalBeta 0x83A0 +#define chrGreekCapitalGamma 0x83A1 +#define chrGreekCapitalDelta 0x83A2 +#define chrGreekCapitalEpsilon 0x83A3 +#define chrGreekCapitalZeta 0x83A4 +#define chrGreekCapitalEta 0x83A5 +#define chrGreekCapitalTheta 0x83A6 +#define chrGreekCapitalIota 0x83A7 +#define chrGreekCapitalKappa 0x83A8 +#define chrGreekCapitalLamda 0x83A9 +#define chrGreekCapitalMu 0x83AA +#define chrGreekCapitalNu 0x83AB +#define chrGreekCapitalXi 0x83AC +#define chrGreekCapitalOmicron 0x83AD +#define chrGreekCapitalPi 0x83AE +#define chrGreekCapitalRho 0x83AF +#define chrGreekCapitalSigma 0x83B0 +#define chrGreekCapitalTau 0x83B1 +#define chrGreekCapitalUpsilon 0x83B2 +#define chrGreekCapitalPhi 0x83B3 +#define chrGreekCapitalChi 0x83B4 +#define chrGreekCapitalPsi 0x83B5 +#define chrGreekCapitalOmega 0x83B6 +#define chrGreekSmallAlpha 0x83BF +#define chrGreekSmallBeta 0x83C0 +#define chrGreekSmallGamma 0x83C1 +#define chrGreekSmallDelta 0x83C2 +#define chrGreekSmallEpsilon 0x83C3 +#define chrGreekSmallZeta 0x83C4 +#define chrGreekSmallEta 0x83C5 +#define chrGreekSmallTheta 0x83C6 +#define chrGreekSmallIota 0x83C7 +#define chrGreekSmallKappa 0x83C8 +#define chrGreekSmallLamda 0x83C9 +#define chrGreekSmallMu 0x83CA +#define chrGreekSmallNu 0x83CB +#define chrGreekSmallXi 0x83CC +#define chrGreekSmallOmicron 0x83CD +#define chrGreekSmallPi 0x83CE +#define chrGreekSmallRho 0x83CF +#define chrGreekSmallSigma 0x83D0 +#define chrGreekSmallTau 0x83D1 +#define chrGreekSmallUpsilon 0x83D2 +#define chrGreekSmallPhi 0x83D3 +#define chrGreekSmallChi 0x83D4 +#define chrGreekSmallPsi 0x83D5 +#define chrGreekSmallOmega 0x83D6 + +#define chrCyrillicCapital_A 0x8440 +#define chrCyrillicCapital_BE 0x8441 +#define chrCyrillicCapital_VE 0x8442 +#define chrCyrillicCapital_GHE 0x8443 +#define chrCyrillicCapital_DE 0x8444 +#define chrCyrillicCapital_IE 0x8445 +#define chrCyrillicCapital_IO 0x8446 +#define chrCyrillicCapital_ZHE 0x8447 +#define chrCyrillicCapital_ZE 0x8448 +#define chrCyrillicCapital_I 0x8449 +#define chrCyrillicCapitalShort_I 0x844A +#define chrCyrillicCapital_KA 0x844B +#define chrCyrillicCapital_EL 0x844C +#define chrCyrillicCapital_EM 0x844D +#define chrCyrillicCapital_EN 0x844E +#define chrCyrillicCapital_O 0x844F +#define chrCyrillicCapital_PE 0x8450 +#define chrCyrillicCapital_ER 0x8451 +#define chrCyrillicCapital_ES 0x8452 +#define chrCyrillicCapital_TE 0x8453 +#define chrCyrillicCapital_U 0x8454 +#define chrCyrillicCapital_EF 0x8455 +#define chrCyrillicCapital_HA 0x8456 +#define chrCyrillicCapital_TSE 0x8457 +#define chrCyrillicCapital_CHE 0x8458 +#define chrCyrillicCapital_SHA 0x8459 +#define chrCyrillicCapital_SHCHA 0x845A +#define chrCyrillicCapitalHardSign 0x845B +#define chrCyrillicCapital_YERU 0x845C +#define chrCyrillicCapitalSoftSign 0x845D +#define chrCyrillicCapital_E 0x845E +#define chrCyrillicCapital_YU 0x845F +#define chrCyrillicCapital_YA 0x8460 +#define chrCyrillicSmall_A 0x8470 +#define chrCyrillicSmall_BE 0x8471 +#define chrCyrillicSmall_VE 0x8472 +#define chrCyrillicSmall_GHE 0x8473 +#define chrCyrillicSmall_DE 0x8474 +#define chrCyrillicSmall_IE 0x8475 +#define chrCyrillicSmall_IO 0x8476 +#define chrCyrillicSmall_ZHE 0x8477 +#define chrCyrillicSmall_ZE 0x8478 +#define chrCyrillicSmall_I 0x8479 +#define chrCyrillicSmallShort_I 0x847A +#define chrCyrillicSmall_KA 0x847B +#define chrCyrillicSmall_EL 0x847C +#define chrCyrillicSmall_EM 0x847D +#define chrCyrillicSmall_EN 0x847E +#define chrCyrillicSmall_O 0x8480 +#define chrCyrillicSmall_PE 0x8481 +#define chrCyrillicSmall_ER 0x8482 +#define chrCyrillicSmall_ES 0x8483 +#define chrCyrillicSmall_TE 0x8484 +#define chrCyrillicSmall_U 0x8485 +#define chrCyrillicSmall_EF 0x8486 +#define chrCyrillicSmall_HA 0x8487 +#define chrCyrillicSmall_TSE 0x8488 +#define chrCyrillicSmall_CHE 0x8489 +#define chrCyrillicSmall_SHA 0x848A +#define chrCyrillicSmall_SHCHA 0x848B +#define chrCyrillicSmallHardSign 0x848C +#define chrCyrillicSmall_YERU 0x848D +#define chrCyrillicSmallSoftSign 0x848E +#define chrCyrillicSmall_E 0x848F +#define chrCyrillicSmall_YU 0x8490 +#define chrCyrillicSmall_YA 0x8491 + +#define chrBoxDrawingsLightHorizontal 0x849F +#define chrBoxDrawingsLightVertical 0x84A0 +#define chrBoxDrawingsLightDownAndRight 0x84A1 +#define chrBoxDrawingsLightDownAndLeft 0x84A2 +#define chrBoxDrawingsLightUpAndLeft 0x84A3 +#define chrBoxDrawingsLightUpAndRight 0x84A4 +#define chrBoxDrawingsLightVerticalAndRight 0x84A5 +#define chrBoxDrawingsLightDownAndHorizontal 0x84A6 +#define chrBoxDrawingsLightVerticalAndLeft 0x84A7 +#define chrBoxDrawingsLightUpAndHorizontal 0x84A8 +#define chrBoxDrawingsLightVerticalAndHorizontal 0x84A9 +#define chrBoxDrawingsHeavyHorizontal 0x84AA +#define chrBoxDrawingsHeavyVertical 0x84AB +#define chrBoxDrawingsHeavyDownAndRight 0x84AC +#define chrBoxDrawingsHeavyDownAndLeft 0x84AD +#define chrBoxDrawingsHeavyUpAndLeft 0x84AE +#define chrBoxDrawingsHeavyUpAndRight 0x84AF +#define chrBoxDrawingsHeavyVerticalAndRight 0x84B0 +#define chrBoxDrawingsHeavyDownAndHorizontal 0x84B1 +#define chrBoxDrawingsHeavyVerticalAndLeft 0x84B2 +#define chrBoxDrawingsHeavyUpAndHorizontal 0x84B3 +#define chrBoxDrawingsHeavyVerticalAndHorizontal 0x84B4 +#define chrBoxDrawingsVerticalHeavyAndRightLight 0x84B5 +#define chrBoxDrawingsDownLightAndHorizontalHeavy 0x84B6 +#define chrBoxDrawingsVerticalHeavyAndLeftLight 0x84B7 +#define chrBoxDrawingsUpLightAndHorizontalHeavy 0x84B8 +#define chrBoxDrawingsVerticalLightAndHorizontalHeavy 0x84B9 +#define chrBoxDrawingsVerticalLightAndRightHeavy 0x84BA +#define chrBoxDrawingsDownHeavyAndHorizontalLight 0x84BB +#define chrBoxDrawingsVerticalLightAndLeftHeavy 0x84BC +#define chrBoxDrawingsUpHeavyAndHorizontalLight 0x84BD +#define chrBoxDrawingsVerticalHeavyAndHorizontalLight 0x84BE + +#define chrCircledDigitOne 0x8740 +#define chrCircledDigitTwo 0x8741 +#define chrCircledDigitThree 0x8742 +#define chrCircledDigitFour 0x8743 +#define chrCircledDigitFive 0x8744 +#define chrCircledDigitSix 0x8745 +#define chrCircledDigitSeven 0x8746 +#define chrCircledDigitEight 0x8747 +#define chrCircledDigitNine 0x8748 +#define chrCircledNumberTen 0x8749 +#define chrCircledNumberEleven 0x874A +#define chrCircledNumberTwelve 0x874B +#define chrCircledNumberThirteen 0x874C +#define chrCircledNumberFourteen 0x874D +#define chrCircledNumberFifteen 0x874E +#define chrCircledNumberSixteen 0x874F +#define chrCircledNumberSeventeen 0x8750 +#define chrCircledNumberEighteen 0x8751 +#define chrCircledNumberNineteen 0x8752 +#define chrCircledNumberTwenty 0x8753 +#define chrRomanNumeralOne 0x8754 +#define chrRomanNumeralTwo 0x8755 +#define chrRomanNumeralThree 0x8756 +#define chrRomanNumeralFour 0x8757 +#define chrRomanNumeralFive 0x8758 +#define chrRomanNumeralSix 0x8759 +#define chrRomanNumeralSeven 0x875A +#define chrRomanNumeralEight 0x875B +#define chrRomanNumeralNine 0x875C +#define chrRomanNumeralTen 0x875D +#define chrSquareMiri 0x875F +#define chrSquareKiro 0x8760 +#define chrSquareSenti 0x8761 +#define chrSquareMeetoru 0x8762 +#define chrSquareGuramu 0x8763 +#define chrSquareTon 0x8764 +#define chrSquareAaru 0x8765 +#define chrSquareHekutaaru 0x8766 +#define chrSquareRittoru 0x8767 +#define chrSquareWatto 0x8768 +#define chrSquareKarorii 0x8769 +#define chrSquareDoru 0x876A +#define chrSquareSento 0x876B +#define chrSquarePaasento 0x876C +#define chrSquareMiribaaru 0x876D +#define chrSquarePeezi 0x876E +#define chrSquareMm 0x876F +#define chrSquareCm 0x8770 +#define chrSquareKm 0x8771 +#define chrSquareMg 0x8772 +#define chrSquareKg 0x8773 +#define chrSquareCc 0x8774 +#define chrSquareMSquared 0x8775 +#define chrSquareEraNameHeisei 0x877E +#define chrReversedDoublePrimeQuotationMark 0x8780 +#define chrLowDoublePrimeQuotationMark 0x8781 +#define chrNumeroSign 0x8782 +#define chrSquareKk 0x8783 +#define chrTelephoneSign 0x8784 +#define chrCircledIdeographHigh 0x8785 +#define chrCircledIdeographCentre 0x8786 +#define chrCircledIdeographLow 0x8787 +#define chrCircledIdeographLeft 0x8788 +#define chrCircledIdeographRight 0x8789 +#define chrParenthesizedIdeographStock 0x878A +#define chrParenthesizedIdeographHave 0x878B +#define chrParenthesizedIdeographRepresent 0x878C +#define chrSquareEraNameMeizi 0x878D +#define chrSquareEraNameTaisyou 0x878E +#define chrSquareEraNameSyouwa 0x878F +#define chrApproximatelyEqualToOrTheImageOfDup 0x8790 // Same as 0x81E0 +#define chrIdenticalToDup 0x8791 // Same as 0x81DF +#define chrIntegralDup 0x8792 // Same as 0x81E7 +#define chrContourIntegral 0x8793 +#define chrNArySummation 0x8794 +#define chrSquareRootDup 0x8795 // Same as 0x81E3 +#define chrUpTackDup 0x8796 // Same as 0x81DB +#define chrAngleDup 0x8797 // Same as 0x81DA +#define chrRightAngle 0x8798 +#define chrRightTriangle 0x8799 +#define chrBecauseDup 0x879A // Same as 0x81E6 +#define chrIntersectionDup 0x879B // Same as 0x81BF +#define chrUnionDup 0x879C // Same as 0x81BE + +#define chrSmallRomanNumeralOne 0xEEEF +#define chrSmallRomanNumeralTwo 0xEEF0 +#define chrSmallRomanNumeralThree 0xEEF1 +#define chrSmallRomanNumeralFour 0xEEF2 +#define chrSmallRomanNumeralFive 0xEEF3 +#define chrSmallRomanNumeralSix 0xEEF4 +#define chrSmallRomanNumeralSeven 0xEEF5 +#define chrSmallRomanNumeralEight 0xEEF6 +#define chrSmallRomanNumeralNine 0xEEF7 +#define chrSmallRomanNumeralTen 0xEEF8 +#define chrFullwidthNotSignDup 0xEEF9 // Same as 0x81CA +#define chrFullwidthBrokenBar 0xEEFA +#define chrFullwidthApostrophe 0xEEFB +#define chrFullwidthQuotationMark 0xEEFC + +#define chrSmallRomanNumeralOneDup 0xFA40 // Same as 0xEEEF +#define chrSmallRomanNumeralTwoDup 0xFA41 // Same as 0xEEF0 +#define chrSmallRomanNumeralThreeDup 0xFA42 // Same as 0xEEF1 +#define chrSmallRomanNumeralFourDup 0xFA43 // Same as 0xEEF2 +#define chrSmallRomanNumeralFiveDup 0xFA44 // Same as 0xEEF3 +#define chrSmallRomanNumeralSixDup 0xFA45 // Same as 0xEEF4 +#define chrSmallRomanNumeralSevenDup 0xFA46 // Same as 0xEEF5 +#define chrSmallRomanNumeralEightDup 0xFA47 // Same as 0xEEF6 +#define chrSmallRomanNumeralNineDup 0xFA48 // Same as 0xEEF7 +#define chrSmallRomanNumeralTenDup 0xFA49 // Same as 0xEEF8 +#define chrRomanNumeralOneDup 0xFA4A // Same as 0x8754 +#define chrRomanNumeralTwoDup 0xFA4B // Same as 0x8755 +#define chrRomanNumeralThreeDup 0xFA4C // Same as 0x8756 +#define chrRomanNumeralFourDup 0xFA4D // Same as 0x8757 +#define chrRomanNumeralFiveDup 0xFA4E // Same as 0x8758 +#define chrRomanNumeralSixDup 0xFA4F // Same as 0x8759 +#define chrRomanNumeralSevenDup 0xFA50 // Same as 0x875A +#define chrRomanNumeralEightDup 0xFA51 // Same as 0x875B +#define chrRomanNumeralNineDup 0xFA52 // Same as 0x875C +#define chrRomanNumeralTenDup 0xFA53 // Same as 0x875D +#define chrFullwidthNotSignDup2 0xFA54 // Same as 0xEEF9 & 0x81CA +#define chrFullwidthBrokenBarDup 0xFA55 // Same as 0xEEFA +#define chrFullwidthApostropheDup 0xFA56 // Same as 0xEEFB +#define chrFullwidthQuotationMarkDup 0xFA57 // Same as 0xEEFC +#define chrParenthesizedIdeographStockDup 0xFA58 // Same as 0x878A +#define chrNumeroSignDup 0xFA59 // Same as 0x8782 +#define chrTelephoneSignDup 0xFA5A // Same as 0x8784 +#define chrBecauseDup2 0xFA5B // Same as 0x81E6 & 0x879A + +#define chrLastSJISDoubleByte 0xFCFC + +// Alternative character names. + +#define chrChouon chrKatakanaHiraganaProlongedSoundMark + +// Old character names. + +#define yenChr chrYenSign + +#endif // __CHARSHIFTJIS_H__ diff --git a/sdk-4/include/Core/System/Chars.h b/sdk-4/include/Core/System/Chars.h new file mode 100644 index 0000000..6f176ea --- /dev/null +++ b/sdk-4/include/Core/System/Chars.h @@ -0,0 +1,438 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __CHARS_H__ +#define __CHARS_H__ + +// Standard Unicode 2.0 names for the ascii characters. These exist in +// all of the text fonts, no matter what character encoding is being +// used by PalmOS. + +#define chrNull 0x0000 +#define chrStartOfHeading 0x0001 +#define chrStartOfText 0x0002 +#define chrEndOfText 0x0003 +#define chrEndOfTransmission 0x0004 +#define chrEnquiry 0x0005 +#define chrAcknowledge 0x0006 +#define chrBell 0x0007 +#define chrBackspace 0x0008 +#define chrHorizontalTabulation 0x0009 +#define chrLineFeed 0x000A +#define chrVerticalTabulation 0x000B +#define chrFormFeed 0x000C +#define chrCarriageReturn 0x000D +#define chrShiftOut 0x000E +#define chrShiftIn 0x000F +#define chrDataLinkEscape 0x0010 +#define chrDeviceControlOne 0x0011 +#define chrDeviceControlTwo 0x0012 +#define chrDeviceControlThree 0x0013 +#define chrDeviceControlFour 0x0014 +#define chrNegativeAcknowledge 0x0015 +#define chrSynchronousIdle 0x0016 +#define chrEndOfTransmissionBlock 0x0017 +#define chrCancel 0x0018 +#define chrEndOfMedium 0x0019 +#define chrSubstitute 0x001A +#define chrEscape 0x001B +#define chrFileSeparator 0x001C +#define chrGroupSeparator 0x001D +#define chrRecordSeparator 0x001E +#define chrUnitSeparator 0x001F +#define chrSpace 0x0020 +#define chrExclamationMark 0x0021 +#define chrQuotationMark 0x0022 +#define chrNumberSign 0x0023 +#define chrDollarSign 0x0024 +#define chrPercentSign 0x0025 +#define chrAmpersand 0x0026 +#define chrApostrophe 0x0027 +#define chrLeftParenthesis 0x0028 +#define chrRightParenthesis 0x0029 +#define chrAsterisk 0x002A +#define chrPlusSign 0x002B +#define chrComma 0x002C +#define chrHyphenMinus 0x002D +#define chrFullStop 0x002E +#define chrSolidus 0x002F +#define chrDigitZero 0x0030 +#define chrDigitOne 0x0031 +#define chrDigitTwo 0x0032 +#define chrDigitThree 0x0033 +#define chrDigitFour 0x0034 +#define chrDigitFive 0x0035 +#define chrDigitSix 0x0036 +#define chrDigitSeven 0x0037 +#define chrDigitEight 0x0038 +#define chrDigitNine 0x0039 +#define chrColon 0x003A +#define chrSemicolon 0x003B +#define chrLessThanSign 0x003C +#define chrEqualsSign 0x003D +#define chrGreaterThanSign 0x003E +#define chrQuestionMark 0x003F +#define chrCommercialAt 0x0040 +#define chrCapital_A 0x0041 +#define chrCapital_B 0x0042 +#define chrCapital_C 0x0043 +#define chrCapital_D 0x0044 +#define chrCapital_E 0x0045 +#define chrCapital_F 0x0046 +#define chrCapital_G 0x0047 +#define chrCapital_H 0x0048 +#define chrCapital_I 0x0049 +#define chrCapital_J 0x004A +#define chrCapital_K 0x004B +#define chrCapital_L 0x004C +#define chrCapital_M 0x004D +#define chrCapital_N 0x004E +#define chrCapital_O 0x004F +#define chrCapital_P 0x0050 +#define chrCapital_Q 0x0051 +#define chrCapital_R 0x0052 +#define chrCapital_S 0x0053 +#define chrCapital_T 0x0054 +#define chrCapital_U 0x0055 +#define chrCapital_V 0x0056 +#define chrCapital_W 0x0057 +#define chrCapital_X 0x0058 +#define chrCapital_Y 0x0059 +#define chrCapital_Z 0x005A +#define chrLeftSquareBracket 0x005B +// #define chrReverseSolidus 0x005C (not in Japanese fonts) +#define chrRightSquareBracket 0x005D +#define chrCircumflexAccent 0x005E +#define chrLowLine 0x005F +#define chrGraveAccent 0x0060 +#define chrSmall_A 0x0061 +#define chrSmall_B 0x0062 +#define chrSmall_C 0x0063 +#define chrSmall_D 0x0064 +#define chrSmall_E 0x0065 +#define chrSmall_F 0x0066 +#define chrSmall_G 0x0067 +#define chrSmall_H 0x0068 +#define chrSmall_I 0x0069 +#define chrSmall_J 0x006A +#define chrSmall_K 0x006B +#define chrSmall_L 0x006C +#define chrSmall_M 0x006D +#define chrSmall_N 0x006E +#define chrSmall_O 0x006F +#define chrSmall_P 0x0070 +#define chrSmall_Q 0x0071 +#define chrSmall_R 0x0072 +#define chrSmall_S 0x0073 +#define chrSmall_T 0x0074 +#define chrSmall_U 0x0075 +#define chrSmall_V 0x0076 +#define chrSmall_W 0x0077 +#define chrSmall_X 0x0078 +#define chrSmall_Y 0x0079 +#define chrSmall_Z 0x007A +#define chrLeftCurlyBracket 0x007B +#define chrVerticalLine 0x007C +#define chrRightCurlyBracket 0x007D +#define chrTilde 0x007E +#define chrDelete 0x007F + + +// Special meanings given to characters by the PalmOS +#define chrTab chrHorizontalTabulation // 0x0009 +#define vchrPageUp chrVerticalTabulation // 0x000B +#define vchrPageDown chrFormFeed // 0x000C +#define chrOtaSecure chrDeviceControlFour // 0x0014 +#define chrOta chrNegativeAcknowledge // 0x0015 +#define chrCommandStroke chrSynchronousIdle // 0x0016 +#define chrShortcutStroke chrEndOfTransmissionBlock // 0x0017 +#define chrEllipsis chrCancel // 0x0018 +#define chrNumericSpace chrEndOfMedium // 0x0019 +#define chrCardIcon chrSubstitute // 0x001A Card Icon glyph, added in PalmOS 4.0 +#define chrLeftArrow chrFileSeparator // 0x001C +#define chrRightArrow chrGroupSeparator // 0x001D +#define chrUpArrow chrRecordSeparator // 0x001E +#define chrDownArrow chrUnitSeparator // 0x001F + + +// The following are key codes used for virtual events, like +// low battery warnings, etc. These keyboard events MUST +// have the commandKeyMask bit set in the modifiers in order +// to be recognized. +#define vchrLowBattery 0x0101 // Display low battery dialog +#define vchrEnterDebugger 0x0102 // Enter Debugger +#define vchrNextField 0x0103 // Go to next field in form +#define vchrStartConsole 0x0104 // Startup console task +#define vchrMenu 0x0105 // Ctl-A +#define vchrCommand 0x0106 // Ctl-C +#define vchrConfirm 0x0107 // Ctl-D +#define vchrLaunch 0x0108 // Ctl-E +#define vchrKeyboard 0x0109 // Ctl-F popup the keyboard in appropriate mode +#define vchrFind 0x010A +#define vchrCalc 0x010B +#define vchrPrevField 0x010C +#define vchrAlarm 0x010D // sent before displaying an alarm +#define vchrRonamatic 0x010E // stroke from graffiti area to top half of screen +#define vchrGraffitiReference 0x010F // popup the Graffiti reference +#define vchrKeyboardAlpha 0x0110 // popup the keyboard in alpha mode +#define vchrKeyboardNumeric 0x0111 // popup the keyboard in number mode +#define vchrLock 0x0112 // switch to the Security app and lock the device +#define vchrBacklight 0x0113 // toggle state of backlight +#define vchrAutoOff 0x0114 // power off due to inactivity timer +// Added for PalmOS 3.0 +#define vchrExgTest 0x0115 // put exchange Manager into test mode (&.t) +#define vchrSendData 0x0116 // Send data if possible +#define vchrIrReceive 0x0117 // Initiate an Ir receive manually (&.i) +// Added for PalmOS 3.1 +#define vchrTsm1 0x0118 // Text Services silk-screen button +#define vchrTsm2 0x0119 // Text Services silk-screen button +#define vchrTsm3 0x011A // Text Services silk-screen button +#define vchrTsm4 0x011B // Text Services silk-screen button +// Added for PalmOS 3.2 +#define vchrRadioCoverageOK 0x011C // Radio coverage check successful +#define vchrRadioCoverageFail 0x011D // Radio coverage check failure +#define vchrPowerOff 0x011E // Posted after autoOffChr or hardPowerChr + // to put system to sleep with SysSleep. +// Added for PalmOS 3.5 +#define vchrResumeSleep 0x011F // Posted by NotifyMgr clients after they + // have deferred a sleep request in order + // to resume it. +#define vchrLateWakeup 0x0120 // Posted by the system after waking up + // to broadcast a late wakeup notification. + // FOR SYSTEM USE ONLY +#define vchrTsmMode 0x0121 // Posted by TSM to trigger mode change. +#define vchrBrightness 0x0122 // Activates brightness adjust dialog +#define vchrContrast 0x0123 // Activates contrast adjust dialog + +#define vchrExpCardInserted 0x0124 // ExpansionMgr card inserted & removed. +#define vchrExpCardRemoved 0x0125 // 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). +#define vchrExgIntData 0x01FF // Exchange Manager wakeup event + +// Added for PalmOS 4.0 NOTE: 0x1FF is used above - not in numeric order! +#define vchrAttnStateChanged 0x0126 // Posted by AttentionMgr API to open or update dialog +#define vchrAttnUnsnooze 0x0127 // Posted when AttentionMgr snooze timer expires +#define vchrAttnIndicatorTapped 0x0128 // Posted when AttentionIndicator is tapped +#define vchrAttnAllowClose 0x0129 // Posted when AttnAllowClose is called +#define vchrAttnReopen 0x012A // Posted when AttnReopen is called +#define vchrCardCloseMenu 0x012B // Posted when a card is inserted +#define vchrIrGotData 0x012C // 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 +#define vchrHardKeyMin 0x0200 +#define vchrHardKeyMax 0x02FF // 256 hard keys + +#define vchrHard1 0x0204 +#define vchrHard2 0x0205 +#define vchrHard3 0x0206 +#define vchrHard4 0x0207 +#define vchrHardPower 0x0208 +#define vchrHardCradle 0x0209 // Button on cradle pressed +#define vchrHardCradle2 0x020A // Button on cradle pressed and hwrDockInGeneric1 + // input on dock asserted (low). +#define vchrHardContrast 0x020B // Sumo's Contrast button +#define vchrHardAntenna 0x020C // Eleven's Antenna switch +#define vchrHardBrightness 0x020D // Hypothetical Brightness button +#define vchrPageUpWhenOff 0x020E // The m100 device's page-up clock button +#define vchrHardEarbud 0x020F // 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 +#define vchrThumperMin 0x0300 +#define vchrThumperMax 0x03FF // 256 command keys + +// Motorola +#define vchrCessnaMin 0x14CD +#define vchrCessnaMax 0x14CD // 1 command key + +// TRG +#define vchrCFlashMin 0x1500 +#define vchrCFlashMax 0x150F // 16 command keys + + +// Symbol +#define vchrSPTMin 0x15A0 +#define vchrSPTMax 0x15AF // 16 command keys + +// Handspring +#define vchrSlinkyMin 0x1600 +#define vchrSlinkyMax 0x16FF // 256 command keys + +// Palm +#define vchrPalmMin 0x1700 // 256 command keys +#define vchrPalmMax 0x17ff + +// Old names for some of the characters. +#define nullChr chrNull // 0x0000 +#define backspaceChr chrBackspace // 0x0008 +#define tabChr chrHorizontalTabulation // 0x0009 +#define linefeedChr chrLineFeed // 0x000A +#define pageUpChr vchrPageUp // 0x000B +#define chrPageUp vchrPageUp // 0x000B +#define pageDownChr vchrPageDown // 0x000C +#define chrPageDown vchrPageDown // 0x000C +#define crChr chrCarriageReturn // 0x000D +#define returnChr chrCarriageReturn // 0x000D +#define otaSecureChr chrOtaSecure // 0x0014 +#define otaChr chrOta // 0x0015 + +#define escapeChr chrEscape // 0x001B +#define leftArrowChr chrLeftArrow // 0x001C +#define rightArrowChr chrRightArrow // 0x001D +#define upArrowChr chrUpArrow // 0x001E +#define downArrowChr chrDownArrow // 0x001F +#define spaceChr chrSpace // 0x0020 +#define quoteChr chrQuotationMark // 0x0022 '"' +#define commaChr chrComma // 0x002C ',' +#define periodChr chrFullStop // 0x002E '.' +#define colonChr chrColon // 0x003A ':' +#define lowBatteryChr vchrLowBattery // 0x0101 +#define enterDebuggerChr vchrEnterDebugger // 0x0102 +#define nextFieldChr vchrNextField // 0x0103 +#define startConsoleChr vchrStartConsole // 0x0104 +#define menuChr vchrMenu // 0x0105 +#define commandChr vchrCommand // 0x0106 +#define confirmChr vchrConfirm // 0x0107 +#define launchChr vchrLaunch // 0x0108 +#define keyboardChr vchrKeyboard // 0x0109 +#define findChr vchrFind // 0x010A +#define calcChr vchrCalc // 0x010B +#define prevFieldChr vchrPrevField // 0x010C +#define alarmChr vchrAlarm // 0x010D +#define ronamaticChr vchrRonamatic // 0x010E +#define graffitiReferenceChr vchrGraffitiReference // 0x010F +#define keyboardAlphaChr vchrKeyboardAlpha // 0x0110 +#define keyboardNumericChr vchrKeyboardNumeric // 0x0111 +#define lockChr vchrLock // 0x0112 +#define backlightChr vchrBacklight // 0x0113 +#define autoOffChr vchrAutoOff // 0x0114 +#define exgTestChr vchrExgTest // 0x0115 +#define sendDataChr vchrSendData // 0x0116 +#define irReceiveChr vchrIrReceive // 0x0117 +#define radioCoverageOKChr vchrRadioCoverageOK // 0x011C +#define radioCoverageFailChr vchrRadioCoverageFail // 0x011D +#define powerOffChr vchrPowerOff // 0x011E +#define resumeSleepChr vchrResumeSleep // 0x011F +#define lateWakeupChr vchrLateWakeup // 0x0120 +#define brightnessChr vchrBrightness // 0x0121 +#define contrastChr vchrContrast // 0x0122 +#define hardKeyMin vchrHardKeyMin // 0x0200 +#define hardKeyMax vchrHardKeyMax // 0x02FF +#define hard1Chr vchrHard1 // 0x0204 +#define hard2Chr vchrHard2 // 0x0205 +#define hard3Chr vchrHard3 // 0x0206 +#define hard4Chr vchrHard4 // 0x0207 +#define hardPowerChr vchrHardPower // 0x0208 +#define hardCradleChr vchrHardCradle // 0x0209 +#define hardCradle2Chr vchrHardCradle2 // 0x020A +#define hardContrastChr vchrHardContrast // 0x020B +#define hardAntennaChr vchrHardAntenna // 0x020C +#define hardBrightnessChr vchrHardBrightness // 0x020D +#define 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 +enum symbolChars { + symbolLeftArrow = 3, + symbolRightArrow, + symbolUpArrow, + symbolDownArrow, + symbolSmallDownArrow, + symbolSmallUpArrow, + symbolMemo = 9, + symbolHelp, + symbolNote, + symbolNoteSelected, + symbolCapsLock, + symbolNumLock, + symbolShiftUpper, + symbolShiftPunc, + symbolShiftExt, + symbolShiftNone, + symbolNoTime, + symbolAlarm, + symbolRepeat, + symbolCheckMark, + // These next four characters were moved from the 0x8D..0x90 + // range in the main fonts to the 9pt Symbol font in PalmOS 3.1 + symbolDiamondChr, + symbolClubChr, + symbolHeartChr, + symbolSpadeChr + }; + +// Character in the 7 point symbol font. Resource ID 9005 +enum symbol7Chars { + symbol7ScrollUp = 1, + symbol7ScrollDown, + symbol7ScrollUpDisabled, + symbol7ScrollDownDisabled + }; + +// Characters in the 11 point symbol font. Resource ID 9004 +enum symbol11Chars { + symbolCheckboxOff = 0, + symbolCheckboxOn, + symbol11LeftArrow, + symbol11RightArrow, + symbol11Help, + symbol11LeftArrowDisabled, // New for Palm OS v3.2 + symbol11RightArrowDisabled // New for Palm OS v3.2 + }; + + +#endif // __CHARS_H__ diff --git a/sdk-4/include/Core/System/ConnectionMgr.h b/sdk-4/include/Core/System/ConnectionMgr.h new file mode 100644 index 0000000..a79daa4 --- /dev/null +++ b/sdk-4/include/Core/System/ConnectionMgr.h @@ -0,0 +1,499 @@ +/*********************************************************************** + * + * 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 + * + ***********************************************************************/ + +#ifndef __CONNECTIONMGR_H__ +#define __CONNECTIONMGR_H__ + +// Include elementary types +#include +#include +#include +#include +#include +#include +#include +#include + +/*********************************************************************** + * Definition + ***********************************************************************/ + +typedef UInt32 CncProfileID; + +/*********************************************************************** + * Connection Profile Broadcasting + ***********************************************************************/ + +#define kCncProfileNotifyCurrentVersion 1 + +typedef struct CncProfileNotifyDetailsTag { + + // In: version - This definition is version 1 (kCncProfileNotifyCurrentVersion) + // later versions should include all the fields of version 1 plus + // any additional fields of CncProfileNotifyDetailsType + UInt16 version; + + // In: Broacasted Profile ID + CncProfileID profileID; + + // In: Device Kind of the profile + UInt16 deviceKind; + + // In: Resquested Action + UInt16 request; +} CncProfileNotifyDetailsType; + + +/*********************************************************************** + * Constants + ***********************************************************************/ + +#define kCncProfileInvalidId ((CncProfileID)(0)) + +// Request's modifiers flags +#define kCncNotifyBecomeCurrentModifier 0x8000 // Change the Client current settings +#define kCncNotifyAlertUserModifier 0x4000 // ask for Client UI +#define kNotifyRequestMofifiersMask (kCncNotifyBecomeCurrentModifier | kCncNotifyAlertUserModifier) + +// Requests +#define kCncNotifyCreateRequest 1 // the profile has been created +#define kCncNotifyModifyRequest 2 // the profile has been modified +#define kCncNotifyDeleteRequest 3 // the profile has been deleted +#define kCncNotifyUpdateListRequest 4 // the profile has been deleted + +/*********************************************************************** + * Connection Profile ParamID Definition Macros and Constants + ***********************************************************************/ + +#define kCncParamOSRange 0x0000 // bit #15 set at 0 +#define kCncParamThirdPartiesRange 0x8000 // bit #15 set at 1 + +#define kCncParamFixedLength 0x0000 // bit #14 set to 0 +#define kCncParamVariableLength 0x4000 // bit #14 set to 1 + +#define kCncParamIDMask 0x07FF // bit #0 to #10 set to 1 (11 bits) +#define kCncParamTypeMask 0x7800 // bit #11 to #14 set to 1 (4 bits) + +// parameter type definition macros +#define kCncParamFixedLen 0x00 // higth bit of 4 set to 0 +#define kCncParamVariableLen 0x08 // 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) ) + +#define kCncParamSystemFlag CncDefineParameterType(kCncParamFixedLen, 0) // 0x0000 +#define kCncParamUInt8 CncDefineParameterType(kCncParamFixedLen, 1) // 0x0800 +#define kCncParamUInt16 CncDefineParameterType(kCncParamFixedLen, 2) // 0x1000 +#define kCncParamUInt32 CncDefineParameterType(kCncParamFixedLen, 3) // 0x1800 +// [free slot from 4 to 7] + +#define kCncParamSystemFlagSize kCncParamUInt8Size +#define kCncParamUInt8Size ( sizeof(UInt8) ) +#define kCncParamUInt16Size ( sizeof(UInt16) ) +#define kCncParamUInt32Size ( sizeof(UInt32) ) + +#define kCncParamString CncDefineParameterType(kCncParamVariableLen, 1) // 0x4800 +#define kCncParamBuffer CncDefineParameterType(kCncParamVariableLen, 2) // 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 + ***********************************************************************/ + +#define kCncFtrCncMgrCreator 'cmgr' + +#define kCncFtrCncMgrVersion 0 +#define kCncMgrVersion 0x00040001 // 4.0 = 4->high 0->low +// feature index 1 and 2 are reserved + +/*********************************************************************** + * Parameter size values + ***********************************************************************/ + +// 22 for compatibility +#define kCncProfileNameSize 22 + +// 81 defined in ModemMgr.h +#define kCncProfileUsualInitStringSize mdmCmdBufSize + +// 81 defined in ModemMgr.h +#define kCncProfileClassicResetStringSize mdmCmdSize // Old size was 8 +#define kCncProfileUsualResetStringSize mdmCmdBufSize + +/*********************************************************************** + * Parameters values + ***********************************************************************/ + +// device kinds +#define kCncDeviceKindSerial 0 +#define kCncDeviceKindModem 1 +#define kCncDeviceKindPhone 2 +#define kCncDeviceKindLocalNetwork 3 + +// Old flow controls +#define kCncFlowControlAuto 0 +#define kCncFlowControlOFF 1 +#define kCncFlowControlON 2 + +#define kCncProfileVersion 4 + +/*********************************************************************** + * Error Codes + ***********************************************************************/ + +#define kCncErrAddProfileFailed (cncErrorClass | 0x01) // Add profile attempt failed +#define kCncErrProfileListFull (cncErrorClass | 0x02) // Add attempt failed because the + // profile list is full. +#define kCncErrGetProfileFailed (cncErrorClass | 0x03) // Get profile attempt failed +#define kCncErrDBAccessFailed (cncErrorClass | 0x04) // Connection database not found or access failed +#define kCncErrGetProfileListFailed (cncErrorClass | 0x05) // Could not get profile list +#define kCncErrProfileReadOnly (cncErrorClass | 0x06) // The profile can not be altered +#define kCncErrProfileNotFound (cncErrorClass | 0x07) // The profile could not be found + +// New API error code +#define kCncErrProfileParamNotFound (cncErrorClass | 0x08) // The profile parameter could not be found +#define kCncErrProfileParamReadOnly (cncErrorClass | 0x09) // The profile parameter can only be read +#define kCncErrProfileParamNameHasChange (cncErrorClass | 0x0a) // The profile parameter Name has been modified to be unique +#define kCncErrProfileGetParamFailed (cncErrorClass | 0x0b) // failed to get a parameter in a profile +#define kCncErrProfileSetParamFailed (cncErrorClass | 0x0c) // failed to Set a parameter in a profile +#define kCncErrProfileBadParamSize (cncErrorClass | 0x0d) // failed to Set a parameter in a profile +#define kCncErrProfileBadSystemFlagBitnum (cncErrorClass | 0x0e) // the bit num of a system flag is not comprise between 0 and 31 + +/*********************************************************************** + * Parameters ID and Sizes + ***********************************************************************/ + +// void param has a size of zero bytes +#define kCncNoParam 0 +#define kCncNoParamSize 0 + +// 22 bytes limited - for compatibility +#define kCncParamName CncDefineParamID( kCncParamOSRange, kCncParamString, 1 ) +#define kCncParamNameMaxSize kCncProfileNameSize + +#define kCncParamPort CncDefineParamID( kCncParamOSRange , kCncParamUInt32, 2 ) +#define kCncParamPortSize kCncParamUInt32Size + +#define kCncParamBaud CncDefineParamID( kCncParamOSRange , kCncParamUInt32, 3 ) +#define kCncParamBaudSize kCncParamUInt32Size + +#define kCncParamVolume CncDefineParamID( kCncParamOSRange , kCncParamUInt16, 4 ) +#define kCncParamVolumeSize kCncParamUInt16Size + +#define kCncParamFlowControl CncDefineParamID( kCncParamOSRange , kCncParamUInt16, 5 ) +#define kCncParamFlowControlSize kCncParamUInt16Size + +// New piece of info - communication time Out (CTS) +#define kCncParamTimeOut CncDefineParamID( kCncParamOSRange , kCncParamUInt32, 6 ) +#define kCncParamTimeOutSize kCncParamUInt32Size + +#define kCncParamInitString CncDefineParamID( kCncParamOSRange, kCncParamString, 7 ) +#define kCncParamInitStringMaxSize mdmCmdBufSize + +#define kCncParamResetString CncDefineParamID( kCncParamOSRange, kCncParamString, 8) +#define kCncParamResetStringMaxSize mdmCmdBufSize + +// New piece of info - extented device kind cf kCncDeviveXXX after +#define kCncParamDeviceKind CncDefineParamID( kCncParamOSRange, kCncParamUInt16, 9) +#define kCncParamDeviceKindSize kCncParamUInt16Size + +// country index for the profile +#define kCncParamCountryIndex CncDefineParamID( kCncParamOSRange, kCncParamUInt16, 11 ) +#define kCncParamCountryIndexSize kCncParamUInt16Size + +// dialing mode, old pulse param +#define kCncParamDialingMode CncDefineParamID( kCncParamOSRange, kCncParamUInt8, 12 ) +#define kCncParamDialingModeSize kCncParamUInt8Size + +#define kCncParamVersion CncDefineParamID( kCncParamOSRange, kCncParamUInt8, 13 ) +#define kCncParamVersionSize kCncParamUInt8Size + +#define kCncParamReceiveTimeOut CncDefineParamID( kCncParamOSRange , kCncParamUInt32, 14 ) +#define kCncParamReceiveTimeOutSize kCncParamUInt32Size + +// International Reset string (count [strings]) +#define kCncParamIntlModemResetStringList CncDefineParamID(kCncParamOSRange, kCncParamBuffer, 15) + + +// International country string (count [strings]) +#define kCncParamIntlModemCountryStringList CncDefineParamID(kCncParamOSRange, kCncParamBuffer, 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 +#define kCncParamReadOnlyBit 0 +#define kCncParamInvisibleBit 1 +#define kCncParamNonEditableBit 2 +#define kCncParamNoDetailsBit 3 +#define kCncParamLockedBit 4 +#define kCncParamReservedBit5 5 +#define kCncParamReservedBit6 6 +#define kCncParamReservedBit7 7 +#define kCncParamReservedBit8 8 +#define kCncParamReservedBit9 9 +#define kCncParamReservedBit10 10 +#define kCncParamReservedBit11 11 +#define kCncParamReservedBit12 12 +#define kCncParamReservedBit13 13 +#define kCncParamReservedBit14 14 +#define kCncParamReservedBit15 15 +#define kCncParamSystemBit16 16 +#define kCncParamSystemBit17 17 +#define kCncParamReservedBit18 18 +#define kCncParamReservedBit19 19 +#define kCncParamReservedBit20 20 +#define kCncParamReservedBit21 21 +#define kCncParamReservedBit22 22 +#define kCncParamReservedBit23 23 +#define kCncParamReservedBit24 24 +#define kCncParamReservedBit25 25 +#define kCncParamReservedBit26 26 +#define kCncParamReservedBit27 27 +#define kCncParamReservedBit28 28 +#define kCncParamReservedBit29 29 +#define kCncParamReservedBit30 30 +#define kCncParamReservedBit31 31 + +#define kCncParamSystemFlagsNum 0x07FF + +// the following parameter handles the system flags as an UInt32 integer (all the flags, at once) +#define kCncParamSystemFlags CncDefineParamID( kCncParamOSRange, kCncParamSystemFlag, kCncParamSystemFlagsNum) +#define kCncParamSystemFlagsSize kCncParamUInt32Size + +// bit parameters definition : to handle flags bit per bit +#define kCncParamReadOnly CncDefineParamID( kCncParamOSRange, kCncParamSystemFlag, 0) + +#define kCncParamReadOnlySize kCncParamSystemFlagSize + +#define kCncParamInvisible CncDefineParamID( kCncParamOSRange, kCncParamSystemFlag, 1 ) +#define kCncParamInvisibleSize kCncParamSystemFlagSize + +#define kCncParamNonEditable CncDefineParamID( kCncParamOSRange, kCncParamSystemFlag, 2 ) +#define kCncParamNonEditableSize kCncParamSystemFlagSize + +#define kCncParamNoDetails CncDefineParamID( kCncParamOSRange, kCncParamSystemFlag, 3 ) +#define kCncParamNoDetailsSize kCncParamSystemFlagSize + +#define kCncParamLocked CncDefineParamID( kCncParamOSRange, kCncParamSystemFlag, 4 ) +#define kCncParamLockedSize kCncParamSystemFlagSize + +/* Bluetooth parameter IDs - New pieces of info */ + +// 48 bit blue Tooth address (BD_ADDR) - This address is derived from the IEEE802 standard + +#define kCncParamBluetoothDeviceAddr CncDefineParamID(kCncParamOSRange, kCncParamBuffer, 50 ) +#define kCncParamBluetoothDeviceAddrSize 8 + +// Bluetooth device name - 248 bytes coded according to the UTF-8 standard at max + NULL terninaison +#define kCncParamBluetoothDeviceName CncDefineParamID(kCncParamOSRange, kCncParamString, 51 ) +#define 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 ) +#define kCncParamSerialPortFlags CncDefineParamID(kCncParamOSRange, kCncParamUInt32, 84 ) +#define kCncParamSerialPortFlagsSize kCncParamUInt32Size + +// Telephony Task type - mobile telephony +#define kCncParamTTType CncDefineParamID( kCncParamOSRange, kCncParamUInt32, 90 ) +#define kCncParamTTTypeSize kCncParamUInt32Size + +// Telephony Task Creator - mobile telephony +#define kCncParamTTCreator CncDefineParamID( kCncParamOSRange, kCncParamUInt32, 91 ) +#define kCncParamTTCreatorSize kCncParamUInt32Size + +// Phone Driver Name - mobile telephony +#define kCncParam_PSDName CncDefineParamID( kCncParamOSRange, kCncParamString, 92 ) +#define kCncParam_PSDNameSize dmDBNameLength + +// Phone Driver creator - mobile telephony +#define kCncParam_PSDCreator CncDefineParamID( kCncParamOSRange, kCncParamUInt32, 93 ) +#define kCncParam_PSDCreatorSize kCncParamUInt32Size + +// Phone Driver type - mobile telephony +#define kCncParam_PSDType CncDefineParamID(kCncParamOSRange, kCncParamUInt32, 94 ) +#define kCncParam_PSDTypeSize kCncParamUInt32Size + +// Phone Driver Param Buffer - mobile telephony +#define kCncParam_PSDParameterBuffer CncDefineParamID(kCncParamOSRange, kCncParamBuffer, 100 ) + +/*********************************************************************** + * New Connection Manager trap selectors + ***********************************************************************/ + +#define sysTrapCncMgrProfileSettingGet 1 +#define sysTrapCncMgrProfileSettingSet 2 +#define sysTrapCncMgrProfileGetCurrent 3 +#define sysTrapCncMgrProfileSetCurrent 4 +#define sysTrapCncMgrProfileGetIDFromName 5 +#define sysTrapCncMgrProfileCreate 6 +#define sysTrapCncMgrProfileDelete 7 +#define sysTrapCncMgrProfileGetIDFromIndex 8 +#define sysTrapCncMgrProfileGetIndex 9 +#define sysTrapCncMgrProfileCount 10 +#define sysTrapCncMgrProfileOpenDB 11 +#define sysTrapCncMgrProfileCloseDB 12 + + +/*********************************************************************** + * Connection Manager Library Macros + ***********************************************************************/ + +#ifndef USE_CNCMGR_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_CNCMGR_TRAPS 1 // use Pilot traps + #else + #define USE_CNCMGR_TRAPS 0 // direct link + #endif +#endif + +#if (USE_CNCMGR_TRAPS == 1) + #define OLD_CNCMGR_TRAP(TrapNum) TrapNum + #define CNCMGR_TRAP(cncMgrSelectorNum) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapCncMgrDispatch, \ + cncMgrSelectorNum) +#else + #define OLD_CNCMGR_TRAP(TrapNum) + #define CNCMGR_TRAP(cncMgrSelectorNum) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*********************************************************************** + * New Connection Mgr API + ***********************************************************************/ + +Err CncProfileSettingGet( CncProfileID profileId, UInt16 paramId, void* paramBufferP, UInt16 * ioParamSizeP ) + CNCMGR_TRAP(sysTrapCncMgrProfileSettingGet); + +Err CncProfileSettingSet( CncProfileID iProfileId, UInt16 paramId, const void* paramBufferP, UInt16 paramSize ) + CNCMGR_TRAP(sysTrapCncMgrProfileSettingSet); + +Err CncProfileSetCurrent( CncProfileID profileId ) + CNCMGR_TRAP(sysTrapCncMgrProfileSetCurrent); + +Err CncProfileGetCurrent( CncProfileID * profileIdP ) + CNCMGR_TRAP(sysTrapCncMgrProfileGetCurrent); + +Err CncProfileGetIDFromName( const Char* profileNameP, CncProfileID * profileIdP) + CNCMGR_TRAP(sysTrapCncMgrProfileGetIDFromName); + +Err CncProfileCreate( CncProfileID * profileIdP ) + CNCMGR_TRAP(sysTrapCncMgrProfileCreate); + +Err CncProfileDelete( CncProfileID profileId ) + CNCMGR_TRAP(sysTrapCncMgrProfileDelete); + +Err CncProfileGetIDFromIndex( UInt16 index, CncProfileID* profileIdP ) + CNCMGR_TRAP(sysTrapCncMgrProfileGetIDFromIndex); + +Err CncProfileGetIndex( CncProfileID profileId, UInt16* indexP ) + CNCMGR_TRAP(sysTrapCncMgrProfileGetIndex); + +Err CncProfileCount( UInt16* profilesCountP ) + CNCMGR_TRAP(sysTrapCncMgrProfileCount); + +Err CncProfileOpenDB( void ) + CNCMGR_TRAP(sysTrapCncMgrProfileOpenDB); + +Err CncProfileCloseDB( void ) + CNCMGR_TRAP(sysTrapCncMgrProfileCloseDB); + +/*********************************************************************** + * Old Connection Mgr API, For compatibility only + ***********************************************************************/ + +// Maximum size for a Connection Profile Name +#define cncProfileNameSize 22 + +// Error Codes +#define cncErrAddProfileFailed (cncErrorClass | 1) // Add profile attempt failed +#define cncErrProfileListFull (cncErrorClass | 2) // Add attempt failed because the + // profile list is full. +#define cncErrGetProfileFailed (cncErrorClass | 3) // Get profile attempt failed +#define cncErrConDBNotFound (cncErrorClass | 4) // Connection database not found +#define cncErrGetProfileListFailed (cncErrorClass | 5) // Could not get profile list +#define cncErrProfileReadOnly (cncErrorClass | 6) // The profile can not be altered +#define cncErrProfileNotFound (cncErrorClass | 7) // The profile could not be found + +// Functions + +Err CncGetProfileList( Char*** nameListPPP, UInt16 *countP ) + OLD_CNCMGR_TRAP(SYS_TRAP(sysTrapCncGetProfileList)); + +Err CncGetProfileInfo( Char *name, UInt32 *port, UInt32 *baud, UInt16 *volume, + UInt16 *handShake, Char *initString, Char *resetString, + Boolean *isModem, Boolean *isPulse ) + OLD_CNCMGR_TRAP(SYS_TRAP(sysTrapCncGetProfileInfo)); + +Err CncAddProfile( Char *name, UInt32 port, UInt32 baud, UInt16 volume, + UInt16 handShake, const Char *initString, const Char *resetString, Boolean isModem, + Boolean isPulse ) + OLD_CNCMGR_TRAP(SYS_TRAP(sysTrapCncAddProfile)); + +Err CncDeleteProfile( const Char *name ) + OLD_CNCMGR_TRAP(SYS_TRAP(sysTrapCncDeleteProfile)); + + +#ifdef __cplusplus +} +#endif + +#endif // __CONNECTIONMGR_H__ diff --git a/sdk-4/include/Core/System/ConsoleMgr.h b/sdk-4/include/Core/System/ConsoleMgr.h new file mode 100644 index 0000000..c4df7f5 --- /dev/null +++ b/sdk-4/include/Core/System/ConsoleMgr.h @@ -0,0 +1,49 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __CONSOLEMGR_H__ +#define __CONSOLEMGR_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +/******************************************************************** + * Console Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err ConPutS(const Char *message) + SYS_TRAP(sysTrapConPutS); + +Err ConGetS(Char *message, Int32 timeout) + SYS_TRAP(sysTrapConGetS); + + +#ifdef __cplusplus +} +#endif + + + + +#endif // __CONSOLEMGR_H__ diff --git a/sdk-4/include/Core/System/Crc.h b/sdk-4/include/Core/System/Crc.h new file mode 100644 index 0000000..4b17f5f --- /dev/null +++ b/sdk-4/include/Core/System/Crc.h @@ -0,0 +1,65 @@ +/****************************************************************************** + * + * Copyright (c) 1995-2000 Palm, 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 *. + * + *****************************************************************************/ + +#ifndef __CRC_H__ +#define __CRC_H__ + + +// Include elementary types +#include +#include + + + + +/******************************************************************** + * CRC Calculation Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + + +// Crc16CalcBlock() +// +// Calculate the 16-bit CRC of a data block using the table lookup method. +// +UInt16 Crc16CalcBlock(const void *bufP, UInt16 count, UInt16 crc) + SYS_TRAP(sysTrapCrc16CalcBlock); + +UInt16 Crc16CalcBigBlock(void *bufP, UInt32 count, UInt16 crc); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __CRC_H__ diff --git a/sdk-4/include/Core/System/DLCommon.h b/sdk-4/include/Core/System/DLCommon.h new file mode 100644 index 0000000..8fc6c8f --- /dev/null +++ b/sdk-4/include/Core/System/DLCommon.h @@ -0,0 +1,3785 @@ +/****************************************************************************** + * + * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: DLCommon.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Desktop Link Protocol(DLP) function id's, parameters, and frame + * structures. + * + * History: + * 6/7/95 vmk Created by Vitaly Marty Kruglikov + * 6/15/95 vmk Changed dlp/Read/Write/UserID to dlp/Read/Write/UserInfo and + * added the last sync PC id field to their arguments at Laura's request. + * 6/15/95 vmk Added option to dlpDeleteRecord to delete all records in DB. + * + *****************************************************************************/ + +#ifndef __DLCOMMON_H__ +#define __DLCOMMON_H__ + +#include + +#include "VFSMgr.h" + +/************************************************************ + * DesktopLink function codes + *************************************************************/ + +// DlpFuncID -- function id's used in request blocks sent to +// the DesktopLink application on Pilot. The width of the function +// id base is 7 bits. The high order bit(the 8th bit) is used to +// distinguish requests from their responses -- it is cleared in request +// blocks and is set in response blocks (i.e., the response to a particular +// command will have the same function code base as the command and the +// high order bit set). See dlpFuncRespFlag defined below. +// +typedef enum DlpFuncID { + + dlpReservedFunc = 0x0F, // range reserved for internal use + + // DLP 1.0 FUNCTIONS START HERE (PalmOS v1.0) + dlpReadUserInfo, + + dlpWriteUserInfo, + + dlpReadSysInfo, + + dlpGetSysDateTime, + + dlpSetSysDateTime, + + dlpReadStorageInfo, + + dlpReadDBList, + + dlpOpenDB, + + dlpCreateDB, + + dlpCloseDB, + + dlpDeleteDB, + + dlpReadAppBlock, + + dlpWriteAppBlock, + + dlpReadSortBlock, + + dlpWriteSortBlock, + + dlpReadNextModifiedRec, + + dlpReadRecord, + + dlpWriteRecord, + + dlpDeleteRecord, + + dlpReadResource, + + dlpWriteResource, + + dlpDeleteResource, + + dlpCleanUpDatabase, + + dlpResetSyncFlags, + + dlpCallApplication, + + dlpResetSystem, + + dlpAddSyncLogEntry, + + dlpReadOpenDBInfo, + + dlpMoveCategory, + + dlpProcessRPC, // remote procedure calls interface + + dlpOpenConduit, // this command is sent before each conduit is opened + + dlpEndOfSync, // ends the sync session + + dlpResetRecordIndex, // resets "modified record" index + + dlpReadRecordIDList, // LAST 1.0 FUNCTION + + + // DLP 1.1 FUNCTIONS ADDED HERE (PalmOS v2.0 Personal, and Professional) + dlpReadNextRecInCategory, // iterate through all records in category + + dlpReadNextModifiedRecInCategory, // iterate through modified records in category + + dlpReadAppPreference, // read application preference + + dlpWriteAppPreference, // write application preference + + dlpReadNetSyncInfo, // read Network HotSync settings + + dlpWriteNetSyncInfo, // write Network HotSync settings + + dlpReadFeature, // read a feature from Feature Manager + + // DLP 1.2 FUNCTIONS ADDED HERE (PalmOS v3.0) + dlpFindDB, // find a database given creator and type, or name, or + // get info on currently-open db + dlpSetDBInfo, // change database information (name, attributes, version, + // creation, modification, backup dates, type and creator + + + // DLP 1.3 FUNCTIONS ADDED HERE (PalmOS v4.0) + dlpLoopBackTest, // Perform a loopback test with the DLServer. The desktop + // will send data down to the device and the device will + // immediately echo it back. + + dlpExpSlotEnumerate, // Get the number of slots on the device from the expansion manager + + dlpExpCardPresent, // Query the expansion manager to see if the card is present. + + dlpExpCardInfo, + + dlpVFSCustomControl, // Make a custom control call to the VFS manager + + dlpVFSGetDefaultDirectory, // Get the defualt directory from the VFS manager + + // ADH Does this one really need to be part of the sync API? + dlpVFSImportDatabaseFromFile, // Import a database into the storage heap from a file + + dlpVFSExportDatabaseToFile, /// Export a database from the storage heap to a file. + + dlpVFSFileCreate, // Create a file using the VFS manager + + dlpVFSFileOpen, // Open a file using the VFS manager + + dlpVFSFileClose, // Close a file using the VFS manager + + dlpVFSFileWrite, // Write a file using the VFS manager + + dlpVFSFileRead, // Read from a file using the VFS manager + + dlpVFSFileDelete, // Delete a file using the VFS manager + + dlpVFSFileRename, // Rename a file using the VFS manager + + dlpVFSFileEOF, // VFS End of File? + + dlpVFSFileTell, // ??? + +// dlpVFSFileTruncate, + + dlpVFSFileGetAttributes, + + dlpVFSFileSetAttributes, + + dlpVFSFileGetDates, + + dlpVFSFileSetDates, + +// dlpVFSFileGetSize, + + dlpVFSDirCreate, + + dlpVFSDirEntryEnumerate, + + dlpVFSGetFile, // HotSync only + + dlpVFSPutFile, // HotSync only + + dlpVFSVolumeFormat, + + dlpVFSVolumeEnumerate, + + dlpVFSVolumeInfo, + + dlpVFSVolumeGetLabel, + + dlpVFSVolumeSetLabel, + + dlpVFSVolumeSize, + + dlpVFSFileSeek, + + dlpVFSFileResize, + + dlpVFSFileSize, + + dlpExpSlotMediaType, + + dlpWriteResourceStream, + + dlpWriteRecordStream, + + dlpReadResourceStream, + + dlpReadRecordStream, + + dlpLastFunc // ***ALWAYS KEEP LAST*** + + } DlpFuncID; + +#define dlpLastPilotV10FuncID dlpReadRecordIDList + + +// Desktop Link function error codes returned in the response errorCode +// field. +typedef enum DlpRespErrorCode { + dlpRespErrNone = 0, // reserve 0 for no error + dlpRespErrSystem, // general Pilot system error + dlpRespErrIllegalReq, // unknown function ID + dlpRespErrMemory, // insufficient dynamic heap memory + dlpRespErrParam, // invalid parameter + dlpRespErrNotFound, // database, record, file, or resource not found + // VFS File Not Found Error + dlpRespErrNoneOpen, // there are no open databases + dlpRespErrDatabaseOpen, // database is open by someone else + dlpRespErrTooManyOpenDatabases, // there are too many open databases + dlpRespErrAlreadyExists, // DB or File already exists + // VFS File Already Exists + dlpRespErrCantOpen, // couldn't open DB + dlpRespErrRecordDeleted, // record is deleted + dlpRespErrRecordBusy, // record is in use by someone else + dlpRespErrNotSupported, // the requested operation is not supported + // on the given database type(record or resource) + dlpRespErrUnused1, // was dlpRespErrROMBased + dlpRespErrReadOnly, // caller does not have write access(or DB is in ROM) + dlpRespErrNotEnoughSpace, // not enough space in data store for record/resource/etc. + dlpRespErrLimitExceeded, // size limit exceeded + dlpRespErrCancelSync, // cancel the sync + + dlpRespErrBadWrapper, // bad arg wrapper(for debugging) + dlpRespErrArgMissing, // required arg not found(for debugging) + dlpRespErrArgSize, // invalid argument size + + dlpRespErrLastReserved = 127, // End of DLP Error codes + + dlpRespErrExpansionRange = expErrorClass, // Expansion Manager range + + dlpRespErrVFSRange = vfsErrorClass // VFS Manager range + + } DlpRespErrorCode; + + +// Database flags +// NOTE: THESE *MUST* MATCH THE TOUCHDOWN DB ATTRIBUTES(AT LEAST IN THE FIRST VERSION). +// ANY CHANGES MUST BE REFLECTED IN "READ DB LIST" AND +#define dlpDBFlagResDB 0x0001 // resource DB if set; record DB if cleared + +#define dlpDBFlagReadOnly 0x0002 // DB is read only if set; read/write if cleared + +#define dlpDBFlagAppInfoDirty 0x0004 // Set if Application Info block is dirty + // Optionally supported by an App's conduit + +#define dlpDBFlagBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. + +#define dlpDBFlagOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK + // for it to install a newer version of this database + // with a different name if the current database is + // open. This mechanism is used to update the + // Graffiti Shortcuts database, for example. + +#define dlpDBFlagResetAfterInstall 0x0020 // Device requires a reset after this database is + // installed. + +#define dlpDBFlagCopyPrevention 0x0040 // This database should not be copied to + // another deviced. + +#define dlpDBFlagOpen 0x8000 // DB is open + + + + +// Database record attributes +#define dlpRecAttrDeleted 0x80 // delete this record next sync +#define dlpRecAttrDirty 0x40 // archive this record next sync +#define dlpRecAttrBusy 0x20 // record currently in use +#define dlpRecAttrSecret 0x10 // "secret" record - password protected +#define dlpRecAttrArchived 0x08 // archived record + + +// Date/time will be described in the following format +// yr(2 bytes), mo(1 byte, 1-12), dy(1 byte, 1-31), +// hr(1 byte, 0-23), min(1 byte, 0-59), sec(1 byte, 0-59), +// unused(1 byte). + +typedef struct DlpDateTimeType { // OFFSET + UInt16 year; // 0; year (high, low) + UInt8 month; // 2; month: 1-12 + UInt8 day; // 3; day: 1-31 + UInt8 hour; // 4; hour: 0-23 + UInt8 minute; // 5; minute: 0-59 + UInt8 second; // 6; second: 0-59 + UInt8 unused; // 7; unused -- set to null! + } DlpDateTimeType; // TOTAL: 8 bytes + + +// Version structure +typedef struct DlpVersionType { + // OFFSET + UInt16 wMajor; // 0; major version number (0 = ignore) + UInt16 wMinor; // 2; minor version number + // TOTAL: 4 bytes + } DlpVersionType; + + +/************************************************************ + * Request and Response headers. + * + * Each DLP request and response data block begins with the + * corresponding header structure which identifies the function + * id, argument count, and error code(responses only). + *************************************************************/ + +// Request header: +// +typedef struct DlpReqHeaderType { + // OFFSET + UInt8 id; // 0; request function ID + UInt8 argc; // 2; count of args that follow this header + // TOTAL: 2 bytes + } DlpReqHeaderType; + +typedef DlpReqHeaderType* DlpReqHeaderPtr; + +typedef struct DlpReqType { + // OFFSET + DlpReqHeaderType header; // 0; request header + // FIXED SIZE: 2 bytes + UInt8 args[2]; // 2; request arguments -- var size + } DlpReqType; + +typedef DlpReqType* DlpReqPtr; + +// Response header: +// +typedef struct DlpRespHeaderType { + // OFFSET + UInt8 id; // 0; response function ID + UInt8 argc; // 1; count of arguments that follow this header + UInt16 errorCode; // 2; error code + // TOTAL: 4 bytes + } DlpRespHeaderType; + +typedef DlpRespHeaderType* DlpRespHeaderPtr; + +typedef struct DlpRespType { + // OFFSET + DlpRespHeaderType header; // 0; response header + // FIXED SIZE: 4 bytes + UInt8 args[2]; // 4; response arguments -- var size + } DlpRespType; + +typedef DlpRespType* DlpRespPtr; + + +// Generic request/response body type(for utility routines) +// +typedef union DlpGenericBodyType { + UInt8 id; // request/response id + DlpReqType req; // request body + DlpRespType resp; // response body + } DlpGenericBodyType; + +typedef DlpGenericBodyType* DlpGenericBodyPtr; + + +// dlpFuncRespFlag is used to form a function response ID from a +// function ID by or'ing it with the function ID. For example: if +// dlpFuncDeleteResource is the request ID, the correct response ID +// must be (dlpFuncDeleteResource | dlpFuncRespFlag). +// +#define dlpFuncRespFlag 0x80 + +// dlpFuncIDMask is used to mask out the function ID value +#define dlpFuncIDMask 0x7f + +// dlpFirstArgID is the value of the first argument ID to be defined for +// functions. Values below it are reserved. +// +#define dlpFirstArgID 0x20 + + +/************************************************************ + * + * Argument headers used to "wrap" request and response arguments + * + * IMPORTANT: ARGUMENT WRAPPERS IN REQUESTS AND RESPONSES MUST + * ALWAYS START ON AN EVEN-BYTE BOUNDARY. The server + * implementation expects this to be the case. + * + *************************************************************/ + +// dlpSmallArgFlag is used to identify "small" argument wrappers by +// or'ing it with the argument id in argument header. +// +// ADH Change +//#define dlpSmallArgFlag 0x080 +#define dlpSmallArgFlag 0x80 + +// dlpShortArgIDMask is used to mask out the argument id value +// +#define dlpShortArgIDMask 0x7F + + +// dlpLongArgFlag is used to identify "long" argument wrappers by +// or'ing it with the argument id in argument header. +// +// ADH Change +//#define dlpLongArgFlag 0xC000 +#define dlpLongArgFlag 0x40 + +// dlpLongArgIDMask is used to mask out the argument id value +// +// ADH Change +//#define dlpLongArgIDMask 0x3FFF +#define dlpLongArgIDMask 0xBF + + +//------------------------------------------------------------------------- +// Int16 argument wrappers (v1.0-compatible) +//------------------------------------------------------------------------- + +// Maximum Int16 argument size which can be "wrapped" +#define dlpMaxTinyArgSize 0x000000FFL +#define dlpMaxSmallArgSize 0x0000FFFFL +#define dlpMaxShortArgSize dlpMaxSmallArgSize + + + +// Tiny argument header for data sizes up to 255 bytes(optimization) +// +typedef struct DlpTinyArgWrapperType { + // OFFSET + UInt8 bID; // 0; argument ID + UInt8 bSize; // 1; argument size (does NOT include this arg header) + // TOTAL: 2 bytes + } DlpTinyArgWrapperType; + +typedef struct DlpTinyArgType { + DlpTinyArgWrapperType wrapper; // 0; argument header + UInt8 data[2]; // 2; argument data -- var size + } DlpTinyArgType; + + +// Small argument header for data sizes above 255 bytes(*may also be used for +// smaller arguments when convenient*) +// +typedef struct DlpSmallArgWrapperType { + // OFFSET + UInt8 bID; // 0; argument ID + UInt8 unused; // 1; unused(for alignment) -- set to null! + UInt16 wSize; // 2; argument size (does NOT include this arg header) + // TOTAL: 4 bytes + } DlpSmallArgWrapperType; + +typedef struct DlpSmallArgType { + DlpSmallArgWrapperType wrapper; // 0; argument header + UInt8 data[2]; // 4; argument data -- var size + } DlpSmallArgType; + +// Unions of Int16 argument types +typedef union DlpShortArgWrapperType { + UInt8 bID; // arg id + DlpTinyArgWrapperType tiny; // "tiny" arg wrapper + DlpSmallArgWrapperType small; // "tiny" arg wrapper + } DlpShortArgWrapperType; +typedef DlpShortArgWrapperType* DlpShortArgWrapperPtr; + +typedef union DlpShortArgType { + UInt8 bID; // arg id + DlpTinyArgType tiny; // "tiny" arg + DlpSmallArgType small; // "small" arg + } DlpShortArgType; + +typedef DlpShortArgType* DlpShortArgPtr; + + + +//------------------------------------------------------------------------- +// Int32 argument wrapper (v2.0 extension) +//------------------------------------------------------------------------- +// NOTE: Pilot v2.0 will implement the capability to parse long arguments +// but will not originate them. This will assure backwards compatibility with +// the 1.0 desktop as well as compatibility with the future version of the +// desktop software which may originate the "long" argument wrappers. +// +// Int32 argument wrappers are identified by the dlpLongArgFlag bits set +// in the argument id field. + +// Maximum long argument size which can be "wrapped" +#define dlpMaxLongArgSize 0xFFFFFFFFL + +typedef struct DlpLongArgWrapperType { + // OFFSET + UInt8 bID; // 0; argument ID + UInt8 unused; // 1: unused set to null + UInt32 dwSize; // 2; argument size (does NOT include this arg header) + // TOTAL: 6 bytes + } DlpLongArgWrapperType; +typedef DlpLongArgWrapperType* DlpLongArgWrapperPtr; + +typedef struct DlpLongArgType { + // OFFSET + DlpLongArgWrapperType wrapper; // 0; argument header + UInt8 data[2]; // 6; argument data -- var size + } DlpLongArgType; +typedef DlpLongArgType* DlpLongArgPtr; + + +//------------------------------------------------------------------------- +// Unions of all argument and wrapper types +//------------------------------------------------------------------------- + +// Union of all argument wrapper types +typedef union DlpGenericArgWrapperType { + DlpShortArgWrapperType shortWrap; // "Int16" arg wrapper(tiny and small) + DlpLongArgWrapperType longWrap; // "long" arg wrapper + } DlpGenericArgWrapperType; +typedef DlpGenericArgWrapperType* DlpGenericArgWrapperPtr; + + +// Union of all argument types +typedef union DlpGenericArgType { + DlpShortArgType shortArg; // "Int16" arg(tiny and small) + DlpLongArgType longArg; // "long" arg + } DlpGenericArgType; +typedef DlpGenericArgType* DlpGenericArgPtr; + + +/******************************************************************** + * Desktop Link Protocol Parameters + ********************************************************************/ + +// dlpCmdTimeoutSec -- this is the number of seconds to wait for a command +// to begin coming in before timing out +// +#define dlpCmdTimeoutSec 30 + + + +/************************************************************ + * DLP function argument structures + *************************************************************/ +#pragma mark *** DLP Command Arguments **** + +////////////////////////////////////////////////////////////////////////// +// dlpReadUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: none +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadUserInfoRespArgID dlpFirstArgID + +typedef struct DlpReadUserInfoRespHdrType { + // OFFSET + UInt32 userID; // 0; user ID number (0 if none) + UInt32 viewerID; // 4; id assigned to viewer by the desktop + UInt32 lastSyncPC; // 8; last sync PC id (0 if none) + DlpDateTimeType succSyncDate; // 12; last successful sync (year = 0 if none) + DlpDateTimeType lastSyncDate; // 20; last sync date(year = 0 if none) + UInt8 userNameLen; // 28; length of user name field, + // including null (0 = no user name) + UInt8 passwordLen; // 29; length of encrypted password + // (0 = no password set) + // TOTAL: 30 bytes + } DlpReadUserInfoRespHdrType; + +typedef struct DlpReadUserInfoRespType { + // OFFSET + DlpReadUserInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 30 bytes + UInt8 nameAndPassword[2]; // 30; user name -- var size + // User name begins at the nameAndPassword field and is null-terminated. + // The encrypted password follows the user name and is NOT null-terminated. + // The encrypted password may contain any byte values(0-255). + } DlpReadUserInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteUserInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// user id (4 bytes) +// last sync PC id(4 bytes) +// user name +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpWriteUserInfoReqArgID dlpFirstArgID + +#define dlpMaxUserNameSize 41 // max user name size, including null byte + +typedef struct DlpWriteUserInfoReqHdrType { + // OFFSET + UInt32 userID; // 0; user ID number + UInt32 viewerID; // 4; id assigned to viewer by the desktop + UInt32 lastSyncPC; // 8; last sync PC id + DlpDateTimeType lastSyncDate; // 12; last sync date(year = 0 if none) + UInt8 modFlags; // 20; flags indicating which values are being + // modified; see the dlpUserInfoMod... + // flags defined below + UInt8 userNameLen; // 21; user name length, including null + // TOTAL: 22 bytes + } DlpWriteUserInfoReqHdrType; + +// Flags indicating which values are being changed by the dlpWriteUserInfo +// request. These flags are used in the modFlags field of DlpWriteUserInfoReqHdrType. +// These flags are additive. +// +#define dlpUserInfoModUserID 0x80 // changing the user id +#define dlpUserInfoModSyncPC 0x40 // changing the last sync PC id +#define dlpUserInfoModSyncDate 0x20 // changing sync date +#define dlpUserInfoModName 0x10 // changing user name +#define dlpUserInfoModViewerID 0x08 // changing the viewer id + +typedef struct DlpWriteUserInfoReqType { + // OFFSET + DlpWriteUserInfoReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 22 bytes + UInt8 userName[2]; // 22; user name -- var size + // User name begins at the userName field and is null-terminated. + } DlpWriteUserInfoReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSysInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem +// + +// Request argument structure: +// +// none. DLP v1.0 and v1.1 + +enum { + // NEW FOR DLP v1.2: + dlpReadSysInfoReqArgID = dlpFirstArgID + }; + + +// dlpReadSysInfoReqArgID request arg structure +// +typedef struct DlpReadSysInfoReqType { + // OFFSET + DlpVersionType dlpVer; // 0; DLP version of the caller + // TOTAL: 4 bytes + } DlpReadSysInfoReqType; + + +// Response argument structure: +// +// Both response arguments are returned in one reply +enum { + dlpReadSysInfoRespArgID = dlpFirstArgID, + + // NEW FOR DLP v1.2: + dlpReadSysInfoVerRespArgID + }; + +// dlpReadSysInfoRespArgID response arg structure: +// +typedef struct DlpReadSysInfoRespType { + // OFFSET + UInt32 romSWVersion; // 0; ROM-based sys software version + UInt32 localizationID;// 4; localization ID + UInt8 unused; // 8; unused(for alignment) -- set to null! + UInt8 prodIDSize; // 9; size of productID/model field + UInt32 prodID; // 10; product id (was variable size) + // TOTAL: 14 bytes + } DlpReadSysInfoRespType; + + +// dlpReadSysInfoVerRespArgID response arg structure: +// +typedef struct DlpReadSysInfoVerRespType { + // OFFSET + DlpVersionType dlpVer; // 0; DLP version of the device + DlpVersionType compVer; // 4; product compatibility version of the device + UInt32 dwMaxRecSize; // 8; maximum record/resource size that may be allocated on + // the device given that sufficient free memory exists + // (0xFFFFFFFF = up to available memory) + // TOTAL: 12 bytes + } DlpReadSysInfoVerRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpGetSysDateTime +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes: none + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpGetSysDateTimeRespArgID dlpFirstArgID + +typedef struct DlpGetSysDateTimeRespType { + // OFFSET + DlpDateTimeType dateTime; // 0; system date/time + // TOTAL: 8 bytes + } DlpGetSysDateTimeRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpSetSysDateTime +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// new system date/time +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrParam + +// Request argument structure: +// +#define dlpSetSysDateTimeReqArgID dlpFirstArgID + +typedef struct DlpSetSysDateTimeReqType { + // OFFSET + DlpDateTimeType dateTime; // 0; new system date/time + // TOTAL: 8 bytes + } DlpSetSysDateTimeReqType; + +typedef DlpSetSysDateTimeReqType* DlpSetSysDateTimeReqPtr; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadStorageInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +enum { + dlpReadStorageInfoReqArgID = dlpFirstArgID + }; + +typedef struct DlpReadStorInfoReqType { + // OFFSET + UInt8 startCardNo; // 0; card number to start at + // (0 = first) + UInt8 unused; // 1; unused -- set to null! + // TOTAL: 2 bytes + } DlpReadStorInfoReqType; + + +// Response argument structure: +// +enum { + dlpReadStorageInfoRespArgID = dlpFirstArgID, + dlpReadStorageInfoExRespArgID // v1.1 extension + }; + +// +// dlpReadStorageInfoRespArgID: +// + +// Card info structure of variable size +typedef struct DlpCardInfoHdrType { + // OFFSET + UInt8 totalSize; // 0; total size of this card info + // *ROUNDED UP TO EVEN SIZE* + UInt8 cardNo; // 1; card number + UInt16 cardVersion; // 2; card version + DlpDateTimeType crDate; // 4; creation date/time + UInt32 romSize; // 12; ROM size + UInt32 ramSize; // 16; RAM size + UInt32 freeRam; // 20; total free data store RAM - Fixed in DLP v1.2 to exclude + // dynamic heap RAM + UInt8 cardNameSize; // 24; size of card name string + UInt8 manufNameSize; // 25; size of manuf. name string + // TOTAL: 26 bytes; + } DlpCardInfoHdrType; + +typedef struct DlpCardInfoType { + // OFFSET + DlpCardInfoHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 26 bytes; + UInt8 cardNameAndManuf[2]; + // 26; card name and manuf. text -- var size + // Card name is the cardNameSize bytes of text at cardNameAndManuf, + // followed immediately by manufNameSize bytes of manufacturer name. + } DlpCardInfoType; + + +typedef struct DlpReadStorInfoRespHdrType { + // OFFSET + UInt8 lastCardNo; // 0; card number of last card retrieved + UInt8 more; // 1; non-zero if there are more cards + UInt8 unused; // 2; unused -- set to null! + UInt8 actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadStorInfoRespHdrType; + +typedef struct DlpReadStorInfoRespType { + // OFFSET + DlpReadStorInfoRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpCardInfoType cardInfo[1]; // 4; actCount of card info structures -- var size + } DlpReadStorInfoRespType; + + +// +// EXTENDED ARGUMENTS(DL v1.1): dlpReadStorageInfoExRespArgID +// +typedef struct DlpReadStorInfoExRespType { + // OFFSET + UInt16 romDBCount; // 0; ROM database count + UInt16 ramDBCount; // 2; RAM database count + UInt32 dwReserved1; // 4; RESERVED -- SET TO NULL! + UInt32 dwReserved2; // 8; RESERVED -- SET TO NULL! + UInt32 dwReserved3; // 12; RESERVED -- SET TO NULL! + UInt32 dwReserved4; // 16; RESERVED -- SET TO NULL! + // TOTAL: 20 bytes + } DlpReadStorInfoExRespType; + + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadDBList +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound + +// Request argument structure: +// +#define dlpReadDBListReqArgID dlpFirstArgID + +typedef struct DlpReadDBListReqType { + // OFFSET + UInt8 srchFlags; // 0; search flags + UInt8 cardNo; // 1; card number -- 0-based + UInt16 startIndex; // 2; DB index to start at + // (0 = from beginning) + // TOTAL: 4 bytes + } DlpReadDBListReqType; + +#define dlpReadDBListFlagRAM 0x80 // Search for RAM-based +#define dlpReadDBListFlagROM 0x40 // Search for ROM-based +#define dlpReadDBListFlagMultiple 0x20 // OK to return multiple entries (DEFINED FOR DLP v1.2) + + +// Response argument structure: +// +#define dlpReadDBListRespArgID dlpFirstArgID + +// Database info structure of variable size +typedef struct DlpDBInfoHdrType { + // OFFSET + UInt8 totalSize; // 0; total size of the DB info (DlpDBInfoHdrType + name) + // *ROUNDED UP TO EVEN SIZE* + UInt8 miscFlags; // 1; dlpDbInfoMiscFlag... flags(v1.1) -- set all unused bits to null! + UInt16 dbFlags; // 2; DB flags: dlpDBFlagReadOnly, + // dlpDBFlagResDB, dlpDBFlagAppInfoDirty, dlpDBFlagOpen, + // dlpDBFlagBackup, etc; + UInt32 type; // 4; database type + UInt32 creator; // 8; database creator + UInt16 version; // 12; database version + UInt32 modNum; // 14; modification number + DlpDateTimeType crDate; // 18; creation date + DlpDateTimeType modDate; // 26; latest modification date + DlpDateTimeType backupDate; // 34; latest backup date + UInt16 dbIndex; // 42; DB index (or dlpDbInfoUnknownDbIndex for dlpFindDB) + // TOTAL: 44 bytes; + } DlpDBInfoHdrType; + +// Flags for the miscFlags field of DlpDBInfoHdrType +#define dlpDbInfoMiscFlagExcludeFromSync 0x80 // DEFINED FOR DLP v1.1 +#define dlpDbInfoMiscFlagRamBased 0x40 // DEFINED FOR DLP v1.2 + +// Unknown index value for the dbIndex field of DlpDBInfoHdrType +#define dlpDbInfoUnknownDbIndex 0xFFFF + + +typedef struct DlpDBInfoType { + // OFFSET + DlpDBInfoHdrType header; // 0; fixed-size header + // FIXED SIZE: 44 bytes; + UInt8 name[2]; // 44; databse name text -- var size and + // null-terminated + } DlpDBInfoType; + + +typedef struct DlpReadDBListRespHdrType { + // OFFSET + UInt16 lastIndex; // 0; DB index of last entry retrieved + UInt8 flags; // 2; flags: dlpReadDBListRespFlagMore + UInt8 actCount; // 3; actual count of structures returned + // TOTAL: 4 bytes + } DlpReadDBListRespHdrType; + +// dlpReadDBListRespFlagMore flag: if set, indicates that there are more +// databases to list -- this enables the server to send the listing +// incrementally, reducing server memory requirements if necessary +#define dlpReadDBListRespFlagMore 0x80 + +typedef struct DlpReadDBListRespType { + // OFFSET + DlpReadDBListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes + DlpDBInfoType dbInfo[1]; // 4; actCount of DB info structures -- var size + } DlpReadDBListRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrTooManyOpenDatabases +// dlpRespErrCantOpen + +// Request argument structure: +// +#define dlpOpenDBReqArgID dlpFirstArgID + +typedef struct DlpOpenDBReqHdrType { + // OFFSET + UInt8 cardNo; // 0; memory module number + UInt8 mode; // 1; open mode + // TOTAL: 2 bytes; + } DlpOpenDBReqHdrType; + +#define dlpOpenDBModeRead 0x80 +#define dlpOpenDBModeWrite 0x40 +#define dlpOpenDBModeExclusive 0x20 +#define dlpOpenDBModeShowSecret 0x10 + + +typedef struct DlpOpenDBReqType { + // OFFSET + DlpOpenDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 name[2]; // 2; databse name text -- var size + // zero-terminated + } DlpOpenDBReqType; + +typedef DlpOpenDBReqType* DlpOpenDBReqPtr; + + +// Response argument structure: +// +#define dlpOpenDBRespArgID dlpFirstArgID +// +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCreateDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrAlreadyExists, +// dlpRespErrCantOpen, +// dlpRespErrNotEnoughSpace, +// dlpRespErrTooManyOpenDatabases + +// Request argument structure: +// +#define dlpCreateDBReqArgID dlpFirstArgID + +typedef struct DlpCreateDBReqHdrType { + // OFFSET + UInt32 creator; // 0; DB creator + UInt32 type; // 4; DB type + UInt8 cardNo; // 8; memory module number + UInt8 unused; // 9; unused -- set to null + UInt16 dbFlags; // 10; allowed flags: dlpDBFlagResDB, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall + UInt16 version; // 12; DB version # + // TOTAL: 14 bytes; + } DlpCreateDBReqHdrType; + +typedef struct DlpCreateDBReqType { + // OFFSET + DlpCreateDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + UInt8 name[2]; // 14; DB name text -- var size + // zero-terminated + } DlpCreateDBReqType; + +typedef DlpCreateDBReqType* DlpCreateDBReqPtr; + + +// Response argument structure: +// +#define dlpCreateDBRespArgID dlpFirstArgID + +// The response argument is the 1-byte database ID to be passed in +// subsequent read/write requests. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCloseDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrParam, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNoneOpen + +// Request argument structure: +// +typedef enum { + dlpCloseDBReqArgID = dlpFirstArgID, // close a specific database + dlpCloseDBAllReqArgID, // close all databases + dlpCloseDBExReqArgID // close a specific db and update backup + // and/or modification dates (PalmOS v3.0) + } DlpCloseDBReqArgID; + +// Argument structure to close a specific database(dlpCloseDBDBIDReqArgID): +// +// The request argument is the 1-byte database ID returned in open/create +// DB responses. +typedef UInt8 DlpCloseDBReqType; + +// Argument structure to close all databases(dlpCloseDBReqAllArgID): +// +// This request argument contains no data + + +// Request type for dlpCloseDBExReqArgID (PalmOS v3.0): +typedef struct DlpCloseDBExReqType { + // OFFSET + UInt8 dbID; // 0; database id to close + UInt8 bOptFlags; // 1; bitfield of dlpCloseDBExOptFlag... flags + // TOTAL: 2 bytes + } DlpCloseDBExReqType; + +// Option flags +#define dlpCloseDBExOptFlagUpdateBackupDate 0x80 // Update the backup date after closing +#define dlpCloseDBExOptFlagUpdateModDate 0x40 // Update the modification date after closing + + +#define dlpCloseDBExOptAllFlags (dlpCloseDBExOptFlagUpdateBackupDate | dlpCloseDBExOptFlagUpdateModDate) + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteDB +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrCantOpen, +// dlpRespErrDatabaseOpen + +// Request argument structure: +// +#define dlpDeleteDBReqArgID dlpFirstArgID + +typedef struct DlpDeleteDBReqHdrType { + // OFFSET + UInt8 cardNo; // 0; memory module number + UInt8 unused; // 1; unused -- set to null! + // TOTAL: 2 bytes; + } DlpDeleteDBReqHdrType; + + +typedef struct DlpDeleteDBReqType { + // OFFSET + DlpDeleteDBReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 name[2]; // 2; databse name text -- var size + // zero-terminated + } DlpDeleteDBReqType; + +typedef DlpDeleteDBReqType* DlpDeleteDBReqPtr; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadOpenDBInfo +////////////////////////////////////////////////////////////////////////// +// Get information on an open database +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadOpenDBInfoArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +#define dlpReadOpenDBInfoRespArgID dlpFirstArgID + + +typedef struct DlpReadOpenDBInfoRespType { + // OFFSET + UInt16 numRec; // 0; number of records or resources + // TOTAL: 2 bytes + } DlpReadOpenDBInfoRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpMoveCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNoneOpen +// dlpRespErrParam +// dlpRespErrNotSupported +// dlpRespErrReadOnly + +// Request argument structure: +// +#define dlpMoveCategoryReqArgID dlpFirstArgID + +typedef struct DlpMoveCategoryReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 fromCategory; // 1; id of the "from" category + UInt8 toCategory; // 2; id of the "to" category + UInt8 unused; // 3; unused -- set to null! + // TOTAL: 4 bytes; + } DlpMoveCategoryReqType; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpReadAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrNotFound +// dlpRespErrNoneOpen +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadBlockReqArgID dlpFirstArgID + +typedef struct DlpReadBlockReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt16 offset; // 2; offset into the block + UInt16 numBytes; // 4; number of bytes to read starting + // at offset(-1 = to the end) + // TOTAL: 6 bytes; + } DlpReadBlockReqType; + + +// Response argument structure: +// +#define dlpReadBlockRespArgID dlpFirstArgID + +typedef struct DlpReadBlockRespHdrType { + // OFFSET + UInt16 blockSize; // 0; actual block size -- may be greater + // than the amount of data returned + // TOTAL: 2 bytes + } DlpReadBlockRespHdrType; + +typedef struct DlpReadBlockRespType { + // OFFSET + DlpReadBlockRespHdrType // + header; // 0; fixed size header + // FIXED SIZE: 2 bytes + UInt8 data[2]; // 2; block data -- var size + } DlpReadBlockRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteAppBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly +// dlpRespErrNotEnoughSpace +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteBlockReqArgID dlpFirstArgID + +typedef struct DlpWriteBlockReqHdrType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt16 blockSize; // 2; total block size(0 = free existing block) + // TOTAL: 4 bytes; + } DlpWriteBlockReqHdrType; + + +typedef struct DlpWriteBlockReqType { + // OFFSET + DlpWriteBlockReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 4 bytes; + UInt8 data[2]; // 4; block data -- var size + } DlpWriteBlockReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpReadAppBlock + + +// Response argument structure: +// +// see dlpReadAppBlock + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteSortBlock +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +// see dlpWriteAppBlock + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextModifiedRec +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadRecord +// + +// Request argument structure: +// +#define dlpReadNextModRecReqArgID dlpFirstArgID +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// Response argument id = dlpReadRecordRespArgID + +// Response argument structure = DlpReadRecordRespType + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetRecordIndex +////////////////////////////////////////////////////////////////////////// +// Resets the "next modified record" index to the beginning +// +// Possible error codes +// dlpRespErrParam +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetRecordIndexReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrRecordBusy, +// dlpRespErrNoneOpen + +typedef enum { + dlpReadRecordIdArgID = dlpFirstArgID, + dlpReadRecordIndexArgID + } DlpReadRecordReqArgID; + +// dlpReadRecordIdArgID request argument structure: +// +typedef struct DlpReadRecordByIDReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt32 recordID; // 2; unique record id + UInt16 offset; // 6; offset into the record + UInt16 numBytes; // 8; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 10 bytes; + } DlpReadRecordByIDReqType; + +// dlpReadRecordIndexArgID request argument structure: +// +typedef struct DlpReadRecordByIndexReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt16 index; // 2; record index + UInt16 offset; // 4; offset into the record + UInt16 numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadRecordByIndexReqType; + + +// Response argument structure: +// +#define dlpReadRecordRespArgID dlpFirstArgID + +typedef struct DlpReadRecordRespHdrType { + // OFFSET + UInt32 recordID; // 0; unique record id + UInt16 index; // 4; record index + UInt16 recSize; // 6; total record size in bytes + UInt8 attributes; // 8; record attributes + UInt8 category; // 9; record category index + // TOTAL: 10 bytes; + } DlpReadRecordRespHdrType; + +typedef struct DlpReadRecordRespType { + // OFFSET + DlpReadRecordRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + UInt8 data[2]; // 8; record data -- var size + } DlpReadRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadRecordIDList +////////////////////////////////////////////////////////////////////////// +// Returns a list of unique record id's. May need to call more than once +// to get the entire list. dlpRespErrNotFound is returned when "start" +// is out of bounds +// +// Possible error codes +// dlpRespErrNotSupported, +// dlpRespErrParam, +// dlpRespErrNotFound, +// dlpRespErrNoneOpen + +#define dlpReadRecordIDListReqArgID dlpFirstArgID + +// dlpReadRecordIDListReqArgID request argument structure: +// +typedef struct DlpReadRecordIDListReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 flags; // 1; request flags + UInt16 start; // 2; starting record index (0-based) + UInt16 maxEntries; // 4; maximum number of entries, or + // 0xFFFF to return as many as possible + // TOTAL: 6 bytes; + } DlpReadRecordIDListReqType; + +// dlpReadRecordIDListFlagSortDB: if set, DL Server will call the creator +// application to resort the database before returning the list. +#define dlpReadRecordIDListFlagSortDB 0x80 + + +// Response argument structure: +// +#define dlpReadRecordIDListRespArgID dlpFirstArgID + +typedef struct DlpReadRecordIDListRespHdrType { + // OFFSET + UInt16 numEntries; // 0; number of entries returned + // TOTAL: 2 bytes; + } DlpReadRecordIDListRespHdrType; + +typedef struct DlpReadRecordIDListRespType { + // OFFSET + DlpReadRecordIDListRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt32 recID[1]; // 8; list of record id's -- var size + } DlpReadRecordIDListRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotEnoughSpace +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteRecordReqArgID dlpFirstArgID + +// dlpWriteRecordReqArgID -- required +typedef struct DlpWriteRecordReqHdrType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 flags; // 1; set unused bits to null! + UInt32 recordID; // 2; unique record id or null + UInt8 attributes; // 6; record attributes -- only + // dlpRecAttrSecret is allowed here + // v1.1 extension: + // dlpRecAttrDeleted, dlpRecAttrArchived and + // dlpRecAttrDirty are also allowed. + UInt8 category; // 7; record category + // TOTAL: 8 bytes; + } DlpWriteRecordReqHdrType; + +#define dlpWriteRecordReqFlagDataIncluded 0x80 // original implementer of destop software always + // set this bit. Define it here for compatibility + +typedef struct DlpWriteRecordReqType { + // OFFSET + DlpWriteRecordReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes; + UInt8 data[2]; // 8; record data -- var size + } DlpWriteRecordReqType; + + +// Response argument structure: +// +#define dlpWriteRecordRespArgID dlpFirstArgID + +typedef struct DlpWriteRecordRespType { + // OFFSET + UInt32 recordID; // 0; record ID + // TOTAL: 4 bytes + } DlpWriteRecordRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteRecord +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen +// + +// Request argument structure: +// +#define dlpDeleteRecordReqArgID dlpFirstArgID + +// Argument structure to delete by record ID(dlpDeleteRecordReqIDArgID): +typedef struct DlpDeleteRecordReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 flags; // 1; flags (dlpDeleteRecFlagDeleteAll) + UInt32 recordID; // 2; unique record id (see flags) + // TOTAL: 6 bytes; + } DlpDeleteRecordReqType; + +// dlpDeleteRecFlagDeleteAll: if this flag is set, the reocordID field +// is ignored and all database records will be deleted +#define dlpDeleteRecFlagDeleteAll 0x80 + +// dlpDeleteRecFlagByCategory: if this flag is set, the least significant byte +// of the reocordID field contains the category id of records to be deleted (PalmOS 2.0) +#define dlpDeleteRecFlagByCategory 0x40 + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNoneOpen + +typedef enum { + dlpReadResourceIndexArgID = dlpFirstArgID, + dlpReadResourceTypeArgID + } DlpReadResourceReqArgID; + +// dlpReadResourceIndexArgID request argument structure: +// +typedef struct DlpReadResourceByIndexReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt16 index; // 2; resource index + UInt16 offset; // 4; offset into the resource + UInt16 numBytes; // 6; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 8 bytes; + } DlpReadResourceByIndexReqType; + +// dlpReadResourceTypeArgID request argument structure: +// +typedef struct DlpReadResourceByTypeReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; unused -- set to null! + UInt32 type; // 2; resource type + UInt16 id; // 6; resource id + UInt16 offset; // 8; offset into the resource + UInt16 numBytes; // 10; number of bytes to read starting + // at the offset(-1 = "to the end") + // TOTAL: 12 bytes; + } DlpReadResourceByTypeReqType; + + +// Response argument structure: +// +#define dlpReadResourceRespArgID dlpFirstArgID + +typedef struct DlpReadResourceRespHdrType { + // OFFSET + UInt32 type; // 0; resource type + UInt16 id; // 4; resource id + UInt16 index; // 6; resource index + UInt16 resSize; // 8; total resource size in bytes + // TOTAL: 10 bytes; + } DlpReadResourceRespHdrType; + +typedef struct DlpReadResourceRespType { + // OFFSET + DlpReadResourceRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes; + UInt8 resData[2]; // 6; resource data -- var size + } DlpReadResourceRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpWriteResourceReqArgID dlpFirstArgID + +typedef struct DlpWriteResourceReqHdrType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; inused -- set to null! + UInt32 type; // 2; resource type + UInt16 id; // 6; resource id + UInt16 resSize; // 8; total resource size + // TOTAL: 10 bytes; + } DlpWriteResourceReqHdrType; + +typedef struct DlpWriteResourceReqType { + // OFFSET + DlpWriteResourceReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 10 bytes; + UInt8 data[2]; // 10; resource data -- var size + } DlpWriteResourceReqType; + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteResourceStream +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam, +// dlpRespErrNoneOpen +#pragma mark Dm Write Resource Stream + +// +// Callback parameters +// +// Write calback parameters +typedef struct DlpWriteResourceCallbackParamType{ + // OFFSET + MemPtr dmBufP; // 0: Locked dm heap handle + UInt32 numBytes; // 4: Expected File Size + UInt32 offset; + // TOTAL: 8 bytes + } DlpWriteResourceCallbackParamType; + +typedef DlpWriteResourceCallbackParamType* DlpWriteResourceCallbackParamPtr; + +// Request argument structure: +// +#define dlpWriteResourceStreamReqArgID dlpFirstArgID + +typedef struct DlpWriteResourceStreamReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 unused; // 1; inused -- set to null! + UInt32 type; // 2; resource type + UInt16 id; // 6; resource id + UInt16 resSize; // 8; total resource size + // TOTAL: 10 bytes; + } DlpWriteResourceStreamReqType; + +typedef DlpWriteResourceStreamReqType* DlpWriteResourceStreamReqPtr; + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteRecordStream +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotEnoughSpace +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen +#pragma mark Dm Write Record Stream + +// +// Callback parameters +// +// Write calback parameters +typedef struct DlpWriteRecordCallbackParamType{ + // OFFSET + MemPtr dmBufP; // 0: Locked dm heap handle + UInt32 numBytes; // 4: Expected File Size + UInt32 offset; + // TOTAL: 8 bytes + } DlpWriteRecordCallbackParamType; + +typedef DlpWriteRecordCallbackParamType* DlpWriteRecordCallbackParamPtr; + +// Request argument structure: +// +#define dlpWriteRecordStreamReqArgID dlpFirstArgID + +// dlpWriteRecordReqArgID -- required +typedef struct DlpWriteRecordStreamReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 flags; // 1; set unused bits to null! + UInt32 recordID; // 2; unique record id or null + UInt8 attributes; // 6; record attributes -- only + // dlpRecAttrSecret is allowed here + // v1.1 extension: + // dlpRecAttrDeleted, dlpRecAttrArchived and + // dlpRecAttrDirty are also allowed. + UInt8 category; // 7; record category + UInt32 recordSize; + // TOTAL: 8 bytes; + } DlpWriteRecordStreamReqType; + +typedef DlpWriteRecordStreamReqType* DlpWriteRecordStreamReqPtr; + +// Response argument structure: +// +#define dlpWriteRecordStreamRespArgID dlpFirstArgID + +typedef struct DlpWriteRecordStreamRespType { + // OFFSET + UInt32 recordID; // 0; record ID + // TOTAL: 4 bytes + } DlpWriteRecordStreamRespType; + + + + + +////////////////////////////////////////////////////////////////////////// +// dlpDeleteResource +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpDeleteResourceReqArgID dlpFirstArgID + +typedef struct DlpDeleteResourceReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 flags; // 1; flags (dlpDeleteResFlagDeleteAll) + UInt32 type; // 2; resource type + UInt16 id; // 6; resource id + // TOTAL: 8 bytes; + } DlpDeleteResourceReqType; + +// dlpDeleteResFlagDeleteAll: if set, all resources in the db will be deleted +#define dlpDeleteResFlagDeleteAll 0x80 + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCleanUpDatabase +////////////////////////////////////////////////////////////////////////// +// Deletes all records which are marked as archived or deleted in the +// record database +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrReadOnly, +// dlpRespErrNotSupported +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpCleanUpDatabaseReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSyncFlags +////////////////////////////////////////////////////////////////////////// +// For record databases, reset all dirty flags. +// For both record and resource databases, set the last sync time to NOW +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam +// dlpRespErrReadOnly, +// dlpRespErrNoneOpen + +// Request argument structure: +// +#define dlpResetSyncFlagsReqArgID dlpFirstArgID + +// The request argument is the 1-byte database ID returned in open/create +// DB responses. + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpCallApplication +////////////////////////////////////////////////////////////////////////// +// Call an application entry point via an action code +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound + +// Request argument structure: +// +enum { + dlpCallApplicationReqArgIDV10 = dlpFirstArgID, // req id for Pilot v1.0 + dlpCallAppReqArgID // req id for Pilot v2.0 and later + }; + +// dlpCallApplicationReqArgIDV10: +typedef struct DlpCallApplicationReqHdrTypeV10 { + // OFFSET + UInt32 creator; // 0; app DB creator id + UInt16 action; // 4; action code + UInt16 paramSize; // 6; custom param size + // TOTAL: 8 bytes + } DlpCallApplicationReqHdrTypeV10; + +typedef struct DlpCallApplicationReqTypeV10 { + // OFFSET + DlpCallApplicationReqHdrTypeV10 // + header; // 0; fixed-size header + // FIXED SIZE: 8 bytes + UInt8 paramData[2]; // 8; custom param data -- var size + } DlpCallApplicationReqTypeV10; + + +// dlpCallAppReqArgID (Pilot v2.0): +typedef struct DlpCallAppReqHdrType { + // OFFSET + UInt32 creator; // 0; DB creator id of target executable + UInt32 type; // 4; DB type id of target executable + UInt16 action; // 8; action code + UInt32 dwParamSize; // 10; custom param size in number of bytes + UInt32 dwReserved1; // 14; RESERVED -- set to NULL!!! + UInt32 dwReserved2; // 18; RESERVED -- set to NULL!!! + // TOTAL: 22 bytes + } DlpCallAppReqHdrType; + +typedef struct DlpCallAppReqType { + // OFFSET + DlpCallAppReqHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 22 bytes + UInt8 paramData[2]; // 22; custom param data -- var size + } DlpCallAppReqType; + + + +// Response argument structure: +// +enum { + dlpCallApplicationRespArgIDV10 = dlpFirstArgID, // resp id for Pilot v1.0 + dlpCallAppRespArgID // resp id for Pilot v2.0 and later + }; + +// dlpCallApplicationRespArgIDV10: +typedef struct DlpCallApplicationRespHdrTypeV10 { + // OFFSET + UInt16 action; // 0; action code which was called + UInt16 resultCode; // 2; result error code returned by action + UInt16 resultSize; // 4; custom result data size + // TOTAL: 6 bytes + } DlpCallApplicationRespHdrTypeV10; + +typedef struct DlpCallApplicationRespTypeV10 { + // OFFSET + DlpCallApplicationRespHdrTypeV10 // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes + UInt8 resultData[2]; // 6; custom result data -- var size + } DlpCallApplicationRespTypeV10; + +// dlpCallAppRespArgID: +typedef struct DlpCallAppRespHdrType { + // OFFSET + UInt32 dwResultCode; // 0; result error code returned by handler + UInt32 dwResultSize; // 4; custom result data size + UInt32 dwReserved1; // 8; RESERVED -- SET TO NULL!!! + UInt32 dwReserved2; // 12; RESERVED -- SET TO NULL!!! + // TOTAL: 16 bytes + } DlpCallAppRespHdrType; + +typedef struct DlpCallAppRespType { + // OFFSET + DlpCallAppRespHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 16 bytes + UInt8 resultData[2]; // 16; custom result data -- var size + } DlpCallAppRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpResetSystem +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpAddSyncLogEntry +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrLimitExceeded, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpAddSyncLogEntryReqArgID dlpFirstArgID + +typedef struct DlpAddSyncLogEntryReqType { + // OFFSET + UInt8 text[2]; // 0; entry text -- var size and + // null-terminated + } DlpAddSyncLogEntryReqType; + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpProcessRPC +////////////////////////////////////////////////////////////////////////// +// Remote Procedure Call interface +// +// Request arguments: +// RPC command block +// +// Response arguments: +// RPC reply block +// +// Possible error codes +// 0 on success; otherwise error code from the TouchDown +// RPC executor +// +// NOTE: this is a low-level system command which does not use arg wrappers. + +// Request argument structure: +// +// Block of RPC command data (no arg wrapper) + +// Response argument structure: +// +// Block of RPC reply data of same length as command block(no arg wrapper) + + + +////////////////////////////////////////////////////////////////////////// +// dlpOpenConduit +////////////////////////////////////////////////////////////////////////// +// This command is sent before each conduit is opened by the desktop. +// If the viewer has a cancel pending, it will return dlpRespErrCancelSync +// in the response header's errorCode field. +// +// Request arguments: none. +// +// Response arguments: none. +// +// Possible error codes +// dlpRespErrCancelSync + +// Request argument structure: +// +// none. + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpEndOfSync +////////////////////////////////////////////////////////////////////////// +// This command is sent by the desktop to end the sync. +// +// Request arguments: termination code: 0 = normal termination; +// otherwise the client is aborting the sync +// +// Possible error codes +// 0 + +// Request argument structure: +// +#define dlpEndOfSyncReqArgID dlpFirstArgID + +typedef enum DlpSyncTermCode { + dlpTermCodeNormal = 0, // normal termination + dlpTermCodeOutOfMemory, // termination due to low memory on TD + dlpTermCodeUserCan, // user cancelled from desktop + dlpTermCodeOther, // catch-all abnormal termination code + dlpTermCodeIncompatibleProducts // incompatibility between desktop and handheld hotsync products + } DlpSyncTermCode; + + +typedef struct DlpEndOfSyncReqType { + // OFFSET + UInt16 termCode; // 0; termination code + // TOTAL: 2 bytes + } DlpEndOfSyncReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextRecInCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadRecord + +#define dlpReadNextRecInCategoryReqArgID dlpFirstArgID + +// dlpReadNextRecInCategoryReqArgID request argument structure: +// +typedef struct DlpReadNextRecInCategoryReqType { + // OFFSET + UInt8 dbID; // 0; database id + UInt8 category; // 1; category id + // TOTAL: 2 bytes; + } DlpReadNextRecInCategoryReqType; + + +// Response argument structure: +// +// Response argument id = dlpReadRecordRespArgID + +// Response argument structure = DlpReadRecordRespType + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNextModifiedRecInCategory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// see dlpReadNextRecInCategory + +// Request argument structure: +// +// same as dlpReadNextRecInCategory + +// Response argument structure: +// +// same as dlpReadNextRecInCategory + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadAppPreference +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory, +// dlpRespErrParam, +// dlpRespErrNotFound, + +#define dlpReadAppPreferenceReqArgID dlpFirstArgID + +// dlpReadAppPreferenceReqArgID request argument structure: +// +typedef struct DlpReadAppPreferenceReqType { + // OFFSET + UInt32 creator; // 0; application creator type + UInt16 id; // 4; preference id + UInt16 reqBytes; // 6; max. number of preference bytes requested; + // pass 0xFFFF for actual size + UInt8 flags; // 8; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db + UInt8 unused; // 9; reserved/padding -- set to NUL! + // TOTAL: 10 bytes; + } DlpReadAppPreferenceReqType; + +#define dlpReadAppPrefActualSize 0xFFFF +#define dlpAppPrefReqFlagBackedUp 0x80 + +// Response argument structure: +// +#define dlpReadAppPreferenceRespArgID dlpFirstArgID + +typedef struct DlpReadAppPreferenceRespHdrType { + // OFFSET + UInt16 version; // 0; version number of the application + UInt16 actualSize; // 2; actual preference data size + UInt16 retBytes; // 4; number of preference bytes returned + // TOTAL: 6 bytes + } DlpReadAppPreferenceRespHdrType; + +typedef struct DlpReadAppPreferenceRespType { + // OFFSET + DlpReadAppPreferenceRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes + UInt8 data[2]; // 6; custom result data -- var size + } DlpReadAppPreferenceRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteAppPreference +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotEnoughSpace + +// Request argument structure: +// +#define dlpWriteAppPreferenceReqArgID dlpFirstArgID + +typedef struct DlpWriteAppPreferenceReqHdrType { + // OFFSET + UInt32 creator; // 0; application creator type + UInt16 id; // 4; preference id + UInt16 version; // 6; version number of the application + UInt16 prefSize; // 8; preference size(in number of bytes) + UInt8 flags; // 10; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db + UInt8 unused; // 11; reserved/padding -- set to NUL! + // TOTAL: 12 bytes; + } DlpWriteAppPreferenceReqHdrType; + +typedef struct DlpWriteAppPreferenceReqType { + // OFFSET + DlpWriteAppPreferenceReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + UInt8 data[2]; // 12; record data -- var size + } DlpWriteAppPreferenceReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadNetSyncInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: none +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrMemory + +// Request argument structure: +// +// none. + +// Response argument structure: +// +#define dlpReadNetSyncInfoRespArgID dlpFirstArgID + +typedef struct DlpReadNetSyncInfoRespHdrType { + // OFFSET + UInt8 lanSyncOn; // 0; non-zero if Lan Sync is enabled + UInt8 bReserved1; // 1; reserved -- SET TO NULL! + UInt32 dwReserved1; // 2; reserved -- SET TO NULL! + UInt32 dwReserved2; // 6; reserved -- SET TO NULL! + UInt32 dwReserved3; // 10; reserved -- SET TO NULL! + UInt32 dwReserved4; // 14; reserved -- SET TO NULL! + UInt16 syncPCNameSize;// 18; length of sync PC host name, + // including null (0 = no host name) + UInt16 syncPCAddrSize;// 20; length of sync PC address, + // including null (0 = no address) + UInt16 syncPCMaskSize;// 22; length of sync PC subnet mask, + // including null (0 = no mask) + // TOTAL: 24 bytes + } DlpReadNetSyncInfoRespHdrType; + +typedef struct DlpReadNetSyncInfoRespType { + // OFFSET + DlpReadNetSyncInfoRespHdrType // + hdr; // 0; fixed-size header + // FIXED SIZE: 24 bytes + UInt8 syncAddr[2]; // 24; sync IP address/host name -- var size, + // null-terminated + } DlpReadNetSyncInfoRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpWriteNetSyncInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: none +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpWriteNetSyncInfoReqArgID dlpFirstArgID + +#define dlpMaxHostAddrLength 255 // maximum PC host name length, not including NULL + +typedef struct DlpWriteNetSyncInfoReqHdrType { + // OFFSET + UInt8 modFlags; // 0; flags indicating which values are being + // modified; see the dlpNetSyncInfoMod... + // flags defined below + UInt8 lanSyncOn; // 1; non-zero if Lan Sync is enabled + UInt32 dwReserved1; // 2; reserved -- SET TO NULL! + UInt32 dwReserved2; // 6; reserved -- SET TO NULL! + UInt32 dwReserved3; // 10; reserved -- SET TO NULL! + UInt32 dwReserved4; // 14; reserved -- SET TO NULL! + UInt16 syncPCNameSize;// 18; length of sync PC host name, + // including null (0 = no address/host name) + UInt16 syncPCAddrSize;// 20; length of sync PC address, + // including null (0 = no address) + UInt16 syncPCMaskSize;// 22; length of sync PC subnet mask, + // including null (0 = no mask) + // TOTAL: 24 bytes + } DlpWriteNetSyncInfoReqHdrType; + +// Flags indicating which values are being changed by the dlpWriteNetSyncInfo +// request. These flags are used in the modFlags field of DlpWriteNetSyncInfoReqHdrType. +// These flags are additive. +// +#define dlpNetSyncInfoModLanSyncOn 0x80 // changing the "lan sync on" setting +#define dlpNetSyncInfoModSyncPCName 0x40 // changing the sync PC host name +#define dlpNetSyncInfoModSyncPCAddr 0x20 // changing the sync PC address +#define dlpNetSyncInfoModSyncPCMask 0x10 // changing the sync PC subnet mask + +typedef struct DlpWriteNetSyncInfoReqType { + // OFFSET + DlpWriteNetSyncInfoReqHdrType + hdr; // 0; fixed-size header + // FIXED SIZE: 24 bytes + UInt8 syncAddr[2]; // 24; sync IP address/host name -- var size, + // null-terminated + } DlpWriteNetSyncInfoReqType; + + +// Response argument structure: +// +// none. + + + +////////////////////////////////////////////////////////////////////////// +// dlpReadFeature +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotFound, +// dlpRespErrParam + +// Request argument structure: +// +#define dlpReadFeatureReqArgID dlpFirstArgID + +typedef struct DlpReadFeatureReqType { + // OFFSET + UInt32 dwFtrCreator; // 0; feature creator + UInt16 wFtrNum; // 4; feature number + // TOTAL: 6 bytes + } DlpReadFeatureReqType; + + +// Response argument structure: +// +#define dlpReadFeatureRespArgID dlpFirstArgID + +typedef struct DlpReadFeatureRespType { + // OFFSET + UInt32 dwFeature; // 0; feature value + // TOTAL: 4 bytes + } DlpReadFeatureRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpFindDB +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotFound, +// dlpRespErrParam + +// Request argument structure: +// + +// dlpFindDBByNameReqArgID, dlpFindDBByTypeCreatorReqArgID and dlpFindDBByOpenHandleReqArgID +// are mutually exclusive +enum { + dlpFindDBByNameReqArgID = dlpFirstArgID, // req id for card + name based search + dlpFindDBByOpenHandleReqArgID, // req id for search given an open db handle + dlpFindDBByTypeCreatorReqArgID // req id for type + creator based iterative search + }; + +// Option flags +#define dlpFindDBOptFlagGetAttributes 0x80 // get database attributes -- this is + // an option to allow find operations to skip + // returning this data as a performance optimization + +#define dlpFindDBOptFlagGetSize 0x40 // get record count and data size also -- this is + // an option because the operation can take a long + // time, which we would rather avoid if it is not needed + +#define dlpFindDBOptFlagGetMaxRecSize 0x20 // get max rec/resource size -- this is + // an option because the operation can take a long + // time, which we would rather avoid if it is not needed + // (dlpFindDBOptFlagGetMaxRecSize is only supported for + // dlpFindDBByOpenHandleReqArgID) + +// Request type for dlpdlpFindDBByNameReqArgID: +typedef struct DlpFindDBByNameReqHdrType { + // OFFSET + UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags + UInt8 bCardNo; // 2; card number to search + // TOTAL: 4 bytes + } DlpFindDBByNameReqHdrType; + +typedef struct DlpFindDBByNameReqType { + // OFFSET + DlpFindDBByNameReqHdrType // + header; // 0; fixed size header + // FIXED SIZE: 4 bytes + UInt8 name[2]; // variable size -- zero-terminated database name string + } DlpFindDBByNameReqType; + + +// Request type for dlpFindDBByOpenHandleReqArgID: +typedef struct DlpFindDBByOpenHandleReqType { + // OFFSET + UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags + UInt8 bDbID; // 1; database id returned by dlpOpenDB or dlpCreateDB + // TOTAL: 2 bytes + } DlpFindDBByOpenHandleReqType; + + +// Request type for dlpFindDBByTypeCreatorReqArgID: +typedef struct DlpFindDBByTypeCreatorReqType { + // OFFSET + UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags + UInt8 bSrchFlags; // 1; bitfield of dlpFindDBSrchFlag... flags + UInt32 dwType; // 2; db type id (zero = wildcard) + UInt32 dwCreator; // 6; db creator id (zero = wildcard) + // TOTAL: 10 bytes + } DlpFindDBByTypeCreatorReqType; + +#define dlpFindDBSrchFlagNewSearch 0x80 // set to beging a new search +#define dlpFindDBSrchFlagOnlyLatest 0x40 // set to search for the latest version + + + +// Response argument structures for dlpFindDBByNameReqArgID, dlpFindDBByOpenHandleReqArgID and +// dlpFindDBByTypeCreatorReqArgID (if found): +// +enum { + dlpFindDBBasicRespArgID = dlpFirstArgID, // resp arg id for basic info + // (if dlpFindDBOptFlagGetAttributes is set) + dlpFindDBSizeRespArgID // resp arg id for size info + // (if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize + // are set) + }; + + +// dlpFindDBBasicRespArgID (returned only if dlpFindDBOptFlagGetAttributes is set): + +typedef struct DlpFindDBBasicRespHdrType { + // OFFSET + UInt8 bCardNo; // 0; card number of database + UInt8 bReserved; // 1; RESERVED -- SET TO NULL + UInt32 dwLocalID; // 2; local id of the database (for internal use) + UInt32 dwOpenRef; // 6; db open ref of the database if it is currently opened + // by the caller; zero otherwise (for internal use) can + // change after read record list + DlpDBInfoHdrType info; //10; database info (creator, type, flags, etc.) MUST BE LAST FIELD + // TOTAL: 54 bytes + } DlpFindDBBasicRespHdrType; + +typedef struct DlpFindDBBasicRespType { + // OFFSET + DlpFindDBBasicRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 54 bytes + UInt8 name[2]; // variable size -- zero-terminated database name string + } DlpFindDBBasicRespType; + + + +// dlpFindDBSizeRespArgID (returned only if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize is set): + +typedef struct DlpFindDBSizeRespType { + // OFFSET + + // Returned if dlpFindDBOptFlagGetSize is set for all queries: + // (otherwise, fields are set to zero) + UInt32 dwNumRecords; // 0; record/resource count + UInt32 dwTotalBytes; // 4; total bytes used by db + UInt32 dwDataBytes; // 8; bytes used for data + + // Returned if dlpFindDBOptFlagGetSize is set for dlpFindDBByOpenHandleReqArgID only: + // (otherwise, fields are set to zero) + UInt32 dwAppBlkSize; //12; size of app info block size (for + // dlpFindDBByOpenHandleReqArgID only) + UInt32 dwSortBlkSize; //16; size of sort info block size(for + // dlpFindDBByOpenHandleReqArgID only) + // + // Returned if dlpFindDBOptFlagGetMaxRecSize is set for dlpFindDBByOpenHandleReqArgID only: + // (otherwise, field is set to zero) + UInt32 dwMaxRecSize; //20; size of largest record or resource in the database (for + // dlpFindDBByOpenHandleReqArgID + dlpFindDBOptFlagGetMaxRecSize only) + // TOTAL: 24 bytes + } DlpFindDBSizeRespType; + + + + +////////////////////////////////////////////////////////////////////////// +// dlpSetDBInfo +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrParam, +// dlpRespErrNotFound +// dlpRespErrNotEnoughSpace +// dlpRespErrNotSupported +// dlpRespErrReadOnly +// dlpRespErrNoneOpen + +// Request argument structure: +// + +enum { + dlpSetDBInfoReqArgID = dlpFirstArgID + }; + + +typedef struct DlpSetDBInfoReqHdrType { + // OFFSET + UInt8 dbID; // 0; database id returned by dlpOpenDB or dlpCreateDB + UInt8 bReserved; // 1; RESERVED -- SET TO NULL + UInt16 wClrDbFlags; // 2; flags to clear; allowed DB flags: dlpDBFlagAppInfoDirty, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention; + // 0 = don't change + UInt16 wSetDbFlags; // 4; flags to set; allowed DB flags: dlpDBFlagAppInfoDirty, + // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer, + // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention; + // 0 = don't change + UInt16 wDbVersion; // 6; database version; dlpSetDBInfoNoVerChange = don't change + DlpDateTimeType crDate; // 8; creation date; zero year = don't change + DlpDateTimeType modDate; //16; modification date; zero year = don't change + DlpDateTimeType bckUpDate; //24; backup date; zero year = don't change + UInt32 dwType; //32; database type id; zero = don't change + UInt32 dwCreator; //36; database creator id; zero = don't change + // TOTAL: 40 bytes + } DlpSetDBInfoReqHdrType; + +#define dlpSetDBInfoNoVerChange 0xFFFF + +typedef struct DlpSetDBInfoReqType { + // OFFSET + DlpSetDBInfoReqHdrType // + header; // 0; fixed size header + // FIXED SIZE: 40 bytes + UInt8 name[2]; // variable size -- zero-terminated database name string + } DlpSetDBInfoReqType; + + +// Response argument structure: +// +// none. + + +////////////////////////////////////////////////////////////////////////// +// dlpExpSlotEnumerate +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark Exp Slot Enumerate +// Response argument structure: +// +#define dlpExpSlotsEnumerateRespArgID dlpFirstArgID + +typedef struct DlpExpSlotsEnumerateRespHdrType { + // OFFSET + UInt16 numSlots; // 0: Number of slots + + } DlpExpSlotsEnumerateRespHdrType; + +typedef struct DlpExpSlotsEnumerateRespType { + // OFFSET + DlpExpSlotsEnumerateRespHdrType + header; // 2: Fixed Header + + UInt16 slots[2]; // 0; Variable size number of volumes + + } DlpExpSlotsEnumerateRespType; + +typedef DlpExpSlotsEnumerateRespType* DlpExpSlotsEnumerateRespPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpExpCardPresent +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark Exp Card Present +// Request argument structure: +// +#define dlpExpCardPresentReqArgID dlpFirstArgID + +typedef struct DlpExpCardPresentReqType { + // OFFSET + UInt16 slotRef; // 0: Slot Reference + + } DlpExpCardPresentReqType; + +typedef DlpExpCardPresentReqType* DlpExpCardPresentReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpExpCardInfo +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// Fill in later. +#pragma mark Exp Card Info + +// Request argument structure: +// +#define dlpExpCardInfoReqArgID dlpFirstArgID + +typedef struct DlpExpCardInfoReqType { + // OFFSET + UInt16 slotRefNum; // 0; Slot Reference Number + + } DlpExpCardInfoReqType; + +typedef DlpExpCardInfoReqType* DlpExpCardInfoReqPtr; + +// Response argument structure: +// +#define dlpExpCardInfoTypeRespArgID dlpFirstArgID + +typedef struct DlpExpCardInfoRespHdrType { + // OFFSET + UInt32 capabilityFlags; // 0: Capabilities of the Slot + UInt16 numStrings; + + } DlpExpCardInfoRespHdrType; + +typedef struct DlpExpCardInfoRespType { + // OFFSET + DlpExpCardInfoRespHdrType + header; // 2: Fixed Header + + UInt16 buffer[2]; // 0; Packed Strings buffer + + } DlpExpCardInfoRespType; + +typedef DlpExpCardInfoRespType* DlpExpCardInfoRespPtr; + + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileCustomControl +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// Fill in later. +#pragma mark VFS File Custom Control + +// Request argument structure: +// +#define dlpVFSFileCustomControlReqArgID dlpFirstArgID + +typedef struct DlpVFSFileCustomControlReqHdrType { + // OFFSET + UInt32 fsCreator; // 0; + UInt32 apiCreator; // 4; + UInt16 apiSelector; // 8; + UInt16 bufLen; // 10; + // TOTAL: 12 bytes + } DlpVFSFileCustomControlReqHdrType; + +typedef struct DlpVFSFileCustomControlReqType { + // OFFSET + DlpVFSFileCustomControlReqHdrType// + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + UInt16 buffer[2]; // 14; The path name and the + // new name are packed together + // both are zero terminated. + } DlpVFSFileCustomControlReqType; + +typedef DlpVFSFileCustomControlReqType* DlpVFSFileCustomControlReqPtr; + +// Response argument structure: +// +#define dlpVFSFileCustomControlRespArgID dlpFirstArgID + +typedef struct DlpVFSFileCustomControlHdrType { + // OFFSET + UInt16 bufLen; // 0: Buffer length + + } DlpVFSFileCustomControlHdrType; + +typedef struct DlpVFSFileCustomControlRespType { + // OFFSET + DlpVFSFileCustomControlHdrType + header; // 2: Fixed Header + + UInt16 buffer[2]; // 0; Variable size number of volumes + + } DlpVFSFileCustomControlRespType; + +typedef DlpVFSFileCustomControlRespType* DlpVFSFileCustomControlRespPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSGetDefaultDirectory +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes + +#pragma mark VFS Get Default Directory + +// Request argument structure: +// +#define dlpVFSGetDefaultDirReqArgID dlpFirstArgID + +typedef struct DlpVFSGetDefaultDirReqHdrType { + // OFFSET + UInt16 volRefNum; // 0: Volume reference + } DlpVFSGetDefaultDirReqHdrType; + +typedef struct DlpVFSGetDefaultDirReqType { + // OFFSET + DlpVFSGetDefaultDirReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 fileTypeStr[2];// 2; File type string -- var size + // zero-terminated + } DlpVFSGetDefaultDirReqType; + +typedef DlpVFSGetDefaultDirReqType* DlpVFSGetDefaultDirReqPtr; + +// Response argument structure: +// +#define dlpVFSGetDefaultDirectoryRespArgID dlpFirstArgID + +typedef struct DlpVFSGetDefaultDirRespHdrType { + // OFFSET + UInt16 bufSize; // 0: Buffer Size + } DlpVFSGetDefaultDirRespHdrType; + +typedef struct DlpVFSGetDefaultDirRespType { + // OFFSET + DlpVFSGetDefaultDirRespHdrType header; + + Char dirPath[2]; // 0; directory path -- var size + // zero-terminated + } DlpVFSGetDefaultDirRespType; + +typedef DlpVFSGetDefaultDirRespType* DlpVFSGetDefaultDirRespPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSImportDatabaseFromFile +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes + +#pragma mark VFS Import DB From File + +// Request argument structure: +// +#define dlpVFSImportDBFromFileReqArgID dlpFirstArgID + +typedef struct DlpVFSImportDBFromFileReqHdrType { + // OFFSET + UInt16 volRefNum; // 0: Volume reference + + } DlpVFSImportDBFromFileReqHdrType; + +typedef struct DlpVFSImportDBFromFileReqType { + // OFFSET + DlpVFSImportDBFromFileReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 pathName[2]; // 2; path name -- var size + // zero-terminated + } DlpVFSImportDBFromFileReqType; + +typedef DlpVFSImportDBFromFileReqType* DlpVFSImportDBFromFileReqPtr; + +// Response argument structure: +// +#define dlpVFSImportDBFromFileRespArgID dlpFirstArgID + +typedef struct DlpVFSImportDBFromFileRespType { + // OFFSET + UInt16 cardNo; // 0: Card Number + LocalID dbID; // 2: Database ID + + } DlpVFSImportDBFromFileRespType; // TOTAL: 4 bytes + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSExportDatabaseToFile +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes + +#pragma mark VFS Export DB To File + +// Request argument structure: +// +#define dlpVFSExportDBToFileReqArgID dlpFirstArgID + +typedef struct DlpVFSExportDBToFileReqHdrType { + // OFFSET + UInt16 volRefNum; // 0: Volume reference + UInt16 cardNo; // 2: Card Number + LocalID dbID; // 4: Database ID + + } DlpVFSExportDBToFileReqHdrType; + +typedef struct DlpVFSExportDBToFileFileReqType { + // OFFSET + DlpVFSExportDBToFileReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 pathName[2]; // 2; path name -- var size + // zero-terminated + } DlpVFSExportDBToFileReqType; + +typedef DlpVFSExportDBToFileReqType* DlpVFSExportDBToFileReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileCreate +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// Fill in later. +#pragma mark VFS File Create + +// Request argument structure: +// +#define dlpVFSFileCreateReqArgID dlpFirstArgID + +typedef struct DlpVFSFileCreateReqHdrType { + // OFFSET + UInt16 volRefNum; // 0; + // TOTAL: 2 bytes + } DlpVFSFileCreateReqHdrType; + +typedef struct DlpVFSFileCreateReqType { + // OFFSET + DlpVFSFileCreateReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + Char path[2]; // 14; abs file path -- var size + // zero-terminated + } DlpVFSFileCreateReqType; + +typedef DlpVFSFileCreateReqType* DlpVFSFileCreateReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// VFS File Open +////////////////////////////////////////////////////////////////////////// +// Request arguments: +// +// Response arguments: +// +// Possible error codes +// +// +#pragma mark VFS File Open + +// Request argument structure: +// + +#define dlpVFSFileOpenReqArgID dlpFirstArgID + +// Open modes +// don't let anyone else open it +#define dlpOpenFileModeExclusive (0x0001UL) +// open for read access +#define dlpOpenFileModeRead (0x0002UL) +// open for write access, implies exclusive +#define dlpOpenFileModeWrite (0x0004UL | dlpOpenFileModeExclusive) +// open for read/write access +#define dlpOpenFileModeReadWrite (dlpOpenFileModeRead | dlpOpenFileModeWrite) + + +typedef struct DlpVFSFileOpenReqHdrType { + // OFFSET + UInt16 volRefNum; // 0: Volume Reference Number + UInt16 openMode; // 2: Open Mode + // TOTAL: 4 bytes + } DlpVFSFileOpenReqHdrType; + +typedef struct DlpVFSFileOpenReqType { + // OFFSET + DlpVFSFileOpenReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + Char path[2]; // 14; abs file path -- var size + // zero-terminated + } DlpVFSFileOpenReqType; + +typedef DlpVFSFileOpenReqType* DlpVFSFileOpenReqPtr; + +// Response argument structure: +// +#define dlpVFSFileOpenRespArgID dlpFirstArgID + +typedef struct DlpVFSFileOpenRespType { + // OFFSET + FileRef fileRef; // 0; File reference + + } DlpVFSFileOpenRespType; // TOTAL: 4 bytes + + + +////////////////////////////////////////////////////////////////////////// +// dlpLoopBackTest +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// dlpRespErrSystem, +// dlpRespErrNotEnoughSpace, +// dlpRespErrParam, +// dlpRespErrNoneOpen +#pragma mark Loopback Test + +// Request argument structure: +// +#define dlpLoopBackTestReqArgID dlpFirstArgID + +typedef struct DlpLoopBackTestReqHdrType { + // OFFSET + UInt32 dataSize; // 0; total resource size + // TOTAL: 4 bytes; + } DlpLoopBackTestReqHdrType; + +typedef struct DlpLoopBackTestReqType { + // OFFSET + DlpLoopBackTestReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 10 bytes; + UInt8 data[2]; // 10; data -- var size + } DlpLoopBackTestReqType; + +// Response argument structure: +// +// +#define dlpLoopBackTestRespArgID dlpFirstArgID + +typedef struct DlpLoopBackTestRespHdrType { + // OFFSET + UInt32 dataSize; // 0; total resource size in bytes + // TOTAL: 4 bytes; + } DlpLoopBackTestRespHdrType; + +typedef struct DlpLoopBackTestRespType { + // OFFSET + DlpLoopBackTestRespHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 6 bytes; + UInt8 data[2]; // 6; data -- var size + } DlpLoopBackTestRespType; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileClose +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Close +// Request argument structure: +// +#define dlpVFSFileCloseReqArgID dlpFirstArgID + +typedef struct DlpVFSFileCloseReqType { + // OFFSET + FileRef fileRef; // 0: File Reference + // TOTAL: 4 bytes + } DlpVFSFileCloseReqType; + +typedef DlpVFSFileCloseReqType* DlpVFSFileCloseReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileWrite +////////////////////////////////////////////////////////////////////////// +// Set the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Write + +// Write calback parameters +typedef struct DlpVFSFileWriteCallbackParamType{ + // OFFSET + FileRef fileRef; // 0: File Reference + UInt32 numBytes; // 4: Expected File Size + // TOTAL: 8 bytes + } DlpVFSFileWriteCallbackParamType; + + +// Request argument structure: +// +#define dlpVFSFileWriteReqArgID dlpFirstArgID + +typedef struct DlpVFSFileWriteReqType { + // OFFSET + FileRef fileRef; // 0: File Reference + UInt32 numBytes; // 4: File Attributes + // TOTAL: 8 bytes + } DlpVFSFileWriteReqType; + +typedef DlpVFSFileWriteReqType* DlpVFSFileWriteReqPtr; + +// Response argument structure: +// +#define dlpVFSFileWriteRespArgID dlpFirstArgID + +typedef struct DlpVFSFileWriteRespType { + // OFFSET + UInt32 numBytesWritten; // 0; File attributes + } DlpVFSFileWriteRespType; // TOTAL: 4 bytes + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileRead +////////////////////////////////////////////////////////////////////////// +// Set the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Read + +// Write calback parameters +typedef struct DlpVFSFileReadCallbackParamType{ + // OFFSET + FileRef fileRef; // 0: File Reference + UInt32 numBytes; // 4: Expected File Size + // TOTAL: 8 bytes + } DlpVFSFileReadCallbackParamType; + +typedef DlpVFSFileReadCallbackParamType* DlpVFSFileReadCallbackParamPtr; + +// Request argument structure: +// +#define dlpVFSFileReadReqArgID dlpFirstArgID + +typedef struct DlpVFSFileReadReqType { + // OFFSET + FileRef fileRef; // 0: File Reference + UInt32 numBytes; // 4: File Attributes + // TOTAL: 8 bytes + } DlpVFSFileReadReqType; + +typedef DlpVFSFileReadReqType* DlpVFSFileReadReqPtr; + +// Response argument structure: +// +#define dlpVFSFileReadRespArgID dlpFirstArgID + +typedef struct DlpVFSFileReadRespType { + // OFFSET + UInt32 numBytes; // 0; + } DlpVFSFileReadRespType; // TOTAL: 4 bytes + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileDelete +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes + +#pragma mark VFS File Delete + + +// Request argument structure: +// +#define dlpVFSFileDeleteReqArgID dlpFirstArgID + +typedef struct DlpVFSFileDeleteReqHdrType { + // OFFSET + UInt16 volRefNum; // 0: Volume reference + + } DlpVFSFileDeleteReqHdrType; + +typedef struct DlpVFSFileDeleteReqType { + // OFFSET + DlpVFSFileDeleteReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 pathNameP[2]; // 2; Directory Name -- var size + // zero-terminated + } DlpVFSFileDeleteReqType; + +typedef DlpVFSFileDeleteReqType* DlpVFSFileDeleteReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileRename +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes +// Fill in later. +#pragma mark VFS File Rename + +// Request argument structure: +// +#define dlpVFSFileRenameReqArgID dlpFirstArgID + +typedef struct DlpVFSFileRenameReqHdrType { + // OFFSET + UInt16 volRefNum; // 0; + UInt16 numStrings; // 2; + // TOTAL: 4 bytes + } DlpVFSFileRenameReqHdrType; + +typedef struct DlpVFSFileRenameReqType { + // OFFSET + DlpVFSFileRenameReqHdrType // + header; // 0; fixed-size header + // FIXED SIZE: 12 bytes; + Char packedNames[2];// 14; The path name and the + // new name are packed together + // both are zero terminated. + } DlpVFSFileRenameReqType; + +typedef DlpVFSFileRenameReqType* DlpVFSFileRenameReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileEOF +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File EOF +// Request argument structure: +// +#define dlpVFSFileEOFReqArgID dlpFirstArgID + +typedef struct DlpVFSFileEOFReqType { + // OFFSET + FileRef fileRef; // 0: File Reference + // TOTAL: 4 bytes + } DlpVFSFileEOFReqType; + +typedef DlpVFSFileEOFReqType* DlpVFSFileEOFReqPtr; + +#define dlpVFSFileEOFRespArgID dlpFirstArgID + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileTell +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Tell +// Request argument structure: +// +#define dlpVFSFileTellReqArgID dlpFirstArgID + +typedef struct DlpVFSFileTellReqType { + // OFFSET + FileRef fileRef; // 0: File reference number + // TOTAL: 2 bytes + } DlpVFSFileTellReqType; + +typedef DlpVFSFileTellReqType* DlpVFSFileTellReqPtr; + +// Response argument structure: +// +#define dlpVFSFileTellRespArgID dlpFirstArgID + +typedef struct DlpVFSFileTellRespType { + // OFFSET + UInt32 filePosition; // 0; Position in the file + } DlpVFSFileTellRespType; // TOTAL: 4 bytes + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileResize +////////////////////////////////////////////////////////////////////////// +// Set the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Resize +// Request argument structure: +// +#define dlpVFSFileResizeReqArgID dlpFirstArgID + +typedef struct DlpVFSFileResizeReqType { + // OFFSET + FileRef fileRef; // 0: File Reference + UInt32 newSize; // 4: NewSize + // TOTAL: 8 bytes + } DlpVFSFileResizeReqType; + +typedef DlpVFSFileResizeReqType* DlpVFSFileResizeReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileGetAttributes +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Get Attributes +// Request argument structure: +// +#define dlpVFSGetAttributesReqArgID dlpFirstArgID + +typedef struct DlpVFSGetAttributesReqType { + // OFFSET + FileRef fileRef; // 0: Volume reference number + // TOTAL: 4 bytes + } DlpVFSGetAttributesReqType; + +typedef DlpVFSGetAttributesReqType* DlpVFSGetAttributesReqPtr; + +// Response argument structure: +// +#define dlpVFSGetAttributesRespArgID dlpFirstArgID + +typedef struct DlpVFSGetAttributesRespType { + // OFFSET + UInt32 attributes; // 0; File attributes + } DlpVFSGetAttributesRespType; // TOTAL: 4 bytes + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileSetAttributes +////////////////////////////////////////////////////////////////////////// +// Set the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Set Attributes +// Request argument structure: +// +#define dlpVFSSetAttributesReqArgID dlpFirstArgID + +typedef struct DlpVFSSetAttributesReqType { + // OFFSET + FileRef fileRef; // 0: File Reference + UInt32 attributes; // 4: File Attributes + // TOTAL: 8 bytes + } DlpVFSSetAttributesReqType; + +typedef DlpVFSSetAttributesReqType* DlpVFSSetAttributesReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileGetDate +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Get Dates +// Request argument structure: +// +#define dlpVFSGetDatesReqArgID dlpFirstArgID + +typedef struct DlpVFSGetDatesReqType { + // OFFSET + FileRef fileRef; // 0: Volume reference number + UInt16 whichDate; // 4: Which date parameter + // TOTAL: 6 bytes + } DlpVFSGetDatesReqType; + +typedef DlpVFSGetDatesReqType* DlpVFSGetDatesReqPtr; + +// Response argument structure: +// +#define dlpVFSGetDatesRespArgID dlpFirstArgID + +typedef struct DlpVFSGetDatesRespType { + // OFFSET + UInt32 date; // 0; The date requested + } DlpVFSGetDatesRespType; // TOTAL: 4 bytes + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileSetDate +////////////////////////////////////////////////////////////////////////// +// Set the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Set Dates +// Request argument structure: +// +#define dlpVFSSetDatesReqArgID dlpFirstArgID + +typedef struct DlpVFSSetDatesReqType { + // OFFSET + FileRef fileRef; // 0: File Reference + UInt16 whichDate; // 4: Which date parameter + UInt32 date; // 6: The date + // TOTAL: 10 bytes + } DlpVFSSetDatesReqType; + +typedef DlpVFSSetDatesReqType* DlpVFSSetDatesReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileGetSize +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Size +// Request argument structure: +// +#define dlpVFSGetFileSizeReqArgID dlpFirstArgID + +typedef struct DlpVFSGetFileSizeReqType { + // OFFSET + FileRef fileRef; // 0: File Reference + // TOTAL: 4 bytes + } DlpVFSGetFileSizeReqType; + +typedef DlpVFSGetFileSizeReqType* DlpVFSGetFileSizeReqPtr; + +// Response argument structure: +// +#define dlpVFSGetFileSizeRespArgID dlpFirstArgID + +typedef struct DlpVFSGetFileSizeRespType { + // OFFSET + UInt32 fileSize; // 0; Amount of the volume already used. + } DlpVFSGetFileSizeRespType; // TOTAL: 4 bytes + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSDirCreate +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes + +#pragma mark VFS Directory Create + + +// Request argument structure: +// +#define dlpVFSDirCreateReqArgID dlpFirstArgID + +typedef struct DlpVFSDirCreateReqHdrType { + // OFFSET + UInt16 volRefNum; // 0: Volume reference + + } DlpVFSDirCreateReqHdrType; + +typedef struct DlpVFSDirCreateReqType { + // OFFSET + DlpVFSDirCreateReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 dirNameP[2]; // 2; Directory Name -- var size + // zero-terminated + } DlpVFSDirCreateReqType; + +typedef DlpVFSDirCreateReqType* DlpVFSDirCreateReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSDirEntryEnumerate +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes + +// ADH, This needs to be reconciled with the desktop version. + +// NEED To have some state information + +#pragma mark VFS Directory Enumerate + +// Request argument structure: +// +#define dlpVFSDirEntryEnumrerateReqArgID dlpFirstArgID + +typedef struct DlpVFSDirEntryEnumrerateReqType { + // OFFSET + FileRef dirRefNum; // 0: Directory Reference number + UInt32 dirEntryIterator; // 4: Directory Iterator + UInt32 bufferSize; // 8: max return buffer + // TOTAL: 4 bytes + } DlpVFSDirEntryEnumrerateReqType; + +typedef DlpVFSDirEntryEnumrerateReqType* DlpVFSDirEntryEnumrerateReqPtr; + + +// Response argument structure: +// +#define dlpVFSDirEntryEnumerateRespArgID dlpFirstArgID + +typedef struct DlpVFSDirEntryEnumerateHdrType { + // OFFSET + UInt32 dirEntryIterator; // 0: Directory iterator + UInt32 numEntries; // 4: Number of directory entries + + } DlpVFSDirEntryEnumerateHdrType; + +typedef struct DlpVFSDirEntryType { + UInt32 attributes; // Directory attributes + Char name[2]; // Zero terminated string. Strings that have an even length + // will be null terminated and have a pad byte. + } DlpVFSDirEntryType; + +typedef struct DlpVFSDirEntryEnumerateRespType { + // OFFSET + DlpVFSDirEntryEnumerateHdrType + header; // 2: Fixed Header + + DlpVFSDirEntryType entries[2]; // 0; Variable size number of volumes + + } DlpVFSDirEntryEnumerateRespType; + +typedef DlpVFSDirEntryEnumerateRespType* DlpVFSDirEntryEnumerateRespPtr; + + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSVolumeFormat +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS Volume Format +// Request argument structure: +// +#define dlpVFSVolumeFormatReqArgID dlpFirstArgID + +typedef struct DlpVFSVolumeFormatHdrType { + // OFFSET + UInt16 fsLibRefNum; // 0: File System Library Ref Num + UInt16 vfsMountParamLen; + UInt8 flags; + UInt8 unused; + + } DlpVFSVolumeFormatHdrType; + +typedef struct DlpVFSVolumeFormatReqType { + // OFFSET + DlpVFSVolumeFormatHdrType + header; // 2: Fixed Header + + UInt8 mountParameters[2]; // 0; Mount parameters + + } DlpVFSVolumeFormatReqType; + +typedef DlpVFSVolumeFormatReqType* DlpVFSVolumeFormatReqPtr; + +////////////////////////////////////////////////////////////////////////// +// dlpVFSVolumeEnumerate +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes + +#pragma mark VFS Volume Enumerate + +// Response argument structure: +// +#define dlpVFSVolumeEnumerateRespArgID dlpFirstArgID + +typedef struct DlpVFSVolumeEnumerateHdrType { + // OFFSET + UInt16 numVolumes; // 0: Number of volumes + + } DlpVFSVolumeEnumerateHdrType; + +typedef struct DlpVFSVolumeEnumerateRespType { + // OFFSET + DlpVFSVolumeEnumerateHdrType + header; // 2: Fixed Header + + UInt16 volumes[2]; // 0; Variable size number of volumes + + } DlpVFSVolumeEnumerateRespType; + +typedef DlpVFSVolumeEnumerateRespType* DlpVFSVolumeEnumerateRespPtr; + + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSVolumeInfo +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS Volume Info +// Request argument structure: +// +#define dlpVFSVolumeInfoReqArgID dlpFirstArgID + +typedef struct DlpVFSVolumeInfoReqType { + // OFFSET + UInt16 volRefNum; // 0: Volume reference number + // TOTAL: 2 bytes + } DlpVFSVolumeInfoReqType; + +typedef DlpVFSVolumeInfoReqType* DlpVFSVolumeInfoReqPtr; + +// Response argument structure: +// +#define dlpVFSVolumeInfoRespArgID dlpFirstArgID + +typedef struct DlpVFSVolumeInfoRespType { + // OFFSET + UInt32 attributes; // 0: read-only etc. + UInt32 fsType; // 4: Filesystem type for this volume (defined below) + UInt32 fsCreator; // 8: Creator code of filesystem driver for this volume. + // For use with VFSCustomControl(). + UInt32 mountClass; // 12: mount class that mounted this volume + // For slot based filesystems: (mountClass = VFSMountClass_SlotDriver) + + UInt16 slotLibRefNum; // 16: Library on which the volume is mounted + UInt16 slotRefNum; // 18: ExpMgr slot number of card containing volume + UInt32 mediaType; // 20: Type of card media (mediaMemoryStick, mediaCompactFlash, etc...) + UInt32 reserved; // 24: reserved for future use (other mountclasses may need more space) + } DlpVFSVolumeInfoRespType; // TOTAL: 28 bytes + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSVolumeGetLabel +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes + +#pragma mark VFS Volume Get Label + + +// Request argument structure: +// +#define dlpVFSVolumeGetLabelReqArgID dlpFirstArgID + +typedef struct DlpVFSVolumeGetLabelReqType { + // OFFSET + UInt16 volRefNum; // 0: Volume reference + } DlpVFSVolumeGetLabelReqType; // TOTAL: 2 bytes + +typedef DlpVFSVolumeGetLabelReqType* DlpVFSVolumeGetLabelReqPtr; + +// Response argument structure: +// +#define dlpVFSVolumeGetLabelRespArgID dlpFirstArgID + +typedef struct DlpVFSVolumeGetLabelRespType { + // OFFSET + UInt8 label[2]; // 0; label name text -- var size + // zero-terminated + } DlpVFSVolumeGetLabelRespType; + + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSVolumeSetLabel +////////////////////////////////////////////////////////////////////////// +// +// Possible error codes + +#pragma mark VFS Volume Set Label + + +// Request argument structure: +// +#define dlpVFSVolumeSetLabelReqArgID dlpFirstArgID + +typedef struct DlpVFSVolumeSetLabelReqHdrType { + // OFFSET + UInt16 volRefNum; // 0: Volume reference + + } DlpVFSVolumeSetLabelReqHdrType; + +typedef struct DlpVFSVolumeSetLabelReqType { + // OFFSET + DlpVFSVolumeSetLabelReqHdrType + header; // 0; fixed-size header + // FIXED SIZE: 2 bytes; + UInt8 label[2]; // 2; label name text -- var size + // zero-terminated + } DlpVFSVolumeSetLabelReqType; + +typedef DlpVFSVolumeSetLabelReqType* DlpVFSVolumeSetLabelReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSVolumeSize +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS Volume Size +// Request argument structure: +// +#define dlpVFSVolumeSizeReqArgID dlpFirstArgID + +typedef struct DlpVFSVolumeSizeReqType { + // OFFSET + UInt16 volRefNum; // 0: Volume reference number + // TOTAL: 2 bytes + } DlpVFSVolumeSizeReqType; + +typedef DlpVFSVolumeSizeReqType* DlpVFSVolumeSizeReqPtr; + +// Response argument structure: +// +#define dlpVFSVolumeSizeRespArgID dlpFirstArgID + +typedef struct DlpVFSVolumeSizeRespType { + // OFFSET + UInt32 volumeSizeUsed; // 0; Amount of the volume already used. + UInt32 volumeSizeTotal; // 4; Total size of the volume + } DlpVFSVolumeSizeRespType; // TOTAL: 8 bytes + + +////////////////////////////////////////////////////////////////////////// +// dlpVFSFileSeek +////////////////////////////////////////////////////////////////////////// +// Set the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark VFS File Seek +// Request argument structure: +// +#define dlpVFSFileSeekReqArgID dlpFirstArgID + +typedef struct DlpVFSFileSeekReqType { + // OFFSET + FileRef fileRef; // 0: File Reference + FileOrigin origin; // 4: File origin + Int32 offset; // 6: offset + // TOTAL: 10 bytes + } DlpVFSFileSeekReqType; + +typedef DlpVFSFileSeekReqType* DlpVFSFileSeekReqPtr; + + +////////////////////////////////////////////////////////////////////////// +// dlpExpSlotMediaType +////////////////////////////////////////////////////////////////////////// +// Get the used and total size of a volume +// +// Possible error codes +// +// +#pragma mark Slot Media Type +// Request argument structure: +// +#define dlpExpSlotMediaTypeReqArgID dlpFirstArgID + +typedef struct DlpExpSlotMediaTypeReqType { + // OFFSET + UInt16 slotNum; // 0: Which slot to query + // TOTAL: 2 bytes + } DlpExpSlotMediaTypeReqType; + +typedef DlpExpSlotMediaTypeReqType* DlpExpSlotMediaTypeReqPtr; + +// Response argument structure: +// +#define dlpExpSlotMediaTypeRespArgID dlpFirstArgID + +typedef struct DlpExpSlotMediaTypeRespType { + // OFFSET + UInt32 mediaType; // 0; The Media Type + } DlpExpSlotMediaTypeRespType; // TOTAL: 4 bytes + + + + +/************************************************************ + * Macros + *************************************************************/ + + +#endif // __DLCOMMON_H__ diff --git a/sdk-4/include/Core/System/DLServer.h b/sdk-4/include/Core/System/DLServer.h new file mode 100644 index 0000000..8b47a39 --- /dev/null +++ b/sdk-4/include/Core/System/DLServer.h @@ -0,0 +1,423 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __DL_SERVER_H__ +#define __DL_SERVER_H__ + +// Pilot common definitions +#include +#include // for DmOpenRef + +#include + + +/************************************************************ + * DLK result codes + * (dlkErrorClass is defined in SystemMgr.h) + *************************************************************/ +#pragma mark *Error Codes* + +#define dlkErrParam (dlkErrorClass | 1) // invalid parameter +#define dlkErrMemory (dlkErrorClass | 2) // memory allocation error +#define dlkErrNoSession (dlkErrorClass | 3) // could not establish a session + +#define dlkErrSizeErr (dlkErrorClass | 4) // reply length was too big + +#define dlkErrLostConnection (dlkErrorClass | 5) // lost connection +#define dlkErrInterrupted (dlkErrorClass | 6) // sync was interrupted (see sync state) +#define dlkErrUserCan (dlkErrorClass | 7) // cancelled by user +#define dlkErrIncompatibleProducts (dlkErrorClass | 8) // incompatible desktop version +#define dlkErrNPOD (dlkErrorClass | 9) // New Password, Old Desktop + + + +/******************************************************************** + * Desktop Link system preferences resource for user info + * id = sysResIDDlkUserInfo, defined in SystemResources.h + ********************************************************************/ +#pragma mark *User Info Preference* + +#define dlkMaxUserNameLength 40 +#define dlkUserNameBufSize (dlkMaxUserNameLength + 1) + +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define dlkMaxLogSize (20 * 1024) +#else +#define dlkMaxLogSize (2 * 1024) +#endif + +typedef enum DlkSyncStateType { + dlkSyncStateNeverSynced = 0, // never synced + dlkSyncStateInProgress, // sync is in progress + dlkSyncStateLostConnection, // connection lost during sync + dlkSyncStateLocalCan, // cancelled by local user on handheld + dlkSyncStateRemoteCan, // cancelled by user from desktop + dlkSyncStateLowMemoryOnTD, // sync ended due to low memory on handheld + dlkSyncStateAborted, // sync was aborted for some other reason + dlkSyncStateCompleted, // sync completed normally + + // Added in PalmOS v3.0: + dlkSyncStateIncompatibleProducts, // sync ended because desktop HotSync product + // is incompatible with this version + // of the handheld HotSync + dlkSyncStateNPOD // New Password, Old Desktop + } DlkSyncStateType; + +#define dlkUserInfoPrefVersion 0x0102 // current user info pref version: 1.2 + +typedef struct DlkUserInfoHdrType { + UInt16 version; // pref version number + UInt32 userID; // user id + UInt32 viewerID; // id assigned to viewer by the desktop + UInt32 lastSyncPC; // last sync PC id + UInt32 succSyncDate; // last successful sync date + UInt32 lastSyncDate; // last sync date + DlkSyncStateType lastSyncState; // last sync status + UInt8 reserved1; // Explicitly account for 16-bit alignment padding + UInt16 lanSyncEnabled;// if non-zero, LAN Sync is enabled + UInt32 hsTcpPortNum; // TCP/IP port number of Desktop HotSync + UInt32 dwReserved1; // RESERVED -- set to NULL! + UInt32 dwReserved2; // RESERVED -- set to NULL! + UInt8 userNameLen; // length of name field(including null) + UInt8 reserved2; // Explicitly account for 16-bit alignment padding + UInt16 syncLogLen; // length of sync log(including null) + } DlkUserInfoHdrType; + +typedef struct DlkUserInfoType { + DlkUserInfoHdrType header; // fixed size header + Char nameAndLog[2]; // user name, followed by sync log; + // both null-terminated(for debugging) + } DlkUserInfoType; + +typedef DlkUserInfoType* DlkUserInfoPtr; // user info pointer + + +/******************************************************************** + * Desktop Link system preferences resource for the Conduit Filter Table + * id = sysResIDDlkCondFilterTab, defined in SystemResources.h + ********************************************************************/ +#pragma mark *Conduit Filter Preference* + +// +// Table for specifying conduits to "filter out" during HotSync +// + +// This table consists of DlkCondFilterTableHdrType header followed by a +// variable number of DlkCondFilterEntryType entries + +typedef struct DlkCondFilterTableHdrType { + UInt16 entryCount; + } DlkCondFilterTableHdrType; +typedef DlkCondFilterTableHdrType* DlkCondFilterTableHdrPtr; + +typedef struct DlkCondFilterEntryType { + UInt32 creator; + UInt32 type; + } DlkCondFilterEntryType; +typedef DlkCondFilterEntryType* DlkCondFilterEntryPtr; + +typedef struct DlkCondFilterTableType { + DlkCondFilterTableHdrType + hdr; // table header + DlkCondFilterEntryType + entry[1]; // variable number of entries + } DlkCondFilterTableType; +typedef DlkCondFilterTableType* DlkCondFilterTablePtr; + + + +/******************************************************************** + * DLK Session Structures + ********************************************************************/ +#pragma mark *Session Structures* + + +// DesktopLink event notification callback. If non-zero is returned, +// sync will be cancelled as soon as a safe point is reached. +typedef enum { + dlkEventOpeningConduit = 1, // conduit is being opened -- paramP + // is null; + + dlkEventDatabaseOpened, // client has opened a database -- paramP + // points to DlkEventDatabaseOpenedType; + + dlkEventCleaningUp, // last stage of sync -- cleaning up (notifying apps, etc) -- + // paramP is null + + dlkEventSystemResetRequested // system reset was requested by the desktop client + // (the normal action is to delay the reset until + // end of sync) -- paramP is null + } DlkEventType; + +// Prototype for the event notification callback +typedef Int16 (*DlkEventProcPtr)(UInt32 eventRef, DlkEventType dlkEvent, + void * paramP); + +// Parameter structure for dlkEventDatabaseOpened +// Added new fields for Pilot v2.0 vmk 12/24/96 +typedef struct DlkEventDatabaseOpenedType { + DmOpenRef dbR; // open database ref (v2.0) + Char * dbNameP; // database name + UInt32 dbType; // databse type (v2.0) + UInt32 dbCreator; // database creator + } DlkEventDatabaseOpenedType; + + +// Prototype for the "user cancel" check callback function +typedef Int16 (*DlkUserCanProcPtr)(UInt32 canRef); + + +// +// List of modified database creators maintained by DLP Server +// +typedef struct DlkDBCreatorList { + UInt16 count; // number of entries in the list + MemHandle listH; // chunk handle of the creators list + } DlkDBCreatorList; + + +// +// Desktop Link Server state flags +// +#define dlkStateFlagVerExchanged 0x8000 +#define dlkStateFlagSyncDateSet 0x4000 + +// +// DLP Server session information +// +typedef struct DlkServerSessionType { + UInt16 htalLibRefNum; // HTAL library reference number - the library has a live connection + UInt32 maxHtalXferSize; // Maximum transfer block size + + // Information supplied by user + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + UInt32 eventRef; // user reference value for event proc + DlkUserCanProcPtr canProcP; // ptr to user-cancel function + UInt32 canRef; // parameter for canProcP() + MemHandle condFilterH; // handle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none + + // Current database information + UInt8 dlkDBID; // Desktop Link database handle of the open database + UInt8 reserved1; + DmOpenRef dbR; // TouchDown database access pointer -- if null, no current db + UInt16 cardNo; // memory module number + UInt32 dbCreator; // creator id + Char dbName[dmDBNameLength]; // DB name + UInt16 dbOpenMode; // database open mode + Boolean created; // true if the current db was created + Boolean isResDB; // set to true if resource database + Boolean ramBased; // true if the db is in RAM storage + Boolean readOnly; // true if the db is read-only + LocalID dbLocalID; // TouchDown LocalID of the database + UInt32 initialModNum; // initial DB modification number + UInt32 curRecIndex; // current record index for enumeration functions + // (0=beginning) + + // List of modified database creators maintained by DLP Server + DlkDBCreatorList creatorList; + + // Session status information + DlkSyncStateType syncState; // current sync state; + + Boolean complete; // set to true when completion request + // has been received + + Boolean conduitOpened; // set to true after the first coduit + // is opened by remote + + Boolean logCleared; // set to true after sync log has been + // cleared during the current session; + // The log will be cleared before any new entries are added or at + // the end of sync in case no new entries were added. + // (we do not clear the log at the beginning of sync in case the + // user cancels during the "identifying user" phase; in this + // event, the spec calls for preserving the original log) + + Boolean resetPending; // set to true if system reset is pending; + // the reset will be carried out at end + // of sync + + // Current request information + Boolean gotCommand; // set to true when got a request + UInt8 cmdTID; // current transaction ID + UInt8 reserved2; + UInt16 cmdLen; // size of data in request buffer + void * cmdP; // pointer to command + MemHandle cmdH; // handle of command buffer + + // Fields added in PalmOS v3.0 + UInt16 wStateFlags; // bitfield of dlkStateFlag... bits + DmSearchStateType dbSearchState; // database search state for iterative + // searches using DmGetNextDatabaseByTypeCreator + + // Fields added in PalmOS v4.0 + MemHandle openFileRefsH; // Table of open file refs + Int16 numOpenFileRefs; // Current size of the file ref table. + Boolean pre40Desktop; // are we using a pre-4.0 desktop (DLP v1.2) + Boolean passwordSet; // is a password set? + + } DlkServerSessionType; + +typedef DlkServerSessionType* DlkServerSessionPtr; + + +/******************************************************************** + * DLK Function Parameter Structures + ********************************************************************/ +#pragma mark *Function Parameter Structures* + +// +// Parameter passed to DlkControl() +// +typedef enum DlkCtlEnum { + dlkCtlFirst = 0, // reserve 0 + + // + // Pilot v2.0 control codes: + // + dlkCtlGetPCHostName, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0) + // param2P = ptr to buffer size(UInt16); + // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostName, // param1P = ptr to host name(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted) + + dlkCtlGetCondFilterTable, // param1P = ptr to destination buffer for filter table, or NULL if *param2 is 0 + // param2P = on entry, ptr to size of buffer(UInt16) (the size may be 0) + // on return, size, in bytes, of the actual filter table + + dlkCtlSetCondFilterTable, // param1P = ptr to to conduit filter table, or NULL if *param2 is 0 + // param2P = ptr to size of filter table(UInt16) (if size is 0, the current table will be deleted) + + dlkCtlGetLANSync, // param1P = ptr to store for the LANSync setting(UInt16): 0 = off, otherwise on + // param2P = not used, set to NULL + + dlkCtlSetLANSync, // param1P = ptr to the LANSync setting(UInt16): 0 = off, otherwise on + // param2P = not used, set to NULL + + dlkCtlGetHSTCPPort, // param1P = ptr to store for the Desktop HotSync TCP/IP port number(UInt32) -- zero if not set + // param2P = not used, set to NULL + + dlkCtlSetHSTCPPort, // param1P = ptr to the Desktop HotSync TCP/IP port number(UInt32) + // param2P = not used, set to NULL + + dlkCtlSendCallAppReply, // param1P = ptr to DlkCallAppReplyParamType structure + // param2P = not used, set to NULL + // + // RETURNS: send error code; use this error code + // as return value from the action code handler + + + dlkCtlGetPCHostAddr, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0) + // param2P = ptr to buffer size(UInt16); + // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostAddr, // param1P = ptr to host address string(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted) + + + dlkCtlGetPCHostMask, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0) + // param2P = ptr to buffer size(UInt16); + // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied. + + dlkCtlSetPCHostMask, // param1P = ptr to subnet mask string(zero-terminated) or NULL if *param2 is 0 + // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted) + + + dlkCtlLAST // *KEEP THIS ENTRY LAST* + +} DlkCtlEnum; + + +// +// Parameter passed to DlkStartServer() +// +typedef struct DlkServerParamType { + UInt16 htalLibRefNum; // HTAL library reference number - the library has a live connection + DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc + UInt32 eventRef; // user reference value for event proc + UInt32 reserved1; // reserved - set to NULL + UInt32 reserved2; // reserved - set to NULL + MemHandle condFilterH; // handle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none + } DlkServerParamType; + +typedef DlkServerParamType* DlkServerParamPtr; + + + +// +// Parameter passed with DlkControl()'s dlkCtlSendCallAppReply code +// +typedef struct DlkCallAppReplyParamType { + UInt16 pbSize; // size of this parameter block (set to sizeof(DlkCallAppReplyParamType)) + UInt32 dwResultCode; // result code to be returned to remote caller + const void * resultP; // ptr to result data + UInt32 dwResultSize; // size of reply data in number of bytes + void * dlRefP; // DesktopLink reference pointer from + // SysAppLaunchCmdHandleSyncCallAppType + UInt32 dwReserved1; // RESERVED -- set to null!!! + } DlkCallAppReplyParamType; + + +/******************************************************************** + * DesktopLink Server Routines + ********************************************************************/ +#pragma mark *Function Prototypes* + +#ifdef __cplusplus +extern "C" { +#endif + +// +// SERVER API +// + +// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam, +// * dlkErrNoSession, dlkErrLostConnection, dlkErrMemory, +// * dlkErrUserCan +extern Err DlkStartServer(DlkServerParamPtr paramP) + SYS_TRAP(sysTrapDlkStartServer); + +extern Err DlkGetSyncInfo(UInt32 * succSyncDateP, UInt32 * lastSyncDateP, + DlkSyncStateType* syncStateP, Char * nameBufP, + Char * logBufP, Int32 * logLenP) + SYS_TRAP(sysTrapDlkGetSyncInfo); + +extern void DlkSetLogEntry(const Char * textP, Int16 textLen, Boolean append) + SYS_TRAP(sysTrapDlkSetLogEntry); + +// Dispatch a DesktopLink request (exposed for patching) +extern Err DlkDispatchRequest(DlkServerSessionPtr sessP) + SYS_TRAP(sysTrapDlkDispatchRequest); + +extern Err DlkControl(DlkCtlEnum op, void * param1P, void * param2P) + SYS_TRAP(sysTrapDlkControl); + +#ifdef __cplusplus +} +#endif + + +/******************************************************************** + * DLK Macros + ********************************************************************/ + + + +#endif // __DL_SERVER_H__ diff --git a/sdk-4/include/Core/System/DataMgr.h b/sdk-4/include/Core/System/DataMgr.h new file mode 100644 index 0000000..c858792 --- /dev/null +++ b/sdk-4/include/Core/System/DataMgr.h @@ -0,0 +1,552 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __DATAMGR_H__ +#define __DATAMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. +#include // Error numbers + +// Other headers we depend on +#include + + +typedef UInt32 DmResType; +typedef UInt16 DmResID; + +/************************************************************ + * Category equates + *************************************************************/ +#define dmRecAttrCategoryMask 0x0F // mask for category # +#define dmRecNumCategories 16 // number of categories +#define dmCategoryLength 16 // 15 chars + 1 null terminator + +#define dmAllCategories 0xff +#define dmUnfiledCategory 0 + +#define dmMaxRecordIndex 0xffff + + + +// Record Attributes +// +// *** IMPORTANT: +// *** +// *** Any changes to record attributes must be reflected in dmAllRecAttrs and dmSysOnlyRecAttrs *** +// *** +// *** Only one nibble is available for record attributes +// +// *** ANY CHANGES MADE TO THESE ATTRIBUTES MUST BE REFLECTED IN DESKTOP LINK +// *** SERVER CODE (DLCommon.h, DLServer.c) +#define dmRecAttrDelete 0x80 // delete this record next sync +#define dmRecAttrDirty 0x40 // archive this record next sync +#define dmRecAttrBusy 0x20 // record currently in use +#define dmRecAttrSecret 0x10 // "secret" record - password protected + + +// All record atributes (for error-checking) +#define dmAllRecAttrs ( dmRecAttrDelete | \ + dmRecAttrDirty | \ + dmRecAttrBusy | \ + dmRecAttrSecret ) + +// Record attributes which only the system is allowed to change (for error-checking) +#define dmSysOnlyRecAttrs ( dmRecAttrBusy ) + + +/************************************************************ + * Database Header equates + *************************************************************/ +#define dmDBNameLength 32 // 31 chars + 1 null terminator + +// Attributes of a Database +// +// *** IMPORTANT: +// *** +// *** Any changes to database attributes must be reflected in dmAllHdrAttrs and dmSysOnlyHdrAttrs *** +// *** +#define dmHdrAttrResDB 0x0001 // Resource database +#define dmHdrAttrReadOnly 0x0002 // Read Only database +#define dmHdrAttrAppInfoDirty 0x0004 // Set if Application Info block is dirty + // Optionally supported by an App's conduit +#define dmHdrAttrBackup 0x0008 // Set if database should be backed up to PC if + // no app-specific synchronization conduit has + // been supplied. +#define dmHdrAttrOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK + // for it to install a newer version of this database + // with a different name if the current database is + // open. This mechanism is used to update the + // Graffiti Shortcuts database, for example. +#define dmHdrAttrResetAfterInstall 0x0020 // Device requires a reset after this database is + // installed. +#define dmHdrAttrCopyPrevention 0x0040 // This database should not be copied to + +#define dmHdrAttrStream 0x0080 // This database is used for file stream implementation. +#define dmHdrAttrHidden 0x0100 // This database should generally be hidden from view + // used to hide some apps from the main view of the + // launcher for example. + // For data (non-resource) databases, this hides the record + // count within the launcher info screen. +#define dmHdrAttrLaunchableData 0x0200 // This data database (not applicable for executables) + // can be "launched" by passing it's name to it's owner + // app ('appl' database with same creator) using + // the sysAppLaunchCmdOpenNamedDB action code. + +#define dmHdrAttrRecyclable 0x0400 // This database (resource or record) is recyclable: + // it will be deleted Real Soon Now, generally the next + // time the database is closed. + +#define dmHdrAttrBundle 0x0800 // This database (resource or record) is associated with + // the application with the same creator. It will be beamed + // and copied along with the application. + +#define dmHdrAttrOpen 0x8000 // Database not closed properly + + +// All database atributes (for error-checking) +#define dmAllHdrAttrs ( dmHdrAttrResDB | \ + dmHdrAttrReadOnly | \ + dmHdrAttrAppInfoDirty | \ + dmHdrAttrBackup | \ + dmHdrAttrOKToInstallNewer | \ + dmHdrAttrResetAfterInstall | \ + dmHdrAttrCopyPrevention | \ + dmHdrAttrStream | \ + dmHdrAttrHidden | \ + dmHdrAttrLaunchableData | \ + dmHdrAttrRecyclable | \ + dmHdrAttrBundle | \ + dmHdrAttrOpen ) + +// Database attributes which only the system is allowed to change (for error-checking) +#define dmSysOnlyHdrAttrs ( dmHdrAttrResDB | \ + dmHdrAttrOpen ) + + +/************************************************************ + * Unique ID equates + *************************************************************/ +#define dmRecordIDReservedRange 1 // The range of upper bits in the database's + // uniqueIDSeed from 0 to this number are + // reserved and not randomly picked when a + // database is created. +#define dmDefaultRecordsID 0 // Records in a default database are copied + // with their uniqueIDSeeds set in this range. +#define dmUnusedRecordID 0 // Record ID not allowed on the device + + +/************************************************************ + * Mode flags passed to DmOpenDatabase + *************************************************************/ +#define dmModeReadOnly 0x0001 // read access +#define dmModeWrite 0x0002 // write access +#define dmModeReadWrite 0x0003 // read & write access +#define dmModeLeaveOpen 0x0004 // leave open when app quits +#define dmModeExclusive 0x0008 // don't let anyone else open it +#define dmModeShowSecret 0x0010 // force show of secret records + +// Generic type used to represent an open Database +typedef void * DmOpenRef; + + +/************************************************************ + * Structure passed to DmGetNextDatabaseByTypeCreator and used + * to cache search information between multiple searches. + *************************************************************/ +typedef struct { + UInt32 info[8]; + } DmSearchStateType; +typedef DmSearchStateType* DmSearchStatePtr; + + + +/************************************************************ + * Structures used by the sorting routines + *************************************************************/ +typedef struct { + UInt8 attributes; // record attributes; + UInt8 uniqueID[3]; // unique ID of record + } SortRecordInfoType; + +typedef SortRecordInfoType *SortRecordInfoPtr; + +typedef Int16 DmComparF (void *, void *, Int16 other, SortRecordInfoPtr, + SortRecordInfoPtr, MemHandle appInfoH); + + + +/************************************************************ + * Database manager error codes + * the constant dmErrorClass is defined in ErrorBase.h + *************************************************************/ +#define dmErrMemError (dmErrorClass | 1) +#define dmErrIndexOutOfRange (dmErrorClass | 2) +#define dmErrInvalidParam (dmErrorClass | 3) +#define dmErrReadOnly (dmErrorClass | 4) +#define dmErrDatabaseOpen (dmErrorClass | 5) +#define dmErrCantOpen (dmErrorClass | 6) +#define dmErrCantFind (dmErrorClass | 7) +#define dmErrRecordInWrongCard (dmErrorClass | 8) +#define dmErrCorruptDatabase (dmErrorClass | 9) +#define dmErrRecordDeleted (dmErrorClass | 10) +#define dmErrRecordArchived (dmErrorClass | 11) +#define dmErrNotRecordDB (dmErrorClass | 12) +#define dmErrNotResourceDB (dmErrorClass | 13) +#define dmErrROMBased (dmErrorClass | 14) +#define dmErrRecordBusy (dmErrorClass | 15) +#define dmErrResourceNotFound (dmErrorClass | 16) +#define dmErrNoOpenDatabase (dmErrorClass | 17) +#define dmErrInvalidCategory (dmErrorClass | 18) +#define dmErrNotValidRecord (dmErrorClass | 19) +#define dmErrWriteOutOfBounds (dmErrorClass | 20) +#define dmErrSeekFailed (dmErrorClass | 21) +#define dmErrAlreadyOpenForWrites (dmErrorClass | 22) +#define dmErrOpenedByAnotherTask (dmErrorClass | 23) +#define dmErrUniqueIDNotFound (dmErrorClass | 24) +#define dmErrAlreadyExists (dmErrorClass | 25) +#define dmErrInvalidDatabaseName (dmErrorClass | 26) +#define dmErrDatabaseProtected (dmErrorClass | 27) +#define dmErrDatabaseNotProtected (dmErrorClass | 28) + +/************************************************************ + * Values for the direction parameter of DmSeekRecordInCategory + *************************************************************/ +#define dmSeekForward 1 +#define dmSeekBackward -1 + + +/************************************************************ + * Data Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initialization +Err DmInit(void) + SYS_TRAP(sysTrapDmInit); + + +// Directory Lists +Err DmCreateDatabase(UInt16 cardNo, const Char *nameP, + UInt32 creator, UInt32 type, Boolean resDB) + SYS_TRAP(sysTrapDmCreateDatabase); + +Err DmCreateDatabaseFromImage(MemPtr bufferP) + SYS_TRAP(sysTrapDmCreateDatabaseFromImage); + + +Err DmDeleteDatabase(UInt16 cardNo, LocalID dbID) + SYS_TRAP(sysTrapDmDeleteDatabase); + +UInt16 DmNumDatabases(UInt16 cardNo) + SYS_TRAP(sysTrapDmNumDatabases); + +LocalID DmGetDatabase(UInt16 cardNo, UInt16 index) + SYS_TRAP(sysTrapDmGetDatabase); + +LocalID DmFindDatabase(UInt16 cardNo, const Char *nameP) + SYS_TRAP(sysTrapDmFindDatabase); + +Err DmGetNextDatabaseByTypeCreator(Boolean newSearch, DmSearchStatePtr stateInfoP, + UInt32 type, UInt32 creator, Boolean onlyLatestVers, + UInt16 *cardNoP, LocalID *dbIDP) + SYS_TRAP(sysTrapDmGetNextDatabaseByTypeCreator); + + +// Database info +Err DmDatabaseInfo(UInt16 cardNo, LocalID dbID, Char *nameP, + UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, + UInt32 * modDateP, UInt32 *bckUpDateP, + UInt32 * modNumP, LocalID *appInfoIDP, + LocalID *sortInfoIDP, UInt32 *typeP, + UInt32 *creatorP) + SYS_TRAP(sysTrapDmDatabaseInfo); + +Err DmSetDatabaseInfo(UInt16 cardNo, LocalID dbID, const Char *nameP, + UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, + UInt32 * modDateP, UInt32 *bckUpDateP, + UInt32 * modNumP, LocalID *appInfoIDP, + LocalID *sortInfoIDP, UInt32 *typeP, + UInt32 *creatorP) + SYS_TRAP(sysTrapDmSetDatabaseInfo); + +Err DmDatabaseSize(UInt16 cardNo, LocalID dbID, UInt32 *numRecordsP, + UInt32 * totalBytesP, UInt32 *dataBytesP) + SYS_TRAP(sysTrapDmDatabaseSize); + + +// This routine can be used to prevent a database from being deleted (by passing +// true for 'protect'). It will increment the protect count if 'protect' is true +// and decrement it if 'protect' is false. This is used by code that wants to +// keep a particular record or resource in a database locked down but doesn't +// want to keep the database open. This information is keep in the dynamic heap so +// all databases are "unprotected" at system reset. +Err DmDatabaseProtect(UInt16 cardNo, LocalID dbID, Boolean protect) + SYS_TRAP(sysTrapDmDatabaseProtect); + + +// Open/close Databases +DmOpenRef DmOpenDatabase(UInt16 cardNo, LocalID dbID, UInt16 mode) + SYS_TRAP(sysTrapDmOpenDatabase); + +DmOpenRef DmOpenDatabaseByTypeCreator(UInt32 type, UInt32 creator, UInt16 mode) + SYS_TRAP(sysTrapDmOpenDatabaseByTypeCreator); + +DmOpenRef DmOpenDBNoOverlay(UInt16 cardNo, LocalID dbID, UInt16 mode) + SYS_TRAP(sysTrapDmOpenDBNoOverlay); + +Err DmCloseDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmCloseDatabase); + + +// Info on open databases +DmOpenRef DmNextOpenDatabase(DmOpenRef currentP) + SYS_TRAP(sysTrapDmNextOpenDatabase); + +Err DmOpenDatabaseInfo(DmOpenRef dbP, LocalID *dbIDP, + UInt16 *openCountP, UInt16 *modeP, UInt16 *cardNoP, + Boolean *resDBP) + SYS_TRAP(sysTrapDmOpenDatabaseInfo); + +LocalID DmGetAppInfoID (DmOpenRef dbP) + SYS_TRAP(sysTrapDmGetAppInfoID); + +void DmGetDatabaseLockState(DmOpenRef dbR, UInt8 *highest, UInt32 *count, UInt32 *busy) + SYS_TRAP(sysTrapDmGetDatabaseLockState); + +// Utility to unlock all records and clear busy bits +Err DmResetRecordStates(DmOpenRef dbP) + SYS_TRAP(sysTrapDmResetRecordStates); + + +// Error Query +Err DmGetLastErr(void) + SYS_TRAP(sysTrapDmGetLastErr); + + +//------------------------------------------------------------ +// Record based access routines +//------------------------------------------------------------ + +// Record Info +UInt16 DmNumRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumRecords); + +UInt16 DmNumRecordsInCategory(DmOpenRef dbP, UInt16 category) + SYS_TRAP(sysTrapDmNumRecordsInCategory); + +Err DmRecordInfo(DmOpenRef dbP, UInt16 index, + UInt16 *attrP, UInt32 *uniqueIDP, LocalID *chunkIDP) + SYS_TRAP(sysTrapDmRecordInfo); + +Err DmSetRecordInfo(DmOpenRef dbP, UInt16 index, + UInt16 *attrP, UInt32 *uniqueIDP) + SYS_TRAP(sysTrapDmSetRecordInfo); + + + +// Record attaching and detaching +Err DmAttachRecord(DmOpenRef dbP, UInt16 *atP, + MemHandle newH, MemHandle *oldHP) + SYS_TRAP(sysTrapDmAttachRecord); + +Err DmDetachRecord(DmOpenRef dbP, UInt16 index, + MemHandle *oldHP) + SYS_TRAP(sysTrapDmDetachRecord); + +Err DmMoveRecord(DmOpenRef dbP, UInt16 from, UInt16 to) + SYS_TRAP(sysTrapDmMoveRecord); + + + +// Record creation and deletion +MemHandle DmNewRecord(DmOpenRef dbP, UInt16 *atP, UInt32 size) + SYS_TRAP(sysTrapDmNewRecord); + +Err DmRemoveRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmRemoveRecord); + +Err DmDeleteRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmDeleteRecord); + +Err DmArchiveRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmArchiveRecord); + +MemHandle DmNewHandle(DmOpenRef dbP, UInt32 size) + SYS_TRAP(sysTrapDmNewHandle); + +Err DmRemoveSecretRecords(DmOpenRef dbP) + SYS_TRAP(sysTrapDmRemoveSecretRecords); + + +// Record viewing manipulation +Err DmFindRecordByID(DmOpenRef dbP, UInt32 uniqueID, UInt16 *indexP) + SYS_TRAP(sysTrapDmFindRecordByID); + +MemHandle DmQueryRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmQueryRecord); + +MemHandle DmGetRecord(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmGetRecord); + +MemHandle DmQueryNextInCategory(DmOpenRef dbP, UInt16 *indexP, UInt16 category) + SYS_TRAP(sysTrapDmQueryNextInCategory); + +UInt16 DmPositionInCategory (DmOpenRef dbP, UInt16 index, UInt16 category) + SYS_TRAP(sysTrapDmPositionInCategory); + +Err DmSeekRecordInCategory (DmOpenRef dbP, UInt16 *indexP, UInt16 offset, + Int16 direction, UInt16 category) + SYS_TRAP(sysTrapDmSeekRecordInCategory); + + +MemHandle DmResizeRecord(DmOpenRef dbP, UInt16 index, UInt32 newSize) + SYS_TRAP(sysTrapDmResizeRecord); + +Err DmReleaseRecord(DmOpenRef dbP, UInt16 index, Boolean dirty) + SYS_TRAP(sysTrapDmReleaseRecord); + +UInt16 DmSearchRecord(MemHandle recH, DmOpenRef *dbPP) + SYS_TRAP(sysTrapDmSearchRecord); + + +// Category manipulation +Err DmMoveCategory (DmOpenRef dbP, UInt16 toCategory, UInt16 fromCategory, Boolean dirty) + SYS_TRAP(sysTrapDmMoveCategory); + +Err DmDeleteCategory (DmOpenRef dbR, UInt16 categoryNum) + SYS_TRAP(sysTrapDmDeleteCategory); + + +// Validation for writing +Err DmWriteCheck(void *recordP, UInt32 offset, UInt32 bytes) + SYS_TRAP(sysTrapDmWriteCheck); + +// Writing +Err DmWrite(void *recordP, UInt32 offset, const void *srcP, UInt32 bytes) + SYS_TRAP(sysTrapDmWrite); + +Err DmStrCopy(void *recordP, UInt32 offset, const Char *srcP) + SYS_TRAP(sysTrapDmStrCopy); + +Err DmSet(void *recordP, UInt32 offset, UInt32 bytes, UInt8 value) + SYS_TRAP(sysTrapDmSet); + + + + +//------------------------------------------------------------ +// Resource based access routines +//------------------------------------------------------------ + +// High level access routines +MemHandle DmGetResource(DmResType type, DmResID resID) + SYS_TRAP(sysTrapDmGetResource); + +MemHandle DmGet1Resource(DmResType type, DmResID resID) + SYS_TRAP(sysTrapDmGet1Resource); + +Err DmReleaseResource(MemHandle resourceH) + SYS_TRAP(sysTrapDmReleaseResource); + +MemHandle DmResizeResource(MemHandle resourceH, UInt32 newSize) + SYS_TRAP(sysTrapDmResizeResource); + + +// Searching resource databases +DmOpenRef DmNextOpenResDatabase(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNextOpenResDatabase); + +UInt16 DmFindResourceType(DmOpenRef dbP, DmResType resType, UInt16 typeIndex) + SYS_TRAP(sysTrapDmFindResourceType); + +UInt16 DmFindResource(DmOpenRef dbP, DmResType resType, DmResID resID, + MemHandle resH) + SYS_TRAP(sysTrapDmFindResource); + +UInt16 DmSearchResource(DmResType resType, DmResID resID, + MemHandle resH, DmOpenRef *dbPP) + SYS_TRAP(sysTrapDmSearchResource); + + +// Resource Info +UInt16 DmNumResources(DmOpenRef dbP) + SYS_TRAP(sysTrapDmNumResources); + +Err DmResourceInfo(DmOpenRef dbP, UInt16 index, + DmResType *resTypeP, DmResID *resIDP, + LocalID *chunkLocalIDP) + SYS_TRAP(sysTrapDmResourceInfo); + +Err DmSetResourceInfo(DmOpenRef dbP, UInt16 index, + DmResType *resTypeP, DmResID *resIDP) + SYS_TRAP(sysTrapDmSetResourceInfo); + + + +// Resource attaching and detaching +Err DmAttachResource(DmOpenRef dbP, MemHandle newH, + DmResType resType, DmResID resID) + SYS_TRAP(sysTrapDmAttachResource); + +Err DmDetachResource(DmOpenRef dbP, UInt16 index, + MemHandle *oldHP) + SYS_TRAP(sysTrapDmDetachResource); + + + +// Resource creation and deletion +MemHandle DmNewResource(DmOpenRef dbP, DmResType resType, DmResID resID, + UInt32 size) + SYS_TRAP(sysTrapDmNewResource); + +Err DmRemoveResource(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmRemoveResource); + + + +// Resource manipulation +MemHandle DmGetResourceIndex(DmOpenRef dbP, UInt16 index) + SYS_TRAP(sysTrapDmGetResourceIndex); + + + +// Record sorting +Err DmQuickSort(DmOpenRef dbP, DmComparF *compar, Int16 other) + SYS_TRAP(sysTrapDmQuickSort); + +Err DmInsertionSort (DmOpenRef dbR, DmComparF *compar, Int16 other) + SYS_TRAP(sysTrapDmInsertionSort); + +UInt16 DmFindSortPosition(DmOpenRef dbP, void *newRecord, + SortRecordInfoPtr newRecordInfo, DmComparF *compar, Int16 other) + SYS_TRAP(sysTrapDmFindSortPosition); + +UInt16 DmFindSortPositionV10(DmOpenRef dbP, void *newRecord, + DmComparF *compar, Int16 other) + SYS_TRAP(sysTrapDmFindSortPositionV10); + +#ifdef __cplusplus +} +#endif + +#endif // __DATAMGR_H__ diff --git a/sdk-4/include/Core/System/DateTime.h b/sdk-4/include/Core/System/DateTime.h new file mode 100644 index 0000000..f5b87ca --- /dev/null +++ b/sdk-4/include/Core/System/DateTime.h @@ -0,0 +1,302 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __DATETIME_H__ +#define __DATETIME_H__ + +#include +#include // LmLocaleType + +typedef enum + { + tfColon, + tfColonAMPM, // 1:00 pm + tfColon24h, // 13:00 + tfDot, + tfDotAMPM, // 1.00 pm + tfDot24h, // 13.00 + tfHoursAMPM, // 1 pm + tfHours24h, // 13 + tfComma24h // 13,00 + } TimeFormatType; + + +typedef enum { + dsNone, // Daylight Savings Time not observed + dsUSA, // United States Daylight Savings Time + dsAustralia, // Australian Daylight Savings Time + dsWesternEuropean, // Western European Daylight Savings Time + dsMiddleEuropean, // Middle European Daylight Savings Time + dsEasternEuropean, // Eastern European Daylight Savings Time + dsGreatBritain, // Great Britain and Eire Daylight Savings Time + dsRumania, // Rumanian Daylight Savings Time + dsTurkey, // Turkish Daylight Savings Time + dsAustraliaShifted // Australian Daylight Savings Time with shift in 1986 + } DaylightSavingsTypes; + + +// pass a TimeFormatType +#define Use24HourFormat(t) ((t) == tfColon24h || (t) == tfDot24h || (t) == tfHours24h || (t) == tfComma24h) +#define TimeSeparator(t) ((Char) ( t <= tfColon24h ? ':' : (t <= tfDot24h ? '.' : ','))) + + +typedef enum { + dfMDYWithSlashes, // 12/31/95 + dfDMYWithSlashes, // 31/12/95 + dfDMYWithDots, // 31.12.95 + dfDMYWithDashes, // 31-12-95 + dfYMDWithSlashes, // 95/12/31 + dfYMDWithDots, // 95.12.31 + dfYMDWithDashes, // 95-12-31 + + dfMDYLongWithComma, // Dec 31, 1995 + dfDMYLong, // 31 Dec 1995 + dfDMYLongWithDot, // 31. Dec 1995 + dfDMYLongNoDay, // Dec 1995 + dfDMYLongWithComma, // 31 Dec, 1995 + dfYMDLongWithDot, // 1995.12.31 + dfYMDLongWithSpace, // 1995 Dec 31 + + dfMYMed, // Dec '95 + dfMYMedNoPost, // Dec 95 (added for French 2.0 ROM) + dfMDYWithDashes // 12-31-95 (added for 4.0 ROM) + } DateFormatType; + +typedef struct { + Int16 second; + Int16 minute; + Int16 hour; + Int16 day; + Int16 month; + Int16 year; + Int16 weekDay; // Days since Sunday (0 to 6) + } DateTimeType; + +typedef DateTimeType *DateTimePtr; + + +// This is the time format. Times are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + UInt8 hours; + UInt8 minutes; +} TimeType; + +typedef TimeType *TimePtr; + +#define noTime -1 // The entire TimeType is -1 if there isn't a time. + + +// This is the date format. Dates are treated as words so don't +// change the order of the members in this structure. +// +typedef struct { + UInt16 year :7; // years since 1904 (MAC format) + UInt16 month :4; + UInt16 day :5; +} DateType; + +typedef DateType *DatePtr; + + +/************************************************************ + * Date Time Constants + *************************************************************/ + +// Maximum lengths of strings return by the date and time formating +// routine DateToAscii and TimeToAscii. +#define timeStringLength 9 +#define dateStringLength 9 +#define longDateStrLength 15 +#define dowDateStringLength 19 +#define dowLongDateStrLength 25 +#define timeZoneStringLength 50 + + +#define firstYear 1904 +#define numberOfYears 128 +#define lastYear (firstYear + numberOfYears - 1) + + + +// Constants for time calculations +// Could change these from xIny to yPerX +#define secondsInSeconds 1 +#define minutesInSeconds 60 +#define hoursInMinutes 60 +#define hoursInSeconds (hoursInMinutes * minutesInSeconds) +#define hoursPerDay 24 +//#define daysInSeconds ((Int32)(hoursPerDay) * ((Int32)hoursInSeconds)) +#define daysInSeconds (0x15180) // cc bug + +#define daysInWeek 7 +#define daysInYear 365 +#define daysInLeapYear 366 +#define daysInFourYears (daysInLeapYear + 3 * daysInYear) + +#define monthsInYear 12 + +#define maxDays ((UInt32) numberOfYears / 4 * daysInFourYears - 1) +#define maxSeconds ((UInt32) (maxDays + 1) * daysInSeconds - 1) + +// Values returned by DayOfWeek routine. +#define sunday 0 +#define monday 1 +#define tuesday 2 +#define wednesday 3 +#define thursday 4 +#define friday 5 +#define saturday 6 + +// Months of the year +#define january 1 +#define february 2 +#define march 3 +#define april 4 +#define may 5 +#define june 6 +#define july 7 +#define august 8 +#define september 9 +#define october 10 +#define november 11 +#define december 12 + +// 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). +#define DayOfWeekType DayOfMonthType + +// Values returned by DayOfMonth routine. +typedef enum { + dom1stSun, dom1stMon, dom1stTue, dom1stWen, dom1stThu, dom1stFri, dom1stSat, + dom2ndSun, dom2ndMon, dom2ndTue, dom2ndWen, dom2ndThu, dom2ndFri, dom2ndSat, + dom3rdSun, dom3rdMon, dom3rdTue, dom3rdWen, dom3rdThu, dom3rdFri, dom3rdSat, + dom4thSun, dom4thMon, dom4thTue, dom4thWen, dom4thThu, dom4thFri, dom4thSat, + domLastSun, domLastMon, domLastTue, domLastWen, domLastThu, domLastFri, + domLastSat + } DayOfMonthType; + +// Values used by DateTemplateToAscii routine. +#define dateTemplateChar chrCircumflexAccent + +enum { + dateTemplateDayNum = '0', + dateTemplateDOWName, + dateTemplateMonthName, + dateTemplateMonthNum, + dateTemplateYearNum +}; + +#define dateTemplateShortModifier 's' +#define dateTemplateRegularModifier 'r' +#define dateTemplateLongModifier 'l' +#define dateTemplateLeadZeroModifier 'z' + +//************************************************************ +//* Date and Time macros +//*********************************************************** + +// Convert a date in a DateType structure to an UInt16. + #define DateToInt(date) (*(UInt16 *) &date) + + +// Convert a date in a DateType structure to a signed int. + #define TimeToInt(time) (*(Int16 *) &time) + + + +//************************************************************ +//* Date Time procedures +//************************************************************ +#ifdef __cplusplus +extern "C" { +#endif + + +void TimSecondsToDateTime(UInt32 seconds, DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimSecondsToDateTime); + +UInt32 TimDateTimeToSeconds(DateTimePtr dateTimeP) + SYS_TRAP(sysTrapTimDateTimeToSeconds); + +void TimAdjust(DateTimePtr dateTimeP, Int32 adjustment) + SYS_TRAP(sysTrapTimAdjust); + +void TimeToAscii(UInt8 hours, UInt8 minutes, TimeFormatType timeFormat, + Char *pString) + SYS_TRAP(sysTrapTimeToAscii); + +UInt32 TimTimeZoneToUTC (UInt32 seconds, Int16 timeZone, + Int16 daylightSavingAdjustment) + SYS_TRAP(sysTrapTimTimeZoneToUTC); + +UInt32 TimUTCToTimeZone (UInt32 seconds, Int16 timeZone, + Int16 daylightSavingAdjustment) + SYS_TRAP(sysTrapTimUTCToTimeZone); + +void TimeZoneToAscii(Int16 timeZone, const LmLocaleType* localeP, Char* string) + SYS_TRAP(sysTrapTimeZoneToAscii); + + + +Int16 DaysInMonth(Int16 month, Int16 year) + SYS_TRAP(sysTrapDaysInMonth); + +Int16 DayOfWeek (Int16 month, Int16 day, Int16 year) + SYS_TRAP(sysTrapDayOfWeek); + +Int16 DayOfMonth (Int16 month, Int16 day, Int16 year) + SYS_TRAP(sysTrapDayOfMonth); + + + +// Date routines. +void DateSecondsToDate (UInt32 seconds, DatePtr date) + SYS_TRAP(sysTrapDateSecondsToDate); + +void DateDaysToDate (UInt32 days, DatePtr date) + SYS_TRAP(sysTrapDateDaysToDate); + +UInt32 DateToDays (DateType date) + SYS_TRAP(sysTrapDateToDays); + +void DateAdjust (DatePtr dateP, Int32 adjustment) + SYS_TRAP(sysTrapDateAdjust); + +void DateToAscii(UInt8 months, UInt8 days, UInt16 years, + DateFormatType dateFormat, Char *pString) + SYS_TRAP(sysTrapDateToAscii); + +void DateToDOWDMFormat(UInt8 months, UInt8 days, UInt16 years, + DateFormatType dateFormat, Char *pString) + SYS_TRAP(sysTrapDateToDOWDMFormat); + +UInt16 DateTemplateToAscii(const Char *templateP, UInt8 months, + UInt8 days, UInt16 years, Char *stringP, Int16 stringLen) + SYS_TRAP(sysTrapDateTemplateToAscii); + +#ifdef __cplusplus +} +#endif + + +#endif //__DATETIME_H__ diff --git a/sdk-4/include/Core/System/DebugMgr.h b/sdk-4/include/Core/System/DebugMgr.h new file mode 100644 index 0000000..59f4431 --- /dev/null +++ b/sdk-4/include/Core/System/DebugMgr.h @@ -0,0 +1,182 @@ +/****************************************************************************** + * + * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: DebugMgr.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Debugging functions + * + * History: + * 11/03/94 RM - Created by Ron Marianetti + * + * 2/1/98 vmk - Defined DbgControl + * + *****************************************************************************/ + +#ifndef __DEBUGMGR_H__ +#define __DEBUGMGR_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +// +// Constants and structures used in conjunction with DbgControl +// +#define dbgCtlNotHandled false // debug control operation was not handled +#define dbgCtlHandled true // debug control operation was handled + +#define dbgCtlAllHandlersID 0 // indiacates that the operation is to be handled + // by all handlers + +#define dbgCtlHandlerNameLen 31 // maximum handler name length, not including null +#define dbgCtlHandlerVerLen 15 // maximum handler version string length, not including null + +#define dbgCtlFirstCustomOp 0x8000 // debug handlers begin numbering their op[erations] + // with this number; the system reserves all operation + // number values below this one +// Typed of the DbgControl function +typedef Boolean DbgControlFuncType(UInt32 handlerID, UInt16 op, void *paramP, UInt32 *dwParamP); + +typedef struct DbgCtlHandlerInfoType { + DbgControlFuncType* handlerFuncP; // pointer to handler's DbgControl function + UInt32 version; // numeric version number (hander-defined) + Boolean enabled; // true if handler is enabled; false if not + Char name[dbgCtlHandlerNameLen+1]; // null-terminated handler name + Char ver[dbgCtlHandlerVerLen+1]; // null-terminated handler version string + UInt8 reserved1; + UInt32 dwReserved; // RESERVED -- CALLER MUST INITIALIZE TO ZERO! + } DbgCtlHandlerInfoType; + +typedef void DbgCtlEnumCallbackFunc(void *callbackDataP, UInt32 handlerID, DbgControlFuncType* handlerFuncP); + +typedef struct DbgCtlEnumInfoType { + DbgCtlEnumCallbackFunc* enumFuncP; + void * callbackDataP; + } DbgCtlEnumInfoType; + +// System-defined debug control operations +enum { + + dbgCtlOpEnumHandlers = 1, // handlerID = dbgCtlAllHandlersID (applies to all handlers) + // paramP = pointer to DbgCtlEnumInfoType + // returns dbgCtlHandled if handled + + dbgCtlOpGetHandlerInfo, // handlerID = desired handler creator + // paramP = pointer to DbgCtlHandlerInfoType + // returns dbgCtlHandled if handled + + dbgCtlOpEnableHandler, // handlerID = desired handler creator or dbgCtlAllHandlersID + // returns dbgCtlHandled if handled + + dbgCtlOpDisableHandler, // handlerID = desired handler creator or dbgCtlAllHandlersID + // returns dbgCtlHandled if handled + + dbgCtlOpGetEnabledStatus, // handlerID = desired handler creator + // dwParamP = pointer to UInt32 type variable to be filled in with + // enabled status: non-zero = enabled, zero = disabled + // returns dbgCtlHandled if handled + + dbgCtlOpGetVersion, // handlerID = desired handler creator + // dwParamP = pointer to UInt32 type variable to be filled in with + // handler-specific version number + // returns dbgCtlHandled if handled + + + dbgCtlOpLAST + }; + + +#ifdef __GNUC__ + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) + #define _DEBUGGER_TRAP __attribute__ ((__callseq__ ("trap #8"))) + #else + #define _DEBUGGER_TRAP + #endif +#elif defined (__MWERKS__) /* The equivalent in CodeWarrior syntax */ + #define _DEBUGGER_TRAP = 0x4E40 + 8 +#endif + + +/************************************************************ + * Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Int32 DbgInit(MemPtr spaceP, MemPtr dispatchTableP[], Boolean openComm); + +void DbgSrcBreak(void) +#if USE_TRAPS + /* Use a trap instruction unless we're a simulator or we've explicitly + set USE_TRAPS to 0. */ + _DEBUGGER_TRAP +#endif + ; + +void DbgSrcMessage(const Char *debugStr) + SYS_TRAP(sysTrapDbgSrcMessage); + + +// Debug control function for implementing debug tracing, etc. via debug handlers. +// The default implementation does nothing, leaving the real work up to "debug handlers". +// Debug handlers will be implemented as system extensions. As they are loaded, extensions +// will override this function call (DbgControl) and chain to those handlers loaded before +// them. When a debug control call is made by the client, a handler id of the handler that +// implements the functionality will be passed in as the first parameter. The handler id is +// the unique creator id of the handler. When a handler is called, it will first examine +// the handler ID -- if it matches its own, the handler will execute the command and return; +// if the handler id does not match, the handler must pass the call down the chain and return +// the value from that call. The operation to be performed is indicated by the parameter "op". +// op is specific to each handler this means that the same op values may be used by different +// handlers, since handler id's are unique. op values defined by handlers must begin at +// dbgCtlFirstCustomOp. Handler ID of dbgCtlAllHandlersID applies to all handlers. When the +// handler id of zero is passed, each handler is responsible for executing the requested action +// and passing the call down the chain. The last two parameters are defined by each handler +// for its own operations. +//typedef Boolean DbgControlFuncType(UInt32 handlerID, UInt16 op, void *paramP, UInt32 *dwParamP); +extern DbgControlFuncType DbgControl + SYS_TRAP(sysTrapDbgControl); + +void DbgBreak(void) +#if EMULATION_LEVEL == EMULATION_NONE + /* Use a trap instruction unless we're a simulator (i.e., even if we've + explicitly set USE_TRAPS to 0). In particular the SmallROM compiles + with USE_TRAPS set to 0 and needs the DbgBreak to resolve as a trap + instruction. */ + _DEBUGGER_TRAP +#endif + ; + +void DbgMessage(const Char *aStr) + SYS_TRAP(sysTrapDbgMessage); + +Char * DbgGetMessage(UInt8 *bufferP, Int32 timeout) + SYS_TRAP(sysTrapDbgGetMessage); + +Err DbgCommSettings(UInt32 *baudP, UInt32 *flagsP) + SYS_TRAP(sysTrapDbgCommSettings); + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ + +// This is an optimization for assembly code on the device. +#if EMULATION_LEVEL == EMULATION_NONE +#define _DbgBreak \ + DC.W m68kTrapInstr+sysDbgTrapNum //lint !e773 +#endif + + +#endif // __DEBUGMGR_H__ diff --git a/sdk-4/include/Core/System/Encrypt.h b/sdk-4/include/Core/System/Encrypt.h new file mode 100644 index 0000000..b7b7250 --- /dev/null +++ b/sdk-4/include/Core/System/Encrypt.h @@ -0,0 +1,58 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __ENCRYPT_H__ +#define __ENCRYPT_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Perform reversible encryption or decryption of 8 byte string in +// srcP using 8 byte key keyP. Place 8 byte result in dstP. +Err EncDES(UInt8 *srcP, UInt8 *keyP, UInt8 *dstP, Boolean encrypt) + SYS_TRAP(sysTrapEncDES); + + +// Digest a string of bytes and produce a 128 bit result using +// the MD4 algorithm. +Err EncDigestMD4(UInt8 *strP, UInt16 strLen, UInt8 digestP[16]) + SYS_TRAP(sysTrapEncDigestMD4); + + +// Digest a string of bytes and produce a 128 bit result using +// the MD5 algorithm. +Err EncDigestMD5(UInt8 *strP, UInt16 strLen, UInt8 digestP[16]) + SYS_TRAP(sysTrapEncDigestMD5); + + + +#ifdef __cplusplus +} +#endif + + + +#endif //__ENCRYPT_H__ diff --git a/sdk-4/include/Core/System/ErrorBase.h b/sdk-4/include/Core/System/ErrorBase.h new file mode 100644 index 0000000..de0901a --- /dev/null +++ b/sdk-4/include/Core/System/ErrorBase.h @@ -0,0 +1,295 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __ERRORBASE_H__ +#define __ERRORBASE_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +#if EMULATION_LEVEL != EMULATION_NONE +#include +#endif + +// Max message length supported by ErrCustomAlert +#define errMaxMsgLength 511 + + +/************************************************************ + * Error Classes for each manager + *************************************************************/ +#define errNone 0x0000 // No error + +#define memErrorClass 0x0100 // Memory Manager +#define dmErrorClass 0x0200 // Data Manager +#define serErrorClass 0x0300 // Serial Manager +#define slkErrorClass 0x0400 // Serial Link Manager +#define sysErrorClass 0x0500 // System Manager +#define fplErrorClass 0x0600 // Floating Point Library +#define flpErrorClass 0x0680 // New Floating Point Library +#define evtErrorClass 0x0700 // System Event Manager +#define sndErrorClass 0x0800 // Sound Manager +#define almErrorClass 0x0900 // Alarm Manager +#define timErrorClass 0x0A00 // Time Manager +#define penErrorClass 0x0B00 // Pen Manager +#define ftrErrorClass 0x0C00 // Feature Manager +#define cmpErrorClass 0x0D00 // Connection Manager (HotSync) +#define dlkErrorClass 0x0E00 // Desktop Link Manager +#define padErrorClass 0x0F00 // PAD Manager +#define grfErrorClass 0x1000 // Graffiti Manager +#define mdmErrorClass 0x1100 // Modem Manager +#define netErrorClass 0x1200 // Net Library +#define htalErrorClass 0x1300 // HTAL Library +#define inetErrorClass 0x1400 // INet Library +#define exgErrorClass 0x1500 // Exg Manager +#define fileErrorClass 0x1600 // File Stream Manager +#define rfutErrorClass 0x1700 // RFUT Library +#define txtErrorClass 0x1800 // Text Manager +#define tsmErrorClass 0x1900 // Text Services Library +#define webErrorClass 0x1A00 // Web Library +#define secErrorClass 0x1B00 // Security Library +#define emuErrorClass 0x1C00 // Emulator Control Manager +#define flshErrorClass 0x1D00 // Flash Manager +#define pwrErrorClass 0x1E00 // Power Manager +#define cncErrorClass 0x1F00 // Connection Manager (Serial Communication) +#define actvErrorClass 0x2000 // Activation application +#define radioErrorClass 0x2100 // Radio Manager (Library) +#define dispErrorClass 0x2200 // Display Driver Errors. +#define bltErrorClass 0x2300 // Blitter Driver Errors. +#define winErrorClass 0x2400 // Window manager. +#define omErrorClass 0x2500 // Overlay Manager +#define menuErrorClass 0x2600 // Menu Manager +#define lz77ErrorClass 0x2700 // Lz77 Library +#define smsErrorClass 0x2800 // Sms Library +#define expErrorClass 0x2900 // Expansion Manager and Slot Driver Library +#define vfsErrorClass 0x2A00 // Virtual Filesystem Manager and Filesystem library +#define lmErrorClass 0x2B00 // Locale Manager +#define intlErrorClass 0x2C00 // International Manager +#define pdiErrorClass 0x2D00 // PDI Library +#define attnErrorClass 0x2E00 // Attention Manager +#define telErrorClass 0x2F00 // Telephony Manager +#define hwrErrorClass 0x3000 // Hardware Manager (HAL) +#define blthErrorClass 0x3100 // Bluetooth Library Error Class +#define udaErrorClass 0x3200 // UDA Manager Error Class +#define oemErrorClass 0x7000 // OEM/Licensee errors (0x7000-0x7EFF shared among ALL partners) +#define errInfoClass 0x7F00 // special class shows information w/o error code +#define appErrorClass 0x8000 // Application-defined errors + + + +/******************************************************************** + * Try / Catch / Throw support + * + * --------------------------------------------------------------------- + * Exception Handler structure + * + * An ErrExceptionType object is created for each ErrTry & ErrCatch block. + * At any point in the program, there is a linked list of + * ErrExceptionType objects. GErrFirstException points to the + * most recently entered block. A ErrExceptionType blocks stores + * information about the state of the machine (register values) + * at the start of the Try block + ********************************************************************/ + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrJumpBuf jmp_buf +#else + typedef long* ErrJumpBuf[12]; // D3-D7,PC,A2-A7 +#endif + +// Structure used to store Try state. +typedef struct ErrExceptionType { + struct ErrExceptionType* nextP; // next exception type + ErrJumpBuf state; // setjmp/longjmp storage + Int32 err; // Error code + } ErrExceptionType; +typedef ErrExceptionType *ErrExceptionPtr; + + +// Try & Catch macros +#define ErrTry \ + { \ + ErrExceptionType _TryObject; \ + _TryObject.err = 0; \ + _TryObject.nextP = (ErrExceptionPtr)*ErrExceptionList(); \ + *ErrExceptionList() = (MemPtr)&_TryObject; \ + if (ErrSetJump(_TryObject.state) == 0) { + + +// NOTE: All variables referenced in and after the ErrCatch must +// be declared volatile. Here's how for variables and pointers: +// volatile UInt16 oldMode; +// ShlDBHdrTablePtr volatile hdrTabP = nil; +// If you have many local variables after the ErrCatch you may +// opt to put the ErrTry and ErrCatch in a separate enclosing function. +#define ErrCatch(theErr) \ + *ErrExceptionList() = (MemPtr)_TryObject.nextP; \ + } \ + else { \ + Int32 theErr = _TryObject.err; \ + *ErrExceptionList() = (MemPtr)_TryObject.nextP; + + +#define ErrEndCatch \ + } \ + } + + + +/******************************************************************** + * Error Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if EMULATION_LEVEL != EMULATION_NONE + #define ErrSetJump(buf) setjmp(buf) + #define ErrLongJump(buf,res) longjmp(buf,res) + +#else + Int16 ErrSetJump(ErrJumpBuf buf) + SYS_TRAP(sysTrapErrSetJump); + + void ErrLongJump(ErrJumpBuf buf, Int16 result) + SYS_TRAP(sysTrapErrLongJump); +#endif + +MemPtr* ErrExceptionList(void) + SYS_TRAP(sysTrapErrExceptionList); + +void ErrThrow(Int32 err) + SYS_TRAP(sysTrapErrThrow); + +void ErrDisplayFileLineMsg(const Char * const filename, UInt16 lineNo, + const Char * const msg) + SYS_TRAP(sysTrapErrDisplayFileLineMsg); + + +//--------------------------------------------------------------------- +// 2/25/98 - New routine for PalmOS >3.0 to display a UI alert for +// run-time errors. This is most likely to be used by network applications +// that are likely to encounter run-time errors like can't find the server, +// network down, etc. etc. +// +// This routine will lookup the text associated with 'errCode' and display +// it in an alert. If errMsgP is not NULL, then that text will be used +// instead of the associated 'errCode' text. If 'preMsgP' or 'postMsgP' +// is not null, then that text will be pre-pended or post-pended +// respectively. +// +// Apps that don't use the extra parameters may want to just use the +// macro below 'ErrAlert' +//--------------------------------------------------------------------- +UInt16 ErrAlertCustom(Err errCode, Char *errMsgP, Char *preMsgP, + Char * postMsgP) + SYS_TRAP(sysTrapErrAlertCustom); + +#define ErrAlert(err) ErrAlertCustom(err, 0, 0, 0) + + + +#ifdef __cplusplus +} +#endif + + + + +#endif // __ERRORBASE_H__ diff --git a/sdk-4/include/Core/System/ErrorMgr.h b/sdk-4/include/Core/System/ErrorMgr.h new file mode 100644 index 0000000..dbc1981 --- /dev/null +++ b/sdk-4/include/Core/System/ErrorMgr.h @@ -0,0 +1,97 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __ERRORMGR_H__ +#define __ERRORMGR_H__ + +#include // Invariant error management stuff + +#include // #define ERROR_CHECK_LEVEL + +//------------------------------------------------------------ +// Full Error Checking +//------------------------------------------------------------ +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL + +#define ErrFatalDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + +#define ErrFatalDisplayIf(condition, msg) \ + do {if (condition) ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg);} while (0) + +#define ErrNonFatalDisplayIf(condition, msg) \ + do {if (condition) ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg);} while (0) + +#define ErrNonFatalDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + + + + +//------------------------------------------------------------ +// Fatal Error Checking Only +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_PARTIAL + +#define ErrFatalDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + +#define ErrFatalDisplayIf(condition, msg) \ + do {if (condition) ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg);} while (0) + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplay(msg) + +#define ErrDisplay(msg) \ + ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, msg) + + + +//------------------------------------------------------------ +// No Error Checking +//------------------------------------------------------------ +#elif ERROR_CHECK_LEVEL == ERROR_CHECK_NONE + +#define ErrFatalDisplay(msg) + +#define ErrFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplayIf(condition, msg) + +#define ErrNonFatalDisplay(msg) + +#define ErrDisplay(msg) + + +//------------------------------------------------------------ +// Not Defined... +//------------------------------------------------------------ +#else +#error ERROR: the compiler define 'ERROR_CHECK_LEVEL' must be defined! + +#endif // ERROR_CHECK_LEVEL + + +#endif // __ERRORMGR_H__ diff --git a/sdk-4/include/Core/System/ExgLib.h b/sdk-4/include/Core/System/ExgLib.h new file mode 100644 index 0000000..b4e6f7a --- /dev/null +++ b/sdk-4/include/Core/System/ExgLib.h @@ -0,0 +1,137 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __EXGLIB_H__ +#define __EXGLIB_H__ + +#include +#include +#include + +// special exchange mgr event key +#define exgIntDataChr 0x01ff + +//----------------------------------------------------------------------------- +// 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!!! +//----------------------------------------------------------------------------- + +#define exgLibTrapHandleEvent (sysLibTrapCustom) +#define exgLibTrapConnect (sysLibTrapCustom+1) +#define exgLibTrapAccept (sysLibTrapCustom+2) +#define exgLibTrapDisconnect (sysLibTrapCustom+3) +#define exgLibTrapPut (sysLibTrapCustom+4) +#define exgLibTrapGet (sysLibTrapCustom+5) +#define exgLibTrapSend (sysLibTrapCustom+6) +#define exgLibTrapReceive (sysLibTrapCustom+7) +#define exgLibTrapControl (sysLibTrapCustom+8) +#define exgLibTrapRequest (sysLibTrapCustom+9) +#define exgLibTrapReserved1 (sysLibTrapCustom+10) +#define exgLibTrapReserved2 (sysLibTrapCustom+11) +#define exgLibTrapReserved3 (sysLibTrapCustom+12) +#define exgLibTrapReserved4 (sysLibTrapCustom+13) +#define exgLibTrapReserved5 (sysLibTrapCustom+14) +#define exgLibTrapReserved6 (sysLibTrapCustom+15) +#define exgLibTrapReserved7 (sysLibTrapCustom+16) +#define exgLibTrapReserved8 (sysLibTrapCustom+17) +#define exgLibTrapReserved9 (sysLibTrapCustom+18) +#define exgLibTrapReserved10 (sysLibTrapCustom+19) +#define exgLibTrapLast (sysLibTrapCustom+20) + + +/************************************************************ + * Net Library procedures. + *************************************************************/ +#pragma mark Functions +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +// Open the library - enable server for receiving data. +Err ExgLibOpen (UInt16 libRefnum) + SYS_TRAP(sysLibTrapOpen); + +Err ExgLibClose (UInt16 libRefnum) + SYS_TRAP(sysLibTrapClose); + +Err ExgLibSleep (UInt16 libRefnum) + SYS_TRAP(sysLibTrapSleep); + +Err ExgLibWake (UInt16 libRefnum) + SYS_TRAP(sysLibTrapWake); + +// Handle events that this library needs. This will be called by +// sysHandle event when certain low level events are triggered. +Boolean ExgLibHandleEvent(UInt16 libRefnum, void *eventP) + SYS_TRAP(exgLibTrapHandleEvent); + +// Establish a new connection +Err ExgLibConnect(UInt16 libRefNum, ExgSocketType *exgSocketP) + SYS_TRAP(exgLibTrapConnect); + +// Accept a connection request from remote end +Err ExgLibAccept(UInt16 libRefnum, ExgSocketType *exgSocketP) + SYS_TRAP(exgLibTrapAccept); + +// Disconnect +Err ExgLibDisconnect(UInt16 libRefnum, ExgSocketType *exgSocketP, Err error) + SYS_TRAP(exgLibTrapDisconnect); + +// Initiate a Put command. This passes the name and other information about +// an object to be sent +Err ExgLibPut(UInt16 libRefnum, ExgSocketType *exgSocketP) + SYS_TRAP(exgLibTrapPut); + +// Initiate a Get command. This requests an object from the remote end. +Err ExgLibGet(UInt16 libRefNum, ExgSocketType *exgSocketP) + SYS_TRAP(exgLibTrapGet); + +// Send data to remote end - called after a Put command +UInt32 ExgLibSend(UInt16 libRefNum, ExgSocketType *exgSocketP, const void *bufP, UInt32 bufLen, Err *errP) + SYS_TRAP(exgLibTrapSend); + +// Receive data from remote end -- called after Accept +UInt32 ExgLibReceive(UInt16 libRefNum, ExgSocketType *exgSocketP, void *bufP, UInt32 bufSize, Err *errP) + SYS_TRAP(exgLibTrapReceive); + +// Send various option commands to the Exg library +Err ExgLibControl(UInt16 libRefNum, UInt16 op, void *valueP, UInt16 *valueLenP) + SYS_TRAP(exgLibTrapControl); + +// Tell the Exg library to check for incoming data +Err ExgLibRequest(UInt16 libRefNum, ExgSocketType *socketP) + SYS_TRAP(exgLibTrapRequest); + + +#ifdef __cplusplus +} +#endif + +#endif // __EXGLIB_H__ diff --git a/sdk-4/include/Core/System/ExgMgr.h b/sdk-4/include/Core/System/ExgMgr.h new file mode 100644 index 0000000..f1b7ad5 --- /dev/null +++ b/sdk-4/include/Core/System/ExgMgr.h @@ -0,0 +1,265 @@ +/****************************************************************************** + * + * Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ExgMgr.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Include file for Exg system functions + * + * History: + * 5/23/97 Created by Gavin Peacock + * + *****************************************************************************/ + +#ifndef __EXGMGR_H__ +#define __EXGMGR_H__ + +#include +#include + +#include +#include +#include + +#define exgMemError (exgErrorClass | 1) +#define exgErrStackInit (exgErrorClass | 2) // stack could not initialize +#define exgErrUserCancel (exgErrorClass | 3) +#define exgErrNoReceiver (exgErrorClass | 4) // receiver device not found +#define exgErrNoKnownTarget (exgErrorClass | 5) // can't find a target app +#define exgErrTargetMissing (exgErrorClass | 6) // target app is known but missing +#define exgErrNotAllowed (exgErrorClass | 7) // operation not allowed +#define exgErrBadData (exgErrorClass | 8) // internal data was not valid +#define exgErrAppError (exgErrorClass | 9) // generic application error +#define exgErrUnknown (exgErrorClass | 10) // unknown general error +#define exgErrDeviceFull (exgErrorClass | 11) // device is full +#define exgErrDisconnected (exgErrorClass | 12) // link disconnected +#define exgErrNotFound (exgErrorClass | 13) // requested object not found +#define exgErrBadParam (exgErrorClass | 14) // bad parameter to call +#define exgErrNotSupported (exgErrorClass | 15) // operation not supported by this library +#define exgErrDeviceBusy (exgErrorClass | 16) // device is busy +#define exgErrBadLibrary (exgErrorClass | 17) // bad or missing ExgLibrary +#define exgErrNotEnoughPower (exgErrorClass | 18) // Device has not enough power to perform the requested operation + +#define exgSeparatorChar '\t' // char used to separate multiple registry entries + +#define exgRegCreatorID 0xfffb // creator ID registry +#define exgRegSchemeID 0xfffc // URL scheme registry +#define exgRegExtensionID 0xfffd // filename extension registry +#define exgRegTypeID 0xfffe // MIME type registry + +#define exgDataPrefVersion 0 // all isDefault bits clear +#define exgTitleBufferSize 20 // buffer size for title from exgLibCtlGetTitle, including null terminator +#define exgMaxTitleLen exgTitleBufferSize // deprecated +#define exgMaxTypeLength 80 // max length of extensions, MIME types, and URL schemes in registry, excluding null terminator +#define exgMaxDescriptionLength 80 // max length of descriptions in registry, excluding null terminator + +#define exgLibCtlGetTitle 1 // get title for Exg dialogs +#define exgLibCtlGetVersion 2 // get version of exg lib API +#define exgLibCtlGetPreview 3 // find out if library supports preview +#define exgLibCtlSpecificOp 0x8000 // start of range for library specific control codes + +#define exgLibAPIVersion 0 // current version of exg lib API + +// Pre-defined URL schemes +#define exgBeamScheme "_beam" // general scheme for Beam commands +#define exgSendScheme "_send" // general scheme for Send commands + +// Pre-defined URL prefixes +#define exgBeamPrefix (exgBeamScheme ":") +#define exgSendPrefix ("?" exgSendScheme ":") +#define exgSendBeamPrefix ("?" exgSendScheme ";" exgBeamScheme ":") +#define exgLocalPrefix (exgLocalScheme ":") + +// A flag used for attachments. +#define exgUnwrap 0x0001 + +// A flag used for skipping the sysAppLaunchCmdExgAskUser sublaunch and the subsequent +// call to ExgDoDialog. +#define exgNoAsk 0x0002 +#define exgGet 0x0004 + +// Enum for preview operations. Also used as masks for the query operation. +#define exgPreviewQuery ((UInt16)0x0000) +#define exgPreviewShortString ((UInt16)0x0001) +#define exgPreviewLongString ((UInt16)0x0002) +#define exgPreviewDraw ((UInt16)0x0004) +#define exgPreviewDialog ((UInt16)0x0008) +#define exgPreviewFirstUser ((UInt16)0x0400) // used for app-specific operations +#define exgPreviewLastUser ((UInt16)0x8000) // + + +typedef struct { + UInt16 dbCardNo; // card number of the database + LocalID dbID; // LocalID of the database + UInt16 recordNum; // index of record that contain a match + UInt32 uniqueID; // postion in record of the match. + UInt32 matchCustom; // application specific info +} ExgGoToType; + +typedef ExgGoToType *ExgGoToPtr; + + +typedef struct ExgSocketType { + UInt16 libraryRef; // identifies the Exg library in use + UInt32 socketRef; // used by Exg library to identify this connection + UInt32 target; // Creator ID of application this is sent to + UInt32 count; // # of objects in this connection (usually 1) + UInt32 length; // # total byte count for all objects being sent (optional) + UInt32 time; // last modified time of object (optional) + UInt32 appData; // application specific info + UInt32 goToCreator; // creator ID of app to launch with goto after receive + ExgGoToType goToParams; // If launchCreator then this contains goto find info + 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 preview:1; // Preview in progress: don't throw away data as it's read + UInt16 reserved:11;// reserved system flags + Char *description; // text description of object (for user) + Char *type; // Mime type of object (optional) + Char *name; // name of object, generally a file name (optional) +} ExgSocketType; +typedef ExgSocketType *ExgSocketPtr; + + +// structures used for sysAppLaunchCmdExgAskUser launch code parameter +// default is exgAskDialog (ask user with dialog... +typedef enum { exgAskDialog,exgAskOk,exgAskCancel } ExgAskResultType; + +typedef struct { + ExgSocketType *socketP; + ExgAskResultType result; // what to do with dialog + UInt8 reserved; +} ExgAskParamType; +typedef ExgAskParamType *ExgAskParamPtr; + +// Optional parameter structure used with ExgDoDialog for category control +typedef struct { + UInt16 version; // version of this structure (should be zero) + DmOpenRef db; // open database ref (for category information) + UInt16 categoryIndex; // index of selected category +} ExgDialogInfoType; + +typedef struct { + UInt16 version; + ExgSocketType *socketP; + UInt16 op; + Char *string; + UInt32 size; + RectangleType bounds; + UInt16 types; + Err error; +} ExgPreviewInfoType; + +typedef Err (*ExgDBReadProcPtr) + (void *dataP, UInt32 *sizeP, void *userDataP); + +typedef Boolean (*ExgDBDeleteProcPtr) + (const char *nameP, UInt16 version, UInt16 cardNo, + LocalID dbID, void *userDataP); + +typedef Err (*ExgDBWriteProcPtr) + (const void *dataP, UInt32 *sizeP, void *userDataP); + +#ifdef __cplusplus +extern "C" { +#endif + +Err ExgInit(void) + SYS_TRAP(sysTrapExgInit); + +Err ExgConnect(ExgSocketType *socketP) + SYS_TRAP(sysTrapExgConnect); + +Err ExgPut(ExgSocketType *socketP) + SYS_TRAP(sysTrapExgPut); + +Err ExgGet(ExgSocketType *socketP) + SYS_TRAP(sysTrapExgGet); + +Err ExgAccept(ExgSocketType *socketP) + SYS_TRAP(sysTrapExgAccept); + +Err ExgDisconnect(ExgSocketType *socketP, Err error) + SYS_TRAP(sysTrapExgDisconnect); + +UInt32 ExgSend(ExgSocketType *socketP, const void *bufP, UInt32 bufLen, Err *err) + SYS_TRAP(sysTrapExgSend); + +UInt32 ExgReceive(ExgSocketType *socketP, void *bufP, UInt32 bufLen, Err *err) + SYS_TRAP(sysTrapExgReceive); + +Err ExgControl(ExgSocketType *socketP, UInt16 op, void *valueP, UInt16 *valueLenP) + SYS_TRAP(sysTrapExgControl); + +Err ExgRegisterData(UInt32 creatorID, UInt16 id, const Char *dataTypesP) + SYS_TRAP(sysTrapExgRegisterData); + +Err ExgRegisterDatatype(UInt32 creatorID, UInt16 id, const Char *dataTypesP, + const Char *descriptionsP, UInt16 flags) + SYS_TRAP(sysTrapExgRegisterDatatype); + +// This function was documented as System Use Only in 3.5, so no third party +// code should have been calling it. So the addition of "V35" to the name +// should not affect anyone. +Err ExgNotifyReceiveV35(ExgSocketType *socketP) + SYS_TRAP(sysTrapExgNotifyReceiveV35); + +Err ExgNotifyReceive(ExgSocketType *socketP, UInt16 flags) + SYS_TRAP(sysTrapExgNotifyReceive); + +Err ExgNotifyGoto(ExgSocketType *socketP, UInt16 flags) + SYS_TRAP(sysTrapExgNotifyGoto); + +Err ExgDBRead( + ExgDBReadProcPtr readProcP, + ExgDBDeleteProcPtr deleteProcP, + void* userDataP, + LocalID* dbIDP, + UInt16 cardNo, + Boolean* needResetP, + Boolean keepDates) + SYS_TRAP(sysTrapExgDBRead); + +Err ExgDBWrite( + ExgDBWriteProcPtr writeProcP, + void* userDataP, + const char* nameP, + LocalID dbID, + UInt16 cardNo) + SYS_TRAP(sysTrapExgDBWrite); + + +Boolean ExgDoDialog(ExgSocketType *socketP, ExgDialogInfoType *infoP, Err *errP) + SYS_TRAP(sysTrapExgDoDialog); + +Err ExgRequest(ExgSocketType *socketP) + SYS_TRAP(sysTrapExgRequest); + +Err ExgSetDefaultApplication(UInt32 creatorID, UInt16 id, const Char *dataTypeP) + SYS_TRAP(sysTrapExgSetDefaultApplication); + +Err ExgGetDefaultApplication(UInt32 *creatorIDP, UInt16 id, const Char *dataTypeP) + SYS_TRAP(sysTrapExgGetDefaultApplication); + +Err ExgGetTargetApplication(ExgSocketType *socketP, Boolean unwrap, UInt32 *creatorIDP, Char *descriptionP, UInt32 descriptionSize) + SYS_TRAP(sysTrapExgGetTargetApplication); + +Err ExgGetRegisteredApplications(UInt32 **creatorIDsP, UInt32 *numAppsP, Char **namesP, Char **descriptionsP, UInt16 id, const Char *dataTypeP) + SYS_TRAP(sysTrapExgGetRegisteredApplications); + +Err ExgGetRegisteredTypes(Char **dataTypesP, UInt32 *sizeP, UInt16 id) + SYS_TRAP(sysTrapExgGetRegisteredTypes); + +Err ExgNotifyPreview(ExgPreviewInfoType *infoP) + SYS_TRAP(sysTrapExgNotifyPreview); + +#ifdef __cplusplus +} +#endif + +#endif // __EXGMGR_H__ diff --git a/sdk-4/include/Core/System/FeatureMgr.h b/sdk-4/include/Core/System/FeatureMgr.h new file mode 100644 index 0000000..036cafb --- /dev/null +++ b/sdk-4/include/Core/System/FeatureMgr.h @@ -0,0 +1,89 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __FEATUREMGR_H__ +#define __FEATUREMGR_H__ + + +#include +#include +#include + + + +/************************************************************ + * Feature manager error codes + * the constant ftrErrorClass is defined in ErrorBase.h + *************************************************************/ +#define ftrErrInvalidParam (ftrErrorClass | 1) +#define ftrErrNoSuchFeature (ftrErrorClass | 2) +#define ftrErrAlreadyExists (ftrErrorClass | 3) +#define ftrErrROMBased (ftrErrorClass | 4) +#define ftrErrInternalErr (ftrErrorClass | 5) + + +/************************************************************ + * Feature Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Init the feature Manager +Err FtrInit(void) + SYS_TRAP(sysTrapFtrInit); + + +// Get a feature +Err FtrGet(UInt32 creator, UInt16 featureNum, UInt32 *valueP) + SYS_TRAP(sysTrapFtrGet); + +// Set/Create a feature. +Err FtrSet(UInt32 creator, UInt16 featureNum, UInt32 newValue) + SYS_TRAP(sysTrapFtrSet); + +// Unregister a feature +Err FtrUnregister(UInt32 creator, UInt16 featureNum) + SYS_TRAP(sysTrapFtrUnregister); + +// Get a feature by index +Err FtrGetByIndex(UInt16 index, Boolean romTable, + UInt32 *creatorP, UInt16 *numP, UInt32 *valueP) + SYS_TRAP(sysTrapFtrGetByIndex); + +// Get temporary space from storage heap +Err FtrPtrNew(UInt32 creator, UInt16 featureNum, UInt32 size, + void **newPtrP) + SYS_TRAP(sysTrapFtrPtrNew); + +// Release temporary space to storage heap +Err FtrPtrFree(UInt32 creator, UInt16 featureNum) + SYS_TRAP(sysTrapFtrPtrFree); + + +// Resize block of temporary storage +Err FtrPtrResize(UInt32 creator, UInt16 featureNum, UInt32 newSize, + void **newPtrP) + SYS_TRAP(sysTrapFtrPtrResize); + + +#ifdef __cplusplus +} +#endif + +#endif // __FEATUREMGR_H__ diff --git a/sdk-4/include/Core/System/FileStream.h b/sdk-4/include/Core/System/FileStream.h new file mode 100644 index 0000000..9cd85a9 --- /dev/null +++ b/sdk-4/include/Core/System/FileStream.h @@ -0,0 +1,342 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __FILESTREAM_H__ +#define __FILESTREAM_H__ + +#include +#include +#include + +/************************************************************ + * File Stream error codes + * the constant dmErrorClass is defined in ErrorBase.h + *************************************************************/ + +#define fileErrMemError (fileErrorClass | 1) // out of memory error +#define fileErrInvalidParam (fileErrorClass | 2) // invalid parameter value passed +#define fileErrCorruptFile (fileErrorClass | 3) // the file is corrupted/invalid/not a stream file +#define fileErrNotFound (fileErrorClass | 4) // couldn't find the file +#define fileErrTypeCreatorMismatch (fileErrorClass | 5) // file's type and creator didn't match those expected +#define fileErrReplaceError (fileErrorClass | 6) // couldn't replace an existing file +#define fileErrCreateError (fileErrorClass | 7) // couldn't create a new file +#define fileErrOpenError (fileErrorClass | 8) // generic open error +#define fileErrInUse (fileErrorClass | 9) // file couldn't be opened or deleted because it is in use +#define fileErrReadOnly (fileErrorClass | 10)// couldn't open in write mode because db is read-only +#define fileErrInvalidDescriptor (fileErrorClass | 11)// invalid file descriptor (FileHandle) +#define fileErrCloseError (fileErrorClass | 12)// error closing the database +#define fileErrOutOfBounds (fileErrorClass | 13)// attempted operation went out of bounds of the file +#define fileErrPermissionDenied (fileErrorClass | 14)// couldn't write to a file open for read-only access +#define fileErrIOError (fileErrorClass | 15)// general I/O error +#define fileErrEOF (fileErrorClass | 16)// end-of-file error +#define fileErrNotStream (fileErrorClass | 17)// attempted to open a file that is not a stream + + + +/************************************************************ + * File Stream handle type + *************************************************************/ +typedef MemHandle FileHand; + +#define fileNullHandle ((FileHand)0) + + +/************************************************************ + * Mode flags passed to FileOpen + *************************************************************/ + +// fileModeReadOnly, fileModeReadWrite, fileModeUpdate, and fileModeAppend are mutually exclusive - only +// pass one of them to FileOpen! +#define fileModeReadOnly (0x80000000UL) // open for read access +#define fileModeReadWrite (0x40000000UL) // create for read/write access, discarding previous if any */ +#define fileModeUpdate (0x20000000UL) // open/create for read/write, preserving previous if any +#define fileModeAppend (0x10000000UL) // open/create for read/write, always writing at the end + +#define fileModeLeaveOpen (0x08000000UL) // leave open when app quits +#define fileModeExclusive (0x04000000UL) // don't let anyone else open it +#define fileModeAnyTypeCreator (0x02000000UL) // if set, skip type/creator validation when + // opening or replacing an existing file + +#define fileModeTemporary (0x01000000UL) // 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) + +#define fileModeDontOverwrite (0x00800000UL) // if set, will prevent fileModeReadWrite from discarding an existing file + // with the same name; may only be specified together with fileModeReadWrite + +// For debugging/validation +#define fileModeAllFlags ( fileModeReadOnly | \ + fileModeReadWrite | \ + fileModeUpdate | \ + fileModeAppend | \ + fileModeLeaveOpen | \ + fileModeExclusive | \ + fileModeAnyTypeCreator | \ + fileModeTemporary | \ + fileModeDontOverwrite ) + +/************************************************************ + * Origin passed to FileSetPos + *************************************************************/ +typedef enum FileOriginEnum { + + fileOriginBeginning = 1, // from the beginning (first data byte of file) + fileOriginCurrent, // from the current position + fileOriginEnd // from the end of file (one position beyond last data byte) + + } FileOriginEnum; + + + +/************************************************************ + * Operation passed to FileControl + *************************************************************/ +typedef enum FileOpEnum { + fileOpNone = 0, // no-op + + fileOpDestructiveReadMode, // 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, // 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, // 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, // 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, // 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, // 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, // 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, // flush any cached data to storage + // ARGUMENTS: + // stream = open stream handle + // valueP = NULL + // valueLenP = NULL + // RETURNS: + // zero on success; fileErr... on error; + + + + + fileOpLAST // ***ADD NEW OPERATIONS BEFORE THIS ENTRY*** + // *** AND ALWAYS AFTER EXISTING ENTRIES *** + // *** FOR BACKWARD COMPATIBILITY *** + } FileOpEnum; + + +/************************************************************ + * File Stream procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Open/create a file stream (name must all be valid -- non-null, non-empty) +// (errP is optional - set to NULL to ignore) +extern FileHand FileOpen(UInt16 cardNo, const Char * nameP, UInt32 type, UInt32 creator, + UInt32 openMode, Err *errP) + SYS_TRAP(sysTrapFileOpen); + +// Close the file stream +extern Err FileClose(FileHand stream) + SYS_TRAP(sysTrapFileClose); + +// Delete a file +extern Err FileDelete(UInt16 cardNo, const Char *nameP) + SYS_TRAP(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 + * + ***********************************************************************/ +#define FileRead(stream, bufP, objSize, numObj, errP) \ + FileReadLow((stream), (bufP), 0/*offset*/, false/*dataStoreBased*/, \ + (objSize), (numObj), (errP)) + + +/*********************************************************************** + * + * 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 + * + ***********************************************************************/ +#define FileDmRead(stream, startOfDmChunkP, destOffset, objSize, numObj, errP) \ + FileReadLow((stream), (startOfDmChunkP), (destOffset), true/*dataStoreBased*/, \ + (objSize), (numObj), (errP)) + + +// 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) +extern Int32 FileReadLow(FileHand stream, void *baseP, Int32 offset, Boolean dataStoreBased, Int32 objSize, + Int32 numObj, Err *errP) + SYS_TRAP(sysTrapFileReadLow); + +// Write data to a file stream +// (errP is optional - set to NULL to ignore) +extern Int32 FileWrite(FileHand stream, const void *dataP, Int32 objSize, + Int32 numObj, Err *errP) + SYS_TRAP(sysTrapFileWrite); + +// Set position within a file stream +extern Err FileSeek(FileHand stream, Int32 offset, FileOriginEnum origin) + SYS_TRAP(sysTrapFileSeek); + +#define FileRewind(__stream__) \ + (FileClearerr((__stream__)), FileSeek((__stream__), 0, fileOriginBeginning)) + +// Get current position and filesize +// (fileSizeP and errP are optional - set to NULL to ignore) +extern Int32 FileTell(FileHand stream, Int32 *fileSizeP, Err *errP) + SYS_TRAP(sysTrapFileTell); + +// Truncate a file +extern Err FileTruncate(FileHand stream, Int32 newSize) + SYS_TRAP(sysTrapFileTruncate); + +// Returns the error code from the last operation on this file stream; +// if resetLastError is non-zero, resets the error status +extern Err FileControl(FileOpEnum op, FileHand stream, void *valueP, Int32 *valueLenP) + SYS_TRAP(sysTrapFileControl); + +#define FileEOF(__stream__) \ + (FileControl(fileOpGetEOFStatus, (__stream__), NULL, NULL) == fileErrEOF) + +#define FileError(__stream__) \ + FileControl(fileOpGetIOErrorStatus, (__stream__), NULL, NULL) + +#define FileClearerr(__stream__) \ + FileControl(fileOpClearError, (__stream__), NULL, NULL) + +#define FileGetLastError(__stream__) \ + FileControl(fileOpGetLastError, (__stream__), NULL, NULL) + + +#define FileFlush(__stream__) \ + FileControl(fileOpFlush, (__stream__), NULL, NULL) + + + +#ifdef __cplusplus +} +#endif + + +#endif // #ifndef __FILESTREAM_H__ diff --git a/sdk-4/include/Core/System/FloatMgr.h b/sdk-4/include/Core/System/FloatMgr.h new file mode 100644 index 0000000..b593719 --- /dev/null +++ b/sdk-4/include/Core/System/FloatMgr.h @@ -0,0 +1,524 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __FLOATMGR_H__ +#define __FLOATMGR_H__ + +#if defined(__MC68K__) +#if __option(IEEEdoubles) == off +//#error "IEEEdoubles ('8-UInt8 Doubles' option in the 68K Processor preference panel) MUST be on!!" +#pragma IEEEdoubles on // force 8-byte doubles for our initialization!! +#endif +#endif + + +#ifndef _DONT_USE_FP_TRAPS_ +#if EMULATION_LEVEL != EMULATION_NONE +#define _DONT_USE_FP_TRAPS_ 1 // always direct link to FP for emulator builds +#endif +#endif + + +#include +#include + +/************************************************************************ + * 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 + ***********************************************************************/ + +#define flpVersion 0x02008000 // first version of NewFloatMgr (PalmOS 2.0) + +/* + * These constants are passed to and received from the _fp_round routine. + */ + +#define flpToNearest 0 +#define flpTowardZero 1 +#define flpUpward 3 +#define flpDownward 2 +#define flpModeMask 0x00000030 +#define 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. + */ + +#define flpInvalid 0x00008000 +#define flpOverflow 0x00004000 +#define flpUnderflow 0x00002000 +#define flpDivByZero 0x00001000 +#define flpInexact 0x00000800 + +/* + * These constants are returned by _d_cmp, _d_cmpe, _f_cmp, and _f_cmpe: + */ + +#define flpEqual 0 +#define flpLess 1 +#define flpGreater 2 +#define flpUnordered 3 + + +/************************************************************************ + * New Floating point manager types (private) + ***********************************************************************/ +typedef struct { + Int32 high; + Int32 low; +} _sfpe_64_bits; // for internal use only + +typedef _sfpe_64_bits sfpe_long_long; // for internal use only +typedef _sfpe_64_bits sfpe_unsigned_long_long; // for internal use only + + +/************************************************************************ + * New Floating point manager types (public) + ***********************************************************************/ +typedef Int32 FlpFloat; +typedef _sfpe_64_bits FlpDouble; +typedef _sfpe_64_bits FlpLongDouble; + +/* +* 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. +*/ + +typedef struct { + UInt32 sign : 1; + Int32 exp : 11; + UInt32 manH : 20; + UInt32 manL; +} FlpDoubleBits; // for accessing specific fields + +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 + *******************************************************************/ +#define flpErrOutOfRange (flpErrorClass | 1) + + +/************************************************************ + * New Floating point manager trap macros + *************************************************************/ + +#if _DONT_USE_FP_TRAPS_ + +#define FLOAT_TRAP(floatSelectorNum) +#define FLOAT_EM_TRAP(floatSelectorNum) + +#else + +#define FLOAT_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapFlpDispatch, sel) + +#define FLOAT_EM_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapFlpEmDispatch, sel) + +#endif + +/************************************************************ + * New Floating point manager selectors + *************************************************************/ + +// The order of these #defines *MUST* match the +// corresponding table in NewFloatDispatch.c +#define sysFloatBase10Info 0 +#define sysFloatFToA 1 +#define sysFloatAToF 2 +#define sysFloatCorrectedAdd 3 +#define sysFloatCorrectedSub 4 +#define sysFloatVersion 5 + +// used by NewFloatDispatch.c +#define flpMaxFloatSelector sysFloatVersion + + +// The order of these #defines *MUST* match the +// corresponding table in NewFloatDispatch.c +#define sysFloatEm_fp_round 0 +#define sysFloatEm_fp_get_fpscr 1 +#define sysFloatEm_fp_set_fpscr 2 + +#define sysFloatEm_f_utof 3 +#define sysFloatEm_f_itof 4 +#define sysFloatEm_f_ulltof 5 +#define sysFloatEm_f_lltof 6 + +#define sysFloatEm_d_utod 7 +#define sysFloatEm_d_itod 8 +#define sysFloatEm_d_ulltod 9 +#define sysFloatEm_d_lltod 10 + +#define sysFloatEm_f_ftod 11 +#define sysFloatEm_d_dtof 12 +#define sysFloatEm_f_ftoq 13 +#define sysFloatEm_f_qtof 14 +#define sysFloatEm_d_dtoq 15 +#define sysFloatEm_d_qtod 16 + +#define sysFloatEm_f_ftou 17 +#define sysFloatEm_f_ftoi 18 +#define sysFloatEm_f_ftoull 19 +#define sysFloatEm_f_ftoll 20 + +#define sysFloatEm_d_dtou 21 +#define sysFloatEm_d_dtoi 22 +#define sysFloatEm_d_dtoull 23 +#define sysFloatEm_d_dtoll 24 + +#define sysFloatEm_f_cmp 25 +#define sysFloatEm_f_cmpe 26 +#define sysFloatEm_f_feq 27 +#define sysFloatEm_f_fne 28 +#define sysFloatEm_f_flt 29 +#define sysFloatEm_f_fle 30 +#define sysFloatEm_f_fgt 31 +#define sysFloatEm_f_fge 32 +#define sysFloatEm_f_fun 33 +#define sysFloatEm_f_for 34 + +#define sysFloatEm_d_cmp 35 +#define sysFloatEm_d_cmpe 36 +#define sysFloatEm_d_feq 37 +#define sysFloatEm_d_fne 38 +#define sysFloatEm_d_flt 39 +#define sysFloatEm_d_fle 40 +#define sysFloatEm_d_fgt 41 +#define sysFloatEm_d_fge 42 +#define sysFloatEm_d_fun 43 +#define sysFloatEm_d_for 44 + +#define sysFloatEm_f_neg 45 +#define sysFloatEm_f_add 46 +#define sysFloatEm_f_mul 47 +#define sysFloatEm_f_sub 48 +#define sysFloatEm_f_div 49 + +#define sysFloatEm_d_neg 50 +#define sysFloatEm_d_add 51 +#define sysFloatEm_d_mul 52 +#define sysFloatEm_d_sub 53 +#define sysFloatEm_d_div 54 + + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************ + * 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. +Err FlpBase10Info(FlpDouble a, UInt32 *mantissaP, Int16 *exponentP, Int16 *signP) + FLOAT_TRAP(sysFloatBase10Info); + +Err FlpFToA(FlpDouble a, Char *s) + FLOAT_TRAP(sysFloatFToA); + +FlpDouble FlpAToF(const Char *s) + FLOAT_TRAP(sysFloatAToF); + +FlpDouble FlpCorrectedAdd(FlpDouble firstOperand, FlpDouble secondOperand, Int16 howAccurate) + FLOAT_TRAP(sysFloatCorrectedAdd); + +FlpDouble FlpCorrectedSub(FlpDouble firstOperand, FlpDouble secondOperand, Int16 howAccurate) + FLOAT_TRAP(sysFloatCorrectedSub); + +#if EMULATION_LEVEL == EMULATION_NONE + +// 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. + +void FlpBufferAToF(FlpDouble *result, const Char *s) + FLOAT_TRAP(sysFloatAToF); + +void FlpBufferCorrectedAdd(FlpDouble *result, + FlpDouble firstOperand, FlpDouble secondOperand, Int16 howAccurate) + FLOAT_TRAP(sysFloatCorrectedAdd); + +void FlpBufferCorrectedSub(FlpDouble *result, + FlpDouble firstOperand, FlpDouble secondOperand, Int16 howAccurate) + FLOAT_TRAP(sysFloatCorrectedSub); + +#endif + +UInt32 FlpVersion(void) + FLOAT_TRAP(sysFloatVersion); + +void FlpSelectorErrPrv (UInt16 flpSelector) + ; // 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 + */ + +Int32 _fp_round(Int32) FLOAT_EM_TRAP(sysFloatEm_fp_round); + +/* + * Constants passed to _fp_set_fpscr and received from _fp_get_fpscr are: + * flpInvalid, flpOverflow, flpUnderflow, flpDivByZero, or flpInexact + */ + +Int32 _fp_get_fpscr(void) FLOAT_EM_TRAP(sysFloatEm_fp_get_fpscr); +void _fp_set_fpscr(Int32) FLOAT_EM_TRAP(sysFloatEm_fp_set_fpscr); + + +/* + * 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 + */ + +FlpFloat _f_utof(UInt32) FLOAT_EM_TRAP(sysFloatEm_f_utof); +FlpFloat _f_itof(Int32) FLOAT_EM_TRAP(sysFloatEm_f_itof); +FlpFloat _f_ulltof(sfpe_unsigned_long_long) FLOAT_EM_TRAP(sysFloatEm_f_ulltof); +FlpFloat _f_lltof(sfpe_long_long) FLOAT_EM_TRAP(sysFloatEm_f_lltof); + +FlpDouble _d_utod(UInt32) FLOAT_EM_TRAP(sysFloatEm_d_utod); +FlpDouble _d_itod(Int32) FLOAT_EM_TRAP(sysFloatEm_d_itod); +FlpDouble _d_ulltod(sfpe_unsigned_long_long) FLOAT_EM_TRAP(sysFloatEm_d_ulltod); +FlpDouble _d_lltod(sfpe_long_long) FLOAT_EM_TRAP(sysFloatEm_d_lltod); + + +FlpDouble _f_ftod(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftod); +FlpFloat _d_dtof(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtof); + +FlpLongDouble _f_ftoq(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoq); +FlpFloat _f_qtof(const FlpLongDouble *) FLOAT_EM_TRAP(sysFloatEm_f_qtof); + +FlpLongDouble _d_dtoq(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoq); +FlpDouble _d_qtod(const FlpLongDouble *) FLOAT_EM_TRAP(sysFloatEm_d_qtod); + + +UInt32 _f_ftou(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftou); +Int32 _f_ftoi(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoi); + +sfpe_unsigned_long_long _f_ftoull(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoull); +sfpe_long_long _f_ftoll(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_ftoll); + +UInt32 _d_dtou(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtou); +Int32 _d_dtoi(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoi); + +sfpe_unsigned_long_long _d_dtoull(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_dtoull); +sfpe_long_long _d_dtoll(FlpDouble) FLOAT_EM_TRAP(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) + */ + +Int32 _f_cmp(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_cmp); +Int32 _f_cmpe(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_cmpe); +Int32 _f_feq(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_feq); +Int32 _f_fne(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fne); +Int32 _f_flt(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_flt); +Int32 _f_fle(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fle); +Int32 _f_fgt(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fgt); +Int32 _f_fge(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fge); +Int32 _f_fun(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_fun); +Int32 _f_for(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_for); + +Int32 _d_cmp(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_cmp); +Int32 _d_cmpe(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_cmpe); +Int32 _d_feq(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_feq); +Int32 _d_fne(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fne); +Int32 _d_flt(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_flt); +Int32 _d_fle(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fle); +Int32 _d_fgt(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fgt); +Int32 _d_fge(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fge); +Int32 _d_fun(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_fun); +Int32 _d_for(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_for); + + +FlpFloat _f_neg(FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_neg); +FlpFloat _f_add(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_add); +FlpFloat _f_mul(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_mul); +FlpFloat _f_sub(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_sub); +FlpFloat _f_div(FlpFloat, FlpFloat) FLOAT_EM_TRAP(sysFloatEm_f_div); + +FlpDouble _d_neg(FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_neg); +FlpDouble _d_add(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_add); +FlpDouble _d_mul(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_mul); +FlpDouble _d_sub(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_sub); +FlpDouble _d_div(FlpDouble, FlpDouble) FLOAT_EM_TRAP(sysFloatEm_d_div); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/sdk-4/include/Core/System/Font.h b/sdk-4/include/Core/System/Font.h new file mode 100644 index 0000000..e4ffe00 --- /dev/null +++ b/sdk-4/include/Core/System/Font.h @@ -0,0 +1,164 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __FONT_H__ +#define __FONT_H__ + +#include +#include + +// Pixel width of tab stops in fields +#define fntTabChrWidth 20 + +// Width of character missing from font. +#define fntMissingChar -1 + +typedef struct FontCharInfoTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FONTS // These fields will not be available in the next OS release! +{ + Int8 offset; + Int8 width; +} +#endif +FontCharInfoType; + +typedef FontCharInfoType *FontCharInfoPtr; + +typedef struct FontTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FONTS // These fields will not be available in the next OS release! +{ + Int16 fontType; // font type + Int16 firstChar; // ASCII code of first character + Int16 lastChar; // ASCII code of last character + Int16 maxWidth; // maximum character width + Int16 kernMax; // negative of maximum character kern + Int16 nDescent; // negative of descent + Int16 fRectWidth; // width of font rectangle + Int16 fRectHeight; // height of font rectangle + Int16 owTLoc; // offset to offset/width table + Int16 ascent; // ascent + Int16 descent; // descent + Int16 leading; // leading + Int16 rowWords; // row width of bit image / 2 +} +#endif +FontType; + +typedef FontType *FontPtr; + +typedef FontPtr *FontTablePtr; + +enum fontID { + stdFont = 0x00, // Small font used for the user's writing. Shows a good amount + boldFont, // Small font. Bold for easier reading. Used often for ui. + largeFont, // Larger font for easier reading. Shows a lot less. + symbolFont, // Various ui images like check boxes and arrows + symbol11Font, // Larger various ui images + symbol7Font, // Smaller various ui images + ledFont, // Calculator specific font + largeBoldFont, // A thicker version of the large font. More readable. + fntAppFontCustomBase = 0x80 // First available application-defined font ID +}; + +typedef enum fontID FontID; + +#define checkboxFont symbol11Font + +#define FntIsAppDefined(fnt) (fnt >= fntAppFontCustomBase) + + + +//-------------------------------------------------------------------- +// +// Font Function +// +//-------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +FontID FntGetFont (void) + SYS_TRAP(sysTrapFntGetFont); + +FontID FntSetFont (FontID font) + SYS_TRAP(sysTrapFntSetFont); + +FontPtr FntGetFontPtr (void) + SYS_TRAP(sysTrapFntGetFontPtr); + +Int16 FntBaseLine (void) + SYS_TRAP(sysTrapFntBaseLine); + +Int16 FntCharHeight (void) + SYS_TRAP(sysTrapFntCharHeight); + +Int16 FntLineHeight (void) + SYS_TRAP(sysTrapFntLineHeight); + +Int16 FntAverageCharWidth (void) + SYS_TRAP(sysTrapFntAverageCharWidth); + +Int16 FntCharWidth (Char ch) + SYS_TRAP(sysTrapFntCharWidth); + +Int16 FntWCharWidth (WChar iChar) + SYS_TRAP(sysTrapFntWCharWidth); + +Int16 FntCharsWidth (Char const *chars, Int16 len) + SYS_TRAP(sysTrapFntCharsWidth); + +Int16 FntWidthToOffset (Char const *pChars, UInt16 length, + Int16 pixelWidth, Boolean *leadingEdge, Int16 *truncWidth) + SYS_TRAP(sysTrapFntWidthToOffset); + +void FntCharsInWidth (Char const *string, + Int16 *stringWidthP, Int16 *stringLengthP, + Boolean *fitWithinWidth) + SYS_TRAP(sysTrapFntCharsInWidth); + +Int16 FntDescenderHeight (void) + SYS_TRAP(sysTrapFntDescenderHeight); + +Int16 FntLineWidth (Char const *pChars, UInt16 length) + SYS_TRAP(sysTrapFntLineWidth); + +UInt16 FntWordWrap (Char const *chars, UInt16 maxWidth) + SYS_TRAP(sysTrapFntWordWrap); + +void FntWordWrapReverseNLines (Char const *const chars, + UInt16 maxWidth, UInt16 *linesToScrollP, UInt16 *scrollPosP) + SYS_TRAP(sysTrapFntWordWrapReverseNLines); + +void FntGetScrollValues (Char const *chars, UInt16 width, + UInt16 scrollPos, UInt16 *linesP, UInt16 *topLine) + SYS_TRAP(sysTrapFntGetScrollValues); + +Err FntDefineFont (FontID font, FontPtr fontP) + SYS_TRAP(sysTrapFntDefineFont); + +#ifdef __cplusplus +} +#endif + + +#endif // __FONT_H__ diff --git a/sdk-4/include/Core/System/Graffiti.h b/sdk-4/include/Core/System/Graffiti.h new file mode 100644 index 0000000..9cc8f1b --- /dev/null +++ b/sdk-4/include/Core/System/Graffiti.h @@ -0,0 +1,225 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __GRAFFITI_H__ +#define __GRAFFITI_H__ + +#include +#include +#include + +/*------------------------------------------------------------------------------ + * Match info structure. Returned by GrfMatch and GrfMatchGlyph + *-----------------------------------------------------------------------------*/ +typedef struct { + UInt8 glyphID; /* glyph ID of this match */ + UInt8 unCertainty; /* unCertainty of this match (0 most certain) */ + } GrfMatchType; + + +#define grfMaxMatches 4 +typedef struct { + UInt16 numMatches; /* number of matches returned in this structure */ + GrfMatchType match[grfMaxMatches]; + } GrfMatchInfoType; +typedef GrfMatchInfoType* GrfMatchInfoPtr; + + +//---------------------------------------------------------------------------- +// 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 +#define grfVirtualSequence 0x01 + +// In dictionary to tell us about temp shift state changes. +#define grfShiftSequence 0x02 + +// In dictionary/macros to hide special features +#define grfSpecialSequence 0x03 + + +// Determine if a string has a sequence +#define HasVirtualSequence(s) (s[0] == grfVirtualSequence) +#define HasSpecialSequence(s) (s[0] == grfSpecialSequence) + + +/*------------------------------------------------------------------------------ + * Temp shift states, returned by GrfGetState + *-----------------------------------------------------------------------------*/ +#define grfTempShiftPunctuation 1 +#define grfTempShiftExtended 2 +#define grfTempShiftUpper 3 +#define grfTempShiftLower 4 + + +/*------------------------------------------------------------------------------ + * Macro (aka Shortcut) related constants/macros + * Use the definitions in ShortcutLib.h instead! + *-----------------------------------------------------------------------------*/ + +// Char indicating a seqeunce of characters to expand. +#define grfExpansionSequence '@' + +// Chars indicating what to expand into +#define expandDateChar 'D' +#define expandTimeChar 'T' +#define expandStampChar 'S' // This follows 'D' or 'T' for the sake + // of the mnemonic name. +#define HasExpansionSequence(s) (s[0] == grfExpansionSequence) + +// max shortcut name length +#define grfNameLength 8 // eight letters possible (don't forget CR) + +// index which is not a shortcut +#define grfNoShortCut 0xffff + + +/************************************************************ + * Graffiti result codes + *************************************************************/ +#define grfErrBadParam (grfErrorClass | 1) +#define grfErrPointBufferFull (grfErrorClass | 2) +#define grfErrNoGlyphTable (grfErrorClass | 3) +#define grfErrNoDictionary (grfErrorClass | 4) +#define grfErrNoMapping (grfErrorClass | 5) +#define grfErrMacroNotFound (grfErrorClass | 6) +#define grfErrDepthTooDeep (grfErrorClass | 7) +#define grfErrMacroPtrTooSmall (grfErrorClass | 8) +#define grfErrNoMacros (grfErrorClass | 9) + +#define grfErrMacroIncomplete (grfErrorClass | 129) // (grfWarningOffset+1) +#define grfErrBranchNotFound (grfErrorClass | 130) // (grfWarningOffset+2) + +#define grfErrGenericHWRErrBase (grfErrorClass | 16) +#define grfErrNoHWRInstalled (grfErrGenericHWRErrBase) + + +/************************************************************ + * Graffiti interface procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef BUILDING_GRAFFITI_EXT +#define GRF_TRAP(x) +#else +#define GRF_TRAP SYS_TRAP +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err GrfInit (void) + GRF_TRAP(sysTrapGrfInit); + +Err GrfFree (void) + GRF_TRAP(sysTrapGrfFree); + +Err GrfProcessStroke(PointType *startPtP, PointType *endPtP, + Boolean upShift) + GRF_TRAP(sysTrapGrfProcessStroke); + +Err GrfFieldChange(Boolean resetState, UInt16 *characterToDelete) + GRF_TRAP(sysTrapGrfFieldChange); + +Err GrfGetState(Boolean *capsLockP, Boolean *numLockP, + UInt16 *tempShiftP, Boolean *autoShiftedP) + GRF_TRAP(sysTrapGrfGetState); + +Err GrfSetState(Boolean capsLock, Boolean numLock, + Boolean upperShift) + GRF_TRAP(sysTrapGrfSetState); + + +//----------------------------------------------------------------- +// Mid Level Calls +//------------------------------------------------------------------ + +Err GrfFlushPoints (void) + GRF_TRAP(sysTrapGrfFlushPoints); + +Err GrfAddPoint (PointType *pt) + GRF_TRAP(sysTrapGrfAddPoint); + +Err GrfInitState(void) + GRF_TRAP(sysTrapGrfInitState); + +Err GrfCleanState(void) + GRF_TRAP(sysTrapGrfCleanState); + +Err GrfMatch (UInt16 *flagsP, void *dataPtrP, UInt16 *dataLenP, + UInt16 *uncertainLenP, GrfMatchInfoPtr matchInfoP) + GRF_TRAP(sysTrapGrfMatch); + +Err GrfGetMacro(Char *nameP, UInt8 *macroDataP, + UInt16 *dataLenP) + SYS_TRAP(sysTrapGrfGetMacro); + +Err GrfGetAndExpandMacro(Char *nameP, UInt8 *macroDataP, + UInt16 *dataLenP) + SYS_TRAP(sysTrapGrfGetAndExpandMacro); + + +//----------------------------------------------------------------- +// Low Level Calls +//------------------------------------------------------------------ +Err GrfFilterPoints (void) + GRF_TRAP(sysTrapGrfFilterPoints); + +Err GrfGetNumPoints(UInt16 *numPtsP) + GRF_TRAP(sysTrapGrfGetNumPoints); + +Err GrfGetPoint(UInt16 index, PointType *pointP) + GRF_TRAP(sysTrapGrfGetPoint); + +Err GrfFindBranch(UInt16 flags) + GRF_TRAP(sysTrapGrfFindBranch); + +Err GrfMatchGlyph (GrfMatchInfoPtr matchInfoP, + Int16 maxUnCertainty, UInt16 maxMatches) + GRF_TRAP(sysTrapGrfMatchGlyph); + +Err GrfGetGlyphMapping (UInt16 glyphID, UInt16 *flagsP, + void *dataPtrP, UInt16 *dataLenP, UInt16 *uncertainLenP) + GRF_TRAP(sysTrapGrfGetGlyphMapping); + +Err GrfGetMacroName(UInt16 index, Char *nameP) + SYS_TRAP(sysTrapGrfGetMacroName); + +Err GrfDeleteMacro(UInt16 index) + SYS_TRAP(sysTrapGrfDeleteMacro); + +Err GrfAddMacro(const Char *nameP, UInt8 *macroDataP, + UInt16 dataLen) + SYS_TRAP(sysTrapGrfAddMacro); + + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SYSEVTMGR_H__ diff --git a/sdk-4/include/Core/System/Helper.h b/sdk-4/include/Core/System/Helper.h new file mode 100644 index 0000000..3834996 --- /dev/null +++ b/sdk-4/include/Core/System/Helper.h @@ -0,0 +1,164 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef HELPER_H +#define HELPER_H + +#include + +//------------------------------------------------------------------------ +// HelperNotifyEventType structure +// This structure is passed as the notifyDetailsP field of SysNotifyParamType with +// a sysNotifyHelperEvent notificatiom. +//------------------------------------------------------------------------ + +#define kHelperNotifyCurrentVersion 1 + +// Action codes for the sysNotifyHelperEvent broadcast (used in HelperNotifyEventType) +typedef UInt16 HelperNotifyActionCodeType; +#define kHelperNotifyActionCodeEnumerate ((HelperNotifyActionCodeType)1) +#define kHelperNotifyActionCodeValidate ((HelperNotifyActionCodeType)2) +#define kHelperNotifyActionCodeExecute ((HelperNotifyActionCodeType)3) + +typedef struct HelperNotifyEventTypeTag +{ + // Version - this definition is version 1 + // Later versions should include all the same fields as version 1 + // of HelperNotifyEventType plus additional fields + UInt16 version; + + // what to do: enumerate, validate, or do it. + HelperNotifyActionCodeType actionCode; + + // data specific to the action code - valid if version = 1 for now + union + { + struct HelperNotifyEnumerateListTypeTag* enumerateP; + struct HelperNotifyValidateTypeTag* validateP; + struct HelperNotifyExecuteTypeTag* executeP; + } data; + +} HelperNotifyEventType; + + +//------------------------------------------------------------------------ +// 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. +// +#define kHelperAppMaxNameSize 48 // max. helper name length, including zero- + // terminator, expressed in # of bytes + +#define kHelperAppMaxActionNameSize 32 // max. helper action name length, including + // zero-terminator, expressed in # of + // bytes + +typedef struct HelperNotifyEnumerateListTypeTag +{ + // Pointer to the next element in the list, or NULL to signal end of list. + struct HelperNotifyEnumerateListTypeTag *nextP; + + // 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). + Char helperAppName[kHelperAppMaxNameSize]; + + // 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. + Char actionName[kHelperAppMaxActionNameSize]; + + // The registered, unique ID of the helper (typically the helper app's + // creator ID). + UInt32 helperAppID; + + // Services class ID supported by the helper; for example: + // helperServiceClassIDEMail (see HelperServiceClass.h) + UInt32 serviceClassID; +} HelperNotifyEnumerateListType; + + +//------------------------------------------------------------------------ +// HelperNotifyValidateType structure +// Data type for the helperNotifyActionCodeValidate event. +//------------------------------------------------------------------------ +// The matching helper(s) must set the "handled" field of SysNotifyParamType +// to true. +typedef struct HelperNotifyValidateTypeTag +{ + // IN: Service Class ID of requested service (required); for example: + // helperServiceClassIDEMail (see HelperServiceClass.h) + UInt32 serviceClassID; + + // IN: The unique ID of the Helper; may be 0 (zero) to indicate any + // available helper of the specified service class; + UInt32 helperAppID; +} HelperNotifyValidateType; + + +//------------------------------------------------------------------------ +// 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. +// +typedef struct HelperNotifyExecuteTypeTag +{ + // IN: Service Class ID of requested service (required); for example: + // helperServiceClassIDEMail (see HelperServiceClass.h) + UInt32 serviceClassID; + + // IN: The unique ID of the Helper; may be 0 (zero) to indicate any + // available helper of the specified service class; + UInt32 helperAppID; + + // 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 (';'). + Char* dataP; + + // IN: Description of data; zero-terminated; will be duplicated by helper + // if necessary (ex. "John Doe"); this field is optional -- may be NULL. + Char* displayedName; + + // 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. + void* detailsP; + + // 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; +} HelperNotifyExecuteType; + +#endif // HELPER_H diff --git a/sdk-4/include/Core/System/HelperServiceClass.h b/sdk-4/include/Core/System/HelperServiceClass.h new file mode 100644 index 0000000..eaafa31 --- /dev/null +++ b/sdk-4/include/Core/System/HelperServiceClass.h @@ -0,0 +1,117 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef HELPERSERVICECLASS_H +#define HELPERSERVICECLASS_H + +#include + + +//------------------------------------------------------------------------ +// 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. +// +#define kHelperServiceClassIDVoiceDial '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. +// +#define kHelperServiceClassIDEMail 'mail' +typedef struct _HelperServiceEMailDetailsType +{ + UInt16 version; // this is version 1 + + Char* cc; // 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") + Char* subject; // IN: subject string or NULL -- will be duplicated + // by helper if necessary (ex. "helper API") + Char* message; // IN: initial message body string or NULL -- will be + // duplicated by helper if necessary (ex. + // "Lets discuss the helper API tomorrow.") + +} 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. +// +#define kHelperServiceClassIDSMS 'sms_' +typedef struct _HelperServiceSMSDetailsType +{ + UInt16 version; // this is version 1 + + Char* message; // IN: initial message body string or NULL -- will be + // duplicated by helper if necessary (ex. + // "Lets discuss the helper API tomorrow.") + +} 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. +// +#define kHelperServiceClassIDFax 'fax_' + + +#endif // HELPERSERVICECLASS_H diff --git a/sdk-4/include/Core/System/HostControl.h b/sdk-4/include/Core/System/HostControl.h new file mode 100644 index 0000000..7e99cdd --- /dev/null +++ b/sdk-4/include/Core/System/HostControl.h @@ -0,0 +1,888 @@ +/* -*- mode: C++; tab-width: 4 -*- */ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * File: HostControl.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This file is part of the Palm OS Emulator. + * + * + *****************************************************************************/ + +#ifndef _HOSTCONTROL_H_ +#define _HOSTCONTROL_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + Set the values for selectors. Note that these values MUST be + two bytes long and have the high byte be non-zero. The reason + for this has to do with the way SysGremlins was originally + declared. It took a GremlinsSelector enumerated value. Originally, + there was only one value, and it was zero. The way the 68K compiler + works, it decides that GremlinsSelectors are only one byte long, + so a call to SysGremlins would push one byte onto the stack. Because + all values on the stack need to be word-aligned, the processor + subtracts 1 from the stack before pushing on the byte. Therefore, + the stack looks like: + + previous contents + garbage byte + selector + return address + + When the two middle bytes are read together as a word, they appear + as: * 256 + . + + With this setup, we have two choices: leave the selector size at + one byte and limit ourselves to 256 functions, or define the selector + to be a two byte value, with the first 256 values (all those with 0x00 + in the upper byte) to be GremlinIsOn. The latter sounds preferable, so + we start the new selectors at 0x0100. +*/ + + + // Host information selectors + +#define hostSelectorGetHostVersion 0x0100 +#define hostSelectorGetHostID 0x0101 +#define hostSelectorGetHostPlatform 0x0102 +#define hostSelectorIsSelectorImplemented 0x0103 +#define hostSelectorGestalt 0x0104 +#define hostSelectorIsCallingTrap 0x0105 + + + // Profiler selectors + +#define hostSelectorProfileInit 0x0200 +#define hostSelectorProfileStart 0x0201 +#define hostSelectorProfileStop 0x0202 +#define hostSelectorProfileDump 0x0203 +#define hostSelectorProfileCleanup 0x0204 +#define hostSelectorProfileDetailFn 0x0205 + + + // Std C Library wrapper selectors + +#define hostSelectorErrNo 0x0300 + +#define hostSelectorFClose 0x0301 +#define hostSelectorFEOF 0x0302 +#define hostSelectorFError 0x0303 +#define hostSelectorFFlush 0x0304 +#define hostSelectorFGetC 0x0305 +#define hostSelectorFGetPos 0x0306 +#define hostSelectorFGetS 0x0307 +#define hostSelectorFOpen 0x0308 +#define hostSelectorFPrintF 0x0309 /* Floating point not yet supported in Poser */ +#define hostSelectorFPutC 0x030A +#define hostSelectorFPutS 0x030B +#define hostSelectorFRead 0x030C +#define hostSelectorRemove 0x030D +#define hostSelectorRename 0x030E +#define hostSelectorFReopen 0x030F /* Not yet implemented in Poser */ +#define hostSelectorFScanF 0x0310 /* Not yet implemented */ +#define hostSelectorFSeek 0x0311 +#define hostSelectorFSetPos 0x0312 +#define hostSelectorFTell 0x0313 +#define hostSelectorFWrite 0x0314 +#define hostSelectorTmpFile 0x0315 +#define hostSelectorTmpNam 0x0316 + +#define hostSelectorGetEnv 0x0317 + +#define hostSelectorMalloc 0x0318 +#define hostSelectorRealloc 0x0319 +#define hostSelectorFree 0x031A + + // time.h wrappers +#define hostSelectorAscTime 0x0370 +#define hostSelectorClock 0x0371 +#define hostSelectorCTime 0x0372 +// #define hostSelectorDiffTime 0x0373 +#define hostSelectorGMTime 0x0374 +#define hostSelectorLocalTime 0x0375 +#define hostSelectorMkTime 0x0376 +#define hostSelectorStrFTime 0x0377 +#define hostSelectorTime 0x0378 + + // dirent.h wrappers +#define hostSelectorOpenDir 0x0380 +#define hostSelectorReadDir 0x0381 +// #define hostSelectorRewindDir 0x0382 +#define hostSelectorCloseDir 0x0383 +// #define hostSelectorTellDir 0x0384 +// #define hostSelectorSeekDir 0x0385 +// #define hostSelectorScanDir 0x0386 + + // fcntl.h wrappers +// #define hostSelectorOpen 0x0386 +// #define hostSelectorCreat 0x0388 +// #define hostSelectorFcntl 0x0389 + + // unistd.h wrappers +// #define hostSelectorAccess 0x038A +// #define hostSelectorChDir 0x038B +// #define hostSelectorClose 0x038C +// #define hostSelectorDup 0x038D +// #define hostSelectorDup2 0x038E +// #define hostSelectorGetCwd 0x038F +// #define hostSelectorIsATTY 0x0390 +// #define hostSelectorLink 0x0391 +// #define hostSelectorLSeek 0x0392 +// #define hostSelectorRead 0x0393 +#define hostSelectorRmDir 0x0394 +// #define hostSelectorTTYName 0x0395 +// #define hostSelectorUnlink 0x0396 +// #define hostSelectorWrite 0x0397 + +// #define hostSelectorFChDir 0x0398 +// #define hostSelectorFChMod 0x0399 +// #define hostSelectorFileNo 0X039A +// #define hostSelectorFSync 0x039B +// #define hostSelectorFTruncate 0x039C +// #define hostSelectorGetHostName 0x039D +// #define hostSelectorGetWD 0x039E +// #define hostSelectorMkSTemp 0x039F +// #define hostSelectorMkTemp 0x03A0 +// #define hostSelectorRe_Comp 0x03A1 +// #define hostSelectorRe_Exec 0x03A2 +// #define hostSelectorReadLink 0x03A3 +// #define hostSelectorSetHostName 0x03A4 +// #define hostSelectorSymLink 0x03A5 +// #define hostSelectorSync 0x03A6 +#define hostSelectorTruncate 0x03A7 + + // sys/stat.h wrappers +// #define hostSelectorChMod 0x03A8 +// #define hostSelectorFStat 0x03A9 +#define hostSelectorMkDir 0x03AA +#define hostSelectorStat 0x03AB +// #define hostSelectorLStat 0x03AC + + // sys/time.h wrappers +// #define hostSelectorGetTimeOfDay 0x03AD +#define hostSelectorUTime 0x03AE + + // DOS attr +#define hostSelectorGetFileAttr 0x03AF +#define hostSelectorSetFileAttr 0x03B0 + + // Gremlin selectors + +#define hostSelectorGremlinIsRunning 0x0400 +#define hostSelectorGremlinNumber 0x0401 +#define hostSelectorGremlinCounter 0x0402 +#define hostSelectorGremlinLimit 0x0403 +#define hostSelectorGremlinNew 0x0404 + + + // Database selectors + +#define hostSelectorImportFile 0x0500 +#define hostSelectorExportFile 0x0501 + +#define hostSelectorExgLibOpen 0x0580 +#define hostSelectorExgLibClose 0x0581 +#define hostSelectorExgLibSleep 0x0582 +#define hostSelectorExgLibWake 0x0583 +#define hostSelectorExgLibHandleEvent 0x0584 +#define hostSelectorExgLibConnect 0x0585 +#define hostSelectorExgLibAccept 0x0586 +#define hostSelectorExgLibDisconnect 0x0587 +#define hostSelectorExgLibPut 0x0588 +#define hostSelectorExgLibGet 0x0589 +#define hostSelectorExgLibSend 0x058A +#define hostSelectorExgLibReceive 0x058B +#define hostSelectorExgLibControl 0x058C +#define hostSelectorExgLibRequest 0x058D + + + // Preferences selectors + +#define hostSelectorGetPreference 0x0600 +#define hostSelectorSetPreference 0x0601 + + + // Logging selectors + +#define hostSelectorLogFile 0x0700 +#define hostSelectorSetLogFileSize 0x0701 + + + // RPC selectors + +#define hostSelectorSessionCreate 0x0800 /* Not yet implemented in Poser */ +#define hostSelectorSessionOpen 0x0801 /* Not yet implemented in Poser */ +#define hostSelectorSessionClose 0x0802 +#define hostSelectorSessionQuit 0x0803 +#define hostSelectorSignalSend 0x0804 +#define hostSelectorSignalWait 0x0805 +#define hostSelectorSignalResume 0x0806 + + + // External tracing tool support + +#define hostSelectorTraceInit 0x0900 +#define hostSelectorTraceClose 0x0901 +#define hostSelectorTraceOutputT 0x0902 +#define hostSelectorTraceOutputTL 0x0903 +#define hostSelectorTraceOutputVT 0x0904 +#define hostSelectorTraceOutputVTL 0x0905 +#define hostSelectorTraceOutputB 0x0906 + + + + // File choosing support + +#define hostSelectorGetFile 0x0B00 +#define hostSelectorPutFile 0x0B01 +#define hostSelectorGetDirectory 0x0B02 + +#define hostSelectorLastTrapNumber 0x0BFF + + + // * Types + +typedef UInt16 HostControlSelectorType; +typedef long HostBoolType; +typedef long HostClockType; +typedef long HostErrType; +typedef long HostIDType; +typedef long HostPlatformType; +typedef long HostSignalType; +typedef long HostSizeType; +typedef long HostTimeType; + + + // * HostDIRType + +struct HostDIRType +{ + long _field; +}; + +typedef struct HostDIRType HostDIRType; + + + // * HostDirEntType + +#define HOST_NAME_MAX 255 + +struct HostDirEntType +{ + char d_name[HOST_NAME_MAX + 1]; +}; + +typedef struct HostDirEntType HostDirEntType; + + + // * HostFILEType + +struct HostFILEType +{ + long _field; +}; + +typedef struct HostFILEType HostFILEType; + + + // * HostGremlinInfoType + +struct HostGremlinInfoType +{ + long fFirstGremlin; + long fLastGremlin; + long fSaveFrequency; + long fSwitchDepth; + long fMaxDepth; + char fAppNames[200]; // Comma-seperated list of application names + // to run Gremlins on. If the string is empty, + // all applications are fair game. If the string + // begins with a '-' (e.g., "-Address,Datebook"), + // then all applications named in the list are + // excluded instead of included. +}; + +typedef struct HostGremlinInfoType HostGremlinInfoType; + + + // * HostStatType + // Note that the field names here have an underscore appended to + // them in order to differentiate them from "compatibility macros" + // under Solaris. + +struct HostStatType +{ + unsigned long st_dev_; + unsigned long st_ino_; + unsigned long st_mode_; + unsigned long st_nlink_; + unsigned long st_uid_; + unsigned long st_gid_; + unsigned long st_rdev_; + HostTimeType st_atime_; + HostTimeType st_mtime_; + HostTimeType st_ctime_; + unsigned long st_size_; + unsigned long st_blksize_; + unsigned long st_blocks_; + unsigned long st_flags_; +}; + +typedef struct HostStatType HostStatType; + + + // * HostTmType + // Note that the field names here have an underscore appended to + // them for consistancy with HostStatType. + +struct HostTmType +{ + long tm_sec_; /* seconds after the minute - [0,59] */ + long tm_min_; /* minutes after the hour - [0,59] */ + long tm_hour_; /* hours since midnight - [0,23] */ + long tm_mday_; /* day of the month - [1,31] */ + long tm_mon_; /* months since January - [0,11] */ + long tm_year_; /* years since 1900 */ + long tm_wday_; /* days since Sunday - [0,6] */ + long tm_yday_; /* days since January 1 - [0,365] */ + long tm_isdst_; /* daylight savings time flag */ +}; + +typedef struct HostTmType HostTmType; + + + // * HostUTimeType + // Note that the field names here have an underscore appended to + // them for consistancy with HostStatType. + +struct HostUTimeType +{ + HostTimeType crtime_; /* creation time */ + HostTimeType actime_; /* access time */ + HostTimeType modtime_; /* modification time */ +}; + +typedef struct HostUTimeType HostUTimeType; + + + // * Backward compatiblity + +typedef HostControlSelectorType HostControlTrapNumber; +typedef HostBoolType HostBool; +typedef HostErrType HostErr; +typedef HostIDType HostID; +typedef HostPlatformType HostPlatform; +typedef HostSignalType HostSignal; +typedef HostFILEType HostFILE; + + + +#ifndef hostErrorClass + #define hostErrorClass 0x1C00 // Host Control Manager +#else + #if hostErrorClass != 0x1C00 + #error "You cannot change hostErrorClass without telling us." + #endif +#endif + +enum // HostErrType values +{ + hostErrNone = 0, + + hostErrBase = hostErrorClass, + + hostErrUnknownGestaltSelector, + hostErrDiskError, + hostErrOutOfMemory, + hostErrMemReadOutOfRange, + hostErrMemWriteOutOfRange, + hostErrMemInvalidPtr, + hostErrInvalidParameter, + hostErrTimeout, + hostErrInvalidDeviceType, + hostErrInvalidRAMSize, + hostErrFileNotFound, + hostErrRPCCall, // Issued if the following functions are not called remotely: + // HostSessionCreate + // HostSessionOpen + // HostSessionClose + // HostSessionQuit + // HostSignalWait + // HostSignalResume + hostErrSessionRunning, // Issued by HostSessionCreate, HostSessionOpen, and + // HostSessionQuit if a session is running. + hostErrSessionNotRunning, // Issued by HostSessionClose if no session is running. + hostErrNoSignalWaiters, // Issued by HostSendSignal if no one's waiting for a signal. + hostErrSessionNotPaused, // Issued when HostSignalResume, but the session was not + // halted from a HostSignalSend call. + + hostErrPermissions, + hostErrFileNameTooLong, + hostErrNotADirectory, + hostErrTooManyFiles, + hostErrFileTooBig, + hostErrReadOnlyFS, + hostErrIsDirectory, + hostErrExists, + hostErrOpNotAvailable, + hostErrDirNotEmpty, + hostErrDiskFull, + hostErrUnknownError +}; + + +enum // HostIDType values +{ + hostIDPalmOS, // The plastic thingy + hostIDPalmOSEmulator, // The Copilot thingy + hostIDPalmOSSimulator // The Mac libraries you link with thingy +}; + + +enum // HostPlatformType values +{ + hostPlatformPalmOS, + hostPlatformWindows, + hostPlatformMacintosh, + hostPlatformUnix +}; + +enum // HostSignalType values +{ + hostSignalReserved, + hostSignalIdle, + hostSignalQuit, +#if 0 + // (Proposed...not supported yet) + hostSignalSessionStarted, + hostSignalSessionStopped, + hostSignalHordeStarted, + hostSignalGremlinStarted, + hostSignalGremlinSuspended, + hostSignalGremlinResumed, + hostSignalGremlinStopped, + hostSignalHordeStopped, +#endif + hostSignalUser = 0x40000000 // User-defined values start here and go up. +}; + +enum // HostGet/SetFileAttr flags, matching EmFileAttr flags +{ + hostFileAttrReadOnly = 1, + hostFileAttrHidden = 2, + hostFileAttrSystem = 4 +}; + +// Use these to call FtrGet to see if you're running under the +// Palm OS Emulator. If not, FtrGet will return ftrErrNoSuchFeature. + +#define kPalmOSEmulatorFeatureCreator ('pose') +#define kPalmOSEmulatorFeatureNumber (0) + + +// Define this, since SysTraps.h doesn't have it. + +#ifdef __SYSTRAPS_H_ +#define sysTrapHostControl sysTrapSysGremlins +#endif + + +// Define HOST_TRAP + +#if defined (_SYSTEM_API) + +#define HOST_TRAP(selector) \ + _SYSTEM_API(_CALL_WITH_16BIT_SELECTOR)(_SYSTEM_TABLE, sysTrapHostControl, selector) + +#else + +#define HOST_TRAP(selector) \ + FIVEWORD_INLINE( \ + 0x3F3C, selector, /* MOVE.W #selector, -(A7) */ \ + m68kTrapInstr + sysDispatchTrapNum, /* TRAP $F */ \ + sysTrapHostControl, /* sysTrapHostControl */ \ + 0x544F) /* ADD.Q #2, A7 */ +#endif + + +/* ==================================================================== */ +/* Host environment-related calls */ +/* ==================================================================== */ + +long HostGetHostVersion(void) + HOST_TRAP(hostSelectorGetHostVersion); + +HostIDType HostGetHostID(void) + HOST_TRAP(hostSelectorGetHostID); + +HostPlatformType HostGetHostPlatform(void) + HOST_TRAP(hostSelectorGetHostPlatform); + +HostBoolType HostIsSelectorImplemented(long selector) + HOST_TRAP(hostSelectorIsSelectorImplemented); + +HostErrType HostGestalt(long gestSel, long* response) + HOST_TRAP(hostSelectorGestalt); + +HostBoolType HostIsCallingTrap(void) + HOST_TRAP(hostSelectorIsCallingTrap); + + +/* ==================================================================== */ +/* Profiling-related calls */ +/* ==================================================================== */ + +HostErrType HostProfileInit(long maxCalls, long maxDepth) + HOST_TRAP(hostSelectorProfileInit); + +HostErrType HostProfileDetailFn(void* addr, HostBoolType logDetails) + HOST_TRAP(hostSelectorProfileDetailFn); + +HostErrType HostProfileStart(void) + HOST_TRAP(hostSelectorProfileStart); + +HostErrType HostProfileStop(void) + HOST_TRAP(hostSelectorProfileStop); + +HostErrType HostProfileDump(const char* filename) + HOST_TRAP(hostSelectorProfileDump); + +HostErrType HostProfileCleanup(void) + HOST_TRAP(hostSelectorProfileCleanup); + + +/* ==================================================================== */ +/* Std C Library-related calls */ +/* ==================================================================== */ + +long HostErrNo(void) + HOST_TRAP(hostSelectorErrNo); + + +long HostFClose(HostFILEType* f) + HOST_TRAP(hostSelectorFClose); + +long HostFEOF(HostFILEType* f) + HOST_TRAP(hostSelectorFEOF); + +long HostFError(HostFILEType* f) + HOST_TRAP(hostSelectorFError); + +long HostFFlush(HostFILEType* f) + HOST_TRAP(hostSelectorFFlush); + +long HostFGetC(HostFILEType* f) + HOST_TRAP(hostSelectorFGetC); + +long HostFGetPos(HostFILEType* f, long* posP) + HOST_TRAP(hostSelectorFGetPos); + +char* HostFGetS(char* s, long n, HostFILEType* f) + HOST_TRAP(hostSelectorFGetS); + +HostFILEType* HostFOpen(const char* name, const char* mode) + HOST_TRAP(hostSelectorFOpen); + +long HostFPrintF(HostFILEType* f, const char* fmt, ...) + HOST_TRAP(hostSelectorFPrintF); + +long HostFPutC(long c, HostFILEType* f) + HOST_TRAP(hostSelectorFPutC); + +long HostFPutS(const char* s, HostFILEType* f) + HOST_TRAP(hostSelectorFPutS); + +long HostFRead(void* buffer, long size, long count, HostFILEType* f) + HOST_TRAP(hostSelectorFRead); + +long HostRemove(const char* name) + HOST_TRAP(hostSelectorRemove); + +long HostRename(const char* oldName, const char* newName) + HOST_TRAP(hostSelectorRename); + +HostFILEType* HostFReopen(const char* name, const char* mode, HostFILEType* f) + HOST_TRAP(hostSelectorFReopen); + +long HostFScanF(HostFILEType* f, const char* fmt, ...) + HOST_TRAP(hostSelectorFScanF); + +long HostFSeek(HostFILEType* f, long offset, long origin) + HOST_TRAP(hostSelectorFSeek); + +long HostFSetPos(HostFILEType* f, long* pos) + HOST_TRAP(hostSelectorFSetPos); + +long HostFTell(HostFILEType* f) + HOST_TRAP(hostSelectorFTell); + +long HostFWrite(const void* buffer, long size, long count, HostFILEType* f) + HOST_TRAP(hostSelectorFWrite); + +HostFILEType* HostTmpFile(void) + HOST_TRAP(hostSelectorTmpFile); + +char* HostTmpNam(char* name) + HOST_TRAP(hostSelectorTmpNam); + +char* HostGetEnv(const char*) + HOST_TRAP(hostSelectorGetEnv); + + +void* HostMalloc(long size) + HOST_TRAP(hostSelectorMalloc); + +void* HostRealloc(void* p, long size) + HOST_TRAP(hostSelectorRealloc); + +void HostFree(void* p) + HOST_TRAP(hostSelectorFree); + + +char* HostAscTime(const HostTmType*) + HOST_TRAP(hostSelectorAscTime); + +char* HostCTime(const HostTimeType*) + HOST_TRAP(hostSelectorCTime); + +HostClockType HostClock(void) + HOST_TRAP(hostSelectorClock); + +//double HostDiffTime(HostTimeType, HostTimeType) +// HOST_TRAP(hostSelectorDiffTime); + +HostTmType* HostGMTime(const HostTimeType*) + HOST_TRAP(hostSelectorGMTime); + +HostTmType* HostLocalTime(const HostTimeType*) + HOST_TRAP(hostSelectorLocalTime); + +HostTimeType HostMkTime(HostTmType*) + HOST_TRAP(hostSelectorMkTime); + +HostSizeType HostStrFTime(char*, HostSizeType, const char*, const HostTmType*) + HOST_TRAP(hostSelectorStrFTime); + +HostTimeType HostTime(HostTimeType*) + HOST_TRAP(hostSelectorTime); + + +long HostMkDir(const char*) + HOST_TRAP(hostSelectorMkDir); + +long HostRmDir(const char*) + HOST_TRAP(hostSelectorRmDir); + +HostDIRType* HostOpenDir(const char*) + HOST_TRAP(hostSelectorOpenDir); + +HostDirEntType* HostReadDir(HostDIRType*) + HOST_TRAP(hostSelectorReadDir); + +long HostCloseDir(HostDIRType*) + HOST_TRAP(hostSelectorCloseDir); + + +long HostStat(const char*, HostStatType*) + HOST_TRAP(hostSelectorStat); + +long HostTruncate(const char*, long) + HOST_TRAP(hostSelectorTruncate); + + +long HostUTime (const char*, HostUTimeType*) + HOST_TRAP(hostSelectorUTime); + +long HostGetFileAttr(const char*, long*) + HOST_TRAP(hostSelectorGetFileAttr); + +long HostSetFileAttr(const char*, long) + HOST_TRAP(hostSelectorSetFileAttr); + + +/* ==================================================================== */ +/* Gremlin-related calls */ +/* ==================================================================== */ + +HostBoolType HostGremlinIsRunning(void) + HOST_TRAP(hostSelectorGremlinIsRunning); + +long HostGremlinNumber(void) + HOST_TRAP(hostSelectorGremlinNumber); + +long HostGremlinCounter(void) + HOST_TRAP(hostSelectorGremlinCounter); + +long HostGremlinLimit(void) + HOST_TRAP(hostSelectorGremlinLimit); + +HostErrType HostGremlinNew(const HostGremlinInfoType*) + HOST_TRAP(hostSelectorGremlinNew); + + +/* ==================================================================== */ +/* Import/export-related calls */ +/* ==================================================================== */ + +HostErrType HostImportFile(const char* fileName, long cardNum) + HOST_TRAP(hostSelectorImportFile); + +HostErrType HostExportFile(const char* fileName, long cardNum, const char* dbName) + HOST_TRAP(hostSelectorExportFile); + + // These are private, internal functions. Third party applications + // should not be calling them. + +Err HostExgLibOpen (UInt16 libRefNum) + HOST_TRAP(hostSelectorExgLibOpen); + +Err HostExgLibClose (UInt16 libRefNum) + HOST_TRAP(hostSelectorExgLibClose); + +Err HostExgLibSleep (UInt16 libRefNum) + HOST_TRAP(hostSelectorExgLibSleep); + +Err HostExgLibWake (UInt16 libRefNum) + HOST_TRAP(hostSelectorExgLibWake); + +Boolean HostExgLibHandleEvent (UInt16 libRefNum, void* eventP) + HOST_TRAP(hostSelectorExgLibHandleEvent); + +Err HostExgLibConnect (UInt16 libRefNum, void* exgSocketP) + HOST_TRAP(hostSelectorExgLibConnect); + +Err HostExgLibAccept (UInt16 libRefNum, void* exgSocketP) + HOST_TRAP(hostSelectorExgLibAccept); + +Err HostExgLibDisconnect (UInt16 libRefNum, void* exgSocketP,Err error) + HOST_TRAP(hostSelectorExgLibDisconnect); + +Err HostExgLibPut (UInt16 libRefNum, void* exgSocketP) + HOST_TRAP(hostSelectorExgLibPut); + +Err HostExgLibGet (UInt16 libRefNum, void* exgSocketP) + HOST_TRAP(hostSelectorExgLibGet); + +UInt32 HostExgLibSend (UInt16 libRefNum, void* exgSocketP, const void* const bufP, const UInt32 bufLen, Err* errP) + HOST_TRAP(hostSelectorExgLibSend); + +UInt32 HostExgLibReceive (UInt16 libRefNum, void* exgSocketP, void* bufP, const UInt32 bufSize, Err* errP) + HOST_TRAP(hostSelectorExgLibReceive); + +Err HostExgLibControl (UInt16 libRefNum, UInt16 op, void* valueP, UInt16* valueLenP) + HOST_TRAP(hostSelectorExgLibControl); + +Err HostExgLibRequest (UInt16 libRefNum, void* exgSocketP) + HOST_TRAP(hostSelectorExgLibRequest); + + +/* ==================================================================== */ +/* Preference-related calls */ +/* ==================================================================== */ + +HostBoolType HostGetPreference(const char*, char*) + HOST_TRAP(hostSelectorGetPreference); + +void HostSetPreference(const char*, const char*) + HOST_TRAP(hostSelectorSetPreference); + + +/* ==================================================================== */ +/* Logging-related calls */ +/* ==================================================================== */ + +HostFILEType* HostLogFile(void) + HOST_TRAP(hostSelectorLogFile); + +void HostSetLogFileSize(long) + HOST_TRAP(hostSelectorSetLogFileSize); + + +/* ==================================================================== */ +/* RPC-related calls */ +/* ==================================================================== */ + +HostErrType HostSessionCreate(const char* device, long ramSize, const char* romPath) + HOST_TRAP(hostSelectorSessionCreate); + +HostErrType HostSessionOpen(const char* psfFileName) + HOST_TRAP(hostSelectorSessionOpen); + +HostErrType HostSessionClose(const char* saveFileName) + HOST_TRAP(hostSelectorSessionClose); + +HostErrType HostSessionQuit(void) + HOST_TRAP(hostSelectorSessionQuit); + +HostErrType HostSignalSend(HostSignalType signalNumber) + HOST_TRAP(hostSelectorSignalSend); + +HostErrType HostSignalWait(long timeout, HostSignalType* signalNumber) + HOST_TRAP(hostSelectorSignalWait); + +HostErrType HostSignalResume(void) + HOST_TRAP(hostSelectorSignalResume); + + +/* ==================================================================== */ +/* Tracing calls */ +/* ==================================================================== */ + +void HostTraceInit(void) + HOST_TRAP(hostSelectorTraceInit); + +void HostTraceClose(void) + HOST_TRAP(hostSelectorTraceClose); + +void HostTraceOutputT(unsigned short, const char*, ...) + HOST_TRAP(hostSelectorTraceOutputT); + +void HostTraceOutputTL(unsigned short, const char*, ...) + HOST_TRAP(hostSelectorTraceOutputTL); + +void HostTraceOutputVT(unsigned short, const char*, char* /*va_list*/) + HOST_TRAP(hostSelectorTraceOutputVT); + +void HostTraceOutputVTL(unsigned short, const char*, char* /*va_list*/) + HOST_TRAP(hostSelectorTraceOutputVTL); + +void HostTraceOutputB(unsigned short, const unsigned char*, unsigned long/*size_t*/) + HOST_TRAP(hostSelectorTraceOutputB); + + +/* ==================================================================== */ +/* File Choosing support */ +/* ==================================================================== */ + +const char* HostGetFile(const char* prompt, const char* defaultDir) + HOST_TRAP(hostSelectorGetFile); + +const char* HostPutFile(const char* prompt, const char* defaultDir, const char* defaultName) + HOST_TRAP(hostSelectorPutFile); + +const char* HostGetDirectory(const char* prompt, const char* defaultDir) + HOST_TRAP(hostSelectorGetDirectory); + +#ifdef __cplusplus +} +#endif + +#endif /* _HOSTCONTROL_H_ */ diff --git a/sdk-4/include/Core/System/IMCUtils.h b/sdk-4/include/Core/System/IMCUtils.h new file mode 100644 index 0000000..d73a5fa --- /dev/null +++ b/sdk-4/include/Core/System/IMCUtils.h @@ -0,0 +1,87 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __IMCUTILS_H__ +#define __IMCUTILS_H__ + +#include +#include + +#ifndef EOF +#define EOF 0xffff +#endif + + +// Constants for some common IMC spec values. +#define parameterDelimeterChr ';' +#define valueDelimeterChr ':' +#define groupDelimeterChr '.' +#define paramaterNameDelimiterChr '=' +#define endOfLineChr 0x0D +#define imcLineSeparatorString "\015\012" +#define imcFilenameLength 32 +#define imcUnlimitedChars 0xFFFE // 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 +typedef UInt16 GetCharF (const void *); +typedef void PutStringF(void *, const Char * const stringP); + +#ifdef __cplusplus +extern "C" { +#endif + +// maxChars does NOT include trailing null, buffer may be 1 larger. +// use imcUnlimitedChars if you don't want a max. +extern Char * ImcReadFieldNoSemicolon(void *inputStream, + GetCharF inputFunc, UInt16 *c, const UInt16 maxChars) + SYS_TRAP(sysTrapImcReadFieldNoSemicolon); + +// maxChars does NOT include trailing null, buffer may be 1 larger. +// use imcUnlimitedChars if you don't want a max. +extern Char * ImcReadFieldQuotablePrintable(void *inputStream, GetCharF inputFunc, UInt16 *c, + const Char stopAt, const Boolean quotedPrintable, const UInt16 maxChars) + SYS_TRAP(sysTrapImcReadFieldQuotablePrintable); + +extern void ImcReadPropertyParameter(void *inputStream, GetCharF inputFunc, + UInt16 *cP, Char *nameP, Char *valueP) + SYS_TRAP(sysTrapImcReadPropertyParameter); + +extern void ImcSkipAllPropertyParameters(void *inputStream, GetCharF inputFunc, + UInt16 *cP, Char *identifierP, Boolean *quotedPrintableP) + SYS_TRAP(sysTrapImcSkipAllPropertyParameters); + +extern void ImcReadWhiteSpace(void *inputStream, GetCharF inputFunc, + const UInt16 *const charAttrP, UInt16 *c) + SYS_TRAP(sysTrapImcReadWhiteSpace); + +extern void ImcWriteQuotedPrintable(void *outputStream, PutStringF outputFunc, + const Char *stringP, const Boolean noSemicolons) + SYS_TRAP(sysTrapImcWriteQuotedPrintable); + +extern void ImcWriteNoSemicolon(void *outputStream, PutStringF outputFunc, + const Char * const stringP) + SYS_TRAP(sysTrapImcWriteNoSemicolon); + +extern Boolean ImcStringIsAscii(const Char * const stringP) + SYS_TRAP(sysTrapImcStringIsAscii); + +#ifdef __cplusplus +} +#endif + +#endif // _IMC_UTILS_H diff --git a/sdk-4/include/Core/System/IntlMgr.h b/sdk-4/include/Core/System/IntlMgr.h new file mode 100644 index 0000000..ace0212 --- /dev/null +++ b/sdk-4/include/Core/System/IntlMgr.h @@ -0,0 +1,138 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __INTLMGR_H__ +#define __INTLMGR_H__ + +#include +#include + +// If nobody has explicitly specified that we should or should not +// use our international trap dispatcher, set it based on the emulation +// level. + +#ifndef USE_INTL_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_INTL_TRAPS 1 + #else + #define USE_INTL_TRAPS 0 + #endif +#endif + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Bits set for the Intl Mgr feature. +#define intlMgrExists 0x00000001 // IntlMgr/TextMgr calls can be made. +#define intlMgrStrict 0x00000002 // Trigger extra errors on debug ROM. + +// Intl manager error codes. +#define intlErrInvalidSelector (intlErrorClass | 1) + +// International Manager trap macros. +#if USE_INTL_TRAPS + #define INTL_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapIntlDispatch, sel) +#else + #define INTL_TRAP(intlSelectorNum) +#endif + +// Selectors for routines found in the international manager. The order +// of these selectors MUST match the jump table in IntlDispatch.c. +#define intlIntlInit 0 +#define intlTxtByteAttr 1 +#define intlTxtCharAttr 2 +#define intlTxtCharXAttr 3 +#define intlTxtCharSize 4 +#define intlTxtGetPreviousChar 5 +#define intlTxtGetNextChar 6 +#define intlTxtGetChar 7 +#define intlTxtSetNextChar 8 +#define intlTxtCharBounds 9 +#define intlTxtPrepFindString 10 +#define intlTxtFindString 11 +#define intlTxtReplaceStr 12 +#define intlTxtWordBounds 13 +#define intlTxtCharEncoding 14 +#define intlTxtStrEncoding 15 +#define intlTxtEncodingName 16 +#define intlTxtMaxEncoding 17 +#define intlTxtTransliterate 18 +#define intlTxtCharIsValid 19 +#define intlTxtCompare 20 +#define intlTxtCaselessCompare 21 +#define intlTxtCharWidth 22 +#define intlTxtGetTruncationOffset 23 +#define intlIntlGetRoutineAddress 24 + +// New for Palm OS 3.5 +#define intlIntlHandleEvent 25 +#define intlTxtParamString 26 + +// Patched for Palm OS 3.5.2 +#define intlTxtConvertEncodingV35 27 + +// New for Palm OS 4.0 +#define intlTxtConvertEncoding 28 +#define intlIntlSetRoutineAddress 29 +#define intlTxtGetWordWrapOffset 30 +#define intlTxtNameToEncoding 31 +#define intlIntlStrictChecks 32 + +#define intlMaxSelector intlIntlStrictChecks + +typedef UInt16 IntlSelector; + + +/*********************************************************************** + * Public routines + ***********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +// Return back the address of the routine indicated by . If +// isn't a valid routine selector, return back NULL. +void *IntlGetRoutineAddress(IntlSelector inSelector) + INTL_TRAP(intlIntlGetRoutineAddress); + +// Set the address of the international mgr routine indicated by +// to be . If isn't valid, return an error. +Err IntlSetRoutineAddress(IntlSelector iSelector, void* iProcPtr) + INTL_TRAP(intlIntlSetRoutineAddress); + +#ifdef __cplusplus + } +#endif + +#endif // __INTLMGR_H__ diff --git a/sdk-4/include/Core/System/IrLib.h b/sdk-4/include/Core/System/IrLib.h new file mode 100644 index 0000000..ba691f2 --- /dev/null +++ b/sdk-4/include/Core/System/IrLib.h @@ -0,0 +1,1519 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __IRLIB_H__ +#define __IRLIB_H__ + +#include +#include + +// 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. + +#include + +// name of Ir library +#define irLibName "IrDA Library" + +// Specific scheme for IR exg lib +#define 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 +#define irFtrCreator sysFileCIrLib +#define 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 +#define irOpenOptBackground 0x80000000 // Unsupported background task use +#define irOpenOptDisconnect3 0x10000000 // sets amount of time in seconds +#define irOpenOptDisconnect8 0x20000000 // after no activity from other +#define irOpenOptDisconnect12 0x30000000 // device before disconnect is +#define irOpenOptDisconnect16 0x40000000 // initiated. +#define irOpenOptDisconnect20 0x50000000 // default is 40 secs +#define irOpenOptDisconnect25 0x60000000 +#define irOpenOptDisconnect30 0x70000000 +#define irOpenOptDisconnect40 0x00000000 +#define irOpenOptSpeed115200 0x0000003F // sets max negotiated baud rate +#define irOpenOptSpeed57600 0x0000001F // default is 57600 +#define irOpenOptSpeed38400 0x0000000F +#define irOpenOptSpeed19200 0x00000007 +#define irOpenOptSpeed9600 0x00000003 + +// Option codes for ExgLibControl +// These options are all unique to the Ir transport +#define irGetScanningMode (exgLibCtlSpecificOp | 1) // returns scanning enabled +#define irSetScanningMode (exgLibCtlSpecificOp | 2) // en/disables ir scanning mode +#define irGetStatistics (exgLibCtlSpecificOp | 3) // returns performance stats +#define irSetSerialMode (exgLibCtlSpecificOp | 4) // sets driver to use direct serial +#define irSetBaudMask (exgLibCtlSpecificOp | 5) // set possible baud rates (irOpenOpts) +#define irSetSupported (exgLibCtlSpecificOp | 6) // disables the ir not supported dialog +#define irSuppressScanning (exgLibCtlSpecificOp | 7) // temporarily disabled beam receive +#define irRestoreScanning (exgLibCtlSpecificOp | 8) // restore beam receive state + +// structure returned by irGetStatistics +typedef struct { + UInt16 recLineErrors; // # of serial errors since library opend + UInt16 crcErrors; // # of crc errors ... +} IrStatsType; + +//----------------------------------------------------------------------------- +// 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. +#define irLibTrapBind (sysLibTrapCustom+10) +#define irLibTrapUnBind (sysLibTrapCustom+11) +#define irLibTrapDiscoverReq (sysLibTrapCustom+12) +#define irLibTrapConnectIrLap (sysLibTrapCustom+13) +#define irLibTrapDisconnectIrLap (sysLibTrapCustom+14) +#define irLibTrapConnectReq (sysLibTrapCustom+15) +#define irLibTrapConnectRsp (sysLibTrapCustom+16) +#define irLibTrapDataReq (sysLibTrapCustom+17) +#define irLibTrapLocalBusy (sysLibTrapCustom+18) +#define irLibTrapMaxTxSize (sysLibTrapCustom+19) +#define irLibTrapMaxRxSize (sysLibTrapCustom+20) +#define irLibTrapSetDeviceInfo (sysLibTrapCustom+21) +#define irLibTrapIsNoProgress (sysLibTrapCustom+22) +#define irLibTrapIsRemoteBusy (sysLibTrapCustom+23) +#define irLibTrapIsMediaBusy (sysLibTrapCustom+24) +#define irLibTrapIsIrLapConnected (sysLibTrapCustom+25) +#define irLibTrapTestReq (sysLibTrapCustom+26) +#define irLibTrapIAS_Add (sysLibTrapCustom+27) +#define irLibTrapIAS_Query (sysLibTrapCustom+28) +#define irLibTrapIAS_SetDeviceName (sysLibTrapCustom+29) +#define irLibTrapIAS_Next (sysLibTrapCustom+30) +#define irLibTrapIrOpen (sysLibTrapCustom+31) +#define irLibTrapHandleEvent (sysLibTrapCustom+32) +#define irLibTrapWaitForEvent (sysLibTrapCustom+33) + +#define irLibTrapLast (sysLibTrapCustom+34) + + +/**************************************************************************** + * + * Types and Constants + * + ****************************************************************************/ + +/* Maximum size of packet that can be sent at connect time (ConnectReq or + * ConnectRsp) for IrLMP and Tiny TP connections. + */ +#define IR_MAX_CON_PACKET 60 +#define IR_MAX_TTP_CON_PACKET 52 +#define IR_MAX_TEST_PACKET 376 +#define IR_MAX_DEVICE_INFO 23 + +/* Size of the device list used in discovery process + */ +#define 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. + */ +#define IR_MAX_XID_LEN 23 + + +/* Maximum allowed LSAP in IrLMP + */ +#define IR_MAX_LSAP 0x6f + +/* The following are used to access the hint bits in the first byte + * of the Device Info field of an XID frame (IrDeviceInfo). + */ +#define IR_HINT_PNP 0x01 +#define IR_HINT_PDA 0x02 +#define IR_HINT_COMPUTER 0x04 +#define IR_HINT_PRINTER 0x08 +#define IR_HINT_MODEM 0x10 +#define IR_HINT_FAX 0x20 +#define IR_HINT_LAN 0x40 +#define IR_HINT_EXT 0x80 + +/* 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. + */ +#define IR_HINT_TELEPHONY 0x01 +#define IR_HINT_FILE 0x02 +#define IR_HINT_IRCOMM 0x04 +#define IR_HINT_MESSAGE 0x08 +#define IR_HINT_HTTP 0x10 +#define IR_HINT_OBEX 0x20 + + +/*--------------------------------------------------------------------------- + * + * Status of a stack operation or of the stack. + */ +typedef UInt8 IrStatus; + +#define IR_STATUS_SUCCESS 0 /* Successful and complete */ +#define IR_STATUS_FAILED 1 /* Operation failed */ +#define IR_STATUS_PENDING 2 /* Successfully started but pending */ +#define IR_STATUS_DISCONNECT 3 /* Link disconnected */ +#define IR_STATUS_NO_IRLAP 4 /* No IrLAP Connection exists */ +#define IR_STATUS_MEDIA_BUSY 5 /* IR Media is busy */ +#define IR_STATUS_MEDIA_NOT_BUSY 6 /* IR Media is not busy */ +#define IR_STATUS_NO_PROGRESS 7 /* IrLAP not making progress */ +#define IR_STATUS_LINK_OK 8 /* No progress condition cleared */ +// #define IR_STATUS_RESERVED1 9 /* Reserved for future use */ +// #define 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. + */ +typedef UInt8 IrCharSet; + +#define IR_CHAR_ASCII 0 +#define IR_CHAR_ISO_8859_1 1 +#define IR_CHAR_ISO_8859_2 2 +#define IR_CHAR_ISO_8859_3 3 +#define IR_CHAR_ISO_8859_4 4 +#define IR_CHAR_ISO_8859_5 5 +#define IR_CHAR_ISO_8859_6 6 +#define IR_CHAR_ISO_8859_7 7 +#define IR_CHAR_ISO_8859_8 8 +#define IR_CHAR_ISO_8859_9 9 +#define IR_CHAR_UNICODE 0xff + +/*--------------------------------------------------------------------------- + * + * 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. + */ +typedef UInt8 IrEvent; + +#define LEVENT_LM_CON_IND 0 +#define LEVENT_LM_DISCON_IND 1 +#define LEVENT_DATA_IND 2 +#define LEVENT_PACKET_HANDLED 3 +#define LEVENT_LAP_CON_IND 4 +#define LEVENT_LAP_DISCON_IND 5 +#define LEVENT_DISCOVERY_CNF 6 +#define LEVENT_LAP_CON_CNF 7 +#define LEVENT_LM_CON_CNF 8 +#define LEVENT_STATUS_IND 9 +#define LEVENT_TEST_IND 10 +#define LEVENT_TEST_CNF 11 +//#define LEVENT_RESERVED1 12 // reserved for future use +#define LEVENT_LM_SEND_IND 13 // added in Palm OS 4.0 + + +/* LmConnect flags - used internally + */ +#define LCON_FLAGS_TTP 0x02 + + + +/**************************************************************************** + * + * IAS Types and Constants + * + ****************************************************************************/ + +/* Maximum size of a query that observes the IrDA Lite rules + */ +#define 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. + */ +#define IR_MAX_IAS_NAME 60 +#define 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. + */ +#define 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. + */ +#define IAS_ATTRIB_MISSING 0 +#define IAS_ATTRIB_INTEGER 1 +#define IAS_ATTRIB_OCTET_STRING 2 +#define IAS_ATTRIB_USER_STRING 3 +#define IAS_ATTRIB_UNDEFINED 0xff + +/* Ias Return Codes. One of these values will be found in the IAS Query + * structure in the retCode field after a successful IAS Query. + */ +#define IAS_RET_SUCCESS 0 /* Query operation is successful */ +#define IAS_RET_NO_SUCH_CLASS 1 /* Query failed no such class exists */ +#define IAS_RET_NO_SUCH_ATTRIB 2 /* Query failed no such attribute exists */ +#define IAS_RET_UNSUPPORTED 0xff /* Query failed operation is unsupported */ + + /* IAS Get Value By Class opcode number + */ +#define IAS_GET_VALUE_BY_CLASS 4 + +// Macros used in accessing ias structures +#define IasGetU16(ptr) (UInt16)( ((UInt16)(*((UInt8*)ptr) << 8)) | \ + ((UInt16) (*((UInt8*)ptr+1)))) +#define IasGetU32(ptr) (UInt32)( ((UInt32)(*((UInt8*)ptr)) << 24) | \ + ((UInt32)(*((UInt8*)ptr+1)) << 16) | \ + ((UInt32)(*((UInt8*)ptr+2)) << 8) | \ + ((UInt32)(*((UInt8*)ptr+3))) ) + +/**************************************************************************** + * + * Data Structures + * + ****************************************************************************/ + +// stack functions use a diferent type for booleans +typedef int BOOL; + +/*--------------------------------------------------------------------------- + * + * ListEntry is used internally by the stack + */ +typedef struct _ListEntry +{ + struct _ListEntry *Flink; + struct _ListEntry *Blink; + +} ListEntry; + +/* Forward declaration of the IrConnect structure + */ +typedef struct _hconnect IrConnect; + +/*--------------------------------------------------------------------------- + * + * Packet Structure for sending IrDA packets. + */ +typedef struct _IrPacket { + /* The node field must be the first field in the structure. It is used + * internally by the stack + */ + ListEntry node; + + /* The buff field is used to point to a buffer of data to send and len + * field indicates the number of bytes in buff. + */ + UInt8 * buff; + UInt16 len; + + /*================== For Internal Use Only ======================= + * + * The following is used internally by the stack and should not be + * modified by the upper layer. + * + *==================================================================*/ + + IrConnect* origin; /* Pointer to connection which owns packet */ + UInt8 headerLen; /* Number of bytes in the header */ + UInt8 header[14]; /* Storage for the header */ + UInt8 reserved; /* Explicitly account for 16-bit alignment padding */ +} IrPacket; + + +/*--------------------------------------------------------------------------- + * + * 32-bit Device Address + */ +typedef union { + UInt8 u8[4]; + UInt16 u16[2]; + UInt32 u32; +} IrDeviceAddr; + +/*--------------------------------------------------------------------------- + * + * 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. + */ +typedef struct { + IrDeviceAddr hDevice; /* 32-bit address of device */ + UInt8 len; /* Length of xid */ + UInt8 xid[IR_MAX_XID_LEN];/* XID information */ +} IrDeviceInfo; + +/*--------------------------------------------------------------------------- + * + * List of Device Discovery info elements. + */ +typedef struct { + UInt8 nItems; /* Number items in the list */ + UInt8 reserved; /* Explicitly account for 16-bit alignment padding */ + IrDeviceInfo dev[IR_DEVICE_LIST_SIZE]; /* Fixed size in IrDA Lite */ +} IrDeviceList; + +/*--------------------------------------------------------------------------- + * + * 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. + */ +typedef struct { + IrEvent event; /* Event causing callback */ + UInt8 reserved1; /* Explicitly account for 16-bit alignment padding */ + UInt8 * rxBuff; /* Receive buffer already advanced to app data */ + UInt16 rxLen; /* Length of data in receive buffer */ + IrPacket* packet; /* Pointer to packet being returned */ + IrDeviceList* deviceList; /* Pointer to discovery device list */ + IrStatus status; /* Status of stack */ + UInt8 reserved2; /* Explicitly account for 16-bit alignment padding */ +} 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. + */ +typedef void (*IrCallBack)(IrConnect*, IrCallBackParms*); + +/*--------------------------------------------------------------------------- + * + * Definition of IrConnect structure. This structure is used to manage an + * IrLMP or Tiny TP connection. + */ +typedef struct _hconnect { + UInt8 lLsap; /* Local LSAP this connection will listen on */ + UInt8 rLsap; /* Remote Lsap */ + + /*================== For Internal Use Only ======================= + * + * The following is used internally by the stack and should not be + * modified by the user. + * + *==================================================================*/ + + UInt8 flags; /* Flags containing state, type, etc. */ + UInt8 reserved; /* Explicitly account for 16-bit alignment padding */ + IrCallBack callBack; /* Pointer to callback function */ + + /* Tiny TP fields */ + IrPacket packet; /* Packet for internal use */ + ListEntry packets; /* List of packets to send */ + UInt16 sendCredit; /* Amount of credit from peer */ + UInt8 availCredit; /* Amount of credit to give to peer */ + UInt8 dataOff; /* Amount of data less than IrLAP size */ +} _hconnect; + +/**************************************************************************** + * + * IAS Data Strucutres + * + ****************************************************************************/ + +/*--------------------------------------------------------------------------- + * + * The LmIasAttribute is a strucutre that holds one attribute of an IAS + * object. + */ +typedef struct _IrIasAttribute { + UInt8 * name; /* Pointer to name of attribute */ + UInt8 len; /* Length of attribute name */ + UInt8 reserved1; /* Explicitly account for 16-bit alignment padding */ + UInt8 * value; /* Hardcode value (see below) */ + UInt8 valLen; /* Length of the value. */ + UInt8 reserved2; /* Explicitly account for 16-bit alignment padding */ +} 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. + */ +typedef struct _IrIasObject { + UInt8 * name; /* Pointer to name of object */ + UInt8 len; /* Length of object name */ + + UInt8 nAttribs; /* Number of attributes */ + IrIasAttribute* attribs; /* A pointer to an array of attributes */ + +} IrIasObject; + + +/*--------------------------------------------------------------------------- + * + * Forward declaration of a structure used for performing IAS Queries so + * that a callback type can be defined for use in the structure. + */ +typedef struct _IrIasQuery IrIasQuery; +typedef void (*IrIasQueryCallBack)(IrStatus); + +/*--------------------------------------------------------------------------- + * + * Actual definition of the IrIasQuery structure. + */ +typedef struct _IrIasQuery +{ + /* 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 + */ + UInt8 queryLen; /* Total length of the query */ + UInt8 reserved; /* Explicitly account for 16-bit alignment padding */ + UInt8 * queryBuf; /* Points to buffer containing the query */ + + /* Fields for the query result */ + UInt16 resultBufSize; /* Size of the result buffer */ + UInt16 resultLen; /* Actual number of bytes in the result buffer */ + UInt16 listLen; /* Number of items in the result list. */ + UInt16 offset; /* Offset into results buffer */ + UInt8 retCode; /* Return code of operation */ + UInt8 overFlow; /* Set TRUE if result exceeded result buffer size */ + UInt8 * result; /* Pointer to buffer containing result; */ + + /* Pointer to callback function */ + IrIasQueryCallBack callBack; +} _IrIasQuery; + +/**************************************************************************** + * + * Function Reference + * + ****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*--------------------------------------------------------------------------- + * + * 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 + * + */ +Err IrOpen(UInt16 refnum, UInt32 options) + SYS_TRAP(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 + * + */ +#if EMULATION_LEVEL == EMULATION_NONE +Err IrClose(UInt16 refnum) + SYS_TRAP(sysLibTrapClose); +#else +// IrClose does not actually exist in the emulator so map it to ExgLibClose +#define IrClose(refNum) ExgLibClose(refNum) +#endif + +/*--------------------------------------------------------------------------- + * + * 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 + */ +IrStatus IrBind(UInt16 refNum,IrConnect* con, IrCallBack callBack) + SYS_TRAP(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. + */ +IrStatus IrUnbind(UInt16 refNum,IrConnect* con) + SYS_TRAP(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. + */ +IrStatus IrDiscoverReq(UInt16 refNum,IrConnect* con) + SYS_TRAP(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 + */ +IrStatus IrConnectIrLap(UInt16 refNum,IrDeviceAddr deviceAddr) + SYS_TRAP(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. + */ +IrStatus IrDisconnectIrLap(UInt16 refNum) + SYS_TRAP(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). + */ +IrStatus IrConnectReq(UInt16 refNum,IrConnect* con, IrPacket* packet, UInt8 credit) + SYS_TRAP(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). + */ +IrStatus IrConnectRsp(UInt16 refNum,IrConnect* con,IrPacket* packet, UInt8 credit) + SYS_TRAP(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 + */ +IrStatus IrDataReq(UInt16 refNum,IrConnect* con, IrPacket* packet) + SYS_TRAP(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 + */ +#define 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 + */ +void IrLocalBusy(UInt16 refNum,BOOL flag) + SYS_TRAP(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 + */ +#define 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 + */ +#define 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. + */ +UInt16 IrMaxTxSize(UInt16 refNum,IrConnect* con) + SYS_TRAP(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). + */ +UInt16 IrMaxRxSize(UInt16 refNum,IrConnect* con) + SYS_TRAP(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). + */ +IrStatus IrSetDeviceInfo(UInt16 refNum,UInt8 *info, UInt8 len) + SYS_TRAP(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. + */ +BOOL IrIsNoProgress(UInt16 refNum) + SYS_TRAP(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. + */ +BOOL IrIsRemoteBusy(UInt16 refNum) + SYS_TRAP(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. + */ +BOOL IrIsMediaBusy(UInt16 refNum) + SYS_TRAP(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. + */ +BOOL IrIsIrLapConnected(UInt16 refNum) + SYS_TRAP(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). + */ +IrStatus IrTestReq(UInt16 refNum,IrDeviceAddr devAddr, IrConnect* con, IrPacket* packet) + SYS_TRAP(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 + */ +IrStatus IrIAS_Add(UInt16 refNum,IrIasObject* obj) + SYS_TRAP(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. + */ +IrStatus IrIAS_Query(UInt16 refNum,IrIasQuery* token) + SYS_TRAP(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). + */ +IrStatus IrIAS_SetDeviceName(UInt16 refNum,UInt8 *name, UInt8 len) + SYS_TRAP(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 + */ +#define 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 + */ +#define 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. + */ +#define 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. + */ +#define 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. + */ +#define 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 + */ +#define 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 + */ +#define 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 + */ +#define 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 + */ +#define 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 + */ +#define 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. + */ +UInt8 * IrIAS_Next(UInt16 refNum,IrIasQuery* token) + SYS_TRAP(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. + */ +Boolean IrHandleEvent(UInt16 refnum) + SYS_TRAP(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. + */ +Err IrWaitForEvent(UInt16 libRefnum,Int32 timeout) + SYS_TRAP(irLibTrapWaitForEvent); + +#ifdef __cplusplus +} +#endif + +#endif // IR_LIB_H + + diff --git a/sdk-4/include/Core/System/KeyMgr.h b/sdk-4/include/Core/System/KeyMgr.h new file mode 100644 index 0000000..6d85cd8 --- /dev/null +++ b/sdk-4/include/Core/System/KeyMgr.h @@ -0,0 +1,76 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __KEYMGR_H__ +#define __KEYMGR_H__ + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Definition of bit field returned from KeyCurrentState + ********************************************************************/ +#define keyBitPower 0x0001 // Power key +#define keyBitPageUp 0x0002 // Page-up +#define keyBitPageDown 0x0004 // Page-down +#define keyBitHard1 0x0008 // App #1 +#define keyBitHard2 0x0010 // App #2 +#define keyBitHard3 0x0020 // App #3 +#define keyBitHard4 0x0040 // App #4 +#define keyBitCradle 0x0080 // Button on cradle +#define keyBitAntenna 0x0100 // Antenna "key" +#define keyBitContrast 0x0200 // Contrast key + +#define keyBitsAll 0xFFFFFFFF // all keys + + +#define slowestKeyDelayRate 0xff +#define slowestKeyPeriodRate 0xff + + +/******************************************************************** + * Key manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Set/Get the auto-key repeat rate +Err KeyRates(Boolean set, UInt16 *initDelayP, UInt16 *periodP, + UInt16 *doubleTapDelayP, Boolean *queueAheadP) + SYS_TRAP(sysTrapKeyRates); + +// Get the current state of the hardware keys +// This is now updated every tick, even when more than 1 key is held down. +UInt32 KeyCurrentState(void) + SYS_TRAP(sysTrapKeyCurrentState); + +// Set the state of the hardware key mask which controls if the key +// generates a keyDownEvent +UInt32 KeySetMask(UInt32 keyMask) + SYS_TRAP(sysTrapKeySetMask); + +#ifdef __cplusplus +} +#endif + + +#endif //__KEYMGR_H__ diff --git a/sdk-4/include/Core/System/LocaleMgr.h b/sdk-4/include/Core/System/LocaleMgr.h new file mode 100644 index 0000000..5c3bae7 --- /dev/null +++ b/sdk-4/include/Core/System/LocaleMgr.h @@ -0,0 +1,228 @@ +/****************************************************************************** + * + * 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 parameter + * to reflect the fact that the routine now checks to make sure + * that is the correct size for all fixed-size settings. + * 09/29/00 CS Made iLocale parm of LmLocaleToIndex const. + * 11/17/00 CS Removed support for lmChoiceLanguage & lmChoiceCountry, + * since these guys were returning UInt8's, which probably + * won't cut it at some point in the future. Callers can use + * lmChoiceLocale, which returns an LmLocaleType struct that + * places the country and language into UInt16 fields. + * CS Defined lmAnyCountry & lmAnyLanguage, which can now be passed + * in LmLocaleToIndex's iLocale parameter (as wildcards). + * + *****************************************************************************/ + +#ifndef __LOCALEMGR_H__ +#define __LOCALEMGR_H__ + +/* Supporting lmChoiceLanguageName would add over 3K to the 'locs' resource. + DOLATER CS - either do it or punt. +*/ +#define SUPPORT_LANGUAGE_NAME 0 + +#include + +/*********************************************************************** + * Locale Manager errors + **********************************************************************/ + +/* Locale not found in 'locs' resource. +*/ +#define lmErrUnknownLocale (lmErrorClass | 1) + +/* Locale index >= LmGetNumLocales(). +*/ +#define lmErrBadLocaleIndex (lmErrorClass | 2) + +/* LmLocaleSettingChoice out of bounds. +*/ +#define lmErrBadLocaleSettingChoice (lmErrorClass | 3) + +/* Data for locale setting too big for destination. +*/ +#define lmErrSettingDataOverflow (lmErrorClass | 4) + +/*********************************************************************** + * Locale Manager settings (pass to LmGetLocaleSetting) + **********************************************************************/ + +typedef UInt16 LmLocaleSettingChoice; + +/* LmLocaleType +*/ +#define lmChoiceLocale ((LmLocaleSettingChoice)1) + +/* Char[kMaxLanguageNameLen+1] - Name of the language spoken there (localized) +*/ +#if SUPPORT_LANGUAGE_NAME + #define lmChoiceLanguageName ((LmLocaleSettingChoice)4) +#else + #define lmChoiceLanguageName #error lmChoiceLanguageName not supported +#endif + +/* Char[kMaxCountryNameLen+1] - Name of the country (localized) +*/ +#define lmChoiceCountryName ((LmLocaleSettingChoice)5) + +/* DateFormatType +*/ +#define lmChoiceDateFormat ((LmLocaleSettingChoice)6) + +/* DateFormatType +*/ +#define lmChoiceLongDateFormat ((LmLocaleSettingChoice)7) + +/* TimeFormatType +*/ +#define lmChoiceTimeFormat ((LmLocaleSettingChoice)8) + +/* UInt16 - Weekday for calendar column 1 (sunday=0, monday=1, etc.) +*/ +#define lmChoiceWeekStartDay ((LmLocaleSettingChoice)9) + +/* Int16 - Default GMT offset minutes, + for east of GMT, - for west +*/ +#define lmChoiceTimeZone ((LmLocaleSettingChoice)10) + +/* NumberFormatType - Specifies decimal and thousands separator characters +*/ +#define lmChoiceNumberFormat ((LmLocaleSettingChoice)11) + +/* Char[kMaxCurrencyNameLen+1] - Name of local currency (e.g., "US Dollar") +*/ +#define lmChoiceCurrencyName ((LmLocaleSettingChoice)12) + +/* Char[kMaxCurrencySymbolLen+1] - Currency symbol (e.g., "$") +*/ +#define lmChoiceCurrencySymbol ((LmLocaleSettingChoice)13) + +/* Char[kMaxCurrencySymbolLen+1] - Unique currency symbol (e.g., "US$") +*/ +#define lmChoiceUniqueCurrencySymbol ((LmLocaleSettingChoice)14) + +/* UInt16 - Number of decimals for currency (e.g., 2 for $10.12) +*/ +#define lmChoiceCurrencyDecimalPlaces ((LmLocaleSettingChoice)15) + +/* MeasurementSystemType - Metric, English, etc. +*/ +#define lmChoiceMeasurementSystem ((LmLocaleSettingChoice)16) + +/*********************************************************************** + * Locale Manager constants + **********************************************************************/ +#define lmAnyCountry 65535U // Pass LmLocaleToIndex's iLocale +#define lmAnyLanguage 65535U // Pass LmLocaleToIndex's iLocale + +#define kMaxCountryNameLen 19 +#if SUPPORT_LANGUAGE_NAME + #define kMaxLanguageNameLen 19 +#endif +#define kMaxCurrencyNameLen 19 +#define kMaxCurrencySymbolLen 5 + +/*********************************************************************** + * Selectors & macros used for calling Locale Manager routines + **********************************************************************/ + +#ifndef DIRECT_LOCALE_CALLS + #define DIRECT_LOCALE_CALLS 0 +#endif +#if DIRECT_LOCALE_CALLS + #define LMDISPATCH_TRAP(routineSelector) +#else + #define LMDISPATCH_TRAP(routineSelector) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, \ + sysTrapLmDispatch, \ + routineSelector) +#endif + +/* Selectors used for getting to the right Locale Manager routine via +the LmDispatch trap. */ + +// DOLATER:jwm: remove me after fixing LocaleMgr.c:PrvSelectorError +typedef UInt16 LmRoutineSelector; +#define lmInit 0 +#define lmGetNumLocales 1 +#define lmLocaleToIndex 2 +#define lmGetLocaleSetting 3 + +#define lmMaxRoutineSelector lmGetLocaleSetting + +/*********************************************************************** + * Locale Manager types + **********************************************************************/ + +typedef UInt8 LanguageType; +typedef UInt8 CountryType; + +typedef struct _LmLocaleType LmLocaleType; +struct _LmLocaleType +{ + UInt16 language; // Language spoken in locale (LanguageType) + UInt16 country; // Specifies "dialect" of language (CountryType) +}; + +/*********************************************************************** + * Locale Manager routines + **********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +/* Return the number of known locales (maximum locale index + 1). +*/ +UInt16 +LmGetNumLocales(void) + LMDISPATCH_TRAP(lmGetNumLocales); + +/* Convert to by locating it within the set of known +locales. +*/ +Err +LmLocaleToIndex( const + LmLocaleType* iLocale, + UInt16* oLocaleIndex) + LMDISPATCH_TRAP(lmLocaleToIndex); + +/* Return in the setting identified by which is appropriate for +the locale identified by . Return lmErrSettingDataOverflow if the +data for occupies more than bytes. Display a non-fatal +error if is larger than the data for a fixed-size setting. +*/ +Err +LmGetLocaleSetting( UInt16 iLocaleIndex, + LmLocaleSettingChoice iChoice, + void* oValue, + UInt16 iValueSize) + LMDISPATCH_TRAP(lmGetLocaleSetting); + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/sdk-4/include/Core/System/Localize.h b/sdk-4/include/Core/System/Localize.h new file mode 100644 index 0000000..e352343 --- /dev/null +++ b/sdk-4/include/Core/System/Localize.h @@ -0,0 +1,54 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __LOCALIZE_H__ +#define __LOCALIZE_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + +// The number format (thousands separator and decimal point). This defines +// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland). +typedef enum { + nfCommaPeriod, + nfPeriodComma, + nfSpaceComma, + nfApostrophePeriod, + nfApostropheComma + } NumberFormatType; + + + +#ifdef __cplusplus +extern "C" { +#endif + + +void LocGetNumberSeparators(NumberFormatType numberFormat, + Char *thousandSeparator, Char *decimalSeparator) + SYS_TRAP(sysTrapLocGetNumberSeparators); + + + +#ifdef __cplusplus +} +#endif + + +#endif // __LOCALIZE_H__ diff --git a/sdk-4/include/Core/System/MemoryMgr.h b/sdk-4/include/Core/System/MemoryMgr.h new file mode 100644 index 0000000..5bc8c46 --- /dev/null +++ b/sdk-4/include/Core/System/MemoryMgr.h @@ -0,0 +1,341 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __MEMORYMGR_H__ +#define __MEMORYMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. +#include + + +/************************************************************ + * Memory Manager Types + *************************************************************/ +typedef enum { memIDPtr, memIDHandle } LocalIDKind; + + +/************************************************************ + * Flags accepted as parameter for MemNewChunk. + *************************************************************/ +#define memNewChunkFlagPreLock 0x0100 +#define memNewChunkFlagNonMovable 0x0200 +#define memNewChunkFlagAtStart 0x0400 // force allocation at front of heap +#define memNewChunkFlagAtEnd 0x0800 // force allocation at end of heap + + +/************************************************************ + * Memory Manager Debug settings for the MemSetDebugMode function + *************************************************************/ +#define memDebugModeCheckOnChange 0x0001 +#define memDebugModeCheckOnAll 0x0002 +#define memDebugModeScrambleOnChange 0x0004 +#define memDebugModeScrambleOnAll 0x0008 +#define memDebugModeFillFree 0x0010 +#define memDebugModeAllHeaps 0x0020 +#define memDebugModeRecordMinDynHeapFree 0x0040 + + + + +/************************************************************ + * Memory Manager result codes + *************************************************************/ +#define memErrChunkLocked (memErrorClass | 1) +#define memErrNotEnoughSpace (memErrorClass | 2) +#define memErrInvalidParam (memErrorClass | 3) /* invalid param or requested size is too big */ +#define memErrChunkNotLocked (memErrorClass | 4) +#define memErrCardNotPresent (memErrorClass | 5) +#define memErrNoCardHeader (memErrorClass | 6) +#define memErrInvalidStoreHeader (memErrorClass | 7) +#define memErrRAMOnlyCard (memErrorClass | 8) +#define memErrWriteProtect (memErrorClass | 9) +#define memErrNoRAMOnCard (memErrorClass | 10) +#define memErrNoStore (memErrorClass | 11) +#define memErrROMOnlyCard (memErrorClass | 12) + + +/******************************************************************** + * Memory Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err MemInit(void) + SYS_TRAP(sysTrapMemInit); + +Err MemKernelInit(void) + SYS_TRAP(sysTrapMemKernelInit); + +Err MemInitHeapTable(UInt16 cardNo) + SYS_TRAP(sysTrapMemInitHeapTable); + +//------------------------------------------------------------------- +// Card formatting and Info +//------------------------------------------------------------------- +UInt16 MemNumCards(void) + SYS_TRAP(sysTrapMemNumCards); + +Err MemCardFormat(UInt16 cardNo, const Char *cardNameP, + const Char *manufNameP, const Char *ramStoreNameP) + SYS_TRAP(sysTrapMemCardFormat); + +Err MemCardInfo(UInt16 cardNo, + Char *cardNameP, Char *manufNameP, + UInt16 *versionP, UInt32 *crDateP, + UInt32 *romSizeP, UInt32 *ramSizeP, + UInt32 *freeBytesP) + SYS_TRAP(sysTrapMemCardInfo); + + +//------------------------------------------------------------------- +// Store Info +//------------------------------------------------------------------- +Err MemStoreInfo(UInt16 cardNo, UInt16 storeNumber, + UInt16 *versionP, UInt16 *flagsP, Char *nameP, + UInt32 * crDateP, UInt32 *bckUpDateP, + UInt32 * heapListOffsetP, UInt32 *initCodeOffset1P, + UInt32 *initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreInfo); + +Err MemStoreSetInfo(UInt16 cardNo, UInt16 storeNumber, + UInt16 *versionP, UInt16 *flagsP, Char *nameP, + UInt32 *crDateP, UInt32 *bckUpDateP, + UInt32 *heapListOffsetP, UInt32 *initCodeOffset1P, + UInt32 *initCodeOffset2P, LocalID* databaseDirIDP) + SYS_TRAP(sysTrapMemStoreSetInfo); + + +//------------------------------------------------------------------- +// Heap Info & Utilities +//------------------------------------------------------------------- +UInt16 MemNumHeaps(UInt16 cardNo) + SYS_TRAP(sysTrapMemNumHeaps); + +UInt16 MemNumRAMHeaps(UInt16 cardNo) + SYS_TRAP(sysTrapMemNumRAMHeaps); + +UInt16 MemHeapID(UInt16 cardNo, UInt16 heapIndex) + SYS_TRAP(sysTrapMemHeapID); + +Boolean MemHeapDynamic(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapDynamic); + +Err MemHeapFreeBytes(UInt16 heapID, UInt32 *freeP, UInt32 *maxP) + SYS_TRAP(sysTrapMemHeapFreeBytes); + +UInt32 MemHeapSize(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapSize); + +UInt16 MemHeapFlags(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapFlags); + + +// Heap utilities +Err MemHeapCompact(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapCompact); + +Err MemHeapInit(UInt16 heapID, Int16 numHandles, Boolean initContents) + SYS_TRAP(sysTrapMemHeapInit); + +Err MemHeapFreeByOwnerID(UInt16 heapID, UInt16 ownerID) + SYS_TRAP(sysTrapMemHeapFreeByOwnerID); + + +//------------------------------------------------------------------- +// Low Level Allocation +//------------------------------------------------------------------- +MemPtr MemChunkNew(UInt16 heapID, UInt32 size, UInt16 attr) + SYS_TRAP(sysTrapMemChunkNew); + +Err MemChunkFree(MemPtr chunkDataP) + SYS_TRAP(sysTrapMemChunkFree); + + + +//------------------------------------------------------------------- +// Pointer (Non-Movable) based Chunk Routines +//------------------------------------------------------------------- +MemPtr MemPtrNew(UInt32 size) + SYS_TRAP(sysTrapMemPtrNew); + +#define MemPtrFree( p) \ + MemChunkFree(p) + +// Getting Attributes +MemHandle MemPtrRecoverHandle(MemPtr p) + SYS_TRAP(sysTrapMemPtrRecoverHandle); + +UInt16 MemPtrFlags(MemPtr p) + SYS_TRAP(sysTrapMemPtrFlags); + +UInt32 MemPtrSize(MemPtr p) + SYS_TRAP(sysTrapMemPtrSize); + +UInt16 MemPtrOwner(MemPtr p) + SYS_TRAP(sysTrapMemPtrOwner); + +UInt16 MemPtrHeapID(MemPtr p) + SYS_TRAP(sysTrapMemPtrHeapID); + +Boolean MemPtrDataStorage(MemPtr p) + SYS_TRAP(sysTrapMemPtrDataStorage); + +UInt16 MemPtrCardNo(MemPtr p) + SYS_TRAP(sysTrapMemPtrCardNo); + +LocalID MemPtrToLocalID(MemPtr p) + SYS_TRAP(sysTrapMemPtrToLocalID); + +// Setting Attributes +Err MemPtrSetOwner(MemPtr p, UInt16 owner) + SYS_TRAP(sysTrapMemPtrSetOwner); + +Err MemPtrResize(MemPtr p, UInt32 newSize) + SYS_TRAP(sysTrapMemPtrResize); + +Err MemPtrResetLock(MemPtr p) + SYS_TRAP(sysTrapMemPtrResetLock); + +Err MemPtrUnlock(MemPtr p) + SYS_TRAP(sysTrapMemPtrUnlock); + + +//------------------------------------------------------------------- +// Handle (Movable) based Chunk Routines +//------------------------------------------------------------------- +MemHandle MemHandleNew(UInt32 size) + SYS_TRAP(sysTrapMemHandleNew); + +Err MemHandleFree(MemHandle h) + SYS_TRAP(sysTrapMemHandleFree); + +// Getting Attributes +UInt16 MemHandleFlags(MemHandle h) + SYS_TRAP(sysTrapMemHandleFlags); + +UInt32 MemHandleSize(MemHandle h) + SYS_TRAP(sysTrapMemHandleSize); + +UInt16 MemHandleOwner(MemHandle h) + SYS_TRAP(sysTrapMemHandleOwner); + +UInt16 MemHandleLockCount(MemHandle h) + SYS_TRAP(sysTrapMemHandleLockCount); + +UInt16 MemHandleHeapID(MemHandle h) + SYS_TRAP(sysTrapMemHandleHeapID); + +Boolean MemHandleDataStorage(MemHandle h) + SYS_TRAP(sysTrapMemHandleDataStorage); + +UInt16 MemHandleCardNo(MemHandle h) + SYS_TRAP(sysTrapMemHandleCardNo); + +LocalID MemHandleToLocalID(MemHandle h) + SYS_TRAP(sysTrapMemHandleToLocalID); + + +// Setting Attributes +Err MemHandleSetOwner( MemHandle h, UInt16 owner) + SYS_TRAP(sysTrapMemHandleSetOwner); + +Err MemHandleResize(MemHandle h, UInt32 newSize) + SYS_TRAP(sysTrapMemHandleResize); + +MemPtr MemHandleLock(MemHandle h) + SYS_TRAP(sysTrapMemHandleLock); + +Err MemHandleUnlock(MemHandle h) + SYS_TRAP(sysTrapMemHandleUnlock); + +Err MemHandleResetLock(MemHandle h) + SYS_TRAP(sysTrapMemHandleResetLock); + + + + +//------------------------------------------------------------------- +// Local ID based routines +//------------------------------------------------------------------- +MemPtr MemLocalIDToGlobal(LocalID local, UInt16 cardNo) + SYS_TRAP(sysTrapMemLocalIDToGlobal); + +LocalIDKind MemLocalIDKind(LocalID local) + SYS_TRAP(sysTrapMemLocalIDKind); + +MemPtr MemLocalIDToPtr(LocalID local, UInt16 cardNo) + SYS_TRAP(sysTrapMemLocalIDToPtr); + +MemPtr MemLocalIDToLockedPtr(LocalID local, UInt16 cardNo) + SYS_TRAP(sysTrapMemLocalIDToLockedPtr); + + +//------------------------------------------------------------------- +// Utilities +//------------------------------------------------------------------- +Err MemMove(void *dstP, const void *sP, Int32 numBytes) + SYS_TRAP(sysTrapMemMove); + +Err MemSet(void *dstP, Int32 numBytes, UInt8 value) + SYS_TRAP(sysTrapMemSet); + +Int16 MemCmp (const void *s1, const void *s2, Int32 numBytes) + SYS_TRAP(sysTrapMemCmp); + +Err MemSemaphoreReserve(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreReserve); + +Err MemSemaphoreRelease(Boolean writeAccess) + SYS_TRAP(sysTrapMemSemaphoreRelease); + +//------------------------------------------------------------------- +// Debugging Support +//------------------------------------------------------------------- +UInt16 MemDebugMode(void) + SYS_TRAP(sysTrapMemDebugMode); + +Err MemSetDebugMode(UInt16 flags) + SYS_TRAP(sysTrapMemSetDebugMode); + +Err MemHeapScramble(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapScramble); + +Err MemHeapCheck(UInt16 heapID) + SYS_TRAP(sysTrapMemHeapCheck); + + +#ifdef __cplusplus +} +#endif + + + + + +#endif // __MEMORYMGR_H__ diff --git a/sdk-4/include/Core/System/ModemMgr.h b/sdk-4/include/Core/System/ModemMgr.h new file mode 100644 index 0000000..50c0db8 --- /dev/null +++ b/sdk-4/include/Core/System/ModemMgr.h @@ -0,0 +1,156 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __MODEM_MGR_H__ +#define __MODEM_MGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. +#include + + +/************************************************************ + * Modem Manager constants + *************************************************************/ + +#define mdmMaxStringSize 40 + +#define mdmCmdBufSize 81 // command buffer capacity (including null) +#define mdmRespBufSize 81 // reply buffer capacity (including null) +#define mdmCmdSize 8 // max storage needed for smartmodem command + +#define mdmDefCmdTimeOut 500000L // in micro-seconds + +#define mdmDefDTWaitSec 4 +#define mdmDefDCDWaitSec 70 +#define mdmDefSpeakerVolume 1 + +#define mdmResetStrInCmdBuf 0x01 + +// Speaker volume settings +enum { + mdmVolumeOff = 0, + mdmVolumeLow = 1, + mdmVolumeMed = 2, + mdmVolumeHigh = 3 + }; + + +// Modem connection stages (NEW for Pilot 2.0) +typedef enum { + mdmStageInvalid = 0, // invalid state + mdmStageReserved = 1, // reserved for 1.0 compatibility + mdmStageFindingModem, // checking if modem is present + mdmStageInitializing, // initializing the modem + mdmStageDialing, // dialing the modem + mdmStageWaitingForCarrier, // waiting for carrier detect + mdmStageHangingUp // hanging up the modem + } MdmStageEnum; + +/************************************************************ + * Modem Manager data structures + *************************************************************/ +// Prototype for the "user cancel" check callback function +typedef Int16 (*MdmUserCanProcPtr)(UInt32 userRef); + +typedef struct MdmInfoType { + UInt16 portID; // serial port ID number. [NewSerialMgr; replaces serRefNum] + UInt32 initialBaud; // initial baud rate to use + UInt32 cmdTimeOut; // number of micro-sec to wait after a cmd + Int16 dtWaitSec; // dialtone wait (sec) (-1 for modem's default) + Int16 dcdWaitSec; // dcd timeout wait (sec) (-1 for modem's default) + Int16 volume; // speaker volume(see mdmVolume... constants) + Boolean pulse; // pulse or tone dialing + Boolean hwHShake; // enable cts/rts handshaking + Boolean autoBaud; // enable/disable auto-baud to connected baud rate + UInt8 telConnection; // Boolean true if connecting to a mobile phone + // false otherwise. + MdmUserCanProcPtr canProcP; // ptr to user-cancel function + UInt32 userRef; // parameter for canProcP() + Char cmdBuf[mdmCmdBufSize]; // build all commands here + Char respBuf[mdmRespBufSize];// response buffer + UInt32 connectBaud; // baud at which connection was established + // (0 = unknown) + UInt8 curStage; // set by ModemMgr to report current MdmStageEnum + UInt8 strInCmdBuf; // 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 + } MdmInfoType; + +typedef MdmInfoType* MdmInfoPtr; + +/************************************************************ + * Modem Manager result codes + * (mdmErrorClass is defined in ErrorBase.h) + *************************************************************/ +#pragma mark -Error Codes- + +#define mdmErrNoTone (mdmErrorClass | 1) // no dial tone +#define mdmErrNoDCD (mdmErrorClass | 2) // no carrier / timeout +#define mdmErrBusy (mdmErrorClass | 3) // busy signal heard +#define mdmErrUserCan (mdmErrorClass | 4) // cancelled by user +#define mdmErrCmdError (mdmErrorClass | 5) // command error +#define mdmErrNoModem (mdmErrorClass | 6) // no modem detected +#define mdmErrMemory (mdmErrorClass | 7) // not enough memory +#define mdmErrPrefs (mdmErrorClass | 8) // modem preferences have not been + // setup - (app should take user to modem prefs panel) +#define mdmErrDial (mdmErrorClass | 9) // dial command error - most likely the dial + // string is too long for the modem's buffer or + // contains invalid characters +// New error code for empty phone number which is only invalid if +// the modem type is not a "Direct Connect" modem +#define mdmErrNoPhoneNum (mdmErrorClass | 10) // No phone number and not "Direct Connect" + + +/******************************************************************** + * Modem Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#pragma mark -API Routines- + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +Err MdmDial(MdmInfoPtr modemP, Char *okDialP, Char *userInitP, Char *phoneNumP) + SYS_TRAP(sysTrapMdmDial); + +Err MdmHangUp(MdmInfoPtr modemP) + SYS_TRAP(sysTrapMdmHangUp); + + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Modem Manager Macros + *************************************************************/ + +#endif // __MODEM_MGR_H__ diff --git a/sdk-4/include/Core/System/NetBitUtils.h b/sdk-4/include/Core/System/NetBitUtils.h new file mode 100644 index 0000000..1b8a84e --- /dev/null +++ b/sdk-4/include/Core/System/NetBitUtils.h @@ -0,0 +1,168 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __NETBITUTILS_H__ +#define __NETBITUTILS_H__ + +#include +#include + +#include + +// # of bits in a byte +#define bitsInByte 8 + + +// Maximum size of variable-size ints in # of bits and bytes. This is based on +// the largest variable size int, which is encoded as follows: 1111 Bit[32] +#define bitVarIntMaxBits 36 +#define bitVarIntMaxBytes ((bitVarIntMaxBits + bitsInByte - 1) / bitsInByte) + + +//===================================================== +// BitXXX Macros +// +// The following macros are handy because they don't require that +// the source code pass in the NetLib library refnum to every +// call. +// +// When building server code or other emulation code where th +// library trap dispatcher is not used, the libRefNUm is unused +// and can be 0. +// +// When building for the viewer, the libRefNum must be the refNum +// of the NetLib. For applications, this libRefNum must be put +// into an application global named 'AppNetRefnum'. +// +//==================================================== +#if USE_TRAPS == 0 + #define netPrvRefnum 0 +#else + #define netPrvRefnum AppNetRefnum +#endif + + +#define BitMove( dstP, dstBitOffsetP, srcP, srcBitOffsetP, numBits) \ + NetLibBitMove(netPrvRefnum, dstP, dstBitOffsetP, srcP, srcBitOffsetP, numBits) + +#define BitPutFixed( dstP, dstBitOffsetP, value, numBits) \ + NetLibBitPutFixed(netPrvRefnum, dstP, dstBitOffsetP, value, numBits) + +#define BitGetFixed(srcP, srcBitOffsetP, numBits) \ + NetLibBitGetFixed(netPrvRefnum, srcP, srcBitOffsetP, numBits) + +#define BitPutUIntV(dstP, dstBitOffsetP, value) \ + NetLibBitPutUIntV(netPrvRefnum, dstP, dstBitOffsetP, value) + +#define BitGetUIntV(srcP, srcBitOffsetP) \ + NetLibBitGetUIntV(netPrvRefnum, srcP, srcBitOffsetP) + +#define BitPutIntV(dstP, dstBitOffsetP, value) \ + NetLibBitPutIntV(netPrvRefnum, dstP, dstBitOffsetP, value) + +#define BitGetIntV(srcP, srcBitOffsetP) \ + NetLibBitGetIntV(netPrvRefnum, srcP, srcBitOffsetP) + + +//===================================================== +// 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 +//==================================================== +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Bit Moving functions. For "slim" bit packing protocols +// used over wireless. +//-------------------------------------------------- +void NetLibBitMove(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + UInt8 *srcP, UInt32 *srcBitOffsetP, + UInt32 numBits) + SYS_TRAP(netLibTrapBitMove); + + +void NetLibBitPutFixed(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + UInt32 value, UInt16 numBits) + SYS_TRAP(netLibTrapBitPutFixed); + +UInt32 NetLibBitGetFixed(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + UInt16 numBits) + SYS_TRAP(netLibTrapBitGetFixed); + +void NetLibBitPutUIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + UInt32 value) + SYS_TRAP(netLibTrapBitPutUIntV); + +UInt32 NetLibBitGetUIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP) + SYS_TRAP(netLibTrapBitGetUIntV); + +void NetLibBitPutIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP, + Int32 value) + SYS_TRAP(netLibTrapBitPutUIntV); + +Int32 NetLibBitGetIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP) + SYS_TRAP(netLibTrapBitGetUIntV); + +#ifdef __cplusplus +} +#endif + + +#endif // __NETBITUTILS_H__ diff --git a/sdk-4/include/Core/System/NetMgr.h b/sdk-4/include/Core/System/NetMgr.h new file mode 100644 index 0000000..b94eb0e --- /dev/null +++ b/sdk-4/include/Core/System/NetMgr.h @@ -0,0 +1,1630 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __NETMGR_H__ +#define __NETMGR_H__ + +#include +#include +#include +#include + +// Get rid of warnings about unused pragmas when compiling with +// Visual C +#ifdef _MSC_VER +#pragma warning( disable : 4068) +#endif + +/******************************************************************** + * Type and creator of Net Library database + ********************************************************************/ + +// Creator. Used for both the database that contains the Net Library and +// it's preferences database. +#define netCreator 'netl' // Our Net Library creator + +// Feature Creators and numbers, for use with the FtrGet() call. This +// feature can be obtained to get the current version of the Net Library +#define netFtrCreator netCreator +#define netFtrNumVersion 0 // get version of Net Library + // 0xMMmfsbbb, where MM is major version, m is minor version + // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development, + // bbb is build number for non-releases + // V1.12b3 would be: 0x01122003 + // V2.00a2 would be: 0x02001002 + // V1.01 would be: 0x01013000 + +// Begin Change (BGT) +// Feature for defining the number of command blocks to allocate +#define netFtrCommandBlocks 1 // get the number of command blocks + + +// Types. Used to identify the Net Library from it's prefs. +#define netLibType 'libr' // Our Net Code Resources Database type +#define netPrefsType 'rsrc' // Our Net Preferences Database type + + +// All Network interface's have the following type: +#define netIFFileType 'neti' // The filetype of all Network Interfaces + +// Each Network interface has a unique creator: +#define netIFCreatorLoop 'loop' // Loopback network interface creator. +#define netIFCreatorSLIP 'slip' // SLIP network interface creator. +#define netIFCreatorPPP 'ppp_' // PPP network interface creator. +// +#define netIFCreatorRAM 'ram_' // Mobitex network interface creator + + +// Special value for configIndex parameter to NetLibOpenConfig that tells it +// to use the current settings - even if they are not the defined default settings +// This is provided for testing purposes +#define netConfigIndexCurSettings 0xFFFF + +// Commented out netMaxNetIFs since Tim says it should NOT be here!! +// Still need to fix (Eleven) code that currently depends on it... +// Max # of interfaces that can be installed +//#define netMaxNetIFs 4 + + +//----------------------------------------------------------------------------- +// Misc. constants +//----------------------------------------------------------------------------- +#define netDrvrTypeNameLen 8 // Maximum driver type length +#define netDrvrHWNameLen 16 // Maximum driver hardware name length +#define netIFNameLen 10 // Maximum interface name (driver type + instance num) +#define netIFMaxHWAddrLen 14 // Maximum size of a hardware address +#define netMaxIPAddrStrLen 16 // Max length of an IP address string with null terminator (255.255.255.255) + + + +//----------------------------------------------------------------------------- +// Names of built-in configuration aliases available through the +// NetLibConfigXXX calls +//----------------------------------------------------------------------------- +#define netCfgNameDefault ".Default" // The default configuration +#define netCfgNameDefWireline ".DefWireline" // The default wireline configuration +#define netCfgNameDefWireless ".DefWireless" // The default wireless configuration +#define netCfgNameCTPWireline ".CTPWireline" // Wireline through the Jerry Proxy +#define netCfgNameCTPWireless ".CTPWireless" // Wireless through the Jerry Proxy + + +//----------------------------------------------------------------------------- +//Flags for the NetUWirelessAppHandleEvent() utility routine +//----------------------------------------------------------------------------- +#define netWLAppEventFlagCTPOnly 0x00000001 // using wireless radio for CTP protocol only +#define netWLAppEventFlagDisplayErrs 0x00000002 // Show error alerts for any errors + +//----------------------------------------------------------------------------- +// Option constants that can be passed to NetSocketOptionSet and NetSocketOptionGet +// When an option is set or retrieved, both the level of the option and the +// option number must be specified. The level refers to which layer the option +// refers to, like the uppermost socket layer, for example. +//----------------------------------------------------------------------------- + +// Socket level options +typedef enum { + // IP Level options + netSocketOptIPOptions = 1, // options in IP header (IP_OPTIONS) + + // TCP Level options + netSocketOptTCPNoDelay = 1, // don't delay send to coalesce packets + netSocketOptTCPMaxSeg = 2, // TCP maximum segment size (TCP_MAXSEG) + + // Socket level options + netSocketOptSockDebug = 0x0001, // turn on debugging info recording + netSocketOptSockAcceptConn = 0x0002, // socket has had listen + netSocketOptSockReuseAddr = 0x0004, // allow local address reuse + netSocketOptSockKeepAlive = 0x0008, // keep connections alive + netSocketOptSockDontRoute = 0x0010, // just use interface addresses + netSocketOptSockBroadcast = 0x0020, // permit sending of broadcast msgs + netSocketOptSockUseLoopback = 0x0040, // bypass hardware when possible + netSocketOptSockLinger = 0x0080, // linger on close if data present + netSocketOptSockOOBInLine = 0x0100, // leave received OutOfBand data in line + + netSocketOptSockSndBufSize = 0x1001, // send buffer size + netSocketOptSockRcvBufSize = 0x1002, // receive buffer size + netSocketOptSockSndLowWater = 0x1003, // send low-water mark + netSocketOptSockRcvLowWater = 0x1004, // receive low-water mark + netSocketOptSockSndTimeout = 0x1005, // send timeout + netSocketOptSockRcvTimeout = 0x1006, // receive timeout + netSocketOptSockErrorStatus= 0x1007, // get error status and clear + netSocketOptSockSocketType = 0x1008, // get socket type + + // The following are Pilot specific options + netSocketOptSockNonBlocking = 0x2000, // set non-blocking mode on or off + netSocketOptSockRequireErrClear = 0x2001, // return error from all further calls to socket + // unless netSocketOptSockErrorStatus is cleared. + netSocketOptSockMultiPktAddr = 0x2002, // for SOCK_RDM (RMP) sockets. This is the + // fixed IP addr (i.e. Mobitex MAN #) to use + // for multiple packet requests. + // for socket notification + // 05/20/00 jhl + netSocketOptSockNotice = 0x2003 // prime socket for notification + + } NetSocketOptEnum; + + +// Option levels for SocketOptionSet and SocketOptionGet +typedef enum { + netSocketOptLevelIP = 0, // IP level options (IPPROTO_IP) + netSocketOptLevelTCP = 6, // TCP level options (IPPROTO_TCP) + netSocketOptLevelSocket = 0xFFFF // Socket level options (SOL_SOCKET) + } NetSocketOptLevelEnum; + + +// Structure used for manipulating the linger option +typedef struct { + Int16 onOff; // option on/off + Int16 time; // linger time in seconds + } NetSocketLingerType; + +//----------------------------------------------------------------------------- +// Enumeration of Socket domains and types passed to NetSocketOpen +//----------------------------------------------------------------------------- +typedef enum { + netSocketAddrRaw=0, // (AF_UNSPEC, AF_RAW) + netSocketAddrINET=2 // (AF_INET) + } NetSocketAddrEnum; + +typedef enum { + netSocketTypeStream=1, // (SOCK_STREAM) + netSocketTypeDatagram=2, // (SOCK_DGRAM) + netSocketTypeRaw=3, // (SOCK_RAW) + netSocketTypeReliableMsg=4, // (SOCK_RDM) + netSocketTypeLicensee=8 // Socket entry reserved for licensees. + } NetSocketTypeEnum; + +// Protocols, passed in the protocol parameter to NetLibSocketOpen +#define netSocketProtoIPICMP 1 // IPPROTO_ICMP +#define netSocketProtoIPTCP 6 // IPPROTO_TCP +#define netSocketProtoIPUDP 17 // IPPROTO_UDP +#define netSocketProtoIPRAW 255 // IPPROTO_RAW + + +//----------------------------------------------------------------------------- +// Enumeration of Socket direction, passed to NetSocketShutdown +//----------------------------------------------------------------------------- +typedef enum { + netSocketDirInput=0, + netSocketDirOutput=1, + netSocketDirBoth=2 + } NetSocketDirEnum; + + +//----------------------------------------------------------------------------- +// Basic Types +//----------------------------------------------------------------------------- +// Socket refnum +typedef Int16 NetSocketRef; + +// Type used to hold internet addresses +typedef UInt32 NetIPAddr; // a 32-bit IP address. + +// IFMediaEvent notifications types +typedef enum { + netIFMediaUp = 1, // Usually sent by Network interfaces + // after they have displayed the UI for displaying + // connection establishment progress. + + netIFMediaDown // Sent by Network interface's when their inactivity timer + // is ellapsed. +} NetLibIFMediaEventNotificationTypeEnum; + + +// Notification structure sent in SysNotifyNetLibIFMedia. +typedef struct SysNotifyNetLibIFMediaTag { + NetLibIFMediaEventNotificationTypeEnum eType; + UInt32 ifCreator; // interface creator + UInt16 ifInstance; // interface instance +} SysNotifyNetLibIFMediaType; + + +//----------------------------------------------------------------------------- +// For socket notification +// 05/20/00 jhl +//----------------------------------------------------------------------------- + +// Notice types +typedef enum { + netSocketNoticeNotify = 1, +// ummmm... +// shouldn't do this - must fix EventMgr before background/ISR events can be posted + netSocketNoticeEvent, + netSocketNoticeMailbox, + netSocketNoticeCallback, + netSocketNoticeWake +} NoticeTypeEnum; + +// Notification structure sent for netSocketNoticeNotify. +typedef struct SysNotifyNetSocketType { + NetSocketRef socketRef; // Socket sending the notification + UInt32 condition; // Bit field reporting trigger conditions +} SysNotifyNetSocketType; + +// Event structure sent for netSocketNoticeEvent. +// This should be defined via Event.h, so it stays in sync. +typedef struct NetSocketNoticeEventType { + eventsEnum eType; // User specified event type + Boolean penDown; + UInt8 tapCount; + Int16 screenX; + Int16 screenY; + union { + struct _GenericEventType generic; // Establish size of union + struct { + NetSocketRef socketRef; // Socket sending the notification + UInt32 condition; // Bit field reporting trigger conditions + } netSocketNotice; + } data; +} NetSocketNoticeEventType; + +// Mailbox structure sent for netSocketNoticeMailbox. +typedef struct NetSocketNoticeMailboxType { + UInt32 message; // User specified message + UInt16 reserved; + NetSocketRef socketRef; // Socket sending the notification + UInt32 condition; // Bit field reporting trigger conditions +} NetSocketNoticeMailboxType; + +// Callback definition for netSocketNoticeCallback. +typedef Err (*NetSocketNoticeCallbackPtr)(void *userDataP,UInt16 socketRef,UInt32 condition); + +// Structure used to register for a notice +typedef struct NetSocketNoticeType { + UInt32 condition; // Bit field specifying trigger conditions + NoticeTypeEnum type; // Notice type + union { + struct { + UInt32 notifyType; // Notification type + // sends SysNotifyNetSocketType in notification + } notify; +// ummmm... +// shouldn't do this - must fix EventMgr before background/ISR events can be posted + struct { + eventsEnum eType; // Event type + // adds NetSocketNoticeEventType event to UI event queue + } event; + struct { + UInt32 mailboxID; // ID of mailbox for send + UInt32 message; // first element of mailbox message + UInt32 wAck; // third argument to SysMailboxSend() + // sends NetSocketNoticeMailboxType message to specified mailboxID + } mailbox; + struct { + NetSocketNoticeCallbackPtr callbackP; // Callback proc pointer + void *userDataP; // User specified ptr passed as callback parameter + // (*callbackP)(userDataP,socketRef,condition) + } callback; + struct { + UInt32 taskID; // ID of task to wake + NetSocketRef *socketRefP; // address to receive socketRef + UInt32 *conditionP; // address to receive trigger condition + } wake; // SysTaskWake(taskID) + } notice; +} NetSocketNoticeType; + +// Bit values for specifying and reporting trigger conditions +#define netSocketNoticeErr 0x00000001 +#define netSocketNoticeUDPReceive 0x00000002 +#define netSocketNoticeTCPReceive 0x00000004 +#define netSocketNoticeTCPTransmit 0x00000008 +#define netSocketNoticeTCPRemoteClosed 0x00000010 +#define netSocketNoticeTCPClosed 0x00000020 +#define netSocketNoticeConnectInbound 0x00000040 +#define netSocketNoticeConnectOutbound 0x00000080 + + +//----------------------------------------------------------------------------- +// Structure used to hold an internet socket address. This includes the internet +// address and the port number. This structure directly maps to the BSD unix +// struct sockaddr_in. +//----------------------------------------------------------------------------- +typedef struct NetSocketAddrINType { + Int16 family; // Address family in HBO (Host UInt8 Order) + UInt16 port; // the UDP port in NBO (Network UInt8 Order) + NetIPAddr addr; // IP address in NBO (Network UInt8 Order) + } NetSocketAddrINType; + +// Constant that means "use the local machine's IP address" +#define netIPAddrLocal 0 // Can be used in NetSockAddrINType.addr + + +// Structure used to hold a generic socket address. This is a generic struct +// designed to hold any type of address including internet addresses. This +// structure directly maps to the BSD unix struct sockaddr. +typedef struct NetSocketAddrType { + Int16 family; // Address family + UInt8 data[14]; // 14 bytes of address + } NetSocketAddrType; + + +// Structure used to hold a raw socket address. When using the netSocketAddrRaw +// protocol family, the caller must bind() the socket to an interface and +// specifies the interface using this structure. IMPORTANT: NUMEROUS +// ROUTINES IN NETLIB RELY ON THE FACT THAT THIS STRUCTURE IS THE SAME +// SIZE AS A NetSocketAddrINType STRUCTURE. +typedef struct NetSocketAddrRawType { + Int16 family; // Address family in HBO (Host UInt8 Order) + UInt16 ifInstance; // the interface instance number + UInt32 ifCreator; // the interface creator + } NetSocketAddrRawType; + + + +//----------------------------------------------------------------------------- +// Structure used to hold information about data to be sent. This structure +// is passed to NetLibSendMsg and contains the optional address to send to, +// a scatter-write array of data to be sent, and optional access rights +//----------------------------------------------------------------------------- + +// Scatter/Gather array type. A pointer to an array of these structs is +// passed to the NetLibSendPB and NetLibRecvPB calls. It specifies where +// data should go to or come from as a list of buffer addresses and sizes. +typedef struct NetIOVecType { + UInt8 * bufP; // buffer address + UInt16 bufLen; // buffer length + } NetIOVecType, *NetIOVecPtr; + +#define netIOVecMaxLen 16 // max# of NetIOVecTypes in an array + +// Read/Write ParamBlock type. Passed directly to the SendPB and RecvPB calls. +typedef struct { + UInt8 * addrP; // address - or 0 for default + UInt16 addrLen; // length of address + NetIOVecPtr iov; // scatter/gather array + UInt16 iovLen; // length of above array + UInt8 * accessRights; // access rights + UInt16 accessRightsLen; // length of accessrights + } NetIOParamType, *NetIOParamPtr; + +// Flags values for the NetLibSend, NetLibReceive calls +#define netIOFlagOutOfBand 0x01 // process out-of-band data +#define netIOFlagPeek 0x02 // peek at incoming message +#define netIOFlagDontRoute 0x04 // send without using routing + + + +//----------------------------------------------------------------------------- +// Structures used for looking up a host by name or address (NetLibGetHostByName) +//----------------------------------------------------------------------------- + +// Equates for DNS names, from RFC-1035 +#define netDNSMaxDomainName 255 +#define netDNSMaxDomainLabel 63 + +#define netDNSMaxAliases 1 // max # of aliases for a host +#define netDNSMaxAddresses 4 // max # of addresses for a host + + +// The actual results of NetLibGetHostByName() are returned in this structure. +// This structure is designed to match the "struct hostent" structure in Unix. +typedef struct { + Char * nameP; // official name of host + Char ** nameAliasesP; // array of alias's for the name + UInt16 addrType; // address type of return addresses + UInt16 addrLen; // the length, in bytes, of the addresse + //Note this denotes length of a address, not # of addresses. + UInt8 ** addrListP; // array of ptrs to addresses in HBO + } NetHostInfoType, *NetHostInfoPtr; + + +// "Buffer" passed to call as a place to store the results +typedef struct { + NetHostInfoType hostInfo; // high level results of call are here + + // The following fields contain the variable length data that + // hostInfo points to + Char name[netDNSMaxDomainName+1]; // hostInfo->name + + Char *aliasList[netDNSMaxAliases+1]; // +1 for 0 termination. + Char aliases[netDNSMaxAliases][netDNSMaxDomainName+1]; + + NetIPAddr* addressList[netDNSMaxAddresses]; + NetIPAddr address[netDNSMaxAddresses]; + + } NetHostInfoBufType, *NetHostInfoBufPtr; + + +//----------------------------------------------------------------------------- +// Structures used for looking up a service (NetLibGetServByName) +//----------------------------------------------------------------------------- + +// Equates for service names +#define netServMaxName 15 // max # characters in service name +#define netProtoMaxName 15 // max # characters in protocol name +#define netServMaxAliases 1 // max # of aliases for a service + + +// The actual results of NetLibGetServByName() are returned in this structure. +// This structure is designed to match the "struct servent" structure in Unix. +typedef struct { + Char * nameP; // official name of service + Char ** nameAliasesP; // array of alias's for the name + UInt16 port; // port number for this service + Char * protoP; // name of protocol to use + } NetServInfoType, *NetServInfoPtr; + +// "Buffer" passed to call as a place to store the results +typedef struct { + NetServInfoType servInfo; // high level results of call are here + + // The following fields contain the variable length data that + // servInfo points to + Char name[netServMaxName+1]; // hostInfo->name + + Char * aliasList[netServMaxAliases+1]; // +1 for 0 termination. + Char aliases[netServMaxAliases][netServMaxName]; + Char protoName[netProtoMaxName+1]; + + UInt8 reserved; + } NetServInfoBufType, *NetServInfoBufPtr; + + + +//-------------------------------------------------------------------- +// Structure of a configuration name. Used by NetLibConfigXXX calls +// added for the new Config calls. +//--------------------------------------------------------------------- +#define netConfigNameSize 32 +typedef struct { + Char name[netConfigNameSize]; // name of configuration + } NetConfigNameType, *NetConfigNamePtr; + + + +/******************************************************************** + * Tracing Flags. These flags are ORed together and passed as a UInt32 + * in the netSettingTraceFlags setting and netIFSettingTraceFlags to + * enable/disable various trace options. + ********************************************************************/ +#define netTracingErrors 0x00000001 // record errors +#define netTracingMsgs 0x00000002 // record messages +#define netTracingPktIP 0x00000004 // record packets sent/received + // to/from interfaces at the IP layer + // NOTE: netTracingPktData40 & netTracingPktData + // will control how much data of each packet is + // recorded. +#define netTracingFuncs 0x00000008 // record function flow +#define netTracingAppMsgs 0x00000010 // record application messages + // (NetLibTracePrintF, NetLibTracePutS) +#define netTracingPktData40 0x00000020 // record first 40 bytes of packets + // when netTracingPktsXX is also on. + // NOTE: Mutually exclusive with + // netTracingPktData and only applicable if + // one of the netTracingPktsXX bits is also set +#define netTracingPktData 0x00000040 // record all bytes of IP packets + // sent/received to/from interfaces + // NOTE: Mutually exclusive with + // netTracingPkts & netTracingPktData64 +#define netTracingPktIFHi 0x00000080 // record packets sent/received at highest layer + // of interface (just below IP layer). + // NOTE: netTracingPktData40 & netTracingPktData + // will control how much data of each packet is + // recorded. +#define netTracingPktIFMid 0x00000100 // record packets sent/received at mid layer + // of interface (just below IFHi layer). + // NOTE: netTracingPktData40 & netTracingPktData + // will control how much data of each packet is + // recorded. +#define netTracingPktIFLow 0x00000200 // record packets sent/received at low layer + // of interface (just below IFMid layer). + // NOTE: netTracingPktData40 & netTracingPktData + // will control how much data of each packet is + // recorded. + + +// OBSOLETE tracing bit, still used by Network Panel +#define netTracingPkts netTracingPktIP + + +/******************************************************************** + * Command numbers and parameter blocks for the NetLibMaster() call. + * This call is used to put the Net library into certain debugging modes + * or for obtaining statistics from the Net Library. + * + ********************************************************************/ +#pragma mark Master +typedef enum { + // These calls return info + netMasterInterfaceInfo, + netMasterInterfaceStats, + netMasterIPStats, + netMasterICMPStats, + netMasterUDPStats, + netMasterTCPStats, + + // This call used to read the trace buffer. + netMasterTraceEventGet // get trace event by index + + } NetMasterEnum; + + +typedef struct NetMasterPBType { + + // These fields are specific to each command + union { + + //............................................................. + // InterfaceInfo command + //............................................................. + struct { + UInt16 index; // -> index of interface + UInt32 creator; // <- creator + UInt16 instance; // <- instance + void * netIFP; // <- net_if pointer + + // driver level info + Char drvrName[netDrvrTypeNameLen]; // <- type of driver (SLIP,PPP, etc) + Char hwName[netDrvrHWNameLen]; // <- hardware name (Serial Library, etc) + UInt8 localNetHdrLen; // <- local net header length + UInt8 localNetTrailerLen; // <- local net trailer length + UInt16 localNetMaxFrame; // <- local net maximum frame size + + // media layer info + Char ifName[netIFNameLen];// <- interface name w/instance + Boolean driverUp; // <- true if interface driver up + Boolean ifUp; // <- true if interface is up + UInt16 hwAddrLen; // <- length of hardware address + UInt8 hwAddr[netIFMaxHWAddrLen]; // <- hardware address + UInt16 mtu; // <- maximum transfer unit of interface + UInt32 speed; // <- speed in bits/sec. + UInt32 lastStateChange; // <- time in milliseconds of last state change + + // Address info + NetIPAddr ipAddr; // Address of this interface + NetIPAddr subnetMask; // subnet mask of local network + NetIPAddr broadcast; // broadcast address of local network + } interfaceInfo; + + //............................................................. + // InterfaceStats command + //............................................................. + struct { + UInt16 index; // -> index of interface + UInt32 inOctets; // <- .... + UInt32 inUcastPkts; + UInt32 inNUcastPkts; + UInt32 inDiscards; + UInt32 inErrors; + UInt32 inUnknownProtos; + UInt32 outOctets; + UInt32 outUcastPkts; + UInt32 outNUcastPkts; + UInt32 outDiscards; + UInt32 outErrors; + } interfaceStats; + + //............................................................. + // IPStats command + //............................................................. + struct { + UInt32 ipInReceives; + UInt32 ipInHdrErrors; + UInt32 ipInAddrErrors; + UInt32 ipForwDatagrams; + UInt32 ipInUnknownProtos; + UInt32 ipInDiscards; + UInt32 ipInDelivers; + UInt32 ipOutRequests; + UInt32 ipOutDiscards; + UInt32 ipOutNoRoutes; + UInt32 ipReasmReqds; + UInt32 ipReasmOKs; + UInt32 ipReasmFails; + UInt32 ipFragOKs; + UInt32 ipFragFails; + UInt32 ipFragCreates; + UInt32 ipRoutingDiscards; + UInt32 ipDefaultTTL; + UInt32 ipReasmTimeout; + } ipStats; + + //............................................................. + // ICMPStats command + //............................................................. + struct { + UInt32 icmpInMsgs; + UInt32 icmpInErrors; + UInt32 icmpInDestUnreachs; + UInt32 icmpInTimeExcds; + UInt32 icmpInParmProbs; + UInt32 icmpInSrcQuenchs; + UInt32 icmpInRedirects; + UInt32 icmpInEchos; + UInt32 icmpInEchoReps; + UInt32 icmpInTimestamps; + UInt32 icmpInTimestampReps; + UInt32 icmpInAddrMasks; + UInt32 icmpInAddrMaskReps; + UInt32 icmpOutMsgs; + UInt32 icmpOutErrors; + UInt32 icmpOutDestUnreachs; + UInt32 icmpOutTimeExcds; + UInt32 icmpOutParmProbs; + UInt32 icmpOutSrcQuenchs; + UInt32 icmpOutRedirects; + UInt32 icmpOutEchos; + UInt32 icmpOutEchoReps; + UInt32 icmpOutTimestamps; + UInt32 icmpOutTimestampReps; + UInt32 icmpOutAddrMasks; + UInt32 icmpOutAddrMaskReps; + } icmpStats; + + //............................................................. + // UDPStats command + //............................................................. + struct { + UInt32 udpInDatagrams; + UInt32 udpNoPorts; + UInt32 udpInErrors; + UInt32 udpOutDatagrams; + } udpStats; + + //............................................................. + // TCPStats command + //............................................................. + struct { + UInt32 tcpRtoAlgorithm; + UInt32 tcpRtoMin; + UInt32 tcpRtoMax; + UInt32 tcpMaxConn; + UInt32 tcpActiveOpens; + UInt32 tcpPassiveOpens; + UInt32 tcpAttemptFails; + UInt32 tcpEstabResets; + UInt32 tcpCurrEstab; + UInt32 tcpInSegs; + UInt32 tcpOutSegs; + UInt32 tcpRetransSegs; + UInt32 tcpInErrs; + UInt32 tcpOutRsts; + } tcpStats; + + //............................................................. + // TraceEventGet command + //............................................................. + struct { + UInt16 index; // which event + Char * textP; // ptr to text string to return it in + } traceEventGet; + + } param; + + } NetMasterPBType, *NetMasterPBPtr; + + + + + +//----------------------------------------------------------------------------- +// Enumeration of Net settings as passed to NetLibSettingGet/Set. +//----------------------------------------------------------------------------- +#pragma mark Settings +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Global environment settings common to all attached network interfaces, +// passed to NetLibSettingGet/Set +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +typedef enum { + netSettingResetAll, // void, NetLibSettingSet only, resets all settings + // to their defaults. + + netSettingPrimaryDNS, // UInt32, IP address of Primary DN Server + netSettingSecondaryDNS, // UInt32, IP address of Secondary DN Server + netSettingDefaultRouter, // UInt32, IP address of Default router + netSettingDefaultIFCreator, // UInt32, Creator type of default interface + netSettingDefaultIFInstance, // UInt16, Instance# of default interface + netSettingHostName, // Char[64], name of host (not including domain) + netSettingDomainName, // Char[256], domain name of hosts's domain + netSettingHostTbl, // Char[], host table + netSettingCloseWaitTime, // UInt32, time in milliseconds to stay in close-wait state + netSettingInitialTCPResendTime, // UInt32, time in milliseconds before TCP resends a packet. + // This is just the initial value, the timeout is adjusted + // from this initial value depending on history of ACK times. + // This is sometimes referred to as the RTO (Roundtrip Time Out) + // See RFC-1122 for additional information. + + + // The following settings are not used for configuration, but rather put the + // stack into various modes for debugging, etc. + netSettingTraceBits = 0x1000, // UInt32, enable/disable various trace flags (netTraceBitXXXX) + netSettingTraceSize, // UInt32, max trace buffer size in bytes. Default 0x800. + // Setting this will also clear the trace buffer. + netSettingTraceStart, // UInt32, for internal use ONLY!! + netSettingTraceRoll, // UInt8, if true, trace buffer will rollover after it fills. + // Default is true. + + netSettingRTPrimaryDNS, // used internally by Network interfaces + // that dynamically obtain the DNS address + netSettingRTSecondaryDNS, // used internally by Network interfaces + // that dynamically obtain the DNS address + + netSettingConfigTable // used internally by NetLib - NOT FOR USE BY + // APPLICATIONS!! + + } NetSettingEnum; + + +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Settings for each Network Interface, passed to NetLibIFSettingGet/Set +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +typedef enum { + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Reset all settings to defaults + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingResetAll, // void, NetLibIFSettingSet only, resets all settings + // to their defaults. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Status - read only + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingUp, // UInt8, true if interface is UP. + netIFSettingName, // Char[32], name of interface + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Addressing + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingReqIPAddr, // UInt32, requested IP address of this interface + netIFSettingSubnetMask, // UInt32, subnet mask of this interface + netIFSettingBroadcast, // UInt32, broadcast address for this interface + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // User Info + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingUsername, // Char[], login script user name + // If 0 length, then user will be prompted for it + netIFSettingPassword, // Char[], login script user password + // If 0 length, then user will be prompted for it + netIFSettingDialbackUsername, // Char[], login script dialback user name. + // If 0 length, then netIFSettingUsername is used + netIFSettingDialbackPassword, // Char[], login script dialback user password. + // If 0 length, then user will be prompted for it + netIFSettingAuthUsername, // Char[], PAP/CHAP name. + // If 0 length, then netIFSettingUsername is used + netIFSettingAuthPassword, // Char[], PAP/CHAP password. + // If "$", then user will be prompted for it + // else If 0 length, then netIFSettingPassword or result + // of it's prompt (if it was empty) will be used + // else it is used as-is. + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // Connect Settings + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingServiceName, // Char[], name of service + netIFSettingLoginScript, // Char[], login script + netIFSettingConnectLog, // Char[], connect log + netIFSettingInactivityTimeout, // UInt16, # of seconds of inactivity allowed before + // interface is brought down. If 0 then + // no inactivity timeout enforced. + netIFSettingEstablishmentTimeout, // UInt16, max delay in seconds between connection + // establishment stages + + // Serial based protocol options + netIFSettingDynamicIP, // UInt8, if true, get IP address from server + // N/A for SLIP + netIFSettingVJCompEnable, // UInt8, if true enable VJ Header compression + // Default is on for PPP, off for SLIP + netIFSettingVJCompSlots, // UInt8, # of slots to use for VJ compression. + // Default is 4 for PPP, 16 for SLIP + // (each slot uses 256 bytes of RAM). + netIFSettingMTU, // UInt16, maximum transmission unit in bytes + // ignored in current PPP and SLIP interfaces + netIFSettingAsyncCtlMap, // UInt32, bitmask of characters to escape + // ignored in current PPP interfaces + + // Serial settings, used by serial based network interfaces + netIFSettingPortNum, // UInt16, port number to use + netIFSettingBaudRate, // UInt32, baud rate in bits/sec. + netIFSettingFlowControl, // UInt8, flow control setting bits. Set to 0x01 for + // hardware flow control, else set to 0x00. + netIFSettingStopBits, // UInt8, # of stop bits + netIFSettingParityOn, // UInt8, true if parity on + netIFSettingParityEven, // UInt8, true if parity even + + // Modem settings, optionally used by serial based network interfaces + netIFSettingUseModem, // UInt8, if true dial-up through modem + netIFSettingPulseDial, // UInt8, if true use pulse dial, else tone + netIFSettingModemInit, // Char[], modem initialization string + netIFSettingModemPhone, // Char[], modem phone number string + netIFSettingRedialCount, // UInt16, # of times to redial + + + //--------------------------------------------------------------------------------- + // New Settings as of PalmOS 3.0 + // Power control, usually only implemented by wireless interfaces + //--------------------------------------------------------------------------------- + netIFSettingPowerUp, // UInt8, true if this interface is powered up + // false if this interface is in power-down mode + // interfaces that don't support power modes should + // quietly ignore this setting. + + // Wireless or Wireline, read-only, returns true for wireless interfaces. this + // setting is used by application level functions to determine which interface(s) + // to attach/detach given user preference and/or state of the antenna. + netIFSettingWireless, // UInt8, true if this interface is wireless + + + + // Option to query server for address of DNS servers + netIFSettingDNSQuery, // UInt8, if true PPP queries for DNS address. Default true + + + //--------------------------------------------------------------------------------- + // New Settings as of PalmOS 3.2 + // Power control, usually only implemented by wireless interfaces + //--------------------------------------------------------------------------------- + + netIFSettingQuitOnTxFail, // BYTE W-only. Power down RF on tx fail + netIFSettingQueueSize, // UInt8 R-only. The size of the Tx queue in the RF interface + netIFSettingTxInQueue, // BYTE R-only. Packets remaining to be sent + netIFSettingTxSent, // BYTE R-only. Packets sent since SocketOpen + netIFSettingTxDiscard, // BYTE R-only. Packets discarded on SocketClose + netIFSettingRssi, // char R-only. signed value in dBm. + netIFSettingRssiAsPercent, // char R-only. signed value in percent, with 0 being no coverage and 100 being excellent. + netIFSettingRadioState, // enum R-only. current state of the radio + netIFSettingBase, // UInt32 R-only. Interface specific + netIFSettingRadioID, // UInt32[2] R-only, two 32-bit. interface specific + netIFSettingBattery, // UInt8, R-only. percentage of battery left + netIFSettingNetworkLoad, // UInt8, R-only. percent estimate of network loading + + //--------------------------------------------------------------------------------- + // New Settings as of PalmOS 3.3 + //--------------------------------------------------------------------------------- + + netIFSettingConnectionName, // Char [] Connection Profile Name + + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // The following settings are not used for configuration, but rather put the + // stack into various modes for debugging, etc. + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingTraceBits = 0x1000, // UInt32, enable/disable various trace flags (netTraceBitXXXX) + netIFSettingGlobalsPtr, // UInt32, (Read-Only) sinterface's globals ptr + netIFSettingActualIPAddr, // UInt32, (Read-Only) the actual IP address that the interface + // ends up using. The login script executor stores + // the result of the "g" script command here as does + // the PPP negotiations. + netIFSettingServerIPAddr, // UInt32, (Read-Only) the IP address of the PPP server + // we're connected to + + + // The following setting should be true if this network interface should be + // brought down when the Pilot is turned off. + netIFSettingBringDownOnPowerDown, // UInt8, if true interface will be brought down when + // Pilot is turned off. + + // The following setting is used by the TCP/IP stack ONLY!! It tells the interface + // to pass all received packets as-is to the NetIFCallbacksPtr->raw_rcv() routine. + // This setting gets setup when an application creates a raw socket in the raw domain + netIFSettingRawMode, // UInt32, parameter to pass to raw_rcv() along with + // packet pointer. + + //--------------------------------------------------------------------------------- + // 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, // void* R-only: Allocated memory buffer - must be free by caller + + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // 3rd party settings start here... + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + netIFSettingCustom = 0x8000 + + } NetIFSettingEnum; + + + +//========================================================================================= +// Enums for the netIFSettingRadioState setting +// +// JB added for the radio state setting. +// fixed naming conventions. +//========================================================================================= +typedef enum { + netRadioStateOffNotConnected=0, + netRadioStateOnNotConnected, // scanning + netRadioStateOnConnected, // have channel + netRadioStateOffConnected + } NetRadioStateEnum; + + + +/************************************************************ + * Net Library Macros + *************************************************************/ +// Return current time in milliseconds. +#define NetNow() (TimGetTicks() * 1000L/sysTicksPerSecond) + + +// File Descriptor macros used for the NetLibSelect() call +typedef UInt32 NetFDSetType; +#define netFDSetSize 32 + +#define netFDSet(n,p) ((*p) |= (1L << n)) +#define netFDClr(n,p) ((*p) &= ~(1L << n)) +#define netFDIsSet(n,p) ((*p) & (1L << n)) +#define netFDZero(p) ((*p) = 0) + + + +//----------------------------------------------------------------------------- +// Net error codes +//----------------------------------------------------------------------------- +#pragma mark ErrorCodes +#define netErrAlreadyOpen (netErrorClass | 1) +#define netErrNotOpen (netErrorClass | 2) +#define netErrStillOpen (netErrorClass | 3) +#define netErrParamErr (netErrorClass | 4) +#define netErrNoMoreSockets (netErrorClass | 5) +#define netErrOutOfResources (netErrorClass | 6) +#define netErrOutOfMemory (netErrorClass | 7) // Might be because free heap space is <32K probably because handheld's RAM <2MB +#define netErrSocketNotOpen (netErrorClass | 8) +#define netErrSocketBusy (netErrorClass | 9) //EINPROGRESS +#define netErrMessageTooBig (netErrorClass | 10) +#define netErrSocketNotConnected (netErrorClass | 11) +#define netErrNoInterfaces (netErrorClass | 12) //ENETUNREACH +#define netErrBufTooSmall (netErrorClass | 13) +#define netErrUnimplemented (netErrorClass | 14) +#define netErrPortInUse (netErrorClass | 15) //EADDRINUSE +#define netErrQuietTimeNotElapsed (netErrorClass | 16) //EADDRINUSE +#define netErrInternal (netErrorClass | 17) +#define netErrTimeout (netErrorClass | 18) //ETIMEDOUT +#define netErrSocketAlreadyConnected (netErrorClass | 19) //EISCONN +#define netErrSocketClosedByRemote (netErrorClass | 20) +#define netErrOutOfCmdBlocks (netErrorClass | 21) +#define netErrWrongSocketType (netErrorClass | 22) +#define netErrSocketNotListening (netErrorClass | 23) +#define netErrUnknownSetting (netErrorClass | 24) +#define netErrInvalidSettingSize (netErrorClass | 25) +#define netErrPrefNotFound (netErrorClass | 26) +#define netErrInvalidInterface (netErrorClass | 27) +#define netErrInterfaceNotFound (netErrorClass | 28) +#define netErrTooManyInterfaces (netErrorClass | 29) +#define netErrBufWrongSize (netErrorClass | 30) +#define netErrUserCancel (netErrorClass | 31) +#define netErrBadScript (netErrorClass | 32) +#define netErrNoSocket (netErrorClass | 33) +#define netErrSocketRcvBufFull (netErrorClass | 34) +#define netErrNoPendingConnect (netErrorClass | 35) +#define netErrUnexpectedCmd (netErrorClass | 36) +#define netErrNoTCB (netErrorClass | 37) +#define netErrNilRemoteWindowSize (netErrorClass | 38) +#define netErrNoTimerProc (netErrorClass | 39) +#define netErrSocketInputShutdown (netErrorClass | 40) // EOF to sockets API +#define netErrCmdBlockNotCheckedOut (netErrorClass | 41) +#define netErrCmdNotDone (netErrorClass | 42) +#define netErrUnknownProtocol (netErrorClass | 43) +#define netErrUnknownService (netErrorClass | 44) +#define netErrUnreachableDest (netErrorClass | 45) +#define netErrReadOnlySetting (netErrorClass | 46) +#define netErrWouldBlock (netErrorClass | 47) //EWOULDBLOCK +#define netErrAlreadyInProgress (netErrorClass | 48) //EALREADY +#define netErrPPPTimeout (netErrorClass | 49) +#define netErrPPPBroughtDown (netErrorClass | 50) +#define netErrAuthFailure (netErrorClass | 51) +#define netErrPPPAddressRefused (netErrorClass | 52) +// The following map into the Epilogue DNS errors declared in DNS.ep.h: +// and MUST be kept in this order!! +#define netErrDNSNameTooLong (netErrorClass | 53) +#define netErrDNSBadName (netErrorClass | 54) +#define netErrDNSBadArgs (netErrorClass | 55) +#define netErrDNSLabelTooLong (netErrorClass | 56) +#define netErrDNSAllocationFailure (netErrorClass | 57) +#define netErrDNSTimeout (netErrorClass | 58) +#define netErrDNSUnreachable (netErrorClass | 59) +#define netErrDNSFormat (netErrorClass | 60) +#define netErrDNSServerFailure (netErrorClass | 61) +#define netErrDNSNonexistantName (netErrorClass | 62) +#define netErrDNSNIY (netErrorClass | 63) +#define netErrDNSRefused (netErrorClass | 64) +#define netErrDNSImpossible (netErrorClass | 65) +#define netErrDNSNoRRS (netErrorClass | 66) +#define netErrDNSAborted (netErrorClass | 67) +#define netErrDNSBadProtocol (netErrorClass | 68) +#define netErrDNSTruncated (netErrorClass | 69) +#define netErrDNSNoRecursion (netErrorClass | 70) +#define netErrDNSIrrelevant (netErrorClass | 71) +#define netErrDNSNotInLocalCache (netErrorClass | 72) +#define netErrDNSNoPort (netErrorClass | 73) +// The following map into the Epilogue IP errors declared in IP.ep.h: +// and MUST be kept in this order!! +#define netErrIPCantFragment (netErrorClass | 74) +#define netErrIPNoRoute (netErrorClass | 75) +#define netErrIPNoSrc (netErrorClass | 76) +#define netErrIPNoDst (netErrorClass | 77) +#define netErrIPktOverflow (netErrorClass | 78) +// End of Epilogue IP errors +#define netErrTooManyTCPConnections (netErrorClass | 79) +#define netErrNoDNSServers (netErrorClass | 80) +#define netErrInterfaceDown (netErrorClass | 81) + +// Mobitex network radio interface error code returns +#define netErrNoChannel (netErrorClass | 82) // The datalink layer cannot acquire a channel +#define netErrDieState (netErrorClass | 83) // Mobitex network has issued a DIE command. +#define netErrReturnedInMail (netErrorClass | 84) // The addressed of the transmitted packet was not available, and the message was placed in the network's mailbox. +#define netErrReturnedNoTransfer (netErrorClass | 85) // This message cannot be transferred or put in the network mailbox. +#define netErrReturnedIllegal (netErrorClass | 86) // The message could not be switched to the network +#define netErrReturnedCongest (netErrorClass | 87) // Line, radio channels, or network nodes are congested. +#define netErrReturnedError (netErrorClass | 88) // Technical error in the network. +#define netErrReturnedBusy (netErrorClass | 89) // The B-party is busy. +#define netErrGMANState (netErrorClass | 90) // The modem has not registered with the network. +#define netErrQuitOnTxFail (netErrorClass | 91) // Couldn't get packet through, shutdown. +#define netErrFlexListFull (netErrorClass | 92) // raw IF error message: see Mobitex spec. +#define netErrSenderMAN (netErrorClass | 93) // ditto +#define netErrIllegalType (netErrorClass | 94) // ditto +#define netErrIllegalState (netErrorClass | 95) // ditto +#define netErrIllegalFlags (netErrorClass | 96) // ditto +#define netErrIllegalSendlist (netErrorClass | 97) // ditto +#define netErrIllegalMPAKLength (netErrorClass | 98) // ditto +#define netErrIllegalAddressee (netErrorClass | 99) // ditto +#define netErrIllegalPacketClass (netErrorClass | 100) // ditto +#define netErrBufferLength (netErrorClass | 101) // any +#define netErrNiCdLowBattery (netErrorClass | 102) // any +#define netErrRFinterfaceFatal (netErrorClass | 103) // any +#define netErrIllegalLogout (netErrorClass | 104) // raw IF error message +#define netErrAAARadioLoad (netErrorClass | 105) // 7/20/98 JB. If there is insufficient AAA +#define netErrAntennaDown (netErrorClass | 106) +#define netErrNiCdCharging (netErrorClass | 107) // just for charging +#define netErrAntennaWentDown (netErrorClass | 108) +#define netErrNotActivated (netErrorClass | 109) // The unit has not been FULLY activated. George and Morty completed. +#define netErrRadioTemp (netErrorClass | 110) // Radio's temp is too high for FCC compliant TX +#define netErrNiCdChargeError (netErrorClass | 111) // Charging stopped due to NiCd charging characteristic +#define netErrNiCdSag (netErrorClass | 112) // the computed sag or actual sag indicates a NiCd with diminished capacity. +#define netErrNiCdChargeSuspend (netErrorClass | 113) // Charging has been suspended due to low AAA batteries. +// Left room for more Mobitex errors + +// Configuration errors +#define netErrConfigNotFound (netErrorClass | 115) +#define netErrConfigCantDelete (netErrorClass | 116) +#define netErrConfigTooMany (netErrorClass | 117) +#define netErrConfigBadName (netErrorClass | 118) +#define netErrConfigNotAlias (netErrorClass | 119) +#define netErrConfigCantPointToAlias (netErrorClass | 120) +#define netErrConfigEmpty (netErrorClass | 121) +#define netErrAlreadyOpenWithOtherConfig (netErrorClass | 122) +#define netErrConfigAliasErr (netErrorClass | 123) +#define netErrNoMultiPktAddr (netErrorClass | 124) +#define netErrOutOfPackets (netErrorClass | 125) +#define netErrMultiPktAddrReset (netErrorClass | 126) +#define netErrStaleMultiPktAddr (netErrorClass | 127) + +// Login scripting plugin errors +#define netErrScptPluginMissing (netErrorClass | 128) +#define netErrScptPluginLaunchFail (netErrorClass | 129) +#define netErrScptPluginCmdFail (netErrorClass | 130) +#define netErrScptPluginInvalidCmd (netErrorClass | 131) + +// Telephony errors +#define netErrTelMissingComponent (netErrorClass | 132) +#define netErrTelErrorNotHandled (netErrorClass | 133) + +#define netErrMobitexStart netErrNoChannel +#define netErrMobitexEnd netErrNiCdChargeSuspend + +//----------------------------------------------------------------------------- +// Net library call ID's. Each library call gets the trap number: +// netTrapXXXX which serves as an index into the library's dispatch table. +// The constant sysLibTrapCustom is the first available trap number after +// the system predefined library traps Open,Close,Sleep & Wake. +// +// WARNING!!! This order of these traps MUST match the order of the dispatch +// table in NetDispatch.c!!! +//----------------------------------------------------------------------------- + +#define netLibTrapAddrINToA (sysLibTrapCustom) +#define netLibTrapAddrAToIN (sysLibTrapCustom+1) + +#define netLibTrapSocketOpen (sysLibTrapCustom+2) +#define netLibTrapSocketClose (sysLibTrapCustom+3) +#define netLibTrapSocketOptionSet (sysLibTrapCustom+4) +#define netLibTrapSocketOptionGet (sysLibTrapCustom+5) +#define netLibTrapSocketBind (sysLibTrapCustom+6) +#define netLibTrapSocketConnect (sysLibTrapCustom+7) +#define netLibTrapSocketListen (sysLibTrapCustom+8) +#define netLibTrapSocketAccept (sysLibTrapCustom+9) +#define netLibTrapSocketShutdown (sysLibTrapCustom+10) + +#define netLibTrapSendPB (sysLibTrapCustom+11) +#define netLibTrapSend (sysLibTrapCustom+12) +#define netLibTrapReceivePB (sysLibTrapCustom+13) +#define netLibTrapReceive (sysLibTrapCustom+14) +#define netLibTrapDmReceive (sysLibTrapCustom+15) +#define netLibTrapSelect (sysLibTrapCustom+16) + +#define netLibTrapPrefsGet (sysLibTrapCustom+17) +#define netLibTrapPrefsSet (sysLibTrapCustom+18) + +// The following traps are for internal and Network interface +// use only. +#define netLibTrapDrvrWake (sysLibTrapCustom+19) +#define netLibTrapInterfacePtr (sysLibTrapCustom+20) +#define netLibTrapMaster (sysLibTrapCustom+21) + +// New Traps +#define netLibTrapGetHostByName (sysLibTrapCustom+22) +#define netLibTrapSettingGet (sysLibTrapCustom+23) +#define netLibTrapSettingSet (sysLibTrapCustom+24) +#define netLibTrapIFAttach (sysLibTrapCustom+25) +#define netLibTrapIFDetach (sysLibTrapCustom+26) +#define netLibTrapIFGet (sysLibTrapCustom+27) +#define netLibTrapIFSettingGet (sysLibTrapCustom+28) +#define netLibTrapIFSettingSet (sysLibTrapCustom+29) +#define netLibTrapIFUp (sysLibTrapCustom+30) +#define netLibTrapIFDown (sysLibTrapCustom+31) +#define netLibTrapIFMediaUp (sysLibTrapCustom+32) +#define netLibTrapScriptExecuteV32 (sysLibTrapCustom+33) +#define netLibTrapGetHostByAddr (sysLibTrapCustom+34) +#define netLibTrapGetServByName (sysLibTrapCustom+35) +#define netLibTrapSocketAddr (sysLibTrapCustom+36) +#define netLibTrapFinishCloseWait (sysLibTrapCustom+37) +#define netLibTrapGetMailExchangeByName (sysLibTrapCustom+38) +#define netLibTrapPrefsAppend (sysLibTrapCustom+39) +#define netLibTrapIFMediaDown (sysLibTrapCustom+40) +#define netLibTrapOpenCount (sysLibTrapCustom+41) + +#define netLibTrapTracePrintF (sysLibTrapCustom+42) +#define netLibTrapTracePutS (sysLibTrapCustom+43) + +#define netLibTrapOpenIfCloseWait (sysLibTrapCustom+44) +#define netLibTrapHandlePowerOff (sysLibTrapCustom+45) + +#define netLibTrapConnectionRefresh (sysLibTrapCustom+46) + +// Traps added after 1.0 release of NetLib +#define netLibTrapBitMove (sysLibTrapCustom+47) +#define netLibTrapBitPutFixed (sysLibTrapCustom+48) +#define netLibTrapBitGetFixed (sysLibTrapCustom+49) +#define netLibTrapBitPutUIntV (sysLibTrapCustom+50) +#define netLibTrapBitGetUIntV (sysLibTrapCustom+51) +#define netLibTrapBitPutIntV (sysLibTrapCustom+52) +#define netLibTrapBitGetIntV (sysLibTrapCustom+53) + +// Traps added after 2.0 release of NetLib +#define netLibOpenConfig (sysLibTrapCustom+54) +#define netLibConfigMakeActive (sysLibTrapCustom+55) +#define netLibConfigList (sysLibTrapCustom+56) +#define netLibConfigIndexFromName (sysLibTrapCustom+57) +#define netLibConfigDelete (sysLibTrapCustom+58) +#define netLibConfigSaveAs (sysLibTrapCustom+59) +#define netLibConfigRename (sysLibTrapCustom+60) +#define netLibConfigAliasSet (sysLibTrapCustom+61) +#define netLibConfigAliasGet (sysLibTrapCustom+62) + +// Traps added after 3.2 release of NetLib +#define netLibTrapScriptExecute (sysLibTrapCustom+63) + +#define netLibTrapLast (sysLibTrapCustom+64) + + +/************************************************************ + * Net Library procedures. + *************************************************************/ +#pragma mark Functions +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +Err NetLibOpen (UInt16 libRefnum, UInt16 *netIFErrsP) + SYS_TRAP(sysLibTrapOpen); + +Err NetLibClose (UInt16 libRefnum, UInt16 immediate) + SYS_TRAP(sysLibTrapClose); + +Err NetLibSleep (UInt16 libRefnum) + SYS_TRAP(sysLibTrapSleep); + +Err NetLibWake (UInt16 libRefnum) + SYS_TRAP(sysLibTrapWake); + + +// This call forces the library to complete a close if it's +// currently in the close-wait state. Returns 0 if library is closed, +// Returns netErrFullyOpen if library is still open by some other task. +Err NetLibFinishCloseWait(UInt16 libRefnum) + SYS_TRAP(netLibTrapFinishCloseWait); + +// This call is for use by the Network preference panel only. It +// causes the NetLib to fully open if it's currently in the close-wait +// state. If it's not in the close wait state, it returns an error code +Err NetLibOpenIfCloseWait(UInt16 libRefnum) + SYS_TRAP(netLibTrapOpenIfCloseWait); + +// Get the open Count of the NetLib +Err NetLibOpenCount (UInt16 refNum, UInt16 *countP) + SYS_TRAP(netLibTrapOpenCount); + +// Give NetLib a chance to close the connection down in response +// to a power off event. Returns non-zero if power should not be +// turned off. EventP points to the event that initiated the power off +// which is either a keyDownEvent of the hardPowerChr or the autoOffChr. +// Don't include unless building for Viewer +#ifdef __SYSEVENT_H__ +Err NetLibHandlePowerOff (UInt16 refNum, SysEventType *eventP) + SYS_TRAP(netLibTrapHandlePowerOff); +#endif + + +// Check status or try and reconnect any interfaces which have come down. +// This call can be made by applications when they suspect that an interface +// has come down (like PPP or SLIP). NOTE: This call can display UI +// (if 'refresh' is true) so it MUST be called from the UI task. +Err NetLibConnectionRefresh(UInt16 refNum, Boolean refresh, + UInt8 *allInterfacesUpP, UInt16 *netIFErrP) + SYS_TRAP(netLibTrapConnectionRefresh); + + + +//-------------------------------------------------- +// Net address translation and conversion routines. +//-------------------------------------------------- + +// (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 (this file), because is +// unconditionally included below.) + +// Convert 32-bit IP address to ascii dotted decimal form. The Sockets glue +// macro inet_ntoa will pass the address of an application global string in +// spaceP. +Char * NetLibAddrINToA(UInt16 libRefnum, NetIPAddr inet, Char *spaceP) + SYS_TRAP(netLibTrapAddrINToA); + +// Convert a dotted decimal ascii string format of an IP address into +// a 32-bit value. +NetIPAddr NetLibAddrAToIN(UInt16 libRefnum, const Char *a) + SYS_TRAP(netLibTrapAddrAToIN); + + + +//-------------------------------------------------- +// Socket creation and option setting +//-------------------------------------------------- + +// Create a socket and return a refnum to it. Protocol is normally 0. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +NetSocketRef NetLibSocketOpen(UInt16 libRefnum, NetSocketAddrEnum domain, + NetSocketTypeEnum type, Int16 protocol, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketOpen); + +// Close a socket. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketClose(UInt16 libRefnum, NetSocketRef socket, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketClose); + +// Set a socket option. Level is usually netSocketOptLevelSocket. Option is one of +// netSocketOptXXXXX. OptValueP is a pointer to the new value and optValueLen is +// the length of the option value. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketOptionSet(UInt16 libRefnum, NetSocketRef socket, + UInt16 /*NetSocketOptLevelEnum*/ level, UInt16 /*NetSocketOptEnum*/ option, + void *optValueP, UInt16 optValueLen, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketOptionSet); + +// Get a socket option. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketOptionGet(UInt16 libRefnum, NetSocketRef socket, + UInt16 /*NetSocketOptLevelEnum*/ level, UInt16 /*NetSocketOptEnum*/ option, + void *optValueP, UInt16 *optValueLenP, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketOptionGet); + + +//-------------------------------------------------- +// Socket Control +//-------------------------------------------------- + +// Bind a source address and port number to a socket. This makes the +// socket accept incoming packets destined for the given socket address. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketBind(UInt16 libRefnum, NetSocketRef socket, + NetSocketAddrType *sockAddrP, Int16 addrLen, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketBind); + + +// Connect to a remote socket. For a stream based socket (i.e. TCP), this initiates +// a 3-way handshake with the remote machine to establish a connection. For +// non-stream based socket, this merely specifies a destination address and port +// number for future outgoing packets from this socket. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketConnect(UInt16 libRefnum, NetSocketRef socket, + NetSocketAddrType *sockAddrP, Int16 addrLen, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketConnect); + + +// Makes a socket ready to accept incoming connection requests. The queueLen +// specifies the max number of pending connection requests that will be enqueued +// while the server is busy handling other requests. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketListen(UInt16 libRefnum, NetSocketRef socket, + UInt16 queueLen, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketListen); + + +// Blocks the current process waiting for an incoming connection request. The socket +// must have previously be put into listen mode through the NetLibSocketListen call. +// On return, *sockAddrP will have the remote machines address and port number. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketAccept(UInt16 libRefnum, NetSocketRef socket, + NetSocketAddrType *sockAddrP, Int16 *addrLenP, Int32 timeout, + Err *errP) + SYS_TRAP(netLibTrapSocketAccept); + + +// Shutdown a connection in one or both directions. +// Only applies to stream based (i.e. TCP) sockets. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketShutdown(UInt16 libRefnum, NetSocketRef socket, + Int16 /*NetSocketDirEnum*/ direction, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketShutdown); + + + +// Gets the local and remote addresses of a socket. Useful for TCP sockets that +// get dynamically bound at connect time. +// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code. +Int16 NetLibSocketAddr(UInt16 libRefnum, NetSocketRef socketRef, + NetSocketAddrType *locAddrP, Int16 *locAddrLenP, + NetSocketAddrType *remAddrP, Int16 *remAddrLenP, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSocketAddr); + + + +//-------------------------------------------------- +// Sending and Receiving +//-------------------------------------------------- +// Send data through a socket. The data is specified through the NetIOParamType +// structure. +// Flags is one or more of netMsgFlagXXX. +// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled +// in with error code. +Int16 NetLibSendPB(UInt16 libRefNum, NetSocketRef socket, + NetIOParamType *pbP, UInt16 flags, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSendPB); + +// Send data through a socket. The data to send is passed in a single buffer, +// unlike NetLibSendPB. If toAddrP is not nil, the data will be sent to +// address *toAddrP. +// Flags is one or more of netMsgFlagXXX. +// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled +// in with error code. +Int16 NetLibSend(UInt16 libRefNum, NetSocketRef socket, + void *bufP, UInt16 bufLen, UInt16 flags, + void *toAddrP, UInt16 toLen, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSend); + +// Receive data from a socket. The data is gatthered into buffers specified in the +// NetIOParamType structure. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +Int16 NetLibReceivePB(UInt16 libRefNum, NetSocketRef socket, + NetIOParamType *pbP, UInt16 flags, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapReceivePB); + +// Receive data from a socket. The data is read into a single buffer, unlike +// NetLibReceivePB. If fromAddrP is not nil, *fromLenP must be initialized to +// the size of the buffer that fromAddrP points to and on exit *fromAddrP will +// have the address of the sender in it. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +Int16 NetLibReceive(UInt16 libRefNum, NetSocketRef socket, + void *bufP, UInt16 bufLen, UInt16 flags, + void *fromAddrP, UInt16 *fromLenP, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapReceive); + + +// Receive data from a socket directly into a (write-protected) Data Manager +// record. +// If fromAddrP is not nil, *fromLenP must be initialized to +// the size of the buffer that fromAddrP points to and on exit *fromAddrP will +// have the address of the sender in it. +// Flags is one or more of netMsgFlagXXX. +// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none. +// Returns # of bytes received, or -1 on error. If error, *errP gets filled in +// with error code. +Int16 NetLibDmReceive(UInt16 libRefNum, NetSocketRef socket, + void *recordP, UInt32 recordOffset, UInt16 rcvLen, UInt16 flags, + void *fromAddrP, UInt16 *fromLenP, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapDmReceive); + + +//-------------------------------------------------- +// Name Lookups +//-------------------------------------------------- +NetHostInfoPtr NetLibGetHostByName(UInt16 libRefNum, const Char *nameP, + NetHostInfoBufPtr bufP, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapGetHostByName); + + +NetHostInfoPtr NetLibGetHostByAddr(UInt16 libRefNum, UInt8 *addrP, UInt16 len, UInt16 type, + NetHostInfoBufPtr bufP, Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapGetHostByAddr); + + +NetServInfoPtr NetLibGetServByName(UInt16 libRefNum, const Char *servNameP, + const Char *protoNameP, NetServInfoBufPtr bufP, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapGetServByName); + +// Looks up a mail exchange name and returns a list of hostnames for it. Caller +// must pass space for list of return names (hostNames), space for +// list of priorities for those hosts (priorities) and max # of names to +// return (maxEntries). +// Returns # of entries found, or -1 on error. If error, *errP gets filled in +// with error code. +Int16 NetLibGetMailExchangeByName(UInt16 libRefNum, Char *mailNameP, + UInt16 maxEntries, + Char hostNames[][netDNSMaxDomainName+1], UInt16 priorities[], + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapGetMailExchangeByName); + + +//-------------------------------------------------- +// Interface setup +//-------------------------------------------------- +Err NetLibIFGet(UInt16 libRefNum, UInt16 index, UInt32 *ifCreatorP, + UInt16 *ifInstanceP) + SYS_TRAP(netLibTrapIFGet); + +Err NetLibIFAttach(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + Int32 timeout) + SYS_TRAP(netLibTrapIFAttach); + +Err NetLibIFDetach(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + Int32 timeout) + SYS_TRAP(netLibTrapIFDetach); + +Err NetLibIFUp(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance) + SYS_TRAP(netLibTrapIFUp); + +Err NetLibIFDown(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + Int32 timeout) + SYS_TRAP(netLibTrapIFDown); + + + + +//-------------------------------------------------- +// Settings +//-------------------------------------------------- +// General settings +Err NetLibSettingGet(UInt16 libRefNum, + UInt16 /*NetSettingEnum*/ setting, void *valueP, UInt16 *valueLenP) + SYS_TRAP(netLibTrapSettingGet); + +Err NetLibSettingSet(UInt16 libRefNum, + UInt16 /*NetSettingEnum*/ setting, void *valueP, UInt16 valueLen) + SYS_TRAP(netLibTrapSettingSet); + +// Network interface specific settings. +Err NetLibIFSettingGet(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + UInt16 /*NetIFSettingEnum*/ setting, void *valueP, UInt16 *valueLenP) + SYS_TRAP(netLibTrapIFSettingGet); + +Err NetLibIFSettingSet(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance, + UInt16 /*NetIFSettingEnum*/ setting, void *valueP, UInt16 valueLen) + SYS_TRAP(netLibTrapIFSettingSet); + + + +//-------------------------------------------------- +// System level +//-------------------------------------------------- +Int16 NetLibSelect(UInt16 libRefNum, UInt16 width, NetFDSetType *readFDs, + NetFDSetType *writeFDs, NetFDSetType *exceptFDs, + Int32 timeout, Err *errP) + SYS_TRAP(netLibTrapSelect); + + + +//-------------------------------------------------- +// Debugging support +//-------------------------------------------------- +Err NetLibMaster(UInt16 libRefNum, UInt16 cmd, NetMasterPBPtr pbP, + Int32 timeout) + SYS_TRAP(netLibTrapMaster); + +Err NetLibTracePrintF(UInt16 libRefNum, const Char *formatStr, ...) + SYS_TRAP(netLibTrapTracePrintF); + +Err NetLibTracePutS(UInt16 libRefNum, Char *strP) + SYS_TRAP(netLibTrapTracePutS); + + + + + +//-------------------------------------------------- +// Configuration Calls +//-------------------------------------------------- +Err NetLibOpenConfig( UInt16 refNum, UInt16 configIndex, UInt32 openFlags, + UInt16 *netIFErrP) + SYS_TRAP(netLibOpenConfig); + +Err NetLibConfigMakeActive( UInt16 refNum, UInt16 configIndex) + SYS_TRAP(netLibConfigMakeActive); + +Err NetLibConfigList( UInt16 refNum, NetConfigNameType nameArray[], + UInt16 *arrayEntriesP) + SYS_TRAP(netLibConfigList); + +Err NetLibConfigIndexFromName( UInt16 refNum, NetConfigNamePtr nameP, + UInt16 *indexP) + SYS_TRAP(netLibConfigIndexFromName); + +Err NetLibConfigDelete( UInt16 refNum, UInt16 index) + SYS_TRAP(netLibConfigDelete); + +Err NetLibConfigSaveAs( UInt16 refNum, NetConfigNamePtr nameP) + SYS_TRAP(netLibConfigSaveAs); + +Err NetLibConfigRename( UInt16 refNum, UInt16 index, + NetConfigNamePtr newNameP) + SYS_TRAP(netLibConfigRename); + +Err NetLibConfigAliasSet( UInt16 refNum, UInt16 configIndex, + UInt16 aliasToIndex) + SYS_TRAP(netLibConfigAliasSet); + +Err NetLibConfigAliasGet( UInt16 refNum, UInt16 aliasIndex, + UInt16 *indexP, Boolean *isAnotherAliasP) + SYS_TRAP(netLibConfigAliasGet); + + + + +#ifdef __cplusplus +} +#endif + + +// Include the NetMgr Bit Utils +#include + +#endif // __NETMGR_H__ diff --git a/sdk-4/include/Core/System/NotifyMgr.h b/sdk-4/include/Core/System/NotifyMgr.h new file mode 100644 index 0000000..ea8391b --- /dev/null +++ b/sdk-4/include/Core/System/NotifyMgr.h @@ -0,0 +1,391 @@ +/****************************************************************************** + * + * 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' + * + *****************************************************************************/ + +#ifndef __NOTIFY_H__ +#define __NOTIFY_H__ + +#include +#include +#include +#include + +#include + +typedef struct SysNotifyParamType + { + UInt32 notifyType; // What type of event occurred? + UInt32 broadcaster; // normally creator code of broadcasting app + void * notifyDetailsP; // ptr to notification-specific data, if any + void * userDataP; // user specified ptr passed back with notification + Boolean handled; // true if event is handled yet + UInt8 reserved2; + } SysNotifyParamType; + + +typedef Err (*SysNotifyProcPtr)(SysNotifyParamType *notifyParamsP); + +#define sysNotifyNormalPriority 0 // clients should use this priority + +#define sysNotifyBroadcasterCode sysFileCSystem // broadcaster code for events broadcast by the system + +#define sysNotifyNoDatabaseID 0xFFFFFFFF // for system use only!!! + +#define 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). +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define sysNotifyDefaultQueueSize 10 +#else +#define sysNotifyDefaultQueueSize 30 +#endif + +/* + 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 external 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. +*/ + +#define sysNotifySyncStartEvent 'hots' // Sent at the start of a hotsync. + // Always sent from UI thread. + // param: none + +#define sysNotifySyncFinishEvent 'sync' // Sent at the end of a hotsync. + // Always sent from UI thread. + // param: none + +#define sysNotifyAntennaRaisedEvent 'tena' // Sent when the antenna is raised on a + // Palm VII series device. + // Always sent from UI thread. + // param: none + +#define sysNotifyResetFinishedEvent 'rstf' // Broadcast after all app launchcodes + // are sent after a reset. + // Always sent from UI thread. + // param: none + +#define sysNotifyForgotPasswordEvent 'bozo' // Broadcast when the user presses the + // 'Forgotten Password' button in the + // security app, just before every database's + // private records are deleted. + +#define sysNotifyTimeChangeEvent '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). + +#define sysNotifySleepRequestEvent '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. + +#define sysNotifySleepNotifyEvent '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. + + +#define sysNotifyEarlyWakeupEvent '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. + + +#define sysNotifyLateWakeupEvent '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. + + +#define sysNotifyDisplayChangeEvent 'scrd' // Sent when the display depth is + // changed, notifyDetailsP has old/new depth + // see SysNotifyDisplayChangeDetailsType + + +#define sysNotifyMenuCmdBarOpenEvent '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. + + +#define cncNotifyProfileEvent '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 + +#define sysExternalConnectorAttachEvent 'ecna' // Broadcast when anything is attached to + // the external connector. + +#define sysExternalConnectorDetachEvent 'ecnd' // Broadcast when anything is detached from + // the external connector. + +#define sysNotifyCardInsertedEvent '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* + +#define sysNotifyCardRemovedEvent '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* + +#define sysNotifyVolumeMountedEvent '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* + +#define sysNotifyVolumeUnmountedEvent '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* + +#define sysNotifyHelperEvent 'hlpr' // Sent by Address Book (or any + // 3rd party application) to + // communicate with Phone Apps + + +#define sysNotifyPOSEMountEvent 'pose' // Sent by HostFS to communicate with itself, + // saving on stack depth. + + +#define sysNotifyLocaleChangedEvent '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 + + + + +#define sysNotifyRetryEnqueueKey 'retk' // An EvtEnqueueKey failed, so retry. + + +#define sysNotifyGotUsersAttention 'attn' // Got users attention. + + +#define sysNotifyDBDeletedEvent '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. + +#define sysNotifyDeviceUnlocked 'unlk' // Broadcasted by the Security app After the device is + //unlocked. + //notifyDetailsP: none + +#define sysNotifyPhoneEvent 'fone' // Sent by third-party applications to communicate + // with built-in or external phones. + // NOTE THAT THIS EVENT IS FOR FUTURE USE + +#define sysNotifyNetLibIFMediaEvent 'neti' // Broadcasted by NetLib to communicate its interfaces media Up and Down requests + // to registered Apps. + // notifyDetailsP: ptr to SysNotifyNetLibIFMediaType. + +#define sysNotifyDeleteProtectedEvent '-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. + +#define sysNotifyIrDASniffEvent 'irda' // Sent by IrDA sniffing code when an incomming IrDA frame is detected + +// for sysNotifyDisplayChangeEvent +typedef struct SysNotifyDisplayChangeDetailsTag { + UInt32 oldDepth; + UInt32 newDepth; +} SysNotifyDisplayChangeDetailsType; + + +// For sysNotifyLocaleChangedEvent +typedef struct SysNotifyLocaleChangedTag { + LmLocaleType oldLocale; + LmLocaleType newLocale; +} SysNotifyLocaleChangedType; + + +// Possible values for the sleep-reason for the sysNotifySleepEvent +#define sysSleepPowerButton 0 +#define sysSleepAutoOff 1 +#define sysSleepResumed 2 +#define sysSleepUnknown 3 + + +// for sysNotifySleepRequestEvent +typedef struct SleepEventParamTag { + UInt16 reason; // contains the reason we are going to sleep. See above list for possible values. + UInt16 deferSleep; // 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. +} SleepEventParamType; + + +// for sysNotifyDeleteProtectedEvent, and possibly others... +typedef struct SysNotifyDBInfoTag { + LocalID dbID; // database ID of dabatase + UInt16 cardNo; // card number that dabatase resides on + UInt16 attributes; // database attributes + Char dbName[dmDBNameLength]; // name of database + UInt32 creator; // creator code of dabatase + UInt32 type; // type of dabatase +} SysNotifyDBInfoType; + + +// for sysNotifyDBDeletedEvent +typedef struct SysNotifyDBDeletedTag { + LocalID oldDBID; // old database ID of dabatase, no longer valid + UInt16 cardNo; // card number that dabatase resides on + UInt16 attributes; // database attributes + Char dbName[dmDBNameLength]; + UInt32 creator; // creator code of dabatase + UInt32 type; // type code of dabatase +} SysNotifyDBDeletedType; + + +/* +Possible event types to be added in the future: +NOTE that these are NOT implemented yet!!!! + +#define sysNotifyDBAddedEvent 'dbs+' // Broadcast after a database is added to the device + // param: ptr to SysNotifyDBInfoType. + +#define sysNotifyInitializeEvent 'helo' // broadcast to an app after its installed + // so it can do any necessary initalization + // This event is always broadcast. + // param: ptr to SysNotifyDBInfoType. + +#define sysNotifyCleanupEvent '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. + +#define sysNotifyCardChangedEvent 'card' // broadcast when the owner's business card + // has changed, allowing apps to adjust for that. + // param: ptr to new owner data. + +*/ + + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern Err SysNotifyRegister(UInt16 cardNo, LocalID dbID, UInt32 notifyType, + SysNotifyProcPtr callbackP, Int8 priority, void *userDataP) + SYS_TRAP(sysTrapSysNotifyRegister); + +extern Err SysNotifyUnregister(UInt16 cardNo, LocalID dbID, UInt32 notifyType, Int8 priority) + SYS_TRAP(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. + */ +extern Err SysNotifyBroadcast(SysNotifyParamType *notify) + SYS_TRAP(sysTrapSysNotifyBroadcast); + +extern Err SysNotifyBroadcastDeferred(SysNotifyParamType *notify, Int16 paramSize) + SYS_TRAP(sysTrapSysNotifyBroadcastDeferred); + + +// Kick off a notification from an interrupt handler. +// Note: non-interrupt code should use SysNotifyBroadcast +extern Err SysNotifyBroadcastFromInterrupt(UInt32 notifyType, UInt32 broadcaster, + void *notifyDetailsP) + SYS_TRAP(sysTrapSysNotifyBroadcastFromInterrupt); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __NOTIFY_H__ diff --git a/sdk-4/include/Core/System/OverlayMgr.h b/sdk-4/include/Core/System/OverlayMgr.h new file mode 100644 index 0000000..d492032 --- /dev/null +++ b/sdk-4/include/Core/System/OverlayMgr.h @@ -0,0 +1,200 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __OVERLAYMGR_H__ +#define __OVERLAYMGR_H__ + +// Include elementary types +#include +#include +#include // For LmLocaleType + +/*********************************************************************** + * Overlay Manager constants + **********************************************************************/ + +#define omOverlayRscType 'ovly' // Overlay desc resource type +#define omOverlayRscID 1000 // Overlay desc resource ID + +#define omFtrCreator 'ovly' // For get/set of Overlay features. +#define omFtrShowErrorsFlag 0 // Boolean - True => display overlay errors. +#define 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. +#define omErrBaseRequiresOverlay (omErrorClass | 1) + +// OmOverlayDBNameToLocale or OmLocaleToOverlayDBName were passed an unknown locale. +#define omErrUnknownLocale (omErrorClass | 2) + +// OmOverlayDBNameToLocale was passed a poorly formed string. +#define omErrBadOverlayDBName (omErrorClass | 3) + +// OmGetIndexedLocale was passed an invalid index. +#define omErrInvalidLocaleIndex (omErrorClass | 4) + +// OmSetSystemLocale was passed an invalid locale (doesn't correspond to available +// system overlay). +#define omErrInvalidLocale (omErrorClass | 5) + +// OmSetSystemLocale was passed a locale that referenced an invalid system overlay +// (missing one or more required resources) +#define omErrInvalidSystemOverlay (omErrorClass | 6) + +// OmGetNextSystemLocale was called, but there were no more valid system +// locales to return. +#define omErrNoNextSystemLocale (omErrorClass | 7) + +/*********************************************************************** + * Selectors & macros used for calling Overlay Manager routines + **********************************************************************/ + +#ifdef DIRECT_OVERLAY_CALLS + #define OMDISPATCH_TRAP(omSelectorNum) +#else + #define OMDISPATCH_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapOmDispatch, sel) +#endif + +// Selectors used for getting to the right Overlay Manager routine via +// the OmDispatch trap. + +#define omInit 0 +#define omOpenOverlayDatabase 1 +#define omLocaleToOverlayDBName 2 +#define omOverlayDBNameToLocale 3 +#define omGetCurrentLocale 4 +#define omGetIndexedLocale 5 +#define omGetSystemLocale 6 +#define omSetSystemLocale 7 +#define omGetRoutineAddress 8 +#define omGetNextSystemLocale 9 + +#define omMaxSelector omGetNextSystemLocale + +typedef UInt16 OmSelector; + +/*********************************************************************** + * Overlay Manager types + **********************************************************************/ + +// DOLATER kwk - decide how to deprecate this. +typedef LmLocaleType OmLocaleType; + +// Structure passed to OmGetNextSystemLocale. +typedef struct { + DmSearchStateType searchState; + DmOpenRef systemDBRef; + UInt16 systemDBCard; + Char systemDBName[dmDBNameLength]; + Int16 systemDBNameLen; + LmLocaleType curLocale; + Boolean didNoOverlaySystem; + Boolean foundSystem; + UInt8 reserved[6]; +} OmSearchStateType; + +/*********************************************************************** + * Overlay Manager routines + **********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +// Return in an overlay database name that's appropriate +// for the base name and the locale . If the +// param in NULL, use the current locale. The +// buffer must be at least dmDBNameLength bytes. +Err OmLocaleToOverlayDBName(const Char *baseDBName, const LmLocaleType *targetLocale, + Char *overlayDBName) + OMDISPATCH_TRAP(omLocaleToOverlayDBName); + +// Given the name of an overlay database in , return back +// the overlay in overlayLocale. If the name isn't an overlay name, +// return omErrBadOverlayDBName. +Err OmOverlayDBNameToLocale(const Char *overlayDBName, LmLocaleType *overlayLocale) + OMDISPATCH_TRAP(omOverlayDBNameToLocale); + +// Return the current locale in . This may not be the same as +// the system locale, which will take effect after the next reset. +void OmGetCurrentLocale(LmLocaleType *currentLocale) + OMDISPATCH_TRAP(omGetCurrentLocale); + +// Return the nth valid system locale in . Indexes are zero-based, +// and omErrInvalidLocaleIndex will be returned if 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. +Err OmGetIndexedLocale(UInt16 localeIndex, LmLocaleType *theLocale) + OMDISPATCH_TRAP(omGetIndexedLocale); + +// Return the system locale in . 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. +void OmGetSystemLocale(LmLocaleType *systemLocale) + OMDISPATCH_TRAP(omGetSystemLocale); + +// Set the post-reset system locale to be . Return omErrInvalidLocale if +// the passed locale doesnŐt correspond to a valid System.prc overlay. +Err OmSetSystemLocale(const LmLocaleType *systemLocale) + OMDISPATCH_TRAP(omSetSystemLocale); + +// Return back the address of the routine indicated by . If +// isn't a valid routine selector, return back NULL. +void *OmGetRoutineAddress(OmSelector inSelector) + OMDISPATCH_TRAP(omGetRoutineAddress); + +// NEW in 4.0. Return back the next valid system locale in . The first +// time the routine is called, 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. +Err OmGetNextSystemLocale(Boolean iNewSearch, OmSearchStateType* ioStateInfoP, LmLocaleType* oLocaleP) + OMDISPATCH_TRAP(omGetNextSystemLocale); + + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/sdk-4/include/Core/System/PalmLocRawData.h b/sdk-4/include/Core/System/PalmLocRawData.h new file mode 100644 index 0000000..c38250e --- /dev/null +++ b/sdk-4/include/Core/System/PalmLocRawData.h @@ -0,0 +1,83 @@ +/****************************************************************************** + * + * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmLocRawData.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Web Clipping proxy server (WCPS) supports a way to automatically + * determine where the handheld is located on the planet. + * This is done through the use of raw location information provided + * by the low level driver that establishes the connection to the + * communication device (ex: phone, modem, over GSM, BellSouth, Japan's + * DoCoMo wireless system). The raw data is passed to WCPS through + * the CTP protocol and WCPS pass it back to Location DLLs. + * + * WCPS uses the palmLocRawDataType defined below to determine + * what Location DLLs it will have to call from an array of DLLs in order + * to decode the raw data into meaningful content for content providers + * like Postal code, City name, Country, GPS, etc. + * + * WARNING: THIS FILE MUST STAY INDEPENDENT OF PALM OS + * This file will be given to 3rd party companies in order for them + * to develop Windows DLLs. So it is very important that this file + * not be tied to Palm OS. + * + * History: + * 06/01/00 MT Initial revision + * 08/15/00 MT Change comments to remove any mention of Palm Codenames + * + *****************************************************************************/ + +#ifndef _PALMLOCRAWDATA_H_ +#define _PALMLOCRAWDATA_H_ + +// Let's define a type of UInt8 and a macro to define the values +// instead of using an enum because enums are not generating values +// of type UInt8 independently of the platform. +// +typedef UInt8 palmLocRawDataType; +#define PALM_RAW_DATA_VALUE(value) ((palmLocRawDataType)value) + +typedef UInt8 LocPacketSizeType; +typedef UInt8 RawLocDataFirstByteType; +typedef struct +{ + LocPacketSizeType rawLocPacketSize; // Size of this raw location packet + palmLocRawDataType rawLocDataType; // Identifying the raw location info + // from a value defined bellow in this file + RawLocDataFirstByteType rawLocDataFirstByte; // actual data bytes of the raw location info +} RawLocPacketType, *RawLocPacketTypeP ; +#define sizeofRawLocPacketTypeHeader (sizeof(LocPacketSizeType) +sizeof(palmLocRawDataType)) + +// Location programming requires sending of raw location data to the server +// Elaine will then substitude the %Location:... string with the appropriate +// Location string for the content provider. + +#define palmLocRawDataNone PALM_RAW_DATA_VALUE( 0 ) +#define palmLocRawDataEnd PALM_RAW_DATA_VALUE( 0 ) + +// Raw location information returned by TelMgr drivers +#define palmLocRawDataCDMA PALM_RAW_DATA_VALUE( 1 ) +#define palmLocRawDataGSM PALM_RAW_DATA_VALUE( 2 ) +#define palmLocRawDataTDMA PALM_RAW_DATA_VALUE( 3 ) +#define palmLocRawDataPDC PALM_RAW_DATA_VALUE( 4 ) + +#define palmLocRawDataBellSouthTowerID PALM_RAW_DATA_VALUE( 5 ) + +#define palmLocRawDataDoCoMoIP PALM_RAW_DATA_VALUE( 6 ) + + +// +// Message to Companies developing location solutions +// -------------------------------------------------- +// If your already registered raw data is not listed above, +// or you would like to register a new raw data, please contact +// Palm OS Development Support: +// http://www.palmos.com/dev/tech/support + + +#endif // _PALMLOCRAWDATA_H_ diff --git a/sdk-4/include/Core/System/PalmLocale.h b/sdk-4/include/Core/System/PalmLocale.h new file mode 100644 index 0000000..906656c --- /dev/null +++ b/sdk-4/include/Core/System/PalmLocale.h @@ -0,0 +1,1207 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __PALMLOCALE_H__ +#define __PALMLOCALE_H__ + + +// Names of the known encodings. + +#define encodingNameAscii "us-ascii" +#define encodingNameISO8859_1 "ISO-8859-1" +#define encodingNameCP1252 "Windows-1252" +#define encodingNameShiftJIS "Shift_JIS" +#define encodingNameCP932 "Windows-31J" +#define encodingNameUTF8 "UTF-8" +#define encodingNameUCS2 "ISO-10646-UCS-2" + +// Maximum length of any encoding name. + +#define maxEncodingNameLength 40 + + + +/* Rez doesn't even support macros, so for Rez we must simplify all of the #defines. +Thus, whenever you modify any constants, please do so in the !rez section, +then execute the following MPW commands (from elsewhere with this file as the target) +so that the Rez case will be automatically updated: + +Find Ľ;Find /TAG SOURCE START/!1:/TAG SOURCE END/Á1 +Copy ¤ +Find Ľ;Find /TAG DESTINATION START/!1:/TAG DESTINATION END/Á1 +Echo +Paste ¤ +Find Ľ;Find /TAG DESTINATION START/ +Replace -c ° /(#define[ śt]+l[a-z0-9_]+[ śt]+)¨1LANGUAGE_VALUEś(([0-9]+)¨2ś)/ "¨1¨2" +Replace -c ° /(#define[ śt]+c[a-z0-9_]+[ śt]+)¨1COUNTRY_VALUEś(([0-9]+)¨2ś)/ "¨1¨2" +Replace -c ° /(#define[ śt]+charEncoding[a-z0-9_]+[ śt]+)¨1CHAR_ENCODING_VALUEś(([0-9]+)¨2ś)/ "¨1¨2" +*/ +#if rez + #define PALM_LOCALE_HAS_TYPES 0 +#endif +#ifndef PALM_LOCALE_HAS_TYPES + #define PALM_LOCALE_HAS_TYPES 1 +#endif + + +#if PALM_LOCALE_HAS_TYPES // Normal (e.g., non-Rez) case + +/*********************************************************************** + * Locale constants + **********************************************************************/ + +/* Language codes (ISO 639). The first 8 preserve the old values for the deprecated +LanguageType; the rest are sorted by the 2-character language code. + +WARNING! Keep in sync with BOTH: + 1) LanguageCode array in OverlayMgr.c + 2) localeLanguage #define in UIResDefs.r +*/ +#define LANGUAGE_VALUE(value) ((LanguageType)value) + +// Leave the following line unchanged before 1st #define to be copied to rez section: +// TAG SOURCE START + +#define lEnglish LANGUAGE_VALUE(0) // EN +#define lFrench LANGUAGE_VALUE(1) // FR +#define lGerman LANGUAGE_VALUE(2) // DE +#define lItalian LANGUAGE_VALUE(3) // IT +#define lSpanish LANGUAGE_VALUE(4) // ES +#define lUnused LANGUAGE_VALUE(5) // Reserved + +// New in 3.1 +#define lJapanese LANGUAGE_VALUE(6) // JA (Palm calls this jp) +#define lDutch LANGUAGE_VALUE(7) // NL + +// New in 4.0 +#define lAfar LANGUAGE_VALUE(8) // AA +#define lAbkhazian LANGUAGE_VALUE(9) // AB +#define lAfrikaans LANGUAGE_VALUE(10) // AF +#define lAmharic LANGUAGE_VALUE(11) // AM +#define lArabic LANGUAGE_VALUE(12) // AR +#define lAssamese LANGUAGE_VALUE(13) // AS +#define lAymara LANGUAGE_VALUE(14) // AY +#define lAzerbaijani LANGUAGE_VALUE(15) // AZ +#define lBashkir LANGUAGE_VALUE(16) // BA +#define lByelorussian LANGUAGE_VALUE(17) // BE +#define lBulgarian LANGUAGE_VALUE(18) // BG +#define lBihari LANGUAGE_VALUE(19) // BH +#define lBislama LANGUAGE_VALUE(20) // BI +#define lBengali LANGUAGE_VALUE(21) // BN (Bangla) +#define lTibetan LANGUAGE_VALUE(22) // BO +#define lBreton LANGUAGE_VALUE(23) // BR +#define lCatalan LANGUAGE_VALUE(24) // CA +#define lCorsican LANGUAGE_VALUE(25) // CO +#define lCzech LANGUAGE_VALUE(26) // CS +#define lWelsh LANGUAGE_VALUE(27) // CY +#define lDanish LANGUAGE_VALUE(28) // DA +#define lBhutani LANGUAGE_VALUE(29) // DZ +#define lGreek LANGUAGE_VALUE(30) // EL +#define lEsperanto LANGUAGE_VALUE(31) // EO +#define lEstonian LANGUAGE_VALUE(32) // ET +#define lBasque LANGUAGE_VALUE(33) // EU +#define lPersian LANGUAGE_VALUE(34) // FA (Farsi) +#define lFinnish LANGUAGE_VALUE(35) // FI +#define lFiji LANGUAGE_VALUE(36) // FJ +#define lFaroese LANGUAGE_VALUE(37) // FO +#define lFrisian LANGUAGE_VALUE(38) // FY +#define lIrish LANGUAGE_VALUE(39) // GA +#define lScotsGaelic LANGUAGE_VALUE(40) // GD +#define lGalician LANGUAGE_VALUE(41) // GL +#define lGuarani LANGUAGE_VALUE(42) // GN +#define lGujarati LANGUAGE_VALUE(43) // GU +#define lHausa LANGUAGE_VALUE(44) // HA +#define lHindi LANGUAGE_VALUE(45) // HI +#define lCroatian LANGUAGE_VALUE(46) // HR +#define lHungarian LANGUAGE_VALUE(47) // HU +#define lArmenian LANGUAGE_VALUE(48) // HY +#define lInterlingua LANGUAGE_VALUE(49) // IA +#define lInterlingue LANGUAGE_VALUE(50) // IE +#define lInupiak LANGUAGE_VALUE(51) // IK +#define lIndonesian LANGUAGE_VALUE(52) // IN +#define lIcelandic LANGUAGE_VALUE(53) // IS +#define lHebrew LANGUAGE_VALUE(54) // IW +#define lYiddish LANGUAGE_VALUE(55) // JI +#define lJavanese LANGUAGE_VALUE(56) // JW +#define lGeorgian LANGUAGE_VALUE(57) // KA +#define lKazakh LANGUAGE_VALUE(58) // KK +#define lGreenlandic LANGUAGE_VALUE(59) // KL +#define lCambodian LANGUAGE_VALUE(60) // KM +#define lKannada LANGUAGE_VALUE(61) // KN +#define lKorean LANGUAGE_VALUE(62) // KO +#define lKashmiri LANGUAGE_VALUE(63) // KS +#define lKurdish LANGUAGE_VALUE(64) // KU +#define lKirghiz LANGUAGE_VALUE(65) // KY +#define lLatin LANGUAGE_VALUE(66) // LA +#define lLingala LANGUAGE_VALUE(67) // LN +#define lLaothian LANGUAGE_VALUE(68) // LO +#define lLithuanian LANGUAGE_VALUE(69) // LT +#define lLatvian LANGUAGE_VALUE(70) // LV (Lettish) +#define lMalagasy LANGUAGE_VALUE(71) // MG +#define lMaori LANGUAGE_VALUE(72) // MI +#define lMacedonian LANGUAGE_VALUE(73) // MK +#define lMalayalam LANGUAGE_VALUE(74) // ML +#define lMongolian LANGUAGE_VALUE(75) // MN +#define lMoldavian LANGUAGE_VALUE(76) // MO +#define lMarathi LANGUAGE_VALUE(77) // MR +#define lMalay LANGUAGE_VALUE(78) // MS +#define lMaltese LANGUAGE_VALUE(79) // MT +#define lBurmese LANGUAGE_VALUE(80) // MY +#define lNauru LANGUAGE_VALUE(81) // NA +#define lNepali LANGUAGE_VALUE(82) // NE +#define lNorwegian LANGUAGE_VALUE(83) // NO +#define lOccitan LANGUAGE_VALUE(84) // OC +#define lAfan LANGUAGE_VALUE(85) // OM (Oromo) +#define lOriya LANGUAGE_VALUE(86) // OR +#define lPunjabi LANGUAGE_VALUE(87) // PA +#define lPolish LANGUAGE_VALUE(88) // PL +#define lPashto LANGUAGE_VALUE(89) // PS (Pushto) +#define lPortuguese LANGUAGE_VALUE(90) // PT +#define lQuechua LANGUAGE_VALUE(91) // QU +#define lRhaetoRomance LANGUAGE_VALUE(92) // RM +#define lKurundi LANGUAGE_VALUE(93) // RN +#define lRomanian LANGUAGE_VALUE(94) // RO +#define lRussian LANGUAGE_VALUE(95) // RU +#define lKinyarwanda LANGUAGE_VALUE(96) // RW +#define lSanskrit LANGUAGE_VALUE(97) // SA +#define lSindhi LANGUAGE_VALUE(98) // SD +#define lSangho LANGUAGE_VALUE(99) // SG +#define lSerboCroatian LANGUAGE_VALUE(100) // SH +#define lSinghalese LANGUAGE_VALUE(101) // SI +#define lSlovak LANGUAGE_VALUE(102) // SK +#define lSlovenian LANGUAGE_VALUE(103) // SL +#define lSamoan LANGUAGE_VALUE(104) // SM +#define lShona LANGUAGE_VALUE(105) // SN +#define lSomali LANGUAGE_VALUE(106) // SO +#define lAlbanian LANGUAGE_VALUE(107) // SQ +#define lSerbian LANGUAGE_VALUE(108) // SR +#define lSiswati LANGUAGE_VALUE(109) // SS +#define lSesotho LANGUAGE_VALUE(110) // ST +#define lSudanese LANGUAGE_VALUE(111) // SU +#define lSwedish LANGUAGE_VALUE(112) // SV +#define lSwahili LANGUAGE_VALUE(113) // SW +#define lTamil LANGUAGE_VALUE(114) // TA +#define lTelugu LANGUAGE_VALUE(115) // TE +#define lTajik LANGUAGE_VALUE(116) // TG +#define lThai LANGUAGE_VALUE(117) // TH +#define lTigrinya LANGUAGE_VALUE(118) // TI +#define lTurkmen LANGUAGE_VALUE(119) // TK +#define lTagalog LANGUAGE_VALUE(120) // TL +#define lSetswana LANGUAGE_VALUE(121) // TN +#define lTonga LANGUAGE_VALUE(122) // TO +#define lTurkish LANGUAGE_VALUE(123) // TR +#define lTsonga LANGUAGE_VALUE(124) // TS +#define lTatar LANGUAGE_VALUE(125) // TT +#define lTwi LANGUAGE_VALUE(126) // TW +#define lUkrainian LANGUAGE_VALUE(127) // UK +#define lUrdu LANGUAGE_VALUE(128) // UR +#define lUzbek LANGUAGE_VALUE(129) // UZ +#define lVietnamese LANGUAGE_VALUE(130) // VI +#define lVolapuk LANGUAGE_VALUE(131) // VO +#define lWolof LANGUAGE_VALUE(132) // WO +#define lXhosa LANGUAGE_VALUE(133) // XH +#define lYoruba LANGUAGE_VALUE(134) // YO +#define lChinese LANGUAGE_VALUE(135) // ZH +#define lZulu LANGUAGE_VALUE(136) // ZU + +/* Country codes (ISO 3166). The first 33 preserve the old values for the +deprecated CountryType; the rest are sorted by the 2-character country code. + +WARNING! Keep in sync with BOTH: + 1) CountryCode array in OverlayMgr.c + 2) localeCountry #define in UIResDefs.r +*/ +#define COUNTRY_VALUE(value) ((CountryType)value) + +#define cAustralia COUNTRY_VALUE(0) // AU +#define cAustria COUNTRY_VALUE(1) // AT +#define cBelgium COUNTRY_VALUE(2) // BE +#define cBrazil COUNTRY_VALUE(3) // BR +#define cCanada COUNTRY_VALUE(4) // CA +#define cDenmark COUNTRY_VALUE(5) // DK +#define cFinland COUNTRY_VALUE(6) // FI +#define cFrance COUNTRY_VALUE(7) // FR +#define cGermany COUNTRY_VALUE(8) // DE +#define cHongKong COUNTRY_VALUE(9) // HK +#define cIceland COUNTRY_VALUE(10) // IS +#define cIreland COUNTRY_VALUE(11) // IE +#define cItaly COUNTRY_VALUE(12) // IT +#define cJapan COUNTRY_VALUE(13) // JP +#define cLuxembourg COUNTRY_VALUE(14) // LU +#define cMexico COUNTRY_VALUE(15) // MX +#define cNetherlands COUNTRY_VALUE(16) // NL +#define cNewZealand COUNTRY_VALUE(17) // NZ +#define cNorway COUNTRY_VALUE(18) // NO +#define cSpain COUNTRY_VALUE(19) // ES +#define cSweden COUNTRY_VALUE(20) // SE +#define cSwitzerland COUNTRY_VALUE(21) // CH +#define cUnitedKingdom COUNTRY_VALUE(22) // GB (UK) +#define cUnitedStates COUNTRY_VALUE(23) // US +#define cIndia COUNTRY_VALUE(24) // IN +#define cIndonesia COUNTRY_VALUE(25) // ID +#define cRepublicOfKorea COUNTRY_VALUE(26) // KR +#define cMalaysia COUNTRY_VALUE(27) // MY +#define cChina COUNTRY_VALUE(28) // CN +#define cPhilippines COUNTRY_VALUE(29) // PH +#define cSingapore COUNTRY_VALUE(30) // SG +#define cThailand COUNTRY_VALUE(31) // TH +#define cTaiwan COUNTRY_VALUE(32) // TW + +// New in 4.0 +#define cAndorra COUNTRY_VALUE(33) // AD +#define cUnitedArabEmirates COUNTRY_VALUE(34) // AE +#define cAfghanistan COUNTRY_VALUE(35) // AF +#define cAntiguaAndBarbuda COUNTRY_VALUE(36) // AG +#define cAnguilla COUNTRY_VALUE(37) // AI +#define cAlbania COUNTRY_VALUE(38) // AL +#define cArmenia COUNTRY_VALUE(39) // AM +#define cNetherlandsAntilles COUNTRY_VALUE(40) // AN +#define cAngola COUNTRY_VALUE(41) // AO +#define cAntarctica COUNTRY_VALUE(42) // AQ +#define cArgentina COUNTRY_VALUE(43) // AR +#define cAmericanSamoa COUNTRY_VALUE(44) // AS +#define cAruba COUNTRY_VALUE(45) // AW +#define cAzerbaijan COUNTRY_VALUE(46) // AZ +#define cBosniaAndHerzegovina COUNTRY_VALUE(47) // BA +#define cBarbados COUNTRY_VALUE(48) // BB +#define cBangladesh COUNTRY_VALUE(49) // BD +#define cBurkinaFaso COUNTRY_VALUE(50) // BF +#define cBulgaria COUNTRY_VALUE(51) // BG +#define cBahrain COUNTRY_VALUE(52) // BH +#define cBurundi COUNTRY_VALUE(53) // BI +#define cBenin COUNTRY_VALUE(54) // BJ +#define cBermuda COUNTRY_VALUE(55) // BM +#define cBruneiDarussalam COUNTRY_VALUE(56) // BN +#define cBolivia COUNTRY_VALUE(57) // BO +#define cBahamas COUNTRY_VALUE(58) // BS +#define cBhutan COUNTRY_VALUE(59) // BT +#define cBouvetIsland COUNTRY_VALUE(60) // BV +#define cBotswana COUNTRY_VALUE(61) // BW +#define cBelarus COUNTRY_VALUE(62) // BY +#define cBelize COUNTRY_VALUE(63) // BZ +#define cCocosIslands COUNTRY_VALUE(64) // CC +#define cDemocraticRepublicOfTheCongo COUNTRY_VALUE(65) // CD +#define cCentralAfricanRepublic COUNTRY_VALUE(66) // CF +#define cCongo COUNTRY_VALUE(67) // CG +#define cIvoryCoast COUNTRY_VALUE(68) // CI +#define cCookIslands COUNTRY_VALUE(69) // CK +#define cChile COUNTRY_VALUE(70) // CL +#define cCameroon COUNTRY_VALUE(71) // CM +#define cColumbia COUNTRY_VALUE(72) // CO +#define cCostaRica COUNTRY_VALUE(73) // CR +#define cCuba COUNTRY_VALUE(74) // CU +#define cCapeVerde COUNTRY_VALUE(75) // CV +#define cChristmasIsland COUNTRY_VALUE(76) // CX +#define cCyprus COUNTRY_VALUE(77) // CY +#define cCzechRepublic COUNTRY_VALUE(78) // CZ +#define cDjibouti COUNTRY_VALUE(79) // DJ +#define cDominica COUNTRY_VALUE(80) // DM +#define cDominicanRepublic COUNTRY_VALUE(81) // DO +#define cAlgeria COUNTRY_VALUE(82) // DZ +#define cEcuador COUNTRY_VALUE(83) // EC +#define cEstonia COUNTRY_VALUE(84) // EE +#define cEgypt COUNTRY_VALUE(85) // EG +#define cWesternSahara COUNTRY_VALUE(86) // EH +#define cEritrea COUNTRY_VALUE(87) // ER +#define cEthiopia COUNTRY_VALUE(88) // ET +#define cFiji COUNTRY_VALUE(89) // FJ +#define cFalklandIslands COUNTRY_VALUE(90) // FK +#define cMicronesia COUNTRY_VALUE(91) // FM +#define cFaeroeIslands COUNTRY_VALUE(92) // FO +#define cMetropolitanFrance COUNTRY_VALUE(93) // FX +#define cGabon COUNTRY_VALUE(94) // GA +#define cGrenada COUNTRY_VALUE(95) // GD +#define cGeorgia COUNTRY_VALUE(96) // GE +#define cFrenchGuiana COUNTRY_VALUE(97) // GF +#define cGhana COUNTRY_VALUE(98) // GH +#define cGibraltar COUNTRY_VALUE(99) // GI +#define cGreenland COUNTRY_VALUE(100) // GL +#define cGambia COUNTRY_VALUE(101) // GM +#define cGuinea COUNTRY_VALUE(102) // GN +#define cGuadeloupe COUNTRY_VALUE(103) // GP +#define cEquatorialGuinea COUNTRY_VALUE(104) // GQ +#define cGreece COUNTRY_VALUE(105) // GR +#define cSouthGeorgiaAndTheSouthSandwichIslands COUNTRY_VALUE(106) // GS +#define cGuatemala COUNTRY_VALUE(107) // GT +#define cGuam COUNTRY_VALUE(108) // GU +#define cGuineaBisseu COUNTRY_VALUE(109) // GW +#define cGuyana COUNTRY_VALUE(110) // GY +#define cHeardAndMcDonaldIslands COUNTRY_VALUE(111) // HM +#define cHonduras COUNTRY_VALUE(112) // HN +#define cCroatia COUNTRY_VALUE(113) // HR +#define cHaiti COUNTRY_VALUE(114) // HT +#define cHungary COUNTRY_VALUE(115) // HU +#define cIsrael COUNTRY_VALUE(116) // IL +#define cBritishIndianOceanTerritory COUNTRY_VALUE(117) // IO +#define cIraq COUNTRY_VALUE(118) // IQ +#define cIran COUNTRY_VALUE(119) // IR +#define cJamaica COUNTRY_VALUE(120) // JM +#define cJordan COUNTRY_VALUE(121) // JO +#define cKenya COUNTRY_VALUE(122) // KE +#define cKyrgyzstan COUNTRY_VALUE(123) // KG (Kirgistan) +#define cCambodia COUNTRY_VALUE(124) // KH +#define cKiribati COUNTRY_VALUE(125) // KI +#define cComoros COUNTRY_VALUE(126) // KM +#define cStKittsAndNevis COUNTRY_VALUE(127) // KN +#define cDemocraticPeoplesRepublicOfKorea COUNTRY_VALUE(128) // KP +#define cKuwait COUNTRY_VALUE(129) // KW +#define cCaymanIslands COUNTRY_VALUE(130) // KY +#define cKazakhstan COUNTRY_VALUE(131) // KK +#define cLaos COUNTRY_VALUE(132) // LA +#define cLebanon COUNTRY_VALUE(133) // LB +#define cStLucia COUNTRY_VALUE(134) // LC +#define cLiechtenstein COUNTRY_VALUE(135) // LI +#define cSriLanka COUNTRY_VALUE(136) // LK +#define cLiberia COUNTRY_VALUE(137) // LR +#define cLesotho COUNTRY_VALUE(138) // LS +#define cLithuania COUNTRY_VALUE(139) // LT +#define cLatvia COUNTRY_VALUE(140) // LV +#define cLibya COUNTRY_VALUE(141) // LY +#define cMorrocco COUNTRY_VALUE(142) // MA +#define cMonaco COUNTRY_VALUE(143) // MC +#define cMoldova COUNTRY_VALUE(144) // MD +#define cMadagascar COUNTRY_VALUE(145) // MG +#define cMarshallIslands COUNTRY_VALUE(146) // MH +#define cMacedonia COUNTRY_VALUE(147) // MK +#define cMali COUNTRY_VALUE(148) // ML +#define cMyanmar COUNTRY_VALUE(149) // MM +#define cMongolia COUNTRY_VALUE(150) // MN +#define cMacau COUNTRY_VALUE(151) // MO +#define cNorthernMarianaIslands COUNTRY_VALUE(152) // MP +#define cMartinique COUNTRY_VALUE(153) // MQ +#define cMauritania COUNTRY_VALUE(154) // MR +#define cMontserrat COUNTRY_VALUE(155) // MS +#define cMalta COUNTRY_VALUE(156) // MT +#define cMauritius COUNTRY_VALUE(157) // MU +#define cMaldives COUNTRY_VALUE(158) // MV +#define cMalawi COUNTRY_VALUE(159) // MW +#define cMozambique COUNTRY_VALUE(160) // MZ +#define cNamibia COUNTRY_VALUE(161) // NA +#define cNewCaledonia COUNTRY_VALUE(162) // NC +#define cNiger COUNTRY_VALUE(163) // NE +#define cNorfolkIsland COUNTRY_VALUE(164) // NF +#define cNigeria COUNTRY_VALUE(165) // NG +#define cNicaragua COUNTRY_VALUE(166) // NI +#define cNepal COUNTRY_VALUE(167) // NP +#define cNauru COUNTRY_VALUE(168) // NR +#define cNiue COUNTRY_VALUE(169) // NU +#define cOman COUNTRY_VALUE(170) // OM +#define cPanama COUNTRY_VALUE(171) // PA +#define cPeru COUNTRY_VALUE(172) // PE +#define cFrenchPolynesia COUNTRY_VALUE(173) // PF +#define cPapuaNewGuinea COUNTRY_VALUE(174) // PG +#define cPakistan COUNTRY_VALUE(175) // PK +#define cPoland COUNTRY_VALUE(176) // PL +#define cStPierreAndMiquelon COUNTRY_VALUE(177) // PM +#define cPitcairn COUNTRY_VALUE(178) // PN +#define cPuertoRico COUNTRY_VALUE(179) // PR +#define cPortugal COUNTRY_VALUE(180) // PT +#define cPalau COUNTRY_VALUE(181) // PW +#define cParaguay COUNTRY_VALUE(182) // PY +#define cQatar COUNTRY_VALUE(183) // QA +#define cReunion COUNTRY_VALUE(184) // RE +#define cRomania COUNTRY_VALUE(185) // RO +#define cRussianFederation COUNTRY_VALUE(186) // RU +#define cRwanda COUNTRY_VALUE(187) // RW +#define cSaudiArabia COUNTRY_VALUE(188) // SA +#define cSolomonIslands COUNTRY_VALUE(189) // SB +#define cSeychelles COUNTRY_VALUE(190) // SC +#define cSudan COUNTRY_VALUE(191) // SD +#define cStHelena COUNTRY_VALUE(192) // SH +#define cSlovenia COUNTRY_VALUE(193) // SI +#define cSvalbardAndJanMayenIslands COUNTRY_VALUE(194) // SJ +#define cSlovakia COUNTRY_VALUE(195) // SK +#define cSierraLeone COUNTRY_VALUE(196) // SL +#define cSanMarino COUNTRY_VALUE(197) // SM +#define cSenegal COUNTRY_VALUE(198) // SN +#define cSomalia COUNTRY_VALUE(199) // SO +#define cSuriname COUNTRY_VALUE(200) // SR +#define cSaoTomeAndPrincipe COUNTRY_VALUE(201) // ST +#define cElSalvador COUNTRY_VALUE(202) // SV +#define cSyranArabRepublic COUNTRY_VALUE(203) // SY +#define cSwaziland COUNTRY_VALUE(204) // SZ +#define cTurksAndCaicosIslands COUNTRY_VALUE(205) // TC +#define cChad COUNTRY_VALUE(206) // TD +#define cFrenchSouthernTerritories COUNTRY_VALUE(207) // TF +#define cTogo COUNTRY_VALUE(208) // TG +#define cTajikistan COUNTRY_VALUE(209) // TJ +#define cTokelau COUNTRY_VALUE(210) // TK +#define cTurkmenistan COUNTRY_VALUE(211) // TM +#define cTunisia COUNTRY_VALUE(212) // TN +#define cTonga COUNTRY_VALUE(213) // TO +#define cEastTimor COUNTRY_VALUE(214) // TP +#define cTurkey COUNTRY_VALUE(215) // TR +#define cTrinidadAndTobago COUNTRY_VALUE(216) // TT +#define cTuvalu COUNTRY_VALUE(217) // TV +#define cTanzania COUNTRY_VALUE(218) // TZ +#define cUkraine COUNTRY_VALUE(219) // UA +#define cUganda COUNTRY_VALUE(220) // UG +#define cUnitedStatesMinorOutlyingIslands COUNTRY_VALUE(221) // UM +#define cUruguay COUNTRY_VALUE(222) // UY +#define cUzbekistan COUNTRY_VALUE(223) // UZ +#define cHolySee COUNTRY_VALUE(224) // VA +#define cStVincentAndTheGrenadines COUNTRY_VALUE(225) // VC +#define cVenezuela COUNTRY_VALUE(226) // VE +#define cBritishVirginIslands COUNTRY_VALUE(227) // VG +#define cUSVirginIslands COUNTRY_VALUE(228) // VI +#define cVietNam COUNTRY_VALUE(229) // VN +#define cVanuatu COUNTRY_VALUE(230) // VU +#define cWallisAndFutunaIslands COUNTRY_VALUE(231) // WF +#define cSamoa COUNTRY_VALUE(232) // WS +#define cYemen COUNTRY_VALUE(233) // YE +#define cMayotte COUNTRY_VALUE(234) // YT +#define cYugoslavia COUNTRY_VALUE(235) // YU +#define cSouthAfrica COUNTRY_VALUE(236) // ZA +#define cZambia COUNTRY_VALUE(237) // ZM +#define cZimbabwe COUNTRY_VALUE(238) // ZW + +/* Various character encodings supported by the PalmOS. Actually these +are a mixture of character sets (repetoires or coded character sets +in Internet lingo) and character encodings (CES - character encoding +standard). Many, however, are some of both (e.g. CP932 is the Shift-JIS +encoding of the JIS character set + Microsoft's extensions). + +The following character set values are used by: + a) Palm devices + b) Palm wireless servers + +WARNING! Be aware that a device supporting a new character set + will require some character set definition and maybe + some development on the wireless server side. +*/ +#define CHAR_ENCODING_VALUE(value) ((CharEncodingType)value) + +// Unknown to this version of PalmOS. +#define charEncodingUnknown CHAR_ENCODING_VALUE(0) + +// Maximum character encoding _currently_ defined +#define charEncodingMax CHAR_ENCODING_VALUE(77) + +// Latin Palm OS character encoding, and subsets. +// PalmOS version of CP1252 +#define charEncodingPalmLatin CHAR_ENCODING_VALUE(3) +// Windows variant of 8859-1 +#define charEncodingCP1252 CHAR_ENCODING_VALUE(7) +// ISO 8859 Part 1 +#define charEncodingISO8859_1 CHAR_ENCODING_VALUE(2) +// ISO 646-1991 +#define charEncodingAscii CHAR_ENCODING_VALUE(1) + +// Japanese Palm OS character encoding, and subsets. +// PalmOS version of CP932 +#define charEncodingPalmSJIS CHAR_ENCODING_VALUE(5) +// Windows variant of ShiftJIS +#define charEncodingCP932 CHAR_ENCODING_VALUE(8) +// Encoding for JIS 0208-1990 + 1-byte katakana +#define charEncodingShiftJIS CHAR_ENCODING_VALUE(4) + +// Unicode character encodings +#define charEncodingUCS2 CHAR_ENCODING_VALUE(9) +#define charEncodingUTF8 CHAR_ENCODING_VALUE(6) +#define charEncodingUTF7 CHAR_ENCODING_VALUE(24) +#define charEncodingUTF16 CHAR_ENCODING_VALUE(75) +#define charEncodingUTF16BE CHAR_ENCODING_VALUE(76) +#define charEncodingUTF16LE CHAR_ENCODING_VALUE(77) + +// Latin character encodings +#define charEncodingCP850 CHAR_ENCODING_VALUE(12) +#define charEncodingCP437 CHAR_ENCODING_VALUE(13) +#define charEncodingCP865 CHAR_ENCODING_VALUE(14) +#define charEncodingCP860 CHAR_ENCODING_VALUE(15) +#define charEncodingCP861 CHAR_ENCODING_VALUE(16) +#define charEncodingCP863 CHAR_ENCODING_VALUE(17) +#define charEncodingCP775 CHAR_ENCODING_VALUE(18) +#define charEncodingMacIslande CHAR_ENCODING_VALUE(19) +#define charEncodingMacintosh CHAR_ENCODING_VALUE(20) +#define charEncodingCP1257 CHAR_ENCODING_VALUE(21) +#define charEncodingISO8859_3 CHAR_ENCODING_VALUE(22) +#define charEncodingISO8859_4 CHAR_ENCODING_VALUE(23) + +// Extended Latin character encodings +#define charEncodingISO8859_2 CHAR_ENCODING_VALUE(26) +#define charEncodingCP1250 CHAR_ENCODING_VALUE(27) +#define charEncodingCP852 CHAR_ENCODING_VALUE(28) +#define charEncodingXKamenicky CHAR_ENCODING_VALUE(29) +#define charEncodingMacXCroate CHAR_ENCODING_VALUE(30) +#define charEncodingMacXLat2 CHAR_ENCODING_VALUE(31) +#define charEncodingMacXRomania CHAR_ENCODING_VALUE(32) + +// Japanese character encodings +#define charEncodingEucJp CHAR_ENCODING_VALUE(25) +#define charEncodingISO2022Jp CHAR_ENCODING_VALUE(10) +#define charEncodingXAutoJp CHAR_ENCODING_VALUE(11) + +// Greek character encodings +#define charEncodingISO8859_7 CHAR_ENCODING_VALUE(33) +#define charEncodingCP1253 CHAR_ENCODING_VALUE(34) +#define charEncodingCP869 CHAR_ENCODING_VALUE(35) +#define charEncodingCP737 CHAR_ENCODING_VALUE(36) +#define charEncodingMacXGr CHAR_ENCODING_VALUE(37) + +// Cyrillic character encodings +#define charEncodingCP1251 CHAR_ENCODING_VALUE(38) +#define charEncodingISO8859_5 CHAR_ENCODING_VALUE(39) +#define charEncodingKoi8R CHAR_ENCODING_VALUE(40) +#define charEncodingKoi8 CHAR_ENCODING_VALUE(41) +#define charEncodingCP855 CHAR_ENCODING_VALUE(42) +#define charEncodingCP866 CHAR_ENCODING_VALUE(43) +#define charEncodingMacCyr CHAR_ENCODING_VALUE(44) +#define charEncodingMacUkraine CHAR_ENCODING_VALUE(45) + +// Turkish character encodings +#define charEncodingCP1254 CHAR_ENCODING_VALUE(46) +#define charEncodingISO8859_9 CHAR_ENCODING_VALUE(47) +#define charEncodingCP857 CHAR_ENCODING_VALUE(48) +#define charEncodingMacTurc CHAR_ENCODING_VALUE(49) +#define charEncodingCP853 CHAR_ENCODING_VALUE(50) + +// Arabic character encodings +#define charEncodingISO8859_6 CHAR_ENCODING_VALUE(51) +#define charEncodingAsmo708 CHAR_ENCODING_VALUE(52) +#define charEncodingCP1256 CHAR_ENCODING_VALUE(53) +#define charEncodingCP864 CHAR_ENCODING_VALUE(54) +#define charEncodingAsmo708Plus CHAR_ENCODING_VALUE(55) +#define charEncodingAsmo708Fr CHAR_ENCODING_VALUE(56) +#define charEncodingMacAra CHAR_ENCODING_VALUE(57) + +// Chinese character encodings +#define charEncodingGB2312 CHAR_ENCODING_VALUE(58) +#define charEncodingHZ CHAR_ENCODING_VALUE(59) +#define charEncodingBig5 CHAR_ENCODING_VALUE(60) + +// Vietnamese character encodings +#define charEncodingViscii CHAR_ENCODING_VALUE(61) +#define charEncodingViqr CHAR_ENCODING_VALUE(62) +#define charEncodingVncii CHAR_ENCODING_VALUE(63) +#define charEncodingVietnet CHAR_ENCODING_VALUE(65) +#define charEncodingCP1258 CHAR_ENCODING_VALUE(66) + +// Korean character encodings +#define charEncodingKsc5601 CHAR_ENCODING_VALUE(67) +#define charEncodingCP949 CHAR_ENCODING_VALUE(68) +#define charEncodingISO2022Kr CHAR_ENCODING_VALUE(69) + +// Hebrew character encodings +#define charEncodingISO8859_8I CHAR_ENCODING_VALUE(70) +#define charEncodingISO8859_8 CHAR_ENCODING_VALUE(71) +#define charEncodingCP1255 CHAR_ENCODING_VALUE(72) +#define charEncodingCP1255V CHAR_ENCODING_VALUE(73) + +// Thai character encodings +#define charEncodingTis620 CHAR_ENCODING_VALUE(74) +#define charEncodingCP874 CHAR_ENCODING_VALUE(64) + + +// Leave the following line unchanged at end of section: +// TAG SOURCE END + +/* Rez doesn't even support macros, so for Rez we simplify all of the #defines. + +WARNING! This section is auto-generated (see comment near top of file). +*/ +#else // !PALM_LOCALE_HAS_TYPES + +// Leave the following line unchanged at beginning of rez section +// TAG DESTINATION START + +#define lEnglish 0 // EN +#define lFrench 1 // FR +#define lGerman 2 // DE +#define lItalian 3 // IT +#define lSpanish 4 // ES +#define lUnused 5 // Reserved + +// New in 3.1 +#define lJapanese 6 // JA (Palm calls this jp) +#define lDutch 7 // NL + +// New in 4.0 +#define lAfar 8 // AA +#define lAbkhazian 9 // AB +#define lAfrikaans 10 // AF +#define lAmharic 11 // AM +#define lArabic 12 // AR +#define lAssamese 13 // AS +#define lAymara 14 // AY +#define lAzerbaijani 15 // AZ +#define lBashkir 16 // BA +#define lByelorussian 17 // BE +#define lBulgarian 18 // BG +#define lBihari 19 // BH +#define lBislama 20 // BI +#define lBengali 21 // BN (Bangla) +#define lTibetan 22 // BO +#define lBreton 23 // BR +#define lCatalan 24 // CA +#define lCorsican 25 // CO +#define lCzech 26 // CS +#define lWelsh 27 // CY +#define lDanish 28 // DA +#define lBhutani 29 // DZ +#define lGreek 30 // EL +#define lEsperanto 31 // EO +#define lEstonian 32 // ET +#define lBasque 33 // EU +#define lPersian 34 // FA (Farsi) +#define lFinnish 35 // FI +#define lFiji 36 // FJ +#define lFaroese 37 // FO +#define lFrisian 38 // FY +#define lIrish 39 // GA +#define lScotsGaelic 40 // GD +#define lGalician 41 // GL +#define lGuarani 42 // GN +#define lGujarati 43 // GU +#define lHausa 44 // HA +#define lHindi 45 // HI +#define lCroatian 46 // HR +#define lHungarian 47 // HU +#define lArmenian 48 // HY +#define lInterlingua 49 // IA +#define lInterlingue 50 // IE +#define lInupiak 51 // IK +#define lIndonesian 52 // IN +#define lIcelandic 53 // IS +#define lHebrew 54 // IW +#define lYiddish 55 // JI +#define lJavanese 56 // JW +#define lGeorgian 57 // KA +#define lKazakh 58 // KK +#define lGreenlandic 59 // KL +#define lCambodian 60 // KM +#define lKannada 61 // KN +#define lKorean 62 // KO +#define lKashmiri 63 // KS +#define lKurdish 64 // KU +#define lKirghiz 65 // KY +#define lLatin 66 // LA +#define lLingala 67 // LN +#define lLaothian 68 // LO +#define lLithuanian 69 // LT +#define lLatvian 70 // LV (Lettish) +#define lMalagasy 71 // MG +#define lMaori 72 // MI +#define lMacedonian 73 // MK +#define lMalayalam 74 // ML +#define lMongolian 75 // MN +#define lMoldavian 76 // MO +#define lMarathi 77 // MR +#define lMalay 78 // MS +#define lMaltese 79 // MT +#define lBurmese 80 // MY +#define lNauru 81 // NA +#define lNepali 82 // NE +#define lNorwegian 83 // NO +#define lOccitan 84 // OC +#define lAfan 85 // OM (Oromo) +#define lOriya 86 // OR +#define lPunjabi 87 // PA +#define lPolish 88 // PL +#define lPashto 89 // PS (Pushto) +#define lPortuguese 90 // PT +#define lQuechua 91 // QU +#define lRhaetoRomance 92 // RM +#define lKurundi 93 // RN +#define lRomanian 94 // RO +#define lRussian 95 // RU +#define lKinyarwanda 96 // RW +#define lSanskrit 97 // SA +#define lSindhi 98 // SD +#define lSangho 99 // SG +#define lSerboCroatian 100 // SH +#define lSinghalese 101 // SI +#define lSlovak 102 // SK +#define lSlovenian 103 // SL +#define lSamoan 104 // SM +#define lShona 105 // SN +#define lSomali 106 // SO +#define lAlbanian 107 // SQ +#define lSerbian 108 // SR +#define lSiswati 109 // SS +#define lSesotho 110 // ST +#define lSudanese 111 // SU +#define lSwedish 112 // SV +#define lSwahili 113 // SW +#define lTamil 114 // TA +#define lTelugu 115 // TE +#define lTajik 116 // TG +#define lThai 117 // TH +#define lTigrinya 118 // TI +#define lTurkmen 119 // TK +#define lTagalog 120 // TL +#define lSetswana 121 // TN +#define lTonga 122 // TO +#define lTurkish 123 // TR +#define lTsonga 124 // TS +#define lTatar 125 // TT +#define lTwi 126 // TW +#define lUkrainian 127 // UK +#define lUrdu 128 // UR +#define lUzbek 129 // UZ +#define lVietnamese 130 // VI +#define lVolapuk 131 // VO +#define lWolof 132 // WO +#define lXhosa 133 // XH +#define lYoruba 134 // YO +#define lChinese 135 // ZH +#define lZulu 136 // ZU + +/* Country codes (ISO 3166). The first 33 preserve the old values for the +deprecated CountryType; the rest are sorted by the 2-character country code. + +WARNING! Keep in sync with BOTH: + 1) CountryCode array in OverlayMgr.c + 2) localeCountry #define in UIResDefs.r +*/ +#define COUNTRY_VALUE(value) ((CountryType)value) + +#define cAustralia 0 // AU +#define cAustria 1 // AT +#define cBelgium 2 // BE +#define cBrazil 3 // BR +#define cCanada 4 // CA +#define cDenmark 5 // DK +#define cFinland 6 // FI +#define cFrance 7 // FR +#define cGermany 8 // DE +#define cHongKong 9 // HK +#define cIceland 10 // IS +#define cIreland 11 // IE +#define cItaly 12 // IT +#define cJapan 13 // JP +#define cLuxembourg 14 // LU +#define cMexico 15 // MX +#define cNetherlands 16 // NL +#define cNewZealand 17 // NZ +#define cNorway 18 // NO +#define cSpain 19 // ES +#define cSweden 20 // SE +#define cSwitzerland 21 // CH +#define cUnitedKingdom 22 // GB (UK) +#define cUnitedStates 23 // US +#define cIndia 24 // IN +#define cIndonesia 25 // ID +#define cRepublicOfKorea 26 // KR +#define cMalaysia 27 // MY +#define cChina 28 // CN +#define cPhilippines 29 // PH +#define cSingapore 30 // SG +#define cThailand 31 // TH +#define cTaiwan 32 // TW + +// New in 4.0 +#define cAndorra 33 // AD +#define cUnitedArabEmirates 34 // AE +#define cAfghanistan 35 // AF +#define cAntiguaAndBarbuda 36 // AG +#define cAnguilla 37 // AI +#define cAlbania 38 // AL +#define cArmenia 39 // AM +#define cNetherlandsAntilles 40 // AN +#define cAngola 41 // AO +#define cAntarctica 42 // AQ +#define cArgentina 43 // AR +#define cAmericanSamoa 44 // AS +#define cAruba 45 // AW +#define cAzerbaijan 46 // AZ +#define cBosniaAndHerzegovina 47 // BA +#define cBarbados 48 // BB +#define cBangladesh 49 // BD +#define cBurkinaFaso 50 // BF +#define cBulgaria 51 // BG +#define cBahrain 52 // BH +#define cBurundi 53 // BI +#define cBenin 54 // BJ +#define cBermuda 55 // BM +#define cBruneiDarussalam 56 // BN +#define cBolivia 57 // BO +#define cBahamas 58 // BS +#define cBhutan 59 // BT +#define cBouvetIsland 60 // BV +#define cBotswana 61 // BW +#define cBelarus 62 // BY +#define cBelize 63 // BZ +#define cCocosIslands 64 // CC +#define cDemocraticRepublicOfTheCongo 65 // CD +#define cCentralAfricanRepublic 66 // CF +#define cCongo 67 // CG +#define cIvoryCoast 68 // CI +#define cCookIslands 69 // CK +#define cChile 70 // CL +#define cCameroon 71 // CM +#define cColumbia 72 // CO +#define cCostaRica 73 // CR +#define cCuba 74 // CU +#define cCapeVerde 75 // CV +#define cChristmasIsland 76 // CX +#define cCyprus 77 // CY +#define cCzechRepublic 78 // CZ +#define cDjibouti 79 // DJ +#define cDominica 80 // DM +#define cDominicanRepublic 81 // DO +#define cAlgeria 82 // DZ +#define cEcuador 83 // EC +#define cEstonia 84 // EE +#define cEgypt 85 // EG +#define cWesternSahara 86 // EH +#define cEritrea 87 // ER +#define cEthiopia 88 // ET +#define cFiji 89 // FJ +#define cFalklandIslands 90 // FK +#define cMicronesia 91 // FM +#define cFaeroeIslands 92 // FO +#define cMetropolitanFrance 93 // FX +#define cGabon 94 // GA +#define cGrenada 95 // GD +#define cGeorgia 96 // GE +#define cFrenchGuiana 97 // GF +#define cGhana 98 // GH +#define cGibraltar 99 // GI +#define cGreenland 100 // GL +#define cGambia 101 // GM +#define cGuinea 102 // GN +#define cGuadeloupe 103 // GP +#define cEquatorialGuinea 104 // GQ +#define cGreece 105 // GR +#define cSouthGeorgiaAndTheSouthSandwichIslands 106 // GS +#define cGuatemala 107 // GT +#define cGuam 108 // GU +#define cGuineaBisseu 109 // GW +#define cGuyana 110 // GY +#define cHeardAndMcDonaldIslands 111 // HM +#define cHonduras 112 // HN +#define cCroatia 113 // HR +#define cHaiti 114 // HT +#define cHungary 115 // HU +#define cIsrael 116 // IL +#define cBritishIndianOceanTerritory 117 // IO +#define cIraq 118 // IQ +#define cIran 119 // IR +#define cJamaica 120 // JM +#define cJordan 121 // JO +#define cKenya 122 // KE +#define cKyrgyzstan 123 // KG (Kirgistan) +#define cCambodia 124 // KH +#define cKiribati 125 // KI +#define cComoros 126 // KM +#define cStKittsAndNevis 127 // KN +#define cDemocraticPeoplesRepublicOfKorea 128 // KP +#define cKuwait 129 // KW +#define cCaymanIslands 130 // KY +#define cKazakhstan 131 // KK +#define cLaos 132 // LA +#define cLebanon 133 // LB +#define cStLucia 134 // LC +#define cLiechtenstein 135 // LI +#define cSriLanka 136 // LK +#define cLiberia 137 // LR +#define cLesotho 138 // LS +#define cLithuania 139 // LT +#define cLatvia 140 // LV +#define cLibya 141 // LY +#define cMorrocco 142 // MA +#define cMonaco 143 // MC +#define cMoldova 144 // MD +#define cMadagascar 145 // MG +#define cMarshallIslands 146 // MH +#define cMacedonia 147 // MK +#define cMali 148 // ML +#define cMyanmar 149 // MM +#define cMongolia 150 // MN +#define cMacau 151 // MO +#define cNorthernMarianaIslands 152 // MP +#define cMartinique 153 // MQ +#define cMauritania 154 // MR +#define cMontserrat 155 // MS +#define cMalta 156 // MT +#define cMauritius 157 // MU +#define cMaldives 158 // MV +#define cMalawi 159 // MW +#define cMozambique 160 // MZ +#define cNamibia 161 // NA +#define cNewCaledonia 162 // NC +#define cNiger 163 // NE +#define cNorfolkIsland 164 // NF +#define cNigeria 165 // NG +#define cNicaragua 166 // NI +#define cNepal 167 // NP +#define cNauru 168 // NR +#define cNiue 169 // NU +#define cOman 170 // OM +#define cPanama 171 // PA +#define cPeru 172 // PE +#define cFrenchPolynesia 173 // PF +#define cPapuaNewGuinea 174 // PG +#define cPakistan 175 // PK +#define cPoland 176 // PL +#define cStPierreAndMiquelon 177 // PM +#define cPitcairn 178 // PN +#define cPuertoRico 179 // PR +#define cPortugal 180 // PT +#define cPalau 181 // PW +#define cParaguay 182 // PY +#define cQatar 183 // QA +#define cReunion 184 // RE +#define cRomania 185 // RO +#define cRussianFederation 186 // RU +#define cRwanda 187 // RW +#define cSaudiArabia 188 // SA +#define cSolomonIslands 189 // SB +#define cSeychelles 190 // SC +#define cSudan 191 // SD +#define cStHelena 192 // SH +#define cSlovenia 193 // SI +#define cSvalbardAndJanMayenIslands 194 // SJ +#define cSlovakia 195 // SK +#define cSierraLeone 196 // SL +#define cSanMarino 197 // SM +#define cSenegal 198 // SN +#define cSomalia 199 // SO +#define cSuriname 200 // SR +#define cSaoTomeAndPrincipe 201 // ST +#define cElSalvador 202 // SV +#define cSyranArabRepublic 203 // SY +#define cSwaziland 204 // SZ +#define cTurksAndCaicosIslands 205 // TC +#define cChad 206 // TD +#define cFrenchSouthernTerritories 207 // TF +#define cTogo 208 // TG +#define cTajikistan 209 // TJ +#define cTokelau 210 // TK +#define cTurkmenistan 211 // TM +#define cTunisia 212 // TN +#define cTonga 213 // TO +#define cEastTimor 214 // TP +#define cTurkey 215 // TR +#define cTrinidadAndTobago 216 // TT +#define cTuvalu 217 // TV +#define cTanzania 218 // TZ +#define cUkraine 219 // UA +#define cUganda 220 // UG +#define cUnitedStatesMinorOutlyingIslands 221 // UM +#define cUruguay 222 // UY +#define cUzbekistan 223 // UZ +#define cHolySee 224 // VA +#define cStVincentAndTheGrenadines 225 // VC +#define cVenezuela 226 // VE +#define cBritishVirginIslands 227 // VG +#define cUSVirginIslands 228 // VI +#define cVietNam 229 // VN +#define cVanuatu 230 // VU +#define cWallisAndFutunaIslands 231 // WF +#define cSamoa 232 // WS +#define cYemen 233 // YE +#define cMayotte 234 // YT +#define cYugoslavia 235 // YU +#define cSouthAfrica 236 // ZA +#define cZambia 237 // ZM +#define cZimbabwe 238 // ZW + +/* Various character encodings supported by the PalmOS. Actually these +are a mixture of character sets (repetoires or coded character sets +in Internet lingo) and character encodings (CES - character encoding +standard). Many, however, are some of both (e.g. CP932 is the Shift-JIS +encoding of the JIS character set + Microsoft's extensions). + +The following character set values are used by: + a) Palm devices + b) Palm wireless servers + +WARNING! Be aware that a device supporting a new character set + will require some character set definition and maybe + some development on the wireless server side. +*/ + + +/////////////////////////////////////////////////////////////////////////// +// Warning: The following files are interdependent and MUST to be modified together: +// +// -> Viewer\Incs\Core\System\PalmLocale.h +// (defines charset IDs) +// +// -> Server\apps\Elaine\Src\Core\CharsetInfo.cpp +// (defines charset attributes like Asian, cp1252 compatible, etc.) +// +// -> Server\CstPalmOSCharsets.lst +// (list the iso names of +// +/////////////////////////////////////////////////////////////////////////// + + +#define CHAR_ENCODING_VALUE(value) ((CharEncodingType)value) + +// Unknown to this version of PalmOS. +#define charEncodingUnknown 0 + +// Maximum character encoding _currently_ defined + +#define charEncodingMax 77 + +// Latin Palm OS character encoding, and subsets. +// PalmOS version of CP1252 +#define charEncodingPalmLatin 3 +// Windows variant of 8859-1 +#define charEncodingCP1252 7 +// ISO 8859 Part 1 +#define charEncodingISO8859_1 2 +// ISO 646-1991 +#define charEncodingAscii 1 + +// Japanese Palm OS character encoding, and subsets. +// PalmOS version of CP932 +#define charEncodingPalmSJIS 5 +// Windows variant of ShiftJIS +#define charEncodingCP932 8 +// Encoding for JIS 0208-1990 + 1-byte katakana +#define charEncodingShiftJIS 4 + +// Unicode character encodings +#define charEncodingUCS2 9 +#define charEncodingUTF8 6 +#define charEncodingUTF7 24 +#define charEncodingUTF16 75 +#define charEncodingUTF16BE 76 +#define charEncodingUTF16LE 77 + +// Latin character encodings +#define charEncodingCP850 12 +#define charEncodingCP437 13 +#define charEncodingCP865 14 +#define charEncodingCP860 15 +#define charEncodingCP861 16 +#define charEncodingCP863 17 +#define charEncodingCP775 18 +#define charEncodingMacIslande 19 +#define charEncodingMacintosh 20 +#define charEncodingCP1257 21 +#define charEncodingISO8859_3 22 +#define charEncodingISO8859_4 23 + +// Extended Latin character encodings +#define charEncodingISO8859_2 26 +#define charEncodingCP1250 27 +#define charEncodingCP852 28 +#define charEncodingXKamenicky 29 +#define charEncodingMacXCroate 30 +#define charEncodingMacXLat2 31 +#define charEncodingMacXRomania 32 + +// Japanese character encodings +#define charEncodingEucJp 25 +#define charEncodingISO2022Jp 10 +#define charEncodingXAutoJp 11 + +// Greek character encodings +#define charEncodingISO8859_7 33 +#define charEncodingCP1253 34 +#define charEncodingCP869 35 +#define charEncodingCP737 36 +#define charEncodingMacXGr 37 + +// Cyrillic character encodings +#define charEncodingCP1251 38 +#define charEncodingISO8859_5 39 +#define charEncodingKoi8R 40 +#define charEncodingKoi8 41 +#define charEncodingCP855 42 +#define charEncodingCP866 43 +#define charEncodingMacCyr 44 +#define charEncodingMacUkraine 45 + +// Turkish character encodings +#define charEncodingCP1254 46 +#define charEncodingISO8859_9 47 +#define charEncodingCP857 48 +#define charEncodingMacTurc 49 +#define charEncodingCP853 50 + +// Arabic character encodings +#define charEncodingISO8859_6 51 +#define charEncodingAsmo708 52 +#define charEncodingCP1256 53 +#define charEncodingCP864 54 +#define charEncodingAsmo708Plus 55 +#define charEncodingAsmo708Fr 56 +#define charEncodingMacAra 57 + +// Chinese character encodings +#define charEncodingGB2312 58 +#define charEncodingHZ 59 +#define charEncodingBig5 60 + +// Vietnamese character encodings +#define charEncodingViscii 61 +#define charEncodingViqr 62 +#define charEncodingVncii 63 +#define charEncodingVietnet 65 +#define charEncodingCP1258 66 + +// Korean character encodings +#define charEncodingKsc5601 67 +#define charEncodingCP949 68 +#define charEncodingISO2022Kr 69 + +// Hebrew character encodings +#define charEncodingISO8859_8I 70 +#define charEncodingISO8859_8 71 +#define charEncodingCP1255 72 +#define charEncodingCP1255V 73 + +// Thai character encodings +#define charEncodingTis620 74 +#define charEncodingCP874 64 + + +// Leave the following line unchanged at end of section +// TAG DESTINATION END + +#endif // !PALM_LOCALE_HAS_TYPES + +#endif // __PALMLOCALE_H__ diff --git a/sdk-4/include/Core/System/Password.h b/sdk-4/include/Core/System/Password.h new file mode 100644 index 0000000..f15a72a --- /dev/null +++ b/sdk-4/include/Core/System/Password.h @@ -0,0 +1,49 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __PASSWORD_H__ +#define __PASSWORD_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +#define pwdLength 32 +#define pwdEncryptionKeyLength 64 + +#ifdef __cplusplus +extern "C" { +#endif + +Boolean PwdExists() + SYS_TRAP(sysTrapPwdExists); + +Boolean PwdVerify(Char *string) + SYS_TRAP(sysTrapPwdVerify); + +void PwdSet(Char *oldPassword, Char *newPassword) + SYS_TRAP(sysTrapPwdSet); + +void PwdRemove(void) + SYS_TRAP(sysTrapPwdRemove); + +#ifdef __cplusplus +} +#endif + +#endif // __PASSWORD_H__ diff --git a/sdk-4/include/Core/System/PenMgr.h b/sdk-4/include/Core/System/PenMgr.h new file mode 100644 index 0000000..8150a6a --- /dev/null +++ b/sdk-4/include/Core/System/PenMgr.h @@ -0,0 +1,98 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __PEN_MGR_H +#define __PEN_MGR_H + +// Pilot common definitions +#include +#include +#include +#include + + +/******************************************************************** + * Pen Manager Errors + * the constant serErrorClass is defined in ErrorBase.h + ********************************************************************/ +#define penErrBadParam (penErrorClass | 1) +#define penErrIgnorePoint (penErrorClass | 2) + + + +/******************************************************************** + * Pen manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +// Initializes the Pen Manager +Err PenOpen(void) + SYS_TRAP(sysTrapPenOpen); + +// Closes the Pen Manager and frees whatever memory it allocated +Err PenClose(void) + SYS_TRAP(sysTrapPenClose); + + +// Put pen to sleep +Err PenSleep(void) + SYS_TRAP(sysTrapPenSleep); + +// Wake pen +Err PenWake(void) + SYS_TRAP(sysTrapPenWake); + + +// Get the raw pen coordinates from the hardware. +Err PenGetRawPen(PointType *penP) + SYS_TRAP(sysTrapPenGetRawPen); + +// Reset calibration in preparation for setting it again +Err PenResetCalibration (void) + SYS_TRAP(sysTrapPenResetCalibration); + +// Set calibration settings for the pen +Err PenCalibrate (PointType *digTopLeftP, PointType *digBotRightP, + PointType *scrTopLeftP, PointType *scrBotRightP) + SYS_TRAP(sysTrapPenCalibrate); + +// Scale a raw pen coordinate into screen coordinates +Err PenRawToScreen(PointType *penP) + SYS_TRAP(sysTrapPenRawToScreen); + +// Scale a screen pen coordinate back into a raw coordinate +Err PenScreenToRaw(PointType *penP) + SYS_TRAP(sysTrapPenScreenToRaw); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _PenGetRawPen \ + ASM_SYS_TRAP(sysTrapPenGetRawPen) + + + +#endif //__PEN_MGR_H diff --git a/sdk-4/include/Core/System/Preferences.h b/sdk-4/include/Core/System/Preferences.h new file mode 100644 index 0000000..e4d0ef7 --- /dev/null +++ b/sdk-4/include/Core/System/Preferences.h @@ -0,0 +1,427 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __PREFERENCES_H__ +#define __PREFERENCES_H__ + +#include +#include +#include +#include // CountryType, kMaxCountryNameLen, etc. +#include // AttnFlagsType + +/*********************************************************************** + * Constants + ***********************************************************************/ + +#define noPreferenceFound -1 + +// Preference version constants +#define preferenceDataVer2 2 // Palm OS 2.0 +#define preferenceDataVer3 3 // Palm OS 3.0 +#define preferenceDataVer4 4 // Palm OS 3.1 +#define preferenceDataVer5 5 // Palm OS 3.2a +#define preferenceDataVer6 6 // Palm OS 3.2b/3.3 +#define preferenceDataVer8 8 // Palm OS 3.5 +#define preferenceDataVer9 9 // Palm OS 4.0 + +// Be SURE to update "preferenceDataVerLatest" when adding a new prefs version... +#define preferenceDataVerLatest preferenceDataVer9 + + +#define defaultAutoOffDuration 2 // minutes +#define defaultAutoOffDurationSecs (2 * minutesInSeconds) // seconds + +#define peggedAutoOffDuration 0xFF // minutes (UInt8) +#define peggedAutoOffDurationSecs 0xFFFF // seconds (UInt16) + +#define defaultAutoLockType never //Never auto lock device +#define defaultAutoLockTime 0 +#define defaultAutoLockTimeFlag 0 + +// Obsolete after V20 +#if EMULATION_LEVEL == EMULATION_NONE + #define defaultSysSoundLevel slOn + #define defaultGameSoundLevel slOn + #define defaultAlarmSoundLevel slOn +#else // EMULATION_LEVEL != EMULATION_NONE + #define defaultSysSoundLevel slOff + #define defaultGameSoundLevel slOff + #define defaultAlarmSoundLevel slOn +#endif + + +#if EMULATION_LEVEL == EMULATION_NONE + #define defaultSysSoundVolume sndMaxAmp + #define defaultGameSoundVolume sndMaxAmp + #define defaultAlarmSoundVolume sndMaxAmp +#else // EMULATION_LEVEL != EMULATION_NONE + #define defaultSysSoundVolume 0 + #define defaultGameSoundVolume 0 + #define defaultAlarmSoundVolume sndMaxAmp +#endif + +typedef enum + { + unitsEnglish = 0, // Feet, yards, miles, gallons, pounds, slugs, etc. + unitsMetric // Meters, liters, grams, newtons, etc. + } MeasurementSystemType; + + +// These sound levels must corrospond to positions in the popup lists +// used by the preferences app. These are made obsolete after V20. The +// loudness of the sound is now represented as a number from 0 to sndMaxAmp. +typedef enum { + slOn = 0, + slOff = 1 + } SoundLevelTypeV20; + +// Device Automatic Locking options. +typedef enum { + never = 0, //Auto-Lock disabled. + uponPowerOff, // Auto lock when the device powers off. + atPresetTime, //Auto lock at HH:MM every day. + afterPresetDelay //Auto lock after x minutes or hours. + } SecurityAutoLockType; + + +// The number format (thousands separator and decimal point). This defines +// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland). +typedef enum { + alOff, // Never show an animation + alEventsOnly, // Show an animation for an event + alEventsAndRandom, // Also show random animation + alEventsAndMoreRandom // Show random animations more frequently + } AnimationLevelType; + + +typedef enum + { + prefVersion, + prefCountry, + prefDateFormat, + prefLongDateFormat, + prefWeekStartDay, + prefTimeFormat, + prefNumberFormat, + prefAutoOffDuration, // prefAutoOffDurationSecs is now preferred (prefAutoOffDuration is in minutes) + prefSysSoundLevelV20, // slOn or slOff - error beeps and other non-alarm/game sounds + prefGameSoundLevelV20, // slOn or slOff - game sound effects + prefAlarmSoundLevelV20, // slOn or slOff - alarm sound effects + prefHidePrivateRecordsV33, + prefDeviceLocked, + prefLocalSyncRequiresPassword, + prefRemoteSyncRequiresPassword, + prefSysBatteryKind, + prefAllowEasterEggs, + prefMinutesWestOfGMT, // deprecated old unsigned minutes EAST of GMT + prefDaylightSavings, // deprecated old daylight saving time rule + prefRonamaticChar, + prefHard1CharAppCreator, // App creator for hard key #1 + prefHard2CharAppCreator, // App creator for hard key #2 + prefHard3CharAppCreator, // App creator for hard key #3 + prefHard4CharAppCreator, // App creator for hard key #4 + prefCalcCharAppCreator, // App creator for calculator soft key + prefHardCradleCharAppCreator, // App creator for hard cradle key + prefLauncherAppCreator, // App creator for launcher soft key + prefSysPrefFlags, + prefHardCradle2CharAppCreator, // App creator for 2nd hard cradle key + prefAnimationLevel, + + // Additions for PalmOS 3.0: + prefSysSoundVolume, // actual amplitude - error beeps and other non-alarm/game sounds + prefGameSoundVolume, // actual amplitude - game sound effects + prefAlarmSoundVolume, // actual amplitude - alarm sound effects + prefBeamReceive, // not used - use ExgLibControl with ir(Get/Set)ScanningMode instead + prefCalibrateDigitizerAtReset, // True makes the user calibrate at soft reset time + prefSystemKeyboardID, // ID of the preferred keyboard resource + prefDefSerialPlugIn, // creator ID of the default serial plug-in + + // Additions for PalmOS 3.1: + prefStayOnWhenPluggedIn, // don't sleep after timeout when using line current + prefStayLitWhenPluggedIn, // keep backlight on when not sleeping on line current + + // Additions for PalmOS 3.2: + prefAntennaCharAppCreator, // App creator for antenna key + + // Additions for PalmOS 3.3: + prefMeasurementSystem, // English, Metric, etc. + + // Additions for PalmOS 3.5: + prefShowPrivateRecords, // returns privateRecordViewEnum + prefAutoOffDurationSecs, // auto-off duration in seconds + + // Additions for PalmOS 4.0: + prefTimeZone, // GMT offset in minutes, + for east of GMT, - for west + prefDaylightSavingAdjustment, // current DST adjustment in minutes (typically 0 or 60) + + prefAutoLockType, // Never, on poweroff, after preset delay or at preset time. + prefAutoLockTime, // Auto lock preset time or delay. + prefAutoLockTimeFlag, // For Minutes or Hours. + + prefLanguage, // Language spoken in country selected via Setup app/Formats panel + prefLocale, // Locale for country selected via Setup app/Formats panel + + prefTimeZoneCountry, // Country used to specify time zone. + + prefAttentionFlags, // User prefs for getting user's attention + + prefDefaultAppCreator // Default application launched on reset. + + } SystemPreferencesChoice; + + +typedef struct { + UInt16 version; // Version of preference info + + // International preferences + CountryType country; // Country the device is in + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + UInt8 weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + + // system preferences + UInt8 autoOffDuration; // Time period before shutting off (in minutes) + SoundLevelTypeV20 sysSoundLevel; // slOn or slOff - error beeps and other non-alarm sounds + SoundLevelTypeV20 alarmSoundLevel; // slOn or slOff - alarm only + Boolean hideSecretRecords; // True to not display records with + // their secret bit attribute set + Boolean deviceLocked; // Device locked until the system + // password is entered + UInt8 reserved1; + UInt16 sysPrefFlags; // Miscellaneous system pref flags + // copied into the global GSysPrefFlags + // at boot time. + SysBatteryKind sysBatteryKind; // The type of batteries installed. This + // is copied into the globals GSysbatteryKind + // at boot time. + UInt8 reserved2; + + } SystemPreferencesTypeV10; + + +// Any entries added to this structure must be initialized in +// Prefereces.c:GetPreferenceResource +// +// DOLATER CS - We should move SystemPreferencesType, SystemPreferencesTypeV10, +// PrefGetPreferences, and PrefSetPreferences to a private header +// file, since any code compiled against an old version of this +// struct will trash memory when run on a version of the Palm OS +// that makes the struct longer. + +typedef struct + { + UInt16 version; // Version of preference info + + // International preferences + CountryType country; // Country the device is in (see PalmLocale.h) + DateFormatType dateFormat; // Format to display date in + DateFormatType longDateFormat; // Format to display date in + Int8 weekStartDay; // Sunday or Monday + TimeFormatType timeFormat; // Format to display time in + NumberFormatType numberFormat; // Format to display numbers in + + // system preferences + UInt8 autoOffDuration; // Time period in minutes before shutting off (use autoOffDurationSecs instead). + SoundLevelTypeV20 sysSoundLevelV20; // slOn or slOff - error beeps and other non-alarm/game sounds + SoundLevelTypeV20 gameSoundLevelV20; // slOn or slOff - game sound effects + SoundLevelTypeV20 alarmSoundLevelV20; // slOn or slOff - alarm sound effects + Boolean hideSecretRecords; // True to not display records with + // their secret bit attribute set + Boolean deviceLocked; // Device locked until the system + // password is entered + Boolean localSyncRequiresPassword; // User must enter password on Pilot + Boolean remoteSyncRequiresPassword; // User must enter password on Pilot + UInt16 sysPrefFlags; // Miscellaneous system pref flags + // copied into the global GSysPrefFlags + // at boot time. Constants are + // sysPrefFlagXXX defined in SystemPrv.h + SysBatteryKind sysBatteryKind; // The type of batteries installed. This + // is copied into the globals GSysbatteryKind + // at boot time. + UInt8 reserved1; + UInt32 minutesWestOfGMT; // minutes west of Greenwich + DaylightSavingsTypes daylightSavings; // Type of daylight savings correction + UInt8 reserved2; + UInt16 ronamaticChar; // character to generate from ronamatic stroke. + // Typically it popups the onscreen keyboard. + UInt32 hard1CharAppCreator; // creator of application to launch in response + // to the hard button #1. Used by SysHandleEvent. + UInt32 hard2CharAppCreator; // creator of application to launch in response + // to the hard button #2. Used by SysHandleEvent. + UInt32 hard3CharAppCreator; // creator of application to launch in response + // to the hard button #3. Used by SysHandleEvent. + UInt32 hard4CharAppCreator; // creator of application to launch in response + // to the hard button #4. Used by SysHandleEvent. + UInt32 calcCharAppCreator; // creator of application to launch in response + // to the Calculator icon. Used by SysHandleEvent. + UInt32 hardCradleCharAppCreator; // creator of application to launch in response + // to the Cradle button. Used by SysHandleEvent. + UInt32 launcherCharAppCreator; // creator of application to launch in response + // to the launcher button. Used by SysHandleEvent. + UInt32 hardCradle2CharAppCreator; // creator of application to launch in response + // to the 2nd Cradle button. Used by SysHandleEvent. + AnimationLevelType animationLevel; // amount of animation to display + + Boolean maskPrivateRecords; // Only meaningful if hideSecretRecords is true. + //true to show a grey placeholder box for secret records. + //was reserved3 - added for 3.5 + + + // Additions for PalmOS 3.0: + UInt16 sysSoundVolume; // system amplitude (0 - sndMaxAmp) - taps, beeps + UInt16 gameSoundVolume; // game amplitude (0 - sndMaxAmp) - explosions + UInt16 alarmSoundVolume; // alarm amplitude (0 - sndMaxAmp) + Boolean beamReceive; // False turns off IR sniffing, sends still work. + Boolean calibrateDigitizerAtReset; // True makes the user calibrate at soft reset time + UInt16 systemKeyboardID; // ID of the preferred keyboard resource + UInt32 defSerialPlugIn; // creator ID of the default serial plug-in + + // Additions for PalmOS 3.1: + Boolean stayOnWhenPluggedIn; // don't sleep after timeout when using line current + Boolean stayLitWhenPluggedIn; // keep backlight on when not sleeping on line current + + // Additions for PalmOS 3.2: + UInt32 antennaCharAppCreator; // creator of application to launch in response + // to the antenna key. Used by SysHandleEvent. + + // Additions for PalmOS 3.5: + MeasurementSystemType measurementSystem; // metric, english, etc. + UInt8 reserved3; + UInt16 autoOffDurationSecs; // Time period in seconds before shutting off. + + // Additions for PalmOS 4.0: + Int16 timeZone; // minutes east of Greenwich + Int16 daylightSavingAdjustment; // current daylight saving correction in minutes + CountryType timeZoneCountry; // country used to specify time zone. + SecurityAutoLockType autoLockType; // Never, on power off, after preset delay or at preset time + UInt32 autoLockTime; // Auto lock preset time or delay. + Boolean autoLockTimeFlag; // For Minutes or Hours. + LanguageType language; // Language spoken in country selected via Setup app/Formats panel + + AttnFlagsType attentionFlags; // User prefs for getting user's attention + + UInt32 defaultAppCreator; // Creator of the default "safe" app that is launched + // on a reset. + } SystemPreferencesType; + + + +typedef SystemPreferencesType *SystemPreferencesPtr; + + +// structure of the resource that holds hard/soft button defaults +typedef struct { + UInt16 keyCode; // virtual key code of the hard/soft button + UInt32 creator; // app creator code +} ButtonDefaultAppType; + +typedef struct { + UInt16 numButtons; // number of default button assignments + ButtonDefaultAppType button[1]; // array of button assignments +} ButtonDefaultListType; + + +//------------------------------------------------------------------- +// Preferences routines +//------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + + +extern DmOpenRef PrefOpenPreferenceDBV10 (void) + SYS_TRAP(sysTrapPrefOpenPreferenceDBV10); + +extern DmOpenRef PrefOpenPreferenceDB (Boolean saved) + SYS_TRAP(sysTrapPrefOpenPreferenceDB); + +extern void PrefGetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefGetPreferences); + +extern void PrefSetPreferences(SystemPreferencesPtr p) + SYS_TRAP(sysTrapPrefSetPreferences); + +extern UInt32 PrefGetPreference(SystemPreferencesChoice choice) + SYS_TRAP(sysTrapPrefGetPreference); + +extern void PrefSetPreference(SystemPreferencesChoice choice, UInt32 value) + SYS_TRAP(sysTrapPrefSetPreference); + +extern Int16 PrefGetAppPreferences (UInt32 creator, UInt16 id, void *prefs, + UInt16 *prefsSize, Boolean saved) + SYS_TRAP(sysTrapPrefGetAppPreferences); + +extern Boolean PrefGetAppPreferencesV10 (UInt32 type, Int16 version, void *prefs, + UInt16 prefsSize) + SYS_TRAP(sysTrapPrefGetAppPreferencesV10); + +extern void PrefSetAppPreferences (UInt32 creator, UInt16 id, Int16 version, + const void *prefs, UInt16 prefsSize, Boolean saved) + SYS_TRAP(sysTrapPrefSetAppPreferences); + +extern void PrefSetAppPreferencesV10 (UInt32 creator, Int16 version, void *prefs, + UInt16 prefsSize) + SYS_TRAP(sysTrapPrefSetAppPreferencesV10); + + +#ifdef __cplusplus +} +#endif + + +#endif // __PREFERENCES_H__ diff --git a/sdk-4/include/Core/System/Rect.h b/sdk-4/include/Core/System/Rect.h new file mode 100644 index 0000000..93adcd5 --- /dev/null +++ b/sdk-4/include/Core/System/Rect.h @@ -0,0 +1,83 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __RECT_H__ +#define __RECT_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. + + +typedef struct AbsRectType { + Coord left; + Coord top; + Coord right; + Coord bottom; +} AbsRectType; + + +typedef struct PointType { + Coord x; + Coord y; +} PointType; + + +typedef struct RectangleType { + PointType topLeft; + PointType extent; +} RectangleType; + +typedef RectangleType *RectanglePtr; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void RctSetRectangle (RectangleType *rP, + Coord left, Coord top, Coord width, Coord height) + SYS_TRAP(sysTrapRctSetRectangle); + +extern void RctCopyRectangle (const RectangleType *srcRectP, + RectangleType *dstRectP) + SYS_TRAP(sysTrapRctCopyRectangle); + +extern void RctInsetRectangle (RectangleType *rP, Coord insetAmt) + SYS_TRAP(sysTrapRctInsetRectangle); + +extern void RctOffsetRectangle (RectangleType *rP, Coord deltaX, Coord deltaY) + SYS_TRAP(sysTrapRctOffsetRectangle); + +extern Boolean RctPtInRectangle (Coord x, Coord y, const RectangleType *rP) + SYS_TRAP(sysTrapRctPtInRectangle); + +extern void RctGetIntersection (const RectangleType *r1P, const RectangleType *r2P, + RectangleType *r3P) + SYS_TRAP(sysTrapRctGetIntersection); + + +#ifdef __cplusplus +} +#endif + + +#endif //__RECT_H__ diff --git a/sdk-4/include/Core/System/ScriptPlugin.h b/sdk-4/include/Core/System/ScriptPlugin.h new file mode 100644 index 0000000..278dec1 --- /dev/null +++ b/sdk-4/include/Core/System/ScriptPlugin.h @@ -0,0 +1,94 @@ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ScriptPlugin.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Include file for script plugin modules of the Network Pref Panel + * and the Net library. Note that you need to include the file + * in your plugin before this file. + * + * History: + * WK 6/10/98 Created + * + *****************************************************************************/ + +#ifndef __SCRIPTPLUGIN_H__ +#define __SCRIPTPLUGIN_H__ + +#include +#include + +// Plugin Launch command codes +// +typedef enum { + scptLaunchCmdDoNothing = sysAppLaunchCmdCustomBase, + scptLaunchCmdListCmds, + scptLaunchCmdExecuteCmd +} ScriptPluginLaunchCodesEnum; + +// Commands for the callback selector function +// +#define pluginNetLibDoNothing 0 // For debug purposes. +#define pluginNetLibReadBytes 1 // Receive X number of bytes. +#define pluginNetLibWriteBytes 2 // Send X number of bytes. +#define pluginNetLibGetUserName 3 // Get the user name from the service profile. +#define pluginNetLibGetUserPwd 4 // Get the user password from the service profile. +#define pluginNetLibCheckCancelStatus 5 // Check the user cancel status. +#define pluginNetLibPromptUser 6 // Prompt the user for data and collect it. +#define pluginNetLibConnLog 7 // Write to the connection log. +#define pluginNetLibCallUIProc 8 // Call the plugin's UI function. +#define pluginNetLibGetSerLibRefNum 9 // Get the Serial library reference number. + + + +// Plugin constants +// +#define pluginMaxCmdNameLen 15 +#define pluginMaxModuleNameLen 15 +#define pluginMaxNumOfCmds 10 +#define pluginMaxLenTxtStringArg 63 + +typedef struct { + Char commandName[pluginMaxCmdNameLen + 1]; + Boolean hasTxtStringArg; + UInt8 reserved; // explicitly account for 16-bit alignment padding +} PluginCmdType; + +typedef PluginCmdType *PluginCmdPtr; + + +typedef struct { + Char pluginName[pluginMaxModuleNameLen + 1]; + UInt16 numOfCommands; + PluginCmdType command[pluginMaxNumOfCmds]; +} PluginInfoType; + +typedef PluginInfoType *PluginInfoPtr; + + + +// Plugin Execute structures + +typedef Err (*ScriptPluginSelectorProcPtr) (void *handle, UInt16 command, void *dataBufferP, + UInt16 *sizeP, UInt16 *dataTimeoutP, void *procAddrP); + + +typedef struct { + ScriptPluginSelectorProcPtr selectorProcP; +} PluginCallbackProcType, *PluginCallbackProcPtr; + + +typedef struct { + Char commandName[pluginMaxCmdNameLen + 1]; + Char txtStringArg[pluginMaxLenTxtStringArg + 1]; + PluginCallbackProcPtr procP; + void * handle; +} PluginExecCmdType, *PluginExecCmdPtr; + + +#endif // __SCRIPTPLUGIN_H__ diff --git a/sdk-4/include/Core/System/SerialDrvr.h b/sdk-4/include/Core/System/SerialDrvr.h new file mode 100644 index 0000000..bbf4acc --- /dev/null +++ b/sdk-4/include/Core/System/SerialDrvr.h @@ -0,0 +1,162 @@ +/****************************************************************************** + * + * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SerialDrvr.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Constants and data structures for serial drvr ('sdrv') code. + * + * History: + * 1/23/98 Created by Ben Manuto + * + *****************************************************************************/ + +#ifndef __SERIALDRVR_H__ +#define __SERIALDRVR_H__ + +#include + +// ********** Constants + +#define kDrvrCreator 0 +#define kDrvrResID 0 +#define kDrvrCODEType 'code' + + +// kDrvrVersion is included by all sdrv's and vdrv's and is returned by the drvr to the +// serial manager to show the driver version is consistent with the required version of +// drvr the new serial manager needs in order to operate properly. +// +// Note: Version 4 driver were introduced in PalmOS 4.0. + +#define kDrvrVersion3 3 +#define kDrvrVersion4 4 + +#define kDrvrVersion kDrvrVersion4 + +#define kMaxPortDescStrLen 64 +#define kPortDescStrID 1000 + +// Flags denoting capabilities and features of this port. + +#define portPhysicalPort 0x00000001 // Should be unset for virtual port. + +#define portBkgndModeSupported 0x00000002 // Denotes that this port can be used for background mode + // This flag is only applicable to virtual drivers. Background + // mode support is implied on physical drivers. + +#define portRS232Capable 0x00000004 // Denotes this serialHW has a RS-232 port. +#define portIRDACapable 0x00000008 // Denotes this serialHW has a IR port and support IRDA mode. + +#define portCradlePort 0x00000010 // Denotes this SerialHW controls the cradle port. +#define portExternalPort 0x00000020 // Denotes this SerialHW's port is external or on a memory card. +#define portModemPort 0x00000040 // Denotes this SerialHW communicates with a modem. +#define portConsolePort 0x00000100 // Denotes this SerialHW's port is the console port. + +#define portCncMgrVisible 0x00000080 // Denotes this serial port's name is to be displayted in the Connection panel. +#define portPrivateUse 0x00001000 // Set if this drvr is for special software and NOT general apps in system. +#define portUSBCapable 0x00000200 // Denotes that the driver supports USB hardware. + + + +// ********** Structs + +typedef enum DrvrIRQEnum { + drvrIRQNone = 0x00, + drvrIRQ1 = 0x01, + drvrIRQ2 = 0x02, + drvrIRQ3 = 0x04, + drvrIRQ4 = 0x08, + drvrIRQ5 = 0x10, + drvrIRQ6 = 0x20, + drvrIRQOther = 0x40 +} DrvrIRQEnum; + + +// ***** Info about this particular port + +typedef struct { + UInt32 drvrID; // e.g. creator type, such as 'u328' + UInt32 drvrVersion; // version of code that works for this HW. + UInt32 maxBaudRate; // Maximum baud rate for this uart. + UInt32 handshakeThreshold; // Baud rate at which hardware handshaking should be used. + UInt32 portFlags; // flags denoting features of this uart. + const Char *portDesc; // Pointer to null-terminated string describing this HW. + DrvrIRQEnum irqType; // IRQ line for this uart serial HW. + // Changed PalmOS 4.0 was reserved now multiple entries. + UInt8 multipleEnumerations; + // Need to know what the database id is if we are going to have one driver have + // multiple ids. + UInt32 dbCreator; + +} DrvrInfoType; + +typedef DrvrInfoType *DrvrInfoPtr; + + +typedef enum DrvrEntryOpCodeEnum { // OpCodes for the entry function. + drvrEntryGetUartFeatures, + drvrEntryGetDrvrFuncts, + drvrEntryGetUartFtrsNEntries // Opcode for drivers that have mulitiple + // entries in the driver table. +} DrvrEntryOpCodeEnum; + + +typedef enum DrvrStatusEnum { + drvrStatusCtsOn = 0x0001, + drvrStatusRtsOn = 0x0002, + drvrStatusDsrOn = 0x0004, + drvrStatusTxFifoFull = 0x0008, + drvrStatusTxFifoEmpty = 0x0010, + drvrStatusBreakAsserted = 0x0020, + drvrStatusDataReady = 0x0040, // For polling mode debugger only at this time. + drvrStatusLineErr = 0x0080 // For polling mode debugger only at this time. +} DrvrStatusEnum; + + +// ********** Entry Point Function type + +typedef Err (*DrvEntryPointProcPtr)(DrvrEntryOpCodeEnum opCode, void *uartData); + + +// ********** ADT and functions for Rcv Queue. + +// Note that qGetSpace or GetSpaceProcPtr will return back at most one less then the +// total size of the queue buffer. The total usable space in the receive queue is the +// size of the queue minus one. + +typedef Err (*WriteByteProcPtr)(void *theQ, UInt8 theByte, UInt16 lineErrs); +typedef Err (*WriteBlockProcPtr)(void *theQ, UInt8 *bufP, UInt16 size, UInt16 lineErrs); +typedef UInt32 (*GetSizeProcPtr)(void *theQ); +typedef UInt32 (*GetSpaceProcPtr)(void *theQ); +typedef void (*SignalCheckPtr)(void *theQ, UInt16 lineErrs); + +typedef struct DrvrRcvQType { + void * rcvQ; + WriteByteProcPtr qWriteByte; + WriteBlockProcPtr qWriteBlock; + GetSizeProcPtr qGetSize; + GetSpaceProcPtr qGetSpace; + SignalCheckPtr qSignalCheck; + +} DrvrRcvQType; + +typedef DrvrRcvQType *DrvrHWRcvQPtr; + +// ***** Our receive queue. + +typedef struct SrmRcvQType { + UInt32 qStart; // start offset of queue + UInt32 qEnd; // end offset of queue + UInt32 qSize; // size of queue + UInt8 *qData; // pointer to queue data + void* qPort; // Open port pointer for this Q. +} SrmRcvQType; + +typedef SrmRcvQType *SrmRcvQPtr; + +#endif // __SERIALDRVR_H__ diff --git a/sdk-4/include/Core/System/SerialLinkMgr.h b/sdk-4/include/Core/System/SerialLinkMgr.h new file mode 100644 index 0000000..bf5791f --- /dev/null +++ b/sdk-4/include/Core/System/SerialLinkMgr.h @@ -0,0 +1,437 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SERIAL_LINK_H +#define __SERIAL_LINK_H + + + +// Pilot common definitions +#include +#include + + +//************************************************************************* +// Pre-defined, fixxed Socket ID's +//************************************************************************* +#define slkSocketDebugger 0 // Debugger Socket +#define slkSocketConsole 1 // Console Socket +#define slkSocketRemoteUI 2 // Remote UI Socket +#define slkSocketDLP 3 // Desktop Link Socket +#define slkSocketFirstDynamic 4 // first dynamic socket ID + + +//************************************************************************* +// Packet Types +//************************************************************************* +#define slkPktTypeSystem 0 // System packets +#define slkPktTypeUnused1 1 // used to be: Connection Manager packets +#define slkPktTypePAD 2 // PAD Protocol packets +#define slkPktTypeLoopBackTest 3 // Loop-back test packets + + + +//************************************************************************* +// +// Packet structure: +// header +// body (0-dbgMaxPacketBodyLength bytes of data) +// footer +// +//************************************************************************* + +//---------------------------------------------------------------------- +// packet header +// Fields marked with -> must be filled in by caller +// Fields marked with X will be filled in by SlkSendPacket. +//---------------------------------------------------------------------- + +typedef UInt8 SlkPktHeaderChecksum; + +typedef struct SlkPktHeaderType { + UInt16 signature1; // X first 2 bytes of signature + UInt8 signature2; // X 3 and final byte of signature + UInt8 dest; // -> destination socket Id + UInt8 src; // -> src socket Id + UInt8 type; // -> packet type + UInt16 bodySize; // X size of body + UInt8 transId; // -> transaction Id + // if 0 specified, it will be replaced + SlkPktHeaderChecksum checksum; // X check sum of header + } SlkPktHeaderType; + +typedef SlkPktHeaderType* SlkPktHeaderPtr; + +#define slkPktHeaderSignature1 0xBEEF +#define slkPktHeaderSignature2 0xED + +#define slkPktHeaderSigFirst 0xBE // First byte +#define slkPktHeaderSigSecond 0xEF // second byte +#define slkPktHeaderSigThird 0xED // third byte + +//---------------------------------------------------------------------- +// packet footer +//---------------------------------------------------------------------- +typedef struct SlkPktFooterType { + UInt16 crc16; // header and body crc + } SlkPktFooterType; + +typedef SlkPktFooterType* SlkPktFooterPtr; + + +//************************************************************************* +// +// Write Data Structure passed to SlkSendPacket. This structure +// Tells SlkSendPacket where each of the chunks that comprise the body are +// and the size of each. SlkSendPacket accepts a pointer to an array +// of SlkWriteDataTypes, the last one has a size field of 0. +// +//************************************************************************* +typedef struct SlkWriteDataType { + UInt16 size; // last one has size of 0 + const void* dataP; // pointer to data + } SlkWriteDataType; +typedef SlkWriteDataType* SlkWriteDataPtr; + + + + +//************************************************************************* +// +// CPU-dependent macros for getting/setting values from/to packets +// +//************************************************************************* + +//-------------------------------------------------------------------- +// macros to get packet values +//-------------------------------------------------------------------- + +#define slkGetPacketByteVal(srcP) (*(UInt8 *)(srcP)) + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketWordVal(srcP) \ + ( (UInt16) \ + ( \ + ((UInt16)((UInt8 *)(srcP))[0] << 8) | \ + ((UInt16)((UInt8 *)(srcP))[1]) \ + ) \ + ) +#else +#define slkGetPacketWordVal(srcP) \ + ( *((UInt16 *)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkGetPacketDWordVal(srcP) \ + ( (UInt32) \ + ( \ + ((UInt32)((UInt8 *)(srcP))[0] << 24) | \ + ((UInt32)((UInt8 *)(srcP))[1] << 16) | \ + ((UInt32)((UInt8 *)(srcP))[2] << 8) | \ + ((UInt32)((UInt8 *)(srcP))[3]) \ + ) \ + ) +#else +#define slkGetPacketDWordVal(srcP) \ + ( *((UInt32 *)(srcP)) ) +#endif //CPU_TYPE == CPU_x86 + + +#define slkGetPacketSignature1(sigP) \ + slkGetPacketWordVal(sigP) + +#define slkGetPacketSignature2(sigP) \ + slkGetPacketByteVal(sigP) + + +#define slkGetPacketDest(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketSrc(addressP) \ + slkGetPacketByteVal(addressP) + +#define slkGetPacketType(commandP) \ + slkGetPacketByteVal(commandP) + + +#define slkGetPacketBodySize(lengthP) \ + slkGetPacketWordVal(lengthP) + +#define slkGetPacketTransId(transIDP) \ + slkGetPacketByteVal(transIDP) + +#define slkGetPacketHdrChecksum(checksumP) \ + slkGetPacketByteVal(checksumP) + + +#define slkGetPacketTotalChecksum(checksumP) \ + slkGetPacketWordVal(checksumP) + + + + + + +//-------------------------------------------------------------------- +// macros to set packet values +//-------------------------------------------------------------------- + + +#define slkSetPacketByteVal(srcByteVal, destP) \ + ( *(UInt8 *)(destP) = (UInt8)(srcByteVal) ) + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketWordVal(srcWordVal, destP) \ + \ + do { \ + UInt16 ___srcVal; \ + UInt8 * ___srcValP; \ + \ + ___srcVal = (UInt16)(srcWordVal); \ + ___srcValP = (UInt8 *)(&___srcVal); \ + \ + ((UInt8 *)(destP))[0] = ___srcValP[1]; \ + ((UInt8 *)(destP))[1] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketWordVal(srcWordVal, destP) \ + ( *((UInt16 *)(destP)) = (UInt16)(srcWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + +#if (CPU_TYPE == CPU_x86) +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + do { \ + UInt32 ___srcVal; \ + UInt8 * ___srcValP; \ + \ + ___srcVal = (UInt32)(srcDWordVal); \ + ___srcValP = (UInt8 *)(&___srcVal); \ + \ + ((UInt8 *)(destP))[0] = ___srcValP[3]; \ + ((UInt8 *)(destP))[1] = ___srcValP[2]; \ + ((UInt8 *)(destP))[2] = ___srcValP[1]; \ + ((UInt8 *)(destP))[3] = ___srcValP[0]; \ + } while( false ) +#else +#define slkSetPacketDWordVal(srcDWordVal, destP) \ + ( *((UInt32 *)(destP)) = (UInt32)(srcDWordVal) ) +#endif //CPU_TYPE == CPU_x86 + + + +#define slkSetPacketSignature1(magic, destP) \ + slkSetPacketWordVal(magic, destP) + +#define slkSetPacketSignature2(magic, destP) \ + slkSetPacketByteVal(magic, destP) + + +#define slkSetPacketDest(dest, destP) \ + slkSetPacketByteVal(dest, destP) + +#define slkSetPacketSrc(src, destP) \ + slkSetPacketByteVal(src, destP) + + +#define slkSetPacketType(type, destP) \ + slkSetPacketByteVal(type, destP) + + +#define slkSetPacketBodySize(numBytes, destP) \ + slkSetPacketWordVal(numBytes, destP) + + +#define slkSetPacketTransId(transID, destP) \ + slkSetPacketByteVal(transID, destP) + +#define slkSetPacketHdrChecksum(checksum, destP) \ + slkSetPacketByteVal(checksum, destP) + +#define slkSetPacketTotalChecksum(checksum, destP) \ + slkSetPacketWordVal(checksum, destP) + + + + + + +/******************************************************************* + * Serial Link Manager Errors + * the constant slkErrorClass is defined in SystemMgr.h + *******************************************************************/ +#define slkErrChecksum (slkErrorClass | 1) +#define slkErrFormat (slkErrorClass | 2) +#define slkErrBuffer (slkErrorClass | 3) +#define slkErrTimeOut (slkErrorClass | 4) +#define slkErrHandle (slkErrorClass | 5) +#define slkErrBodyLimit (slkErrorClass | 6) +#define slkErrTransId (slkErrorClass | 7) +#define slkErrResponse (slkErrorClass | 8) +#define slkErrNoDefaultProc (slkErrorClass | 9) +#define slkErrWrongPacketType (slkErrorClass | 10) +#define slkErrBadParam (slkErrorClass | 11) +#define slkErrAlreadyOpen (slkErrorClass | 12) +#define slkErrOutOfSockets (slkErrorClass | 13) +#define slkErrSocketNotOpen (slkErrorClass | 14) +#define slkErrWrongDestSocket (slkErrorClass | 15) +#define slkErrWrongPktType (slkErrorClass | 16) +#define slkErrBusy (slkErrorClass | 17) // called while sending a packet + // only returned on single-threaded + // emulation implementations +#define slkErrNotOpen (slkErrorClass | 18) + + + +/******************************************************************* + * Type definition for a Serial Link Socket Listener + * + *******************************************************************/ +typedef void (*SlkSocketListenerProcPtr) + (SlkPktHeaderPtr headerP, void *bodyP); + +typedef struct SlkSocketListenType { + SlkSocketListenerProcPtr listenerP; + SlkPktHeaderPtr headerBufferP; // App allocated buffer for header + void* bodyBufferP; // App allocated buffer for body + UInt32 bodyBufferSize; + } SlkSocketListenType; +typedef SlkSocketListenType* SlkSocketListenPtr; + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------- +// Initializes the Serial Link Manager +//------------------------------------------------------------------- +Err SlkOpen(void) + SYS_TRAP(sysTrapSlkOpen); + +//------------------------------------------------------------------- +// Close down the Serial Link Manager +//------------------------------------------------------------------- +Err SlkClose(void) + SYS_TRAP(sysTrapSlkClose); + + + + +//------------------------------------------------------------------- +// Open up another Serial Link socket. The caller must have already +// opened the comm library and set it to the right settings. +//------------------------------------------------------------------- + +Err SlkOpenSocket(UInt16 portID, UInt16 *socketP, Boolean staticSocket) + SYS_TRAP(sysTrapSlkOpenSocket); + + +//------------------------------------------------------------------- +// Close up a Serial Link socket. +// Warning: This routine is assymetrical with SlkOpenSocket because it +// WILL CLOSE the library for the caller (unless the refNum is the +// refNum of the debugger comm library). +//------------------------------------------------------------------- +Err SlkCloseSocket(UInt16 socket) + SYS_TRAP(sysTrapSlkCloseSocket); + + +//------------------------------------------------------------------- +// Get the library refNum for a particular Socket +//------------------------------------------------------------------- + + + Err SlkSocketPortID(UInt16 socket, UInt16 *portIDP) + SYS_TRAP(sysTrapSlkSocketRefNum); + + #define SlkSocketRefNum SlkSocketPortID + + +//------------------------------------------------------------------- +// Set the in-packet timeout for a socket +//------------------------------------------------------------------- +Err SlkSocketSetTimeout(UInt16 socket, Int32 timeout) + SYS_TRAP(sysTrapSlkSocketSetTimeout); + + + + + +//------------------------------------------------------------------- +// Flush a Socket +//------------------------------------------------------------------- +Err SlkFlushSocket(UInt16 socket, Int32 timeout) + SYS_TRAP(sysTrapSlkFlushSocket); + + +//------------------------------------------------------------------- +// Set up a Socket Listener +//------------------------------------------------------------------- +Err SlkSetSocketListener(UInt16 socket, SlkSocketListenPtr socketP) + SYS_TRAP(sysTrapSlkSetSocketListener); + + +//------------------------------------------------------------------- +// Sends a packet's header, body, footer. Stuffs the header's +// magic number and checksum fields. Expects all other +// header fields to be filled in by caller. +// errors returned: dseHandle, dseLine, dseIO, dseParam, dseBodyLimit, +// dseOther +//------------------------------------------------------------------- +Err SlkSendPacket(SlkPktHeaderPtr headerP, SlkWriteDataPtr writeList) + SYS_TRAP(sysTrapSlkSendPacket); + + +//------------------------------------------------------------------- +// Receives and validates an entire packet. +// errors returned: dseHandle, dseParam, dseLine, dseIO, dseFormat, +// dseChecksum, dseBuffer, dseBodyLimit, dseTimeOut, +// dseOther +//------------------------------------------------------------------- +Err SlkReceivePacket( UInt16 socket, Boolean andOtherSockets, + SlkPktHeaderPtr headerP, void *bodyP, UInt16 bodySize, + Int32 timeout) + SYS_TRAP(sysTrapSlkReceivePacket); + + +//------------------------------------------------------------------- +// Do Default processing of a System packet +//------------------------------------------------------------------- +Err SlkSysPktDefaultResponse(SlkPktHeaderPtr headerP, void *bodyP) + SYS_TRAP(sysTrapSlkSysPktDefaultResponse); + +//------------------------------------------------------------------- +// Do RPC call +//------------------------------------------------------------------- +Err SlkProcessRPC(SlkPktHeaderPtr headerP, void *bodyP) + SYS_TRAP(sysTrapSlkProcessRPC); + + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIAL_LINK_H diff --git a/sdk-4/include/Core/System/SerialMgr.h b/sdk-4/include/Core/System/SerialMgr.h new file mode 100644 index 0000000..879005f --- /dev/null +++ b/sdk-4/include/Core/System/SerialMgr.h @@ -0,0 +1,456 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SERIALMGR_H +#define __SERIALMGR_H + + +// Pilot common definitions +#include +#include + +// New Serial manager feature numbers +#define sysFtrNewSerialPresent 1 +#define sysFtrNewSerialVersion 2 + +#define serMgrVersion 2 + +/******************************************************************** + * Serial Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ + +#define serErrBadParam (serErrorClass | 1) +#define serErrBadPort (serErrorClass | 2) +#define serErrNoMem (serErrorClass | 3) +#define serErrBadConnID (serErrorClass | 4) +#define serErrTimeOut (serErrorClass | 5) +#define serErrLineErr (serErrorClass | 6) +#define serErrAlreadyOpen (serErrorClass | 7) +#define serErrStillOpen (serErrorClass | 8) +#define serErrNotOpen (serErrorClass | 9) +#define serErrNotSupported (serErrorClass | 10) // functionality not supported +#define serErrNoDevicesAvail (serErrorClass | 11) // No serial devices were loaded or are available. +// New error codes for USB support +#define serErrConfigurationFailed (serErrorClass | 12) + +// +// mask values for the lineErrors from SerGetStatus +// + +#define serLineErrorParity 0x0001 // parity error +#define serLineErrorHWOverrun 0x0002 // HW overrun +#define serLineErrorFraming 0x0004 // framing error +#define serLineErrorBreak 0x0008 // break signal asserted +#define serLineErrorHShake 0x0010 // line hand-shake error +#define serLineErrorSWOverrun 0x0020 // HW overrun +#define serLineErrorCarrierLost 0x0040 // CD dropped + + +/******************************************************************** + * Serial Port Definitions + ********************************************************************/ + +#define serPortLocalHotSync 0x8000 // Use physical HotSync port + +#define serPortCradlePort 0x8000 // Cradle Port (Auto detect cradle type) +#define serPortIrPort 0x8001 // Use available IR port. +#define serPortConsolePort 0x8002 // Console port +#define serPortCradleRS232Port 0x8003 // Cradle RS232 Port +#define serPortCradleUSBPort 0x8004 // Cradle USB Port + +// This constant is used by the Serial Link Mgr only +#define serPortIDMask 0xC000 + + +/******************************************************************** + * Serial Settings Descriptor + ********************************************************************/ + +#define srmSettingsFlagStopBitsM 0x00000001 // mask for stop bits field +#define srmSettingsFlagStopBits1 0x00000000 // 1 stop bits +#define srmSettingsFlagStopBits2 0x00000001 // 2 stop bits +#define srmSettingsFlagParityOnM 0x00000002 // mask for parity on +#define srmSettingsFlagParityEvenM 0x00000004 // mask for parity even +#define srmSettingsFlagXonXoffM 0x00000008 // (NOT IMPLEMENTED) mask for Xon/Xoff flow control +#define srmSettingsFlagRTSAutoM 0x00000010 // mask to prevent UART input overflow using RTS (NOTE: this flag + // alone does not prevent software overruns from the serial input buffer) +#define srmSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control (see srmSettingsFlagFlowControlIn below) +#define srmSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char +#define srmSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char +#define srmSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char +#define srmSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char +#define srmSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char +#define srmSettingsFlagFlowControlIn 0x00000100 // mask to prevent the serial input buffer overflow, using RTS. Use in + // conjunction with srmSettingsFlagRTSAutoM for a fully flow controlled input. +#define srmSettingsFlagRTSInactive 0x00000200 // if set and srmSettingsFlagRTSAutoM==0, RTS is held in the inactive (flow off) state forever. + + +// Default settings +#define srmDefaultSettings (srmSettingsFlagBitsPerChar8 | \ + srmSettingsFlagStopBits1 | \ + srmSettingsFlagRTSAutoM | srmSettingsFlagFlowControlIn) + +#define srmDefaultCTSTimeout (5*sysTicksPerSecond) + + +// Status bitfield constants + +#define srmStatusCtsOn 0x00000001 +#define srmStatusRtsOn 0x00000002 +#define srmStatusDsrOn 0x00000004 +#define srmStatusBreakSigOn 0x00000008 + + +// +// Info fields describing serial HW capabilities. +// + +#define serDevCradlePort 0x00000001 // Serial HW controls RS-232 serial from cradle connector of handheld. +#define serDevRS232Serial 0x00000002 // Serial HW has RS-232 line drivers +#define serDevIRDACapable 0x00000004 // Serial Device has IR line drivers and generates IRDA mode serial. +#define serDevModemPort 0x00000008 // Serial deivce drives modem connection. +#define serDevCncMgrVisible 0x00000010 // Serial device port name string to be displayed in Connection Mgr panel. +#define serDevConsolePort 0x00000020 // Serial device is the default console port. +#define serDevUSBCapable 0x00000040 // USB driver for USB hardware connected to the cradle connector of the handheld. + + +typedef struct DeviceInfoType { + UInt32 serDevCreator; // Four Character creator type for serial driver ('sdrv') + UInt32 serDevFtrInfo; // Flags defining features of this serial hardware. + UInt32 serDevMaxBaudRate; // Maximum baud rate for this device. + UInt32 serDevHandshakeBaud; // HW Handshaking is reccomended for baud rates over this + Char *serDevPortInfoStr; // Description of serial HW device or virtual device. + UInt8 reserved[8]; // Reserved. +} DeviceInfoType; + +typedef DeviceInfoType *DeviceInfoPtr; + +// +// 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. +// +#define serFncUndefined 0L // Undefined function +#define serFncPPPSession netIFCreatorPPP // NetLib PPP Interface +#define serFncSLIPSession netIFCreatorSLIP // NetLib SLIP Interface +#define serFncDebugger sysFileCSystem // PalmOS Debugger +#define serFncHotSync sysFileCSync // HotSync function +#define serFncConsole sysFileCSystem // PalmOS Console +#define serFncTelephony sysFileCTelMgrLib // Telephony Library + + +// +// Open Configuration Structure +// +typedef struct SrmOpenConfigType { + UInt32 baud; // 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 + UInt32 function; // 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. + MemPtr drvrDataP; // Pointer to driver specific data. + UInt16 drvrDataSize; // Size of the driver specific data block. + UInt32 sysReserved1; // System Reserved + UInt32 sysReserved2; // System Reserved +} SrmOpenConfigType; + +typedef SrmOpenConfigType* SrmOpenConfigPtr; + +/******************************************************************** + * Transfer modes for USB + ********************************************************************/ +typedef enum SrmTransferModeType { + srmTransferFirstReserved = 0, // RESERVE 0 + srmUSBInterruptMode, + srmUSBBulkMode, + srmUSBIsochronous +} SrmTransferModeType; + + + +/******************************************************************** + * Type of a wakeup handler procedure which can be installed through the + * SerSetWakeupHandler() call. + ********************************************************************/ +typedef void (*WakeupHandlerProcPtr)(UInt32 refCon); + +/******************************************************************** + * Type of an emulator-mode only blocking hook routine installed via + * SerControl function serCtlEmuSetBlockingHook. This is supported only + * under emulation mode. The argument to the function is the value + * specified in the SerCallbackEntryType structure. The intention of the + * return value is to return false if serial manager should abort the + * current blocking action, such as when an app quit event has been received; + * otherwise, it should return true. However, in the current implementation, + * this return value is ignored. The callback can additionally process + * events to enable user interaction with the UI, such as interacting with the + * debugger. + ********************************************************************/ +typedef Boolean (*BlockingHookProcPtr) (UInt32 userRef); + + +/******************************************************************** + * Serial Library Control Enumerations (Pilot 2.0) + ********************************************************************/ + +/******************************************************************** + * Structure for specifying callback routines. + ********************************************************************/ +typedef struct SrmCallbackEntryType { + BlockingHookProcPtr funcP; // function pointer + UInt32 userRef; // ref value to pass to callback +} SrmCallbackEntryType; +typedef SrmCallbackEntryType* SrmCallbackEntryPtr; + + +typedef enum SrmCtlEnum { + srmCtlFirstReserved = 0, // RESERVE 0 + + srmCtlSetBaudRate, // Sets the current baud rate for the HW. + // valueP = pointer to Int32, valueLenP = pointer to sizeof(Int32) + + srmCtlGetBaudRate, // Gets the current baud rate for the HW. + + srmCtlSetFlags, // Sets the current flag settings for the serial HW. + + srmCtlGetFlags, // Gets the current flag settings the serial HW. + + srmCtlSetCtsTimeout, // Sets the current Cts timeout value. + + srmCtlGetCtsTimeout, // Gets the current Cts timeout value. + + srmCtlStartBreak, // turn RS232 break signal on: + // users are responsible for ensuring that the break is set + // long enough to genearate a valid BREAK! + // valueP = 0, valueLenP = 0 + + srmCtlStopBreak, // turn RS232 break signal off: + // valueP = 0, valueLenP = 0 + + srmCtlStartLocalLoopback, // Start local loopback test + // valueP = 0, valueLenP = 0 + + srmCtlStopLocalLoopback, // Stop local loopback test + // valueP = 0, valueLenP = 0 + + + srmCtlIrDAEnable, // Enable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + srmCtlIrDADisable, // Disable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + srmCtlRxEnable, // enable receiver ( for IrDA ) + + srmCtlRxDisable, // disable receiver ( for IrDA ) + + srmCtlEmuSetBlockingHook, // Set a blocking hook routine FOR EMULATION + // MODE ONLY - NOT SUPPORTED ON THE PILOT + //PASS: + // valueP = pointer to SerCallbackEntryType + // *valueLenP = sizeof(SerCallbackEntryType) + //RETURNS: + // the old settings in the first argument + + srmCtlUserDef, // Specifying this opCode passes through a user-defined + // function to the DrvControl function. This is for use + // specifically by serial driver developers who need info + // from the serial driver that may not be available through the + // standard SrmMgr interface. + + srmCtlGetOptimalTransmitSize, // This function will ask the port for the most efficient buffer size + // for transmitting data packets. This opCode returns serErrNotSupported + // if the physical or virtual device does not support this feature. + // The device can return a transmit size of 0, if send buffering is + // requested, but the actual size is up to the caller to choose. + // valueP = pointer to UInt32 --> return optimal buf size + // ValueLenP = sizeof(UInt32) + + srmCtlSetDTRAsserted, // Enable or disable DTR. + + srmCtlGetDTRAsserted, // Determine if DTR is enabled or disabled. + + srmCtlSetYieldPortCallback, // Set the yield port callback + + srmCtlSetYieldPortRefCon, // Set the yield port refNum + + // ***** ADD NEW ENTRIES BEFORE THIS ONE + + srmCtlSystemReserved = 0x7000, // Reserve control op code space for system use. + + srmCtlCustom = 0x8000, // Reserve control op code space for licensee use. + + srmCtlLAST + +} SrmCtlEnum; + +#define srmCtlSystemStart 0x7000 // Start poitn for system op codes. +#define srmCtlCustomStart 0x8000 // Start point for custom op codes. + + +/******************************************************************** + * Serial Hardware Library Routines + ********************************************************************/ + +#ifdef BUILDING_NEW_SERIAL_MGR + #define SERIAL_TRAP(serialSelectorNum) +#else + #define SERIAL_TRAP(serialSelectorNum) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapSerialDispatch, \ + serialSelectorNum) +#endif + + +// ***************************************************************** +// * New Serial Manager trap selectors +// ***************************************************************** + +// The numbering of these #defines *MUST* match the order in SerialMgr.c +#define sysSerialInstall 0 +#define sysSerialOpen 1 +#define sysSerialOpenBkgnd 2 +#define sysSerialClose 3 +#define sysSerialSleep 4 +#define sysSerialWake 5 +#define sysSerialGetDeviceCount 6 +#define sysSerialGetDeviceInfo 7 +#define sysSerialGetStatus 8 +#define sysSerialClearErr 9 +#define sysSerialControl 10 +#define sysSerialSend 11 +#define sysSerialSendWait 12 +#define sysSerialSendCheck 13 +#define sysSerialSendFlush 14 +#define sysSerialReceive 15 +#define sysSerialReceiveWait 16 +#define sysSerialReceiveCheck 17 +#define sysSerialReceiveFlush 18 +#define sysSerialSetRcvBuffer 19 +#define sysSerialRcvWindowOpen 20 +#define sysSerialRcvWindowClose 21 +#define sysSerialSetWakeupHandler 22 +#define sysSerialPrimeWakeupHandler 23 +#define sysSerialOpenV4 24 +#define sysSerialOpenBkgndV4 25 +#define sysSerialCustomControl 26 + +// Used by SerialMgrDispatch.c +#define maxSerialSelector sysSerialCustomControl + + +#ifdef __cplusplus +extern "C" { +#endif + +Err SerialMgrInstall(void) + SERIAL_TRAP(sysSerialInstall); + +Err SrmOpen(UInt32 port, UInt32 baud, UInt16 *newPortIdP) + SERIAL_TRAP(sysSerialOpen); + +Err SrmExtOpen(UInt32 port, SrmOpenConfigType* configP, UInt16 configSize, UInt16 *newPortIdP) + SERIAL_TRAP(sysSerialOpenV4); + +Err SrmExtOpenBackground(UInt32 port, SrmOpenConfigType* configP, UInt16 configSize, UInt16 *newPortIdP) + SERIAL_TRAP(sysSerialOpenBkgndV4); + +Err SrmOpenBackground(UInt32 port, UInt32 baud, UInt16 *newPortIdP) + SERIAL_TRAP(sysSerialOpenBkgnd); + +Err SrmClose(UInt16 portId) + SERIAL_TRAP(sysSerialClose); + +Err SrmSleep() + SERIAL_TRAP(sysSerialSleep); + +Err SrmWake() + SERIAL_TRAP(sysSerialWake); + +Err SrmGetDeviceCount(UInt16 *numOfDevicesP) + SERIAL_TRAP(sysSerialGetDeviceCount); + +Err SrmGetDeviceInfo(UInt32 deviceID, DeviceInfoType *deviceInfoP) + SERIAL_TRAP(sysSerialGetDeviceInfo); + +Err SrmGetStatus(UInt16 portId, UInt32 *statusFieldP, UInt16 *lineErrsP) + SERIAL_TRAP(sysSerialGetStatus); + +Err SrmClearErr (UInt16 portId) + SERIAL_TRAP(sysSerialClearErr); + +Err SrmControl(UInt16 portId, UInt16 op, void *valueP, UInt16 *valueLenP) + SERIAL_TRAP(sysSerialControl); + +Err SrmCustomControl(UInt16 portId, UInt16 opCode, UInt32 creator, + void* valueP, UInt16* valueLenP) + SERIAL_TRAP(sysSerialCustomControl); + +UInt32 SrmSend (UInt16 portId, const void *bufP, UInt32 count, Err *errP) + SERIAL_TRAP(sysSerialSend); + +Err SrmSendWait(UInt16 portId) + SERIAL_TRAP(sysSerialSendWait); + +Err SrmSendCheck(UInt16 portId, UInt32 *numBytesP) + SERIAL_TRAP(sysSerialSendCheck); + +Err SrmSendFlush(UInt16 portId) + SERIAL_TRAP(sysSerialSendFlush); + +UInt32 SrmReceive(UInt16 portId, void *rcvBufP, UInt32 count, Int32 timeout, Err *errP) + SERIAL_TRAP(sysSerialReceive); + +Err SrmReceiveWait(UInt16 portId, UInt32 bytes, Int32 timeout) + SERIAL_TRAP(sysSerialReceiveWait); + +Err SrmReceiveCheck(UInt16 portId, UInt32 *numBytesP) + SERIAL_TRAP(sysSerialReceiveCheck); + +Err SrmReceiveFlush(UInt16 portId, Int32 timeout) + SERIAL_TRAP(sysSerialReceiveFlush); + +Err SrmSetReceiveBuffer(UInt16 portId, void *bufP, UInt16 bufSize) + SERIAL_TRAP(sysSerialSetRcvBuffer); + +Err SrmReceiveWindowOpen(UInt16 portId, UInt8 **bufPP, UInt32 *sizeP) + SERIAL_TRAP(sysSerialRcvWindowOpen); + +Err SrmReceiveWindowClose(UInt16 portId, UInt32 bytesPulled) + SERIAL_TRAP(sysSerialRcvWindowClose); + +Err SrmSetWakeupHandler(UInt16 portId, WakeupHandlerProcPtr procP, UInt32 refCon) + SERIAL_TRAP(sysSerialSetWakeupHandler); + +Err SrmPrimeWakeupHandler(UInt16 portId, UInt16 minBytes) + SERIAL_TRAP(sysSerialPrimeWakeupHandler); + +void SrmSelectorErrPrv (UInt16 serialSelector); // used only by SerialMgrDispatch.c + +#ifdef __cplusplus +} +#endif + +#endif // __SERIALMGR_H diff --git a/sdk-4/include/Core/System/SerialMgrOld.h b/sdk-4/include/Core/System/SerialMgrOld.h new file mode 100644 index 0000000..54e3d9a --- /dev/null +++ b/sdk-4/include/Core/System/SerialMgrOld.h @@ -0,0 +1,347 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SERIALMGROLD_H_ +#define __SERIALMGROLD_H_ + +// Pilot common definitions +#include +#include + + +/******************************************************************** + * Serial Manager Errors + * the constant serErrorClass is defined in SystemMgr.h + ********************************************************************/ + +#define serErrBadParam (serErrorClass | 1) +#define serErrBadPort (serErrorClass | 2) +#define serErrNoMem (serErrorClass | 3) +#define serErrBadConnID (serErrorClass | 4) +#define serErrTimeOut (serErrorClass | 5) +#define serErrLineErr (serErrorClass | 6) +#define serErrAlreadyOpen (serErrorClass | 7) +#define serErrStillOpen (serErrorClass | 8) +#define serErrNotOpen (serErrorClass | 9) +#define serErrNotSupported (serErrorClass | 10) // functionality not supported + + +/******************************************************************** + * Serial Port Definitions + ********************************************************************/ + +#define serPortDefault 0x0000 // Use prefDefSerialPlugIn +#define serPortLocalHotSync 0x8000 // Use physical HotSync port +#define serPortMaskLocal 0x7FFF // Mask off HotSync "hint" (for SerialMgr) + + +/******************************************************************** + * Serial Settings Descriptor + ********************************************************************/ + +typedef struct SerSettingsType { + UInt32 baudRate; // baud rate + UInt32 flags; // miscellaneous settings + Int32 ctsTimeout; // max # of ticks to wait for CTS to become asserted + // before transmitting; used only when + // configured with serSettingsFlagCTSAutoM. + } SerSettingsType; +typedef SerSettingsType* SerSettingsPtr; + +#define serSettingsFlagStopBitsM 0x00000001 // mask for stop bits field +#define serSettingsFlagStopBits1 0x00000000 // 1 stop bits +#define serSettingsFlagStopBits2 0x00000001 // 2 stop bits +#define serSettingsFlagParityOnM 0x00000002 // mask for parity on +#define serSettingsFlagParityEvenM 0x00000004 // mask for parity even +#define serSettingsFlagXonXoffM 0x00000008 // (NOT IMPLEMENTED) mask for Xon/Xoff flow control +#define serSettingsFlagRTSAutoM 0x00000010 // mask for RTS rcv flow control +#define serSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control +#define serSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char +#define serSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char +#define serSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char +#define serSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char +#define serSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char + + +// Default settings +#define serDefaultSettings (serSettingsFlagBitsPerChar8 | \ + serSettingsFlagStopBits1 | \ + serSettingsFlagRTSAutoM) + +#define serDefaultCTSTimeout (5*sysTicksPerSecond) + +// +// mask values for the lineErrors from SerGetStatus +// + +#define serLineErrorParity 0x0001 // parity error +#define serLineErrorHWOverrun 0x0002 // HW overrun +#define serLineErrorFraming 0x0004 // framing error +#define serLineErrorBreak 0x0008 // break signal asserted +#define serLineErrorHShake 0x0010 // line hand-shake error +#define serLineErrorSWOverrun 0x0020 // HW overrun +#define serLineErrorCarrierLost 0x0040 // CD dropped + + + + +/******************************************************************** + * Type of a wakeup handler procedure which can be installed through the + * SerSetWakeupHandler() call. + ********************************************************************/ +typedef void (*SerWakeupHandler) (UInt32 refCon); + +/******************************************************************** + * Type of an emulator-mode only blocking hook routine installed via + * SerControl function serCtlEmuSetBlockingHook. This is supported only + * under emulation mode. The argument to the function is the value + * specified in the SerCallbackEntryType structure. The intention of the + * return value is to return false if serial manager should abort the + * current blocking action, such as when an app quit event has been received; + * otherwise, it should return true. However, in the current implementation, + * this return value is ignored. The callback can additionally process + * events to enable user interaction with the UI, such as interacting with the + * debugger. + ********************************************************************/ +typedef Boolean (*SerBlockingHookHandler) (UInt32 userRef); + + + + +/******************************************************************** + * Serial Library Control Enumerations (Pilot 2.0) + ********************************************************************/ + +/******************************************************************** + * Structure for specifying callback routines. + ********************************************************************/ +typedef struct SerCallbackEntryType { + MemPtr funcP; // function pointer + UInt32 userRef; // ref value to pass to callback + } SerCallbackEntryType; +typedef SerCallbackEntryType* SerCallbackEntryPtr; + +// v2.0 extension +typedef enum SerCtlEnum { + serCtlFirstReserved = 0, // RESERVE 0 + + serCtlStartBreak, // 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, // turn RS232 break signal off: + // valueP = 0, valueLenP = 0 + + serCtlBreakStatus, // Get RS232 break signal status(on or off): + // valueP = pointer to UInt16 for returning status(0 = off, !0 = on) + // *valueLenP = sizeof(UInt16) + + serCtlStartLocalLoopback, // Start local loopback test + // valueP = 0, valueLenP = 0 + + serCtlStopLocalLoopback, // Stop local loopback test + // valueP = 0, valueLenP = 0 + + serCtlMaxBaud, // Get maximum supported baud rate: + // valueP = pointer to UInt32 for returned baud + // *valueLenP = sizeof(UInt32) + + serCtlHandshakeThreshold, // 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, // 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, // Enable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + serCtlIrDADisable, // Disable IrDA connection on this serial port + // valueP = 0, valueLenP = 0 + + serCtlIrScanningOn, // Start Ir Scanning mode + + serCtlIrScanningOff, // Stop Ir Scanning mode + + serCtlRxEnable, // enable receiver ( for IrDA ) + + serCtlRxDisable, // disable receiver ( for IrDA ) + + serCtlLAST // ADD NEW ENTRIES BEFORE THIS ONE + } SerCtlEnum; + + +// 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. +#define serCtlFirstCustomEntry 0xA800 + +/******************************************************************** + * Serial Library Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Used by mac applications to map the pilot serial port to a particular +// macintosh port. +UInt16 SerSetMapPort( UInt16 pilotPort, UInt16 macPort ); + +// Acquires and opens a serial port with given baud and default settings. +Err SerOpen(UInt16 refNum, UInt16 port, UInt32 baud) + SYS_TRAP(sysLibTrapOpen); + +// Used by debugger to re-initialize serial port if necessary +Err SerDbgAssureOpen(UInt16 refNum, UInt16 port, UInt32 baud); + +// Closes the serial connection previously opened with SerOpen. +Err SerClose(UInt16 refNum) + SYS_TRAP(sysLibTrapClose); + +// Puts serial library to sleep +Err SerSleep(UInt16 refNum) + SYS_TRAP(sysLibTrapSleep); + +// Wake Serial library +Err SerWake(UInt16 refNum) + SYS_TRAP(sysLibTrapWake); + +// Get attributes of the serial connection +Err SerGetSettings(UInt16 refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom); + +// Set attributes of the serial connection +Err SerSetSettings(UInt16 refNum, SerSettingsPtr settingsP) + SYS_TRAP(sysLibTrapCustom+1); + +// Return status of serial connection +UInt16 SerGetStatus(UInt16 refNum, Boolean * ctsOnP, + Boolean * dsrOnP) + SYS_TRAP(sysLibTrapCustom+2); + +// Reset error condition of serial connection +Err SerClearErr(UInt16 refNum) + SYS_TRAP(sysLibTrapCustom+3); + + + + +// Sends a buffer of data (may queue it up and return). +Err SerSend10(UInt16 refNum, const void * bufP, UInt32 size) + SYS_TRAP(sysLibTrapCustom+4); + +// Waits until the serial transmit buffer empties. +// The timeout arg is ignored; CTS timeout is used +Err SerSendWait(UInt16 refNum, Int32 timeout) + SYS_TRAP(sysLibTrapCustom+5); + +// Returns how many characters are left in the send queue waiting +// for transmission +Err SerSendCheck(UInt16 refNum, UInt32 * numBytesP) + SYS_TRAP(sysLibTrapCustom+6); + +// Flushes the data out of the transmit buffer +Err SerSendFlush(UInt16 refNum) + SYS_TRAP(sysLibTrapCustom+7); + + + + +// Receives a buffer of data of the given size. +Err SerReceive10(UInt16 refNum, void * bufP, UInt32 bytes, Int32 timeout) + SYS_TRAP(sysLibTrapCustom+8); + +// Waits for at least 'bytes' bytes of data to arrive at the serial input. +// but does not read them in +Err SerReceiveWait(UInt16 refNum, UInt32 bytes, Int32 timeout) + SYS_TRAP(sysLibTrapCustom+9); + +// Returns how many characters are in the receive queue +Err SerReceiveCheck(UInt16 refNum, UInt32 * numBytesP) + SYS_TRAP(sysLibTrapCustom+10); + +// Flushes any data coming into the serial port, discarding the data. +void SerReceiveFlush(UInt16 refNum, Int32 timeout) + SYS_TRAP(sysLibTrapCustom+11); + + +// Specify a new input buffer. To restore the original buffer, pass +// bufSize = 0. +Err SerSetReceiveBuffer(UInt16 refNum, void * bufP, UInt16 bufSize) + SYS_TRAP(sysLibTrapCustom+12); + + +// The receive character interrupt service routine, called by kernel when +// a UART interrupt is detected. +Boolean SerReceiveISP(void) + SYS_TRAP(sysTrapSerReceiveISP); + + + +// "Back Door" into the serial receive queue. Used by applications (like TCP Media layers) +// that need faster access to received characters +Err SerReceiveWindowOpen(UInt16 refNum, UInt8 ** bufPP, UInt32 * sizeP) + SYS_TRAP(sysLibTrapCustom+13); + +Err SerReceiveWindowClose(UInt16 refNum, UInt32 bytesPulled) + SYS_TRAP(sysLibTrapCustom+14); + +// Can be called by applications that need an alternate wakeup mechanism +// when characters get enqueued by the interrupt routine. +Err SerSetWakeupHandler(UInt16 refNum, SerWakeupHandler procP, + UInt32 refCon) + SYS_TRAP(sysLibTrapCustom+15); + +// Called to prime wakeup handler +Err SerPrimeWakeupHandler(UInt16 refNum, UInt16 minBytes) + SYS_TRAP(sysLibTrapCustom+16); + +// Called to perform a serial manager control operation +// (v2.0 extension) +Err SerControl(UInt16 refNum, UInt16 op, void * valueP, UInt16 * valueLenP) + SYS_TRAP(sysLibTrapCustom+17); + + +// Sends a buffer of data (may queue it up and return). +UInt32 SerSend(UInt16 refNum, const void * bufP, UInt32 count, Err* errP) + SYS_TRAP(sysLibTrapCustom+18); + +// Receives a buffer of data of the given size. +UInt32 SerReceive(UInt16 refNum, void * bufP, UInt32 count, Int32 timeout, Err* errP) + SYS_TRAP(sysLibTrapCustom+19); + + +#ifdef __cplusplus +} +#endif + + +#endif //__SERIALMGROLD_H_ diff --git a/sdk-4/include/Core/System/SerialSdrv.h b/sdk-4/include/Core/System/SerialSdrv.h new file mode 100644 index 0000000..97705eb --- /dev/null +++ b/sdk-4/include/Core/System/SerialSdrv.h @@ -0,0 +1,152 @@ +/****************************************************************************** + * + * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SerialSdrv.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Constants and data structures for serial drvr ('sdrv') code. + * + * History: + * 5/11/98 Created by Ben Manuto + * + *****************************************************************************/ + +#ifndef __SERIALSDRV_H__ +#define __SERIALSDRV_H__ + +#include +#include + +#include + +#include + + +// ĽĽĽĽĽĽĽĽĽĽ Constants + +#define kSdrvResType 'sdrv' + + +// ĽĽĽĽĽĽĽĽĽĽ Typdefs + +typedef enum SdrvCtlOpCodeEnum { // Control function opCodes + sdrvOpCodeNoOp = 0, + sdrvOpCodeSetBaudRate = 0x1000, // Set baud rate + sdrvOpCodeSetSettingsFlags, // Set port send/rcv settings. + sdrvOpCodeClearErr, // Clear any HW errors. + sdrvOpCodeEnableUART, // Enable the UART. + sdrvOpCodeDisableUART, // Disable the UART. + sdrvOpCodeEnableUARTInterrupts, // Enable the UART interrupts. + sdrvOpCodeDisableUARTInterrupts, // Disable the UART interrupts. + sdrvOpCodeSetSleepMode, // Put the HW in sleep mode. + sdrvOpCodeSetWakeupMode, // Wake the HW from sleep mode. + sdrvOpCodeRxEnable, // Enable the RX lines. + sdrvOpCodeRxDisable, // Disbale the RX lines. + sdrvOpCodeLineEnable, // Enable the RS-232 lines. + sdrvOpCodeFIFOCount, // Return bytes in HW FIFO. + sdrvOpCodeEnableIRDA, // Enable the IR mode for the UART. + sdrvOpCodeDisableIRDA, // Disable the IR mode for the UART. + sdrvOpCodeStartBreak, // Start a break signal. + sdrvOpCodeStopBreak, // Stop a break signal. + sdrvOpCodeStartLoopback, // Start loopback mode. + sdrvOpCodeStopLoopback, // Stop loopback mode. + sdrvOpCodeFlushTxFIFO, // Flush HW TX FIFO. + sdrvOpCodeFlushRxFIFO, // Flsuh HW RX FIFO. + sdrvOpCodeGetOptTransmitSize, // Get HW optimal buffer size. + sdrvOpCodeEnableRTS, // De-assert the RTS line to allow data to be received. + sdrvOpCodeDisableRTS, // Assert the RTS line to prevent rcv buffer overflows. + sdrvOpCodeSetDTRAsserted, // Assert or deassert DTR signal + sdrvOpCodeGetDTRAsserted, // Yields 'true' if DTR is asserted, 'false' otherwise. + sdrvOpCodeUserDef = 0x2000, + + // --- Insert new control code above this line + sdrvOpCodeSystem = 0x7000, + sdrvOpCodeCustom = 0x8000 +} SdrvCtlOpCodeEnum; + +#define sdrvOpCodeSystemStart 0x7000 // Start poitn for system op codes. +#define sdrvOpCodeCustomStart 0x8000 // Start point for custom op codes. + +typedef void *SdrvDataPtr; + +#if EMULATION_LEVEL == EMULATION_NONE && !defined(__GNUC__) + +typedef void (*SerialMgrISPProcPtr)(void *portP:__A0); + +typedef Err (*SdrvOpenProcPtr)(SdrvDataPtr *drvrDataP, + UInt32 baudRate, + void *portP, + SerialMgrISPProcPtr saveDataProc); +typedef Err (*SdrvCloseProcPtr)(SdrvDataPtr drvrDataP); +typedef Err (*SdrvControlProcPtr)(SdrvDataPtr drvrDataP, + SdrvCtlOpCodeEnum controlCode, + void *controlDataP, + UInt16 *controlDataLenP); +typedef UInt16 (*SdrvStatusProcPtr)(SdrvDataPtr drvrDataP); +typedef UInt16 (*SdrvReadCharProcPtr)(SdrvDataPtr drvrDataP:__A0):__D0; +typedef Err (*SdrvWriteCharProcPtr)(SdrvDataPtr drvrDataP, UInt8 aChar); + +#else +typedef void (*SerialMgrISPProcPtr)(void *portP); +typedef Err (*SdrvOpenProcPtr)(SdrvDataPtr *drvrDataP, + UInt32 baudRate, + void *portP, + void *saveDataProc); +typedef Err (*SdrvCloseProcPtr)(SdrvDataPtr drvrDataP); +typedef Err (*SdrvControlProcPtr)(SdrvDataPtr drvrDataP, + SdrvCtlOpCodeEnum controlCode, + void *controlDataP, + UInt16 *controlDataLenP); +typedef UInt16 (*SdrvStatusProcPtr)(SdrvDataPtr drvrDataP); +typedef UInt16 (*SdrvReadCharProcPtr)(SdrvDataPtr drvrDataP); +typedef Err (*SdrvWriteCharProcPtr)(SdrvDataPtr drvrDataP, UInt8 aChar); +#endif + + +typedef struct { + SdrvOpenProcPtr drvOpen; + SdrvCloseProcPtr drvClose; + SdrvControlProcPtr drvControl; + SdrvStatusProcPtr drvStatus; + SdrvReadCharProcPtr drvReadChar; + SdrvWriteCharProcPtr drvWriteChar; +} SdrvAPIType; + +typedef SdrvAPIType *SdrvAPIPtr; + + +// Normally, serial drvr functions are accessed (by the NewSerialMgr) +// through the above SdrvAPIType structure of ProcPtrs. + +// However, SerialMgrDbg.c (the Serial Mgr linked to the boot/debugger code) +// needs to call the HAL's debug serial code through the HAL_CALL macro. + + +Err DrvOpen(SdrvDataPtr *drvrData, UInt32 baudRate, void *portP, + SerialMgrISPProcPtr saveDataProc) + HAL_CALL(sysTrapDbgSerDrvOpen); + +Err DrvClose(SdrvDataPtr drvrData) + HAL_CALL(sysTrapDbgSerDrvClose); + +Err DrvControl(SdrvDataPtr drvrData, SdrvCtlOpCodeEnum controlCode, + void *controlData, UInt16 *controlDataLen) + HAL_CALL(sysTrapDbgSerDrvControl); + +UInt16 DrvStatus(SdrvDataPtr drvrData) + HAL_CALL(sysTrapDbgSerDrvStatus); + +Err DrvWriteChar(SdrvDataPtr drvrData, UInt8 aChar) + HAL_CALL(sysTrapDbgSerDrvWriteChar); + +#if EMULATION_LEVEL == EMULATION_NONE && !defined(__GNUC__) +#pragma parameter __D0 DrvReadChar(__A0) +#endif +UInt16 DrvReadChar(SdrvDataPtr drvrData) + HAL_CALL(sysTrapDbgSerDrvReadChar); + +#endif // __SERIALSDRV_H__ diff --git a/sdk-4/include/Core/System/SerialVdrv.h b/sdk-4/include/Core/System/SerialVdrv.h new file mode 100644 index 0000000..50f3e76 --- /dev/null +++ b/sdk-4/include/Core/System/SerialVdrv.h @@ -0,0 +1,188 @@ +/****************************************************************************** + * + * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SerialVdrv.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Constants and data structures for virtual driver ('vdrv') code. + * + * History: + * 5/11/98 Created by Ben Manuto + * + *****************************************************************************/ + +#ifndef __SERIALVDRV_H__ +#define __SERIALVDRV_H__ + +#include +#include + +#include + +#include +#include + + +// ********** Constants + +#define kVdrvResType 'vdrv' + + +// ********** Typedefs + +typedef enum VdrvCtlOpCodeEnum { // Control function opCodes + vdrvOpCodeNoOp = 0, + vdrvOpCodeSetBaudRate = 0x1000, // Set the port's baud rate. + vdrvOpCodeSetSettingsFlags, // Set the ports send/rvc settings + vdrvOpCodeSetCtsTimeout, // The HW handshake timeout. + vdrvOpCodeClearErr, // Clear any HW errors. + vdrvOpCodeSetSleepMode, // Put in sleep mode. + vdrvOpCodeSetWakeupMode, // Wake from sleep mode. + vdrvOpCodeFIFOCount, // Return bytes in FIFO + vdrvOpCodeStartBreak, // Start a break signal. + vdrvOpCodeStopBreak, // Stop a break signal + vdrvOpCodeStartLoopback, // Start loopback mode. + vdrvOpCodeStopLoopback, // Stop loopback mode. + vdrvOpCodeFlushTxFIFO, // Flush the TX FIFO. + vdrvOpCodeFlushRxFIFO, // Flush the RX FIFO. + vdrvOpCodeSendBufferedData, // Send any buffered data in e vdrv. + vdrvOpCodeRcvCheckIdle, // Check idle state. + vdrvOpCodeEmuSetBlockingHook, // Special opCode for the simulator. + vdrvOpCodeGetOptTransmitSize, // Get the optimal TX buffer size for this port. + vdrvOpCodeGetMaxRcvBlockSize, // Get the optimal RX buffer size for this port. + vdrvOpCodeNotifyBytesReadFromQ, // Notify the vdrv bytes have been removed from Q. + vdrvOpCodeSetDTRAsserted, // Assert or deassert DTR signal + vdrvOpCodeGetDTRAsserted, // Yields 'true' if DTR is asserted, 'false' otherwise. + vdrvOpCodeWaitForConfiguration, // Some protocols like USB have an enumeration or + // discovery phase. This control code is called + // from Send and Receive to give the driver time to + // wait until configuration completes\. + vdrvOpCodeGetUSBDeviceDescriptor, // Query driver for device descriptor for USB + vdrvOpCodeGetUSBConfigDescriptor, // Query driver for configuration descriptor for USB + vdrvOpCodeEnableIRDA, // Enable irda, if supported + vdrvOpCodeDisableIRDA, // Disable irda, if supported + vdrvOpCodeEnableUART, // Enable the UART + vdrvOpCodeDisableUART, // Disable the UART + vdrvOpCodeRxEnable, // Enable receive lines + vdrvOpCodeRxDisable, // Disable receive lines + vdrvOpCodeLineEnable, // Enable the RS-232 lines. + vdrvOpCodeEnableUARTInterrupts, // Enable the UART interrupts. + vdrvOpCodeDisableUARTInterrupts, // Disable the UART interrupts. + vdrvOpCodeSetReceiveQueue, // Set the receive queue + + vdrvOpCodeSaveState, // Save the state of the driver and port + // Used for port yielding + // A drive does not need to support this + // if it can not save state. + vdrvOpCodeRestoreState, // Restore the state of the driver and port + // Used for port yielding + // A drive does not need to support this + // if it can not save state. + vdrvOpCodeSetYieldPortCallback, // Set the yield port callback + // Port yielding is handled by the serial manager + // but if a virtual driver has a port beneath it + // that needs to be yieldable then it can pass the + // callback down to the port beneath it. + vdrvOpCodeSetYieldPortRefCon, // Set the yield port refCon + // Port yielding is handled by the serial manager + // but if a virtual driver has a port beneath it + // that needs to be yieldable then it can pass the + // refCon down to the port beneath it. + + vdrvOpCodeUserDef = 0x2000, // User defined + + // --- Insert new control code above this line + vdrvOpCodeSystem = 0x7000, // All op codes in this range are reserved for the system + vdrvOpCodeCustom = 0x8000 // All op codes in this range are reserved for licensees +} VdrvCtlOpCodeEnum; + +#define vdrvOpCodeSystemStart 0x7000 // Start point for system op codes. +#define vdrvOpCodeCustomStart 0x8000 // Start point for custom op codes. + +typedef struct VdrvConfigType { + UInt32 baud; // Baud rate to connect at + UInt32 drvrId; // Creator of the port that was opened + UInt32 function; // Function id of the connection + MemPtr drvrDataP; // Pointer to driver specific data. + UInt16 drvrDataSize; // Size of the driver specific data block. + UInt32 sysReserved1; // System Reserved + UInt32 sysReserved2; // System Reserved +} VdrvConfigType; + +typedef VdrvConfigType *VdrvConfigPtr; + + +typedef void *VdrvDataPtr; + +typedef Err (*VdrvOpenProcPtr)(VdrvDataPtr *drvrDataP, UInt32 baudRate, DrvrHWRcvQPtr rcvQP); +typedef Err (*VdrvOpenProcV4Ptr)(VdrvDataPtr *drvrDataP, VdrvConfigPtr configP, DrvrHWRcvQPtr rcvQP); + +typedef Err (*VdrvCloseProcPtr)(VdrvDataPtr drvrDataP); + +typedef UInt16 (*VdrvStatusProcPtr)(VdrvDataPtr drvrDataP); +typedef Err (*VdrvControlProcPtr)(VdrvDataPtr drvrDataP, + VdrvCtlOpCodeEnum controlCode, + void *controlDataP, + UInt16 *controlDataLenP); + +typedef Err (*VdrvReadProcPtr)(VdrvDataPtr drvrDataP, void **bufP, UInt32 *sizeP); +typedef UInt32 (*VdrvWriteProcPtr)(VdrvDataPtr drvrDataP, const void *bufP, UInt32 size, Err *errP); + +typedef Err (*VdrvControlCustomProcPtr)(VdrvDataPtr drvrDataP, UInt16 opCode, UInt32 creator, void* controlDataP, + UInt16* controlDataLenP); + + +typedef struct { + VdrvOpenProcPtr drvOpen; + VdrvCloseProcPtr drvClose; + VdrvControlProcPtr drvControl; + VdrvStatusProcPtr drvStatus; + VdrvReadProcPtr drvRead; + VdrvWriteProcPtr drvWrite; + VdrvOpenProcV4Ptr drvOpenV4; + VdrvControlCustomProcPtr drvControlCustom; +} VdrvAPIType; + +typedef VdrvAPIType *VdrvAPIPtr; + + +// Normally, virtual drvr functions are accessed (by the NewSerialMgr) +// through the above SdrvAPIType structure of ProcPtrs. + +// However, SerialMgrDbg.c (the Serial Mgr linked to the boot/debugger code) +// needs to call the HAL's debug serial code through the HAL_CALL macro. + +// Note that this version of DrvOpen conforms with version four of the virtual driver +// model. +Err VDrvOpen(VdrvDataPtr *drvrData, VdrvConfigPtr configP, DrvrHWRcvQPtr rcvQP) + HAL_CALL(sysTrapDbgSerDrvOpen); + +Err VDrvClose(VdrvDataPtr drvrData) + HAL_CALL(sysTrapDbgSerDrvClose); + +Err VDrvControl(VdrvDataPtr drvrData, VdrvCtlOpCodeEnum controlCode, + void *controlData, UInt16 *controlDataLen) + HAL_CALL(sysTrapDbgSerDrvControl); + + +UInt16 VDrvStatus(VdrvDataPtr drvrData) + HAL_CALL(sysTrapDbgSerDrvStatus); + +UInt32 VDrvDbgWrite(VdrvDataPtr drvrData, void * bufP, UInt32 count, + Err* errP) + HAL_CALL(sysTrapDbgSerDrvWriteChar); + +UInt32 VDrvDbgRead(VdrvDataPtr drvrData, void * bufP, UInt32 count, + Int32 timeout, Err* errP) + HAL_CALL(sysTrapDbgSerDrvReadChar); + +// Note the debugger does not use Custom Control calls so there is no corresponding HAL +// trap. +Err VDrvCustomControl(VdrvDataPtr drvrData, UInt16 opCode, UInt32 creator, void* controlDataP, + UInt16* controlDataLenP); + +#endif // __SERIALVDRV_H__ diff --git a/sdk-4/include/Core/System/SoundMgr.h b/sdk-4/include/Core/System/SoundMgr.h new file mode 100644 index 0000000..f0673fd --- /dev/null +++ b/sdk-4/include/Core/System/SoundMgr.h @@ -0,0 +1,331 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SOUNDMGR_H__ +#define __SOUNDMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + +#include + + +/************************************************************ + * Sound Manager constants + * + *************************************************************/ + +// Sound Manager max and default volume levels +#define sndMaxAmp 64 +//#define sndVolumeMask 0x0ff +#define sndDefaultAmp sndMaxAmp + +#define sndMidiNameLength 32 // MIDI track name length *including* NULL terminator + + +/************************************************************ + * Sound Manager data structures + * + *************************************************************/ + +// +// Command numbers for SndCommandType's cmd field +// +typedef enum SndCmdIDType { + + sndCmdFreqDurationAmp = 1, // play a sound, blocking for the entire duration (except for zero amplitude) + // param1 = frequency in Hz + // param2 = duration in milliseconds + // param3 = amplitude (0 - sndMaxAmp); if 0, will return immediately + + // Commands added in PilotOS v3.0 + // ***IMPORTANT*** + // Please note that SndDoCmd() in PilotOS before v3.0 will Fatal Error on unknown + // commands (anything other than sndCmdFreqDurationAmp). For this reason, + // applications wishing to take advantage of these new commands while staying + // compatible with the earlier version of the OS, _must_ avoid using these commands + // when running on OS versions less thatn v3.0 (see sysFtrNumROMVersion in SystemMgr.h). + // Beginning with v3.0, SndDoCmd has been fixed to return sndErrBadParam when an + // unknown command is passed. + // + sndCmdNoteOn, // start a sound given its MIDI key index, max duration and velocity; + // the call will not wait for the sound to complete, returning imeediately; + // any other sound play request made before this one completes will interrupt it. + // param1 = MIDI key index (0-127) + // param2 = maximum duration in milliseconds + // param3 = velocity (0 - 127) (will be interpolated as amplitude) + + sndCmdFrqOn, // start a sound given its frequency in Hz, max duration and amplitude; + // the call will not wait for the sound to complete, returning imeediately; + // any other sound play request made before this one completes will interrupt it. + // param1 = frequency in Hz + // param2 = maximum duration in milliseconds + // param3 = amplitude (0 - sndMaxAmp) + + sndCmdQuiet // stop current sound + // param1 = 0 + // param2 = 0 + // param3 = 0 + + } SndCmdIDType; + + + + +// +// SndCommandType: used by SndDoCmd() +// + +typedef struct SndCommandType { +SndCmdIDType cmd; // command id +UInt8 reserved; +Int32 param1; // first parameter +UInt16 param2; // second parameter +UInt16 param3; // third parameter +} SndCommandType; + +typedef SndCommandType* SndCommandPtr; + + +// +// Beep numbers used by SndSysBeep() +// + +typedef enum SndSysBeepType { + sndInfo = 1, + sndWarning, + sndError, + sndStartUp, + sndAlarm, + sndConfirmation, + sndClick + } SndSysBeepType; + + +/************************************************************ + * Standard MIDI File (SMF) support structures + *************************************************************/ + + +// Structure of records in the MIDI sound database: +// +// Each MIDI record consists of a record header followed immediately by the +// Standard MIDI File (SMF) data stream. Only SMF format #0 is presently supported. +// The first byte of the record header is the byte offset from the beginning of the record +// to the SMF data stream. The name of the record follows the byte offset +// field. sndMidiNameLength is the limit on name size (including NULL). +#define sndMidiRecSignature 'PMrc' +typedef struct SndMidiRecHdrType { + UInt32 signature; // set to sndMidiRecSignature + UInt8 bDataOffset; // offset from the beginning of the record + // to the Standard Midi File data stream + UInt8 reserved; // set to zero + } SndMidiRecHdrType; + +typedef struct SndMidiRecType { + SndMidiRecHdrType hdr; // offset from the beginning of the record + // to the Standard Midi File data stream + Char name[2]; // Track name: 1 or more chars including NULL terminator. + // If a track has no name, the NULL character must still + // be provided. + // Set to 2 to pad the structure out to a word boundary. + } SndMidiRecType; + + +// Midi records found by SndCreateMidiList. +typedef struct SndMidiListItemType + { + Char name[sndMidiNameLength]; // including NULL terminator + UInt32 uniqueRecID; + LocalID dbID; + UInt16 cardNo; + } SndMidiListItemType; + + +// Commands for SndPlaySmf +typedef enum SndSmfCmdEnum { + sndSmfCmdPlay = 1, // play the selection + sndSmfCmdDuration // get the duration in milliseconds of the entire track + } SndSmfCmdEnum; + +typedef void SndComplFuncType(void *chanP, UInt32 dwUserData); +typedef SndComplFuncType *SndComplFuncPtr; + + +// Return true to continue, false to abort +typedef Boolean SndBlockingFuncType(void *chanP, UInt32 dwUserData, Int32 sysTicksAvailable); +typedef SndBlockingFuncType *SndBlockingFuncPtr; + +typedef struct SndCallbackInfoType { + MemPtr funcP; // pointer to the callback function (NULL = no function) + UInt32 dwUserData; // value to be passed in the dwUserData parameter of the callback function + } SndCallbackInfoType; + + +typedef struct SndSmfCallbacksType { + SndCallbackInfoType completion; // completion callback function (see SndComplFuncType) + SndCallbackInfoType blocking; // blocking hook callback function (see SndBlockingFuncType) + SndCallbackInfoType reserved; // RESERVED -- SET ALL FIELDS TO ZERO BEFORE PASSING + } SndSmfCallbacksType; + + +#define sndSmfPlayAllMilliSec 0xFFFFFFFFUL + +typedef struct SndSmfOptionsType { + // dwStartMilliSec and dwEndMilliSec are used as inputs to the function for sndSmfCmdPlay and as + // outputs for sndSmfCmdDuration + UInt32 dwStartMilliSec; // 0 = "start from the beginning" + UInt32 dwEndMilliSec; // sndSmfPlayAllMilliSec = "play the entire track"; + // the default is "play entire track" if this structure + // is not passed in + + // The amplitude and interruptible fields are used only for sndSmfCmdPlay + UInt16 amplitude; // relative volume: 0 - sndMaxAmp, inclusively; the default is + // sndMaxAmp if this structure is not passed in; if 0, the play will + // be skipped and the call will return immediately + + Boolean interruptible; // if true, sound play will be interrupted if + // user interacts with the controls (digitizer, buttons, etc.); + // if false, the paly will not be interrupted; the default behavior + // is "interruptible" if this structure is not passed in + + UInt8 reserved1; + UInt32 reserved; // RESERVED! -- MUST SET TO ZERO BEFORE PASSING + } SndSmfOptionsType; + + +typedef struct SndSmfChanRangeType { + UInt8 bFirstChan; // first MIDI channel (0-15 decimal) + UInt8 bLastChan; // last MIDI channel (0-15 decimal) + } SndSmfChanRangeType; + + + + +/************************************************************ + * Sound Manager result codes + * (sndErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define sndErrBadParam (sndErrorClass | 1) +#define sndErrBadChannel (sndErrorClass | 2) +#define sndErrMemory (sndErrorClass | 3) +#define sndErrOpen (sndErrorClass | 4) +#define sndErrQFull (sndErrorClass | 5) +#define sndErrQEmpty (sndErrorClass | 6) // internal +#define sndErrFormat (sndErrorClass | 7) // unsupported data format +#define sndErrBadStream (sndErrorClass | 8) // invalid data stream +#define sndErrInterrupted (sndErrorClass | 9) // play was interrupted + + + +/******************************************************************** + * Sound Manager Routines + * These are define as external calls only under emulation mode or + * under native mode from the module that actually installs the trap + * vectors + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- + +// Initializes the Sound Manager. Should only be called by +// Pilot initialization code. +Err SndInit(void) SYS_TRAP(sysTrapSndInit); + +// Frees the Sound Manager. +//void SndFree(void) SYS_TRAP(sysTrapSndFree); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// Sets default sound volume levels +// +// Any parameter may be passed as NULL +extern void SndSetDefaultVolume(UInt16 *alarmAmpP, UInt16 *sysAmpP, UInt16 *defAmpP) + SYS_TRAP(sysTrapSndSetDefaultVolume); + +// Gets default sound volume levels +// +// Any parameter may be passed as NULL +extern void SndGetDefaultVolume(UInt16 *alarmAmpP, UInt16 *sysAmpP, UInt16 *masterAmpP) + SYS_TRAP(sysTrapSndGetDefaultVolume); + +// Executes a sound command on the given sound channel (pass +// channelP = 0 to use the shared channel). +extern Err SndDoCmd(void * /*SndChanPtr*/ channelP, SndCommandPtr cmdP, Boolean noWait) + SYS_TRAP(sysTrapSndDoCmd); + +// Plays one of several defined system beeps/sounds (see sndSysBeep... +// constants). +extern void SndPlaySystemSound(SndSysBeepType beepID) + SYS_TRAP(sysTrapSndPlaySystemSound); + + +// NEW FOR v3.0 +// Performs an operation on a Standard MIDI File (SMF) Format #0 +extern Err SndPlaySmf(void *chanP, SndSmfCmdEnum cmd, UInt8 *smfP, SndSmfOptionsType *selP, + SndSmfChanRangeType *chanRangeP, SndSmfCallbacksType *callbacksP, + Boolean bNoWait) + SYS_TRAP(sysTrapSndPlaySmf); + +// NEW FOR v3.0 +// Creates a list of all midi records. Useful for displaying in lists. +// For creator wildcard, pass creator=0; +extern Boolean SndCreateMidiList(UInt32 creator, Boolean multipleDBs, UInt16 *wCountP, MemHandle *entHP) + SYS_TRAP(sysTrapSndCreateMidiList); + +// NEW FOR v3.2 +// Plays a MIDI sound which is read out of an open resource database +extern Err SndPlaySmfResource(UInt32 resType, Int16 resID, SystemPreferencesChoice volumeSelector) + SYS_TRAP(sysTrapSndPlaySmfResource); + + +// NEW FOR v4.0 +// Plays MIDI sounds regardless of the how the interruptible flag is set +extern Err SndPlaySmfIrregardless(void *chanP, SndSmfCmdEnum cmd, UInt8 *smfP, SndSmfOptionsType *selP, + SndSmfChanRangeType *chanRangeP, SndSmfCallbacksType *callbacksP, + Boolean bNoWait) + SYS_TRAP(sysTrapSndPlaySmfIrregardless); + +extern Err SndPlaySmfResourceIrregardless(UInt32 resType, Int16 resID, SystemPreferencesChoice volumeSelector) + SYS_TRAP(sysTrapSndPlaySmfResourceIrregardless); + + +extern Err SndInterruptSmfIrregardless(void) + SYS_TRAP(sysTrapSndInterruptSmfIrregardless); + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Sound Manager Macros + * + *************************************************************/ + +#endif // __SOUND_MGR_H__ diff --git a/sdk-4/include/Core/System/StdIOPalm.h b/sdk-4/include/Core/System/StdIOPalm.h new file mode 100644 index 0000000..005ac22 --- /dev/null +++ b/sdk-4/include/Core/System/StdIOPalm.h @@ -0,0 +1,233 @@ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: StdIOPalm.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This header file must be included by Palm standard IO apps so that they + * can use primitive standard IO functions like printf, getchar(), etc. + * + *****************************************************************************/ + +/* + * A PalmOS standard IO app is built like a normal PalmOS app but has + * a database type of 'sdio' instead of 'appl'. In addition, it must + * be named "Cmd-" where is the name of the command that + * users will enter to execute the app. For example, the 'ping' command + * would be placed in a database named "Cmd-ping". + * + * In order to run a PalmOS standard IO app, a regular PalmOS app + * must be running first that provides a window for the output. This type + * of app is called a StdIO Provider. The StdIO Provider launches the + * stdio app when the user types in a command line and "hits" enter. + * The provider app passes a structure pointer that contains the callbacks + * necessary for performing IO to the stdio app through the cmdPBP parameter + * of PilotMain. + * + * In addition to including this header, standard IO apps must link with + * the module :Libraries:Palm OS Glue:PalmOSGlue.lib. This module provides a + * PilotMain that extracts the command line arguments from the cmd and + * cmdPBP parameters and the glue code necessary for jumping through the + * appropriate callbacks provided by the StdIO provider. + * + * + * A minimal PalmOS stdio app's source file might look like this: + *------------------------------------------------------------------------- + + #include + + // When compiling for the device, the entry point must be called SioMain(). + #if EMULATION_LEVEL == EMULATION_NONE + #define MyHello SioMain + #endif + + Int16 MyHello(UInt16 argc, char* argv[]) + { + printf("\nHello World"); + } + + *------------------------------------------------------------------------- + * + * Notice that the bulk of the code is in a routine named MyHello() this is + * so the routine can easily be called and tested using the Simulator. + * + * When compiling for the viewer though, MyHello is renamed to SioMain(). + * This is the assumed entry point used by the StdIOPalm.c glue code when it + * is compiled for the viewer. + * + * HISTORY: + * 5-6-98 RM Created by Ron Marianetti + * 10/27/00 CS Make use of new sysFileTStdIO. + * + **********************************************************************/ +#ifndef __STDIOPALM_H__ +#define __STDIOPALM_H__ + +// Define this so we don't get the standard stuff +#define _STDIO_H + +// Get PalmOS includes +#include +#include // for _Palm_va_list + + +// All PalmOS Standard IO apps have the following database type +#define sioDBType sysFileTStdIO + + +// Stub out the "FILE" type until we support real file IO +typedef void FILE; + + + +/******************************************************************* + * C Standard IO macros and functions + ********************************************************************/ + + +// We don't support re-direction yet, stdin is always the keyboard and +// stdout is always the stdio window. +#define stdin ((FILE*)0) +#define stdout ((FILE*)1) +#define stderr ((FILE*)2) + +#ifndef EOF +#define EOF -1 +#endif + + +//------------------------------------------------------------------------ +// Functions provided in the StdIOPalm.c module which must be linked in with +// the application source. +//------------------------------------------------------------------------ +#ifdef __cplusplus +extern "C" { +#endif + +// Your "main" entry point must have these calling conventions and +// must be named "SioMain". +Int16 SioMain(UInt16 argc, const Char * argv[]); +typedef Int16 (*SioMainProcPtr)(UInt16 argc, const Char * argv[]); + + +// This routine can be used to add your command to a simulator app +// that is a StdIO provider. It registers the command name and it's +// procedure pointer as a built-in command. THis is necessary in order +// to test under the Simulator because it doesn't support executing +// other databases. +void SioAddCommand(const Char * cmdStr, SioMainProcPtr cmdProcP); + + +// File IO routines +Int16 Siofgetc (FILE* fs); +Char * Siofgets (Char * strP, UInt16 maxChars, FILE* fs); +Int16 Siofputc (Int16 c, FILE* fs); +Int16 Siofputs (const Char * strP, FILE* fs); +Int16 Siofprintf(FILE* fs, const Char * formatP, ...); +Int16 Siovfprintf(FILE* fs, const Char * formatP, _Palm_va_list args); + + +// stdin/stdout IO routines +Int16 Sioprintf(const Char * formatP, ...); +Int16 Sioputs(const Char * strP); +Char * Siogets(Char * strP); + + +// Execute a command line of text +Int16 Siosystem(const Char * cmdStrP); + +#ifdef __cplusplus +} +#endif + + + +//------------------------------------------------------------------------ +// Macros. +// If you don't want to use the C stdio names, define STDIO_PALM_NATIVE_NAMES_ONLY +// before including this header. You might want to do this for apps that +// run in the simulator that want to use the Desktops stdio library as well +// as the Palm stdio library from the same module. +//------------------------------------------------------------------------ +#ifndef STDIO_PALM_NATIVE_NAMES_ONLY +#define fgetc(fs) Siofgetc(fs) +#define fgets(strP,maxChars,fs) Siofgets(strP,maxChars,fs) +#define fputc(c,fs) Siofputc(c,fs) +#define fputs(strP,fs) Siofputs(strP,fs) +#define fprintf Siofprintf +#define vfprintf(fs,formatP,args) Siovfprintf(fs,formatP,args) + +#define printf Sioprintf +#define puts(strP) Sioputs(strP) +#define gets(strP) Siogets(strP) + +#define getchar() Siofgetc(stdin) +#define putc(c,fs) Siofputc(c,fs) +#define putchar(c) Siofputc(c, stdout) + +#define sprintf StrPrintF +#define vsprintf(x,y,z) StrVPrintF(x,(const Char *)y,z) + +#define system(strP) Siosystem(strP) + +#endif //STDIO_PALM_NATIVE_NAMES_ONLY + +#endif //__STDIOPALM_H__ + + +/* This is outside the "#ifndef __STDIOPALM_H__" so that StdIOProvider.h + can pick it up even if StdIOPalm.h has already been included. */ +#if defined(_STDIO_PALM_C_) && !defined(__STDIOPALM_H__SIOGLOBALS__) +#define __STDIOPALM_H__SIOGLOBALS__ +/********************************************************** + * Structure of stdio parameters that are pointed to by the + * application global GAppSioGlobalsP. In stdio apps, this application + * global gets initialized from the cmdPBP parameter to PilotMain. + * + * The stdio provider that launches the stdio app must create this + * structure and initialize it. + * + * NOTE: This structure should be considered for PRIVATE use + * by the StdIOPalm.c module only. Your source code should not + * reference it + ********************************************************************/ + +typedef struct SioGlobalsType { + // size of this structure, used for version matching/checking + // and flags. + UInt16 size; + UInt32 flags; + + // argc, argv parameters to this command + UInt16 argc; + const Char ** argv; + + + // Basic standard IO procedure pointers which are filled in + // by the standard IO provider application. These are the + // callbacks available in the first rev. + Int16 (*fgetcProcP) (void* sioGP, FILE* fs); + Char * (*fgetsProcP) (void* sioGP, Char * strP, UInt16 n, FILE* fs); + + Int16 (*fputcProcP) (void* sioGP, Int16 c, FILE* fs); + Int16 (*fputsProcP) (void* sioGP, const Char * strP, FILE* fs); + + Int16 (*vfprintfProcP) (void* sioGP, FILE* fs, + const Char * formatP, _Palm_va_list args); + + Int16 (*systemProcP) (void* sioGP, const Char * strP); + + + // Standard IO provider private data follows this structure + // UInt8 private[]; + } SioGlobalsType, *SioGlobalsPtr; + + +// This global is declared in StdIOPalm.c which must be linked in with any +// stdio app. +extern SioGlobalsPtr GAppSioGlobalsP; +#endif diff --git a/sdk-4/include/Core/System/StdIOProvider.h b/sdk-4/include/Core/System/StdIOProvider.h new file mode 100644 index 0000000..93530d6 --- /dev/null +++ b/sdk-4/include/Core/System/StdIOProvider.h @@ -0,0 +1,69 @@ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: StdIOProvider.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This header file must be included by apps that want to provide + * a standard IO window and "execute" standard IO apps in it. See the + * comments in the file "StdIOProvier.c" for more info + * + *****************************************************************************/ + +#ifndef __STDIOPROVIDER_H__ +#define __STDIOPROVIDER_H__ + +#define _STDIO_PALM_C_ + +#include +#include +#include + + +/**************************************************************** + * Provider SioGlobalsType includes the client visible fields + * in the beginning + ****************************************************************/ +typedef struct { + SioGlobalsType client; + + UInt32 provA5; // saved A5 register + + MemHandle textH; // holds latest text + UInt16 formID; // Form ID that contains text field + UInt16 fieldID; // Field ID + UInt16 scrollerID; + Boolean echo; + + UInt8 reserved; + } SioProvGlobalsType, *SioProvGlobalsPtr; + + + +/******************************************************************* + * Function Prototypes + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err SioInit(UInt16 formID, UInt16 fieldID, UInt16 scrollerID); +Err SioFree(void); +Boolean SioHandleEvent (SysEventType * eventP); + +// This routine will execute a command line. It is faster than +// using the "system()" call but can only be used by the +// StdIO provider app itself. +Int16 SioExecCommand(const Char * cmd); + +void SioClearScreen(void); + +#ifdef __cplusplus +} +#endif + +#endif //_STDIOPROVIDER_H_ diff --git a/sdk-4/include/Core/System/StringMgr.h b/sdk-4/include/Core/System/StringMgr.h new file mode 100644 index 0000000..ba9f63c --- /dev/null +++ b/sdk-4/include/Core/System/StringMgr.h @@ -0,0 +1,115 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __STRINGMGR_H__ +#define __STRINGMGR_H__ + + +// Include elementary types +#include // Basic types +#include // Trap Numbers. +#if EMULATION_LEVEL == EMULATION_NONE +# define _Palm_va_list char * +#else +# define _Palm_va_list va_list +# include +#endif + +// Max length of string returned by StrIToA, for -2147483647, plus space +// for the terminating null. +#define maxStrIToALen 12 + +#ifdef __cplusplus +extern "C" { +#endif + +// String Manipulation routines +Char * StrCopy(Char *dst, const Char *src) + SYS_TRAP(sysTrapStrCopy); + +Char * StrNCopy(Char *dst, const Char *src, Int16 n) + SYS_TRAP(sysTrapStrNCopy); + +Char * StrCat(Char *dst, const Char *src) + SYS_TRAP(sysTrapStrCat); + +Char * StrNCat(Char *dst, const Char *src, Int16 n) + SYS_TRAP(sysTrapStrNCat); + +Int16 StrLen(const Char *src) + SYS_TRAP(sysTrapStrLen); + +Int16 StrCompareAscii(const Char *s1, const Char *s2) + SYS_TRAP(sysTrapStrCompareAscii); + +Int16 StrCompare(const Char *s1, const Char *s2) + SYS_TRAP(sysTrapStrCompare); + +Int16 StrNCompareAscii(const Char *s1, const Char *s2, Int32 n) + SYS_TRAP(sysTrapStrNCompareAscii); + +Int16 StrNCompare(const Char *s1, const Char *s2, Int32 n) + SYS_TRAP(sysTrapStrNCompare); + +Int16 StrCaselessCompare(const Char *s1, const Char *s2) + SYS_TRAP(sysTrapStrCaselessCompare); + +Int16 StrNCaselessCompare(const Char *s1, const Char *s2, Int32 n) + SYS_TRAP(sysTrapStrNCaselessCompare); + +Char * StrToLower(Char *dst, const Char *src) + SYS_TRAP(sysTrapStrToLower); + +Char * StrIToA(Char *s, Int32 i) + SYS_TRAP(sysTrapStrIToA); + +Char * StrIToH(Char *s, UInt32 i) + SYS_TRAP(sysTrapStrIToH); + +Char * StrLocalizeNumber(Char *s, Char thousandSeparator, Char decimalSeparator) + SYS_TRAP(sysTrapStrLocalizeNumber); + +Char * StrDelocalizeNumber(Char *s, Char thousandSeparator, Char decimalSeparator) + SYS_TRAP(sysTrapStrDelocalizeNumber); + +Char * StrChr (const Char *str, WChar chr) + SYS_TRAP(sysTrapStrChr); + +Char * StrStr (const Char *str, const Char *token) + SYS_TRAP(sysTrapStrStr); + +Int32 StrAToI (const Char *str) + SYS_TRAP(sysTrapStrAToI); + +Int16 StrPrintF(Char *s, const Char *formatStr, ...) + SYS_TRAP(sysTrapStrPrintF); + +Int16 StrVPrintF(Char *s, const Char *formatStr, _Palm_va_list arg) + SYS_TRAP(sysTrapStrVPrintF); + +#ifdef __cplusplus +} +#endif + + + + +#endif //__STRINGMGR_H diff --git a/sdk-4/include/Core/System/SysEvent.h b/sdk-4/include/Core/System/SysEvent.h new file mode 100644 index 0000000..ff7115c --- /dev/null +++ b/sdk-4/include/Core/System/SysEvent.h @@ -0,0 +1,163 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __SYSEVENT_H__ +#define __SYSEVENT_H__ + +#include +#include +#include +#include +#include + + +typedef enum { + sysEventNilEvent = 0, + sysEventPenDownEvent, + sysEventPenUpEvent, + sysEventPenMoveEvent, + sysEventKeyDownEvent, + sysEventWinEnterEvent, + sysEventWinExitEvent, + sysEventAppStopEvent = 22, + sysEventTsmConfirmEvent = 35, + sysEventTsmFepButtonEvent, + sysEventTsmFepModeEvent, + sysEventFrmTitleChangedEvent, + + // add future UI level events in this numeric space + // to save room for new system level events + sysEventNextUIEvent = 0x0800, + + // Equates added for library events + sysEventFirstINetLibEvent = 0x1000, + sysEventFirstWebLibEvent = 0x1100, + + // Changed firstUserEvent from 32767 (0x7FFF) to 0x6000 + // Enums are signed ints, so 32767 technically only allowed for ONE event. + sysEventFirstUserEvent = 0x6000, + sysEventLastUserEvent = 0x7FFF +} SysEventsEnum; + + + +// keyDownEvent modifers +#define shiftKeyMask 0x0001 +#define capsLockMask 0x0002 +#define numLockMask 0x0004 +#define commandKeyMask 0x0008 +#define optionKeyMask 0x0010 +#define controlKeyMask 0x0020 +#define autoRepeatKeyMask 0x0040 // True if generated due to auto-repeat +#define doubleTapKeyMask 0x0080 // True if this is a double-tap event +#define poweredOnKeyMask 0x0100 // True if this is a double-tap event +#define appEvtHookKeyMask 0x0200 // True if this is an app hook key +#define libEvtHookKeyMask 0x0400 // True if this is a library hook key + +// define mask for all "virtual" keys +#define virtualKeyMask (appEvtHookKeyMask | libEvtHookKeyMask | commandKeyMask) + + +// Event timeouts +#define evtWaitForever -1 +#define evtNoWait 0 + +struct _GenericEventType { + UInt16 datum[8]; + }; + +struct _PenUpEventType { + PointType start; // display coord. of stroke start + PointType end; // display coord. of stroke start + }; + +struct _KeyDownEventType { + WChar chr; // ascii code + UInt16 keyCode; // virtual key code + UInt16 modifiers; + }; + +struct _WinEnterEventType { + WinHandle enterWindow; + WinHandle exitWindow; + }; + +struct _WinExitEventType { + WinHandle enterWindow; + WinHandle exitWindow; + }; + +struct _TSMConfirmType { + Char * yomiText; + UInt16 formID; + }; + +struct _TSMFepButtonType { + UInt16 buttonID; + }; + +struct _TSMFepModeEventType { + UInt16 mode; // DOLATER kwk - use real type for mode? + }; + + +// The event record. +typedef struct SysEventType { + SysEventsEnum eType; + Boolean penDown; + UInt8 tapCount; + Coord screenX; + Coord screenY; + union { + struct _GenericEventType generic; + + struct _PenUpEventType penUp; + struct _KeyDownEventType keyDown; + struct _WinEnterEventType winEnter; + struct _WinExitEventType winExit; + struct _TSMConfirmType tsmConfirm; + struct _TSMFepButtonType tsmFepButton; + struct _TSMFepModeEventType tsmFepMode; + + } data; + +} SysEventType; + + +// Events are stored in the event queue with some extra fields: +typedef struct { + SysEventType event; + UInt32 id; // used to support EvtAddUniqueEvent + } SysEventStoreType; + +#define PenGetPoint(a,b,c) EvtGetPen(a,b,c) + + + +#endif // __SYSEVENT_H__ diff --git a/sdk-4/include/Core/System/SysEvtMgr.h b/sdk-4/include/Core/System/SysEvtMgr.h new file mode 100644 index 0000000..fa1c861 --- /dev/null +++ b/sdk-4/include/Core/System/SysEvtMgr.h @@ -0,0 +1,257 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __SYSEVTMGR_H__ +#define __SYSEVTMGR_H__ + +#include +#include + +/************************************************************ + * System Event Manager Errors + *************************************************************/ +#define evtErrParamErr (evtErrorClass | 1) +#define evtErrQueueFull (evtErrorClass | 2) +#define evtErrQueueEmpty (evtErrorClass | 3) + + +/************************************************************ + * Commands for EvtSetAutoOffTimer() + *************************************************************/ +typedef enum +{ + SetAtLeast, // turn off in at least xxx seconds + SetExactly, // turn off in xxx seconds + SetAtMost, // turn off in at most xxx seconds + SetDefault, // change default auto-off timeout to xxx seconds + ResetTimer // reset the timer to the default auto-off timeout + +} EvtSetAutoOffCmd; + + +/************************************************************ + * Pen button info structure. This structure is used + * to hold the bounds of each button on the silk screen and + * the ascii code and modifiers byte that each will generate + * when tapped by the user. + *************************************************************/ +typedef struct PenBtnInfoType { + RectangleType boundsR; // bounding rectangle of button + WChar asciiCode; // ascii code for key event + UInt16 keyCode; // virtual key code for key event + UInt16 modifiers; // modifiers for key event + } PenBtnInfoType; +typedef PenBtnInfoType* PenBtnInfoPtr; + +typedef struct PenBtnListType { + UInt16 numButtons; // Count of number of buttons + PenBtnInfoType buttons[1]; // Placeholder for one or more buttons + } PenBtnListType; + + +/************************************************************ + * Silkscreen area info structure. An array of these structures + * is returned by the EvtGetSilkscreenAreaList function. + *************************************************************/ + +// Different types of rectangles on the display. For new vendor areas, +// the type should be set to the vendor's creator code, as assigned +// by 3Com's Partner Engineering group. +#define silkscreenRectScreen 'scrn' +#define silkscreenRectGraffiti 'graf' + +// Values for SilkscreenAreaType.index if areaType = silkscreenRectGraffiti +#define alphaGraffitiSilkscreenArea 0 +#define numericGraffitiSilkscreenArea 1 + +// One silkscreen area. The areaType field tells us which type of +// area it is, while the index field has different meanings depending +// on the area type. +typedef struct SilkscreenAreaType { + RectangleType bounds; + UInt32 areaType; // four byte creator code. + UInt16 index; + } SilkscreenAreaType; + + +/************************************************************ + * System Event Manager procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------- +// High Level Calls +//------------------------------------------------------------------ +Err EvtSysInit(void) + SYS_TRAP(sysTrapEvtSysInit); + +// Return next "System" event. This routine will send strokes to Graffiti as necessary +// and return a key event. Otherwise, it will return a simple pen down or pen +// up event, or put the processor to sleep for a max time of 'timeout' if +// no events are available. +void EvtGetSysEvent(SysEventType *eventP, Int32 timeout) + SYS_TRAP(sysTrapEvtGetSysEvent); + + +// Return true if there is a low level system event (pen or key) available +Boolean EvtSysEventAvail(Boolean ignorePenUps) + SYS_TRAP(sysTrapEvtSysEventAvail); + + + +// Translate a stroke in the silk screen area to a key event +Err EvtProcessSoftKeyStroke(PointType *startPtP, PointType *endPtP) + SYS_TRAP(sysTrapEvtProcessSoftKeyStroke); + + +//----------------------------------------------------------------- +// Pen Queue Utilties +//------------------------------------------------------------------ + +// Replace current pen queue with another of the given size +Err EvtSetPenQueuePtr(MemPtr penQueueP, UInt32 size) + SYS_TRAP(sysTrapEvtSetPenQueuePtr); + +// Return size of current pen queue in bytes +UInt32 EvtPenQueueSize(void) + SYS_TRAP(sysTrapEvtPenQueueSize); + +// Flush the pen queue +Err EvtFlushPenQueue(void) + SYS_TRAP(sysTrapEvtFlushPenQueue); + + +// Append a point to the pen queue. Passing -1 for x and y means +// pen-up (terminate the current stroke). Called by digitizer interrupt routine +Err EvtEnqueuePenPoint(PointType *ptP) + SYS_TRAP(sysTrapEvtEnqueuePenPoint); + + +// Return the stroke info for the next stroke in the pen queue. This MUST +// be the first call when removing a stroke from the queue +Err EvtDequeuePenStrokeInfo(PointType *startPtP, PointType *endPtP) + SYS_TRAP(sysTrapEvtDequeuePenStrokeInfo); + +// Dequeue the next point from the pen queue. Returns non-0 if no +// more points. The point returned will be (-1,-1) at the end +// of the stroke. +Err EvtDequeuePenPoint(PointType *retP) + SYS_TRAP(sysTrapEvtDequeuePenPoint); + + +// Flush the entire stroke from the pen queue and dispose it +Err EvtFlushNextPenStroke() + SYS_TRAP(sysTrapEvtFlushNextPenStroke); + + + + +//----------------------------------------------------------------- +// Key Queue Utilties +//------------------------------------------------------------------ + +// Replace current key queue with another of the given size. This routine will +// intialize the given key queue before installing it +Err EvtSetKeyQueuePtr(MemPtr keyQueueP, UInt32 size) + SYS_TRAP(sysTrapEvtSetKeyQueuePtr); + +// Return size of current key queue in bytes +UInt32 EvtKeyQueueSize(void) + SYS_TRAP(sysTrapEvtKeyQueueSize); + +// Flush the key queue +Err EvtFlushKeyQueue(void) + SYS_TRAP(sysTrapEvtFlushKeyQueue); + + +// Append a key to the key queue. +Err EvtEnqueueKey(WChar ascii, UInt16 keycode, UInt16 modifiers) + SYS_TRAP(sysTrapEvtEnqueueKey); + +// Return true of key queue empty. +Boolean EvtKeyQueueEmpty(void) + SYS_TRAP(sysTrapEvtKeyQueueEmpty); + + +// Pop off the next key event from the key queue and fill in the given +// event record structure. Returns non-zero if there aren't any keys in the +// key queue. If peek is non-zero, key will be left in key queue. +Err EvtDequeueKeyEvent(SysEventType *eventP, UInt16 peek) + SYS_TRAP(sysTrapEvtDequeueKeyEvent); + + +//----------------------------------------------------------------- +// Silkscreen information calls +//------------------------------------------------------------------ + +// Return pointer to the pen based button list +const PenBtnInfoType* EvtGetPenBtnList(UInt16* numButtons) + SYS_TRAP(sysTrapEvtGetPenBtnList); + +// Return pointer to the silkscreen area list +const SilkscreenAreaType* EvtGetSilkscreenAreaList(UInt16* numAreas) + SYS_TRAP(sysTrapEvtGetSilkscreenAreaList); + + +//----------------------------------------------------------------- +// General Utilities +//------------------------------------------------------------------ +// Force the system to wake-up. This will result in a null event being +// sent to the current app. +Err EvtWakeup(void) + SYS_TRAP(sysTrapEvtWakeup); + +// Force the system to wake-up. This will NOT result in a null event being +// sent to the current app. +Err EvtWakeupWithoutNilEvent() + SYS_TRAP(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. +Err EvtResetAutoOffTimer(void) + SYS_TRAP(sysTrapEvtResetAutoOffTimer); + +Err EvtSetAutoOffTimer(EvtSetAutoOffCmd cmd, UInt16 timeout) + SYS_TRAP(sysTrapEvtSetAutoOffTimer); + +// Set Graffiti enabled or disabled. +void EvtEnableGraffiti(Boolean enable) + SYS_TRAP(sysTrapEvtEnableGraffiti); + +// Force a NullEvent at or before tick +Boolean EvtSetNullEventTick(UInt32 tick) + SYS_TRAP(sysTrapEvtSetNullEventTick); + + +#ifdef __cplusplus +} +#endif + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _EvtEnqueuePenPoint \ + ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint) + + + +#endif //__SYSEVTMGR_H__ diff --git a/sdk-4/include/Core/System/SysResTypes.rh b/sdk-4/include/Core/System/SysResTypes.rh new file mode 100644 index 0000000..d2b28ad --- /dev/null +++ b/sdk-4/include/Core/System/SysResTypes.rh @@ -0,0 +1,68 @@ +/****************************************************************************** + * + * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SysResTypes.rh + * + * Release: + * + * Description: + * Include file for PalmRez. This file contains resource definitions + * 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 + * 07/23/99 bob Split out from SystemMgr.rh + * + *****************************************************************************/ + +#ifndef __SYSRESTYPES_RH__ +#define __SYSRESTYPES_RH__ + +#include + +//----------------------------------------------------------- +// This section is only valid when running the resource compiler +//----------------------------------------------------------- +#ifdef RESOURCE_COMPILER + +// Definition of the Pilot Preferences Resource. This must match +// the definition of the structure SysAppPrefs in SystemMgr.h +resdef { + word priority; // AMX task priority + long stackSize; // required stack size + long minHeapSpace; // min required free space in heap + } sysResTAppPrefs; + +// Definition of the extended preferences resource. This must +// match the definition of the structure SysExtPrefsType in SystemMgr.h + +resdef { + word version; // Version of structure. + long flags; // 32 flags. + } sysResTExtPrefs; + +// Definition of the ROM - Based Feature table +resdef { + word featureNum; // Feature number + long featureValue; // Feature value + } 'FITM'; + +resdef { + long creator; // creator type + word len(featureItems); + resource 'FITM' featureItems[]; + } 'CITM'; + +resdef { + word len(creatorItems); + resource 'CITM' creatorItems[]; + } sysResTFeatures; + + +#endif + + +#endif // __SYSRESTYPES_RH__ diff --git a/sdk-4/include/Core/System/SysUtils.h b/sdk-4/include/Core/System/SysUtils.h new file mode 100644 index 0000000..df6a10d --- /dev/null +++ b/sdk-4/include/Core/System/SysUtils.h @@ -0,0 +1,103 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SYSUTILS_H__ +#define __SYSUTILS_H__ + +// Include elementary types +#include // Basic types +#include // Trap Numbers. +#include + + + +//typedef Int16 _comparF (const void *, const void *, Int16 other); +typedef Int16 _comparF (void *, void *, Int32 other); +typedef _comparF * CmpFuncPtr; + +typedef Int16 _searchF (void const *searchData, void const *arrayData, Int32 other); +typedef _searchF * SearchFuncPtr; + + +// For backwards compatibility +#define GremlinIsOn hostSelectorGremlinIsRunning + +/************************************************************ + * Constants + *************************************************************/ +#define sysRandomMax 0x7FFF // Max value returned from SysRandom() + + +/************************************************************ + * Macros + *************************************************************/ +#define Abs(a) (((a) >= 0) ? (a) : -(a)) + +/************************************************************ + * procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Boolean SysBinarySearch (void const *baseP, Int16 numOfElements, Int16 width, + SearchFuncPtr searchF, void const *searchData, + Int32 other, Int32 *position, Boolean findFirst) + SYS_TRAP(sysTrapSysBinarySearch); + +void SysInsertionSort (void *baseP, Int16 numOfElements, Int16 width, + CmpFuncPtr comparF, Int32 other) + SYS_TRAP(sysTrapSysInsertionSort); + +void SysQSort (void *baseP, Int16 numOfElements, Int16 width, + CmpFuncPtr comparF, Int32 other) + SYS_TRAP(sysTrapSysQSort); + +void SysCopyStringResource (Char *string, Int16 theID) + SYS_TRAP(sysTrapSysCopyStringResource); + +MemHandle SysFormPointerArrayToStrings(Char *c, Int16 stringCount) + SYS_TRAP(sysTrapSysFormPointerArrayToStrings); + + +// Return a random number ranging from 0 to sysRandomMax. +// Normally, 0 is passed unless you want to start with a new seed. +Int16 SysRandom(Int32 newSeed) + SYS_TRAP(sysTrapSysRandom); + + +Char * SysStringByIndex(UInt16 resID, UInt16 index, Char *strP, UInt16 maxLen) + SYS_TRAP(sysTrapSysStringByIndex); + +Char * SysErrString(Err err, Char *strP, UInt16 maxLen) + SYS_TRAP(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. +UInt32 HostControl(HostControlTrapNumber selector, ...) + SYS_TRAP(sysTrapHostControl); + + +// For backwards compatibility +#define SysGremlins HostControl + +#ifdef __cplusplus +} +#endif + +#endif // __SYSUTILS_H__ diff --git a/sdk-4/include/Core/System/SystemMgr.h b/sdk-4/include/Core/System/SystemMgr.h new file mode 100644 index 0000000..c46d78a --- /dev/null +++ b/sdk-4/include/Core/System/SystemMgr.h @@ -0,0 +1,1306 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SYSTEMMGR_H__ +#define __SYSTEMMGR_H__ + +// Include elementary types +#include +#include // Trap Numbers. + +// Other types +#include // Resource definitions. + + +// System Headers +#include +#include +#include +#include +#include +#include // for DmOpenRef +#include + + +/************************************************************ + * 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 + #define sysTicksPerSecond 100 // 100/sec on Pilot +#elif EMULATION_LEVEL == EMULATION_WINDOWS + #define sysTicksPerSecond 1000 // 1000/sec on Windows PC +#elif EMULATION_LEVEL == EMULATION_UNIX + #define sysTicksPerSecond 1000 + // 1000/sec on Linux +#else + #error Invalid EMULATION_LEVEL +#endif + + + +/************************************************************ + * Rules for creating and using the Command Parameter Block + * passed to SysUIAppSwitch + *************************************************************/ + +// A parameter block containing application-specific information may be passed +// to an application when launching it via SysUIAppSwitch. To create the +// parameter block, you allocate a memory block using MemPtrNew and then you must +// call MemPtrSetOwner to set the block's owner ID to 0. This assigns the block's +// ownership to the system so that it will not be automatically freed by the system +// when the calling app exits. The command block must be self contained. It must not +// have pointers to anything on the stack or in memory blocks owned by an application. +// The launching and launched applications do not need to worry about freeing the +// command block since the system will do this after the launched application exits. +// If no parameter block is being passed, this parameter must be NULL. + + +/************************************************************ + * Action Codes + * + * IMPORTANT ACTION CODE CONSIDERATIONS: + * + * Many action codes are "sent" to apps via a direct function call into the app's + * PilotMain() function without launching the app. For these action codes, the + * application's global and static variables are *not* available, unless the + * application is already running. Some action codes are synchronized with the + * currently running UI applcation via the event manager (alarm action codes, + * for example), while others, such as HotSync action codes, are sent from a + * background thread. To find out if your app is running (is the current UI + * app) when an action code is received, test the sysAppLaunchFlagSubCall flag + * (defined in SystemMgr.h) which is passed to your PilotMain in the + * launchFlags parameter (the third PilotMain parameter). If it is non-zero, + * you may assume that your app is currently running and the global variables + * are accessible. This information is useful if your app maintains an open + * data database (or another similar resource) when it is running. If the app + * receives an action code and the sysAppLaunchFlagSubCall is set in + * launchFlags, the handler may access global variables and use the open + * database handle while handling the call. On the other hand, if the + * sysAppLaunchFlagSubCall flag is not set (ie., zero), the handler will need + * to open and close the database itself and is not allowed to access global + * or static variables. + * + *************************************************************/ + +// NOTE: for defining custom action codes, see sysAppLaunchCmdCustomBase below. + +// System SysAppLaunch Commands +#define sysAppLaunchCmdNormalLaunch 0 // Normal Launch + +#define sysAppLaunchCmdFind 1 // Find string + +#define sysAppLaunchCmdGoTo 2 // Launch and go to a particular record + +#define sysAppLaunchCmdSyncNotify 3 // Sent to apps whose databases changed during + // HotSync after the sync has been completed, + // including when the app itself has been installed + // by HotSync. The data database(s) must have the + // same creator ID as the application for this + // mechanism to function correctly. This is a + // good opportunity to update/initialize/validate + // the app's data, such as resorting records, + // setting alarms, etc. + // + // Parameter block: None. + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a + // direct function call into the app's + // PilotMain function from the background + // thread of the HotSync application. + + +#define sysAppLaunchCmdTimeChange 4 // Sent to all applications and preference + // panels when the system time is changed. + // This notification is the right place to + // update alarms and other time-related + // activities and resources. + // + // Parameter block: None. + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdSystemReset 5 // Sent to all applications and preference + // panels when the system is either soft-reset + // or hard-reset. This notification is the + // right place to initialize and/or validate + // your application's preferences/features/ + // database(s) as well as to update alarms and + // other time-related activities and resources. + // + // Parameter block: SysAppLaunchCmdSystemResetType + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdAlarmTriggered 6 // Sent to an application at the time its + // alarm time expires (even when another app + // is already displaying its alarm dialog box). + // This call is intended to allow the app to + // perform some very quick activity, such as + // scheduling the next alarm or performing a + // quick maintenance task. The handler for + // sysAppLaunchCmdAlarmTriggered must take as + // little time as possible and is *not* allowed + // to block (this would delay notification for + // alarms set by other applications). + // + // Parameter block: SysAlarmTriggeredParamType + // (defined in AlarmMgr.h) + // Restrictions: No accessing of global or + // static variables unless sysAppLaunchFlagSubCall + // flag is set, as discussed above. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdDisplayAlarm 7 // Sent to an application when it is time + // to display the alarm UI. The application + // is responsible for making any alarm sounds + // and for displaying the alarm UI. + // sysAppLaunchCmdDisplayAlarm calls are ordered + // chronoligically and are not overlapped. + // This means that your app will receive + // sysAppLaunchCmdDisplayAlarm only after + // all earlier alarms have been displayed. + // + // Parameter block: SysDisplayAlarmParamType + // (defined in AlarmMgr.h) + // Restrictions: No accessing of global or + // static variables unless sysAppLaunchFlagSubCall + // flag is set, as discussed above. UI calls are + // allowed to display the app's alarm dialog. + // Notes: This action code is sent via a direct + // function call into the app's PilotMain + // function without "launching" the app. + +#define sysAppLaunchCmdCountryChange 8 // The country has changed + +#define sysAppLaunchCmdSyncRequestLocal 9 // Sent to the HotSync application to request a + // local HotSync. ("HotSync" button was pressed.) + +#define sysAppLaunchCmdSyncRequest sysAppLaunchCmdSyncRequestLocal // for backward compatibility + +#define sysAppLaunchCmdSaveData 10 // Sent to running app before sysAppLaunchCmdFind + // or other action codes that will cause data + // searches or manipulation. + +#define sysAppLaunchCmdInitDatabase 11 // Sent to an application when a database with + // a matching Creator ID is created during + // HotSync (in response to a "create db" + // request). This allows the application to + // initialize a newly-created database during + // HotSync. This might include creating some + // default records, setting up the database's + // application and sort info blocks, etc. + // + // Parameter block: SysAppLaunchCmdInitDatabaseType + // Restrictions: No accessing of global or + // static variables; no User Interface calls. + // Notes: This action code is sent via a + // direct function call into the app's + // PilotMain function from the background + // thread of the HotSync application. + +#define sysAppLaunchCmdSyncCallApplicationV10 12 // Used by DesktopLink Server command "call application"; + // Pilot v1.0 only!!! + +//------------------------------------------------------------------------ +// New launch codes defined for PalmOS 2.0 +//------------------------------------------------------------------------ + +#define sysAppLaunchCmdPanelCalledFromApp 13 // The panel should display a done + // button instead of the pick list. + // The Done button will return the user + // to the last app. + +#define sysAppLaunchCmdReturnFromPanel 14 // A panel returned to this app + +#define sysAppLaunchCmdLookup 15 // Lookup info managed by an app + +#define sysAppLaunchCmdSystemLock 16 // Lock the system until a password is entered. + +#define sysAppLaunchCmdSyncRequestRemote 17 // Sent to the HotSync application to request + // a remote HotSync. ("Remote HotSync" button + // was pressed.) + +#define sysAppLaunchCmdHandleSyncCallApp 18 // Pilot v2.0 and greater. Sent by DesktopLink Server to an application to handle + // the "call application" command; use DlkControl with + // control code dlkCtlSendCallAppReply to send the reply(see DLServer.h). + // This action code replaces the v1.0 code sysAppLaunchCmdSyncCallApplication. + // vmk 11/26/96 + +#define sysAppLaunchCmdAddRecord 19 // Add a record to an applications's database. + + +//------------------------------------------------------------------------ +// Standard Service Panel launch codes (used by network panel, dialer panel, etc.) +//------------------------------------------------------------------------ +#define sysSvcLaunchCmdSetServiceID 20 +#define sysSvcLaunchCmdGetServiceID 21 +#define sysSvcLaunchCmdGetServiceList 22 +#define sysSvcLaunchCmdGetServiceInfo 23 + + +#define sysAppLaunchCmdFailedAppNotify 24 // An app just switched to failed. +#define sysAppLaunchCmdEventHook 25 // Application event hook callback +#define sysAppLaunchCmdExgReceiveData 26 // Exg command for app to receive data. +#define sysAppLaunchCmdExgAskUser 27 // Exg command sent before asking user. + + +//------------------------------------------------------------------------ +// Standard Dialer Service launch codes (30 - 39 reserved) +//------------------------------------------------------------------------ + +// sysDialLaunchCmdDial: dials the modem(optionally displays dial progress UI), given service id +// and serial library reference number +#define sysDialLaunchCmdDial 30 +// sysDialLaunchCmdHangUp: hangs up the modem(optionally displays disconnect progress UI), given service id +// and serial library reference number +#define sysDialLaunchCmdHangUp 31 +#define sysDialLaunchCmdLast 39 + + +//------------------------------------------------------------------------ +// Additional standard Service Panel launch codes (used by network panel, dialer panel, etc) +// (40-49 reserved) +//------------------------------------------------------------------------ + +#define sysSvcLaunchCmdGetQuickEditLabel 40 // SvcQuickEditLabelInfoType +#define sysSvcLaunchCmdLast 49 + + +//------------------------------------------------------------------------ +// New launch codes defined for PalmOS 3.x where x >= 1 +//------------------------------------------------------------------------ + +#define sysAppLaunchCmdURLParams 50 // Sent from the Web Clipper application. + // This launch code gets used to satisfy + // URLs like the following: + // palm:memo.appl?param1=value1¶m2=value2 + // Everything in the URL past the '?' is passed + // to the app as the cmdPBP parameter of PilotMain(). + +#define sysAppLaunchCmdNotify 51 // This is a NotifyMgr notification sent + // via SysNotifyBroadcast. The cmdPBP parameter + // points to a SysNotifyParamType structure + // containing more specific information + // about the notification (e.g., what it's for). + +#define sysAppLaunchCmdOpenDB 52 // Sent to switch to an application and have it + // "open" up the given data file. The cmdPBP + // pointer is a pointer to a SysAppLaunchCmdOpenDBType + // structure that has the cardNo and localID of the database + // to open. This action code is used by the Launcher + // to launch data files, like Eleven PQA files that + // have the dmHdrAttrLaunchableData bit set in their + // database attributes. + +#define sysAppLaunchCmdAntennaUp 53 // Sent to switch only to the launcher when + // the antenna is raised and the launcher + // is the application in the buttons preferences + // that is to be run when the antenna is raised is + // the launcher. + +#define sysAppLaunchCmdGoToURL 54 // Sent to Clipper to have it launch and display + // a given URL. cmdPBP points to the URL string. + +// Begin Change - BGT 03/21/2000 + +//------------------------------------------------------------------------ +// New launch codes defined for Network panel plug-in +//------------------------------------------------------------------------ + +#define sysAppLaunchNppiNoUI 55 // Sent to network panel plug-in ("nppi") to have it launch + // without UI and load to netlib + +#define 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 +//------------------------------------------------------------------------ + +#define sysAppLaunchCmdExgPreview 57 // Sent to an application by the Exchange Manager when the + // application needs to produce a preview. + + +#define sysAppLaunchCmdCardLaunch 58 // Sent to an application by the Launcher when the + // application is being run from a card. + +#define sysAppLaunchCmdExgGetData 59 // Exg command for app to send data requested by an ExgGet + + + +#define 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. + +#define 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) +//------------------------------------------------------------------------ +#define sysAppLaunchCmdCustomBase 0x8000 + +// Your custom launch codes can be defined like this: +// +// typedef enum { +// myAppCmdDoSomething = sysAppLaunchCmdCustomBase, +// myAppCmdDoSomethingElse, +// myAppCmdEtcetera +// +// } MyAppCustomActionCodes; + + + +//------------------------------------------------------------------------ +// SysAppLaunch flags (passed to PilotMain) +//------------------------------------------------------------------------ + +#define sysAppLaunchFlagNewThread 0x01 // create a new thread for application + // - implies sysAppLaunchFlagNewStack +#define sysAppLaunchFlagNewStack 0x02 // create separate stack for application +#define sysAppLaunchFlagNewGlobals 0x04 // create new globals world for application + // - implies new owner ID for Memory chunks +#define sysAppLaunchFlagUIApp 0x08 // notifies launch routine that this is a UI app being + // launched. +#define sysAppLaunchFlagSubCall 0x10 // notifies launch routine that the app is calling it's + // entry point as a subroutine call. This tells the launch + // code that it's OK to keep the A5 (globals) pointer valid + // through the call. + // IMPORTANT: This flag is for internal use by + // SysAppLaunch only!!! It should NEVER be set + // by the caller. +#define sysAppLaunchFlagDataRelocated 0x80 // global data (static ptrs) have been "relocated" + // by either SysAppStartup or StartupCode.c + // IMPORTANT: This flag is for internal use by + // SysAppLaunch only!!! It should NEVER be set + // by the caller. + +// The set of private, internal flags that should never be set by the caller +#define sysAppLaunchFlagPrivateSet (sysAppLaunchFlagSubCall | sysAppLaunchFlagDataRelocated) + + + +//------------------------------------------------------------------- +// Parameter blocks for action codes +// NOTE: The parameter block for the sysAppLaunchCmdFind and sysAppLaunchCmdGoTo +// action codes are defined in "Find.h"; +//--------------------------------------------------------------------------- + +// For sysAppLaunchCmdSaveData +typedef struct { + Boolean uiComing; // true if system dialog will be put up + // before coming action code arrives. + UInt8 reserved1; + } SysAppLaunchCmdSaveDataType; + +// For sysAppLaunchCmdSystemReset +typedef struct { + Boolean hardReset; // true if system was hardReset, false if soft-reset. + Boolean createDefaultDB; // true if app should create default database. + } SysAppLaunchCmdSystemResetType; + + +// For sysAppLaunchCmdInitDatabase +typedef struct SysAppLaunchCmdInitDatabaseType { + DmOpenRef dbP; // Handle of the newly-created database, + // already open for read/write access. + // IMPORTANT: The handler *MUST* leave + // this database handle open on return. + UInt32 creator; // Creator ID of the newly-created database + UInt32 type; // Type ID of the newly-created database + UInt16 version; // Version number of the newly-created database + } SysAppLaunchCmdInitDatabaseType; + + +// For sysAppLaunchCmdSyncCallApplicationV10 +// This structure used on Pilot v1.0 only. See sysAppLaunchCmdHandleSyncCallApp +// for later platforms. +typedef struct SysAppLaunchCmdSyncCallApplicationTypeV10 { + UInt16 action; // call action id (app-specific) + UInt16 paramSize; // parameter size + void * paramP; // ptr to parameter + UInt8 remoteSocket; // remote socket id + UInt8 tid; // command transaction id + Boolean handled; // if handled, MUST be set true by the app + UInt8 reserved1; + } SysAppLaunchCmdSyncCallApplicationTypeV10; + + +// For sysAppLaunchCmdHandleSyncCallApp (Pilot v2.0 and greater). +// This structure replaces SysAppLaunchCmdSyncCallApplicationType +// which was used in Pilot v1.0 +typedef struct SysAppLaunchCmdHandleSyncCallAppType { + UInt16 pbSize; // this parameter block size (set to sizeof SysAppLaunchCmdHandleSyncCallAppType) + UInt16 action; // call action id (app-specific) + void * paramP; // ptr to parameter + UInt32 dwParamSize; // parameter size + void * dlRefP; // DesktopLink reference pointer for passing + // to DlkControl()'s dlkCtlSendCallAppReply code + + Boolean handled; // initialized to FALSE by DLServer; if + // handled, MUST be set TRUE by the app(the + // handler MUST call DlkControl with + // control code dlkCtlSendCallAppReply); + // if the handler is not going to send a reply, + // it should leave this field set to FALSE, in which + // case DesktopLink Server will send the default + // "unknown request" reply. + + UInt8 reserved1; + + Err replyErr; // error from dlkCtlSendCallAppReply + + // RESERVED FOR FUTURE EXTENSIONS + UInt32 dwReserved1; // RESERVED -- set to null!!! + UInt32 dwReserved2; // RESERVED -- set to null!!! + + // Target executable creator and type for testing the mechanism + // in EMULATION MODE ONLY!!! + #if EMULATION_LEVEL != EMULATION_NONE + UInt32 creator; + UInt32 type; + #endif + + } SysAppLaunchCmdHandleSyncCallAppType; + +// For sysAppLaunchCmdFailedAppNotify +typedef struct + { + UInt32 creator; + UInt32 type; + Err result; + } SysAppLaunchCmdFailedAppNotifyType; + + +// For sysAppLaunchCmdOpenDB +typedef struct + { + UInt16 cardNo; + LocalID dbID; + } SysAppLaunchCmdOpenDBType; + + +// For sysAppLaunchCmdCardLaunch +typedef struct + { + Err err; + UInt16 volRefNum; + const Char *path; + UInt16 startFlags; // See vfsStartFlagXXX constants below + } SysAppLaunchCmdCardType; + +#define sysAppLaunchStartFlagAutoStart 0x0001 // this bit in the 'startFlags' field is set for an app which is run automatically on card insertion +#define sysAppLaunchStartFlagNoUISwitch 0x0002 // set this bit in the 'startFlags' field to prevent a UI switch to the start.prc app +#define sysAppLaunchStartFlagNoAutoDelete 0x0004 // set this bit in the 'startFlags' field to prevent VFSMgr from deleting start.prc app on volume unmount + + +//for launch code sysAppLaunchPnpsPreLaunch +typedef struct { + Err error; //an error code from the pre-launch application, set to errNone to prevent normal launching + UInt16 volRefNum; //Non-zero if an optional file system was mounted + UInt16 slotLibRefNum; //always valid for a slot driver call + UInt16 slotRefNum; //always valid for a slot driver call + }SysAppLaunchCmdPnpsType; + + +/************************************************************ + * Structure of Application info for an application. Applications + * do not necessarily have to be on their own thread - there + * can be more than 1 app on the same AMX task. Each application + * has an assocated SysAppInfoType structure which holds the + * application specific information like the database MemHandle of the + * app, the code MemHandle, the stack chunk pointer, the owner ID, etc. + * + * As of PalmOS 3.X, one of these structures is created for each + * app running as an action code. + * + **** + ****IMPORTANT: ADD NEW FIELDS AT THE END OF THE STRUCTURE FOR + **** BACKWARD COMPATIBILITY + **** + *************************************************************/ +typedef struct SysAppInfoType { + Int16 cmd; // command code for app + MemPtr cmdPBP; // cmd ParamBlock + UInt16 launchFlags; // launch flags + + UInt32 taskID; // AMX task ID of task that app runs in + MemHandle codeH; // handle of the main code segment + DmOpenRef dbP; // Application database access pointer of App + UInt8 *stackP; // stack chunk for the App + UInt8 *globalsChunkP; // globals chunk for the App + + UInt16 memOwnerID; // owner ID for Memory Manager chunks + MemPtr dmAccessP; // pointer to linked list of opened DB's + Err dmLastErr; // Last error from Data Manager + MemPtr errExceptionP; // ErrTry,Catch exception list + + // PalmOS v3.0 fields begin here + UInt8 *a5Ptr; // A5 pointer for this app + UInt8 *stackEndP; // stack chunk end for the App (last byte) + UInt8 *globalEndP; // global chunk end for the App (last byte) + struct SysAppInfoType *rootP; // Points to the SysAppInfoType first + // allocated for this thread. + MemPtr extraP; // unused pointer for the App. + } SysAppInfoType; +typedef SysAppInfoType *SysAppInfoPtr; + + +/************************************************************ + * Function prototype for libraries + *************************************************************/ + +// ***IMPORTANT*** +// ***IMPORTANT*** +// ***IMPORTANT*** +// +// The assembly level TrapDispatcher() function uses a hard-coded value for +// the size of the structure SysLibTblEntryType to obtain a pointer to a +// library entry in the library table. Therefore, any changes to this structure, +// require corresponding changes in TrapDispatcher() in ROMBoot.c. Furthermore, +// it is advantageous to keep the size of the structure a power of 2 as this +// improves performance by allowing the entry offset to be calculated by shifting +// left instead of using the multiply instruction. vmk 8/27/96 (yes, I fell into +// this trap myself) +typedef struct SysLibTblEntryType { + MemPtr *dispatchTblP; // pointer to library dispatch table + void *globalsP; // Library globals + + // New INTERNAL fields for v2.0 (vmk 8/27/96): + LocalID dbID; // database id of the library + void *codeRscH; // library code resource handle for RAM-based libraries + } SysLibTblEntryType; +typedef SysLibTblEntryType* SysLibTblEntryPtr; + +// Emulated versions of libraries have a slightly different dispatch table +// Enough for the offset to the library name and the name itself. +#if EMULATION_LEVEL != EMULATION_NONE +typedef struct SimDispatchTableType { + UInt32 numEntries; // number of library entries + void *entries[1]; // dispatch routine entries + // followed by pointer to name + } SimDispatchTableType; +typedef SimDispatchTableType* SimDispatchTablePtr; +#endif + + +// Library entry point procedure +typedef Err (*SysLibEntryProcPtr)(UInt16 refNum, SysLibTblEntryPtr entryP); + +// This library refNum is reserved for the Debugger comm library +#define sysDbgCommLibraryRefNum 0 + +// This portID is reserved for identifying the debugger's port +#define sysDbgCommPortID 0xC0FF + +// This refNum signals an invalid refNum +#define sysInvalidRefNum 0xFFFF + + +/************************************************************ + * Function prototype for Kernel + *************************************************************/ +// Task termination procedure prototype for use with SysTaskSetTermProc +typedef void (*SysTermProcPtr)(UInt32 taskID, Int32 reason); + +// Timer procedure for use with SysTimerCreate +typedef void (*SysTimerProcPtr)(Int32 timerID, Int32 param); + + +/************************************************************ + * Structure of the pref=0 resource in applications. Note, this + * structure must mirror the structure of the sysResTAppPrefs + * resource as defined in SystemResources.h. + *************************************************************/ +typedef struct SysAppPrefs { + UInt16 priority; // task priority + UInt32 stackSize; // required stack space + UInt32 minHeapSpace; // minimum heap space required + } SysAppPrefsType; +typedef SysAppPrefsType *SysAppPrefsPtr; + + +/************************************************************ + * 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. + *************************************************************/ + +#define sysExtPrefsVers 1 + +// Flags defined for SysExtPrefsType.flags +#define sysExtPrefsNoOverlayFlag 0x00000001 + +typedef struct SysExtPrefsType { + UInt16 version; // version of structure. + UInt32 flags; // 32 boolean flags. + } SysExtPrefsType; + + + +/************************************************************ + * System Errors + *************************************************************/ +#define sysErrTimeout (sysErrorClass | 1) +#define sysErrParamErr (sysErrorClass | 2) +#define sysErrNoFreeResource (sysErrorClass | 3) +#define sysErrNoFreeRAM (sysErrorClass | 4) +#define sysErrNotAllowed (sysErrorClass | 5) +#define sysErrSemInUse (sysErrorClass | 6) +#define sysErrInvalidID (sysErrorClass | 7) +#define sysErrOutOfOwnerIDs (sysErrorClass | 8) +#define sysErrNoFreeLibSlots (sysErrorClass | 9) +#define sysErrLibNotFound (sysErrorClass | 10) +#define sysErrDelayWakened (sysErrorClass | 11) // SysTaskDelay wakened by SysTaskWake before delay completed. +#define sysErrRomIncompatible (sysErrorClass | 12) +#define sysErrBufTooSmall (sysErrorClass | 13) +#define sysErrPrefNotFound (sysErrorClass | 14) + +// NotifyMgr error codes: +#define sysNotifyErrEntryNotFound (sysErrorClass | 16) // could not find registration entry in the list +#define sysNotifyErrDuplicateEntry (sysErrorClass | 17) // identical entry already exists +#define sysNotifyErrBroadcastBusy (sysErrorClass | 19) // a broadcast is already in progress - try again later. +#define sysNotifyErrBroadcastCancelled (sysErrorClass | 20) // a handler cancelled the broadcast + +// AMX error codes continued - jb 10/20/98 +#define sysErrMbId (sysErrorClass | 21) +#define sysErrMbNone (sysErrorClass | 22) +#define sysErrMbBusy (sysErrorClass | 23) +#define sysErrMbFull (sysErrorClass | 24) +#define sysErrMbDepth (sysErrorClass | 25) +#define sysErrMbEnv (sysErrorClass | 26) + +// NotifyMgr Phase #2 Error Codes: +#define sysNotifyErrQueueFull (sysErrorClass | 27) // deferred queue is full. +#define sysNotifyErrQueueEmpty (sysErrorClass | 28) // deferred queue is empty. +#define sysNotifyErrNoStackSpace (sysErrorClass | 29) // not enough stack space for a broadcast +#define sysErrNotInitialized (sysErrorClass | 30) // manager is not initialized + +// AMX error/warning codes continued - jed 9/10/99 +#define sysErrNotAsleep (sysErrorClass | 31) // Task woken by SysTaskWake was not asleep, 1 wake pending +#define sysErrNotAsleepN (sysErrorClass | 32) // Task woken by SysTaskWake was not asleep, >1 wake pending + + +// Power Manager error codes - soe, srj 9/19/00 +#define pwrErrNone (pwrErrorClass | 0) +#define pwrErrBacklight (pwrErrorClass | 1) +#define pwrErrRadio (pwrErrorClass | 2) +#define pwrErrBeam (pwrErrorClass | 3) +#define pwrErrGeneric (pwrErrorClass | 4) + + +/************************************************************ + * System Features + *************************************************************/ +#define sysFtrCreator sysFileCSystem // Feature Creator + +#define sysFtrNumROMVersion 1 // ROM Version + // 0xMMmfsbbb, where MM is major version, m is minor version + // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development, + // bbb is build number for non-releases + // V1.12b3 would be: 0x01122003 + // V2.00a2 would be: 0x02001002 + // V1.01 would be: 0x01013000 + +#define sysFtrNumProcessorID 2 // Product id + // 0xMMMMRRRR, where MMMM is the processor model and RRRR is the revision. +#define sysFtrNumProcessorMask 0xFFFF0000 // Mask to obtain processor model +#define sysFtrNumProcessor328 0x00010000 // Motorola 68328 (Dragonball) +#define sysFtrNumProcessorEZ 0x00020000 // Motorola 68EZ328 (Dragonball EZ) +#define sysFtrNumProcessorVZ 0x00030000 // Motorola 68VZ328 (Dragonball VZ) +#define sysFtrNumProductID sysFtrNumProcessorID // old (obsolete) define + +#define sysFtrNumBacklight 3 // Backlight + // bit 0: 1 if present. 0 if Feature does not exist or backlight is not present + +#define sysFtrNumEncryption 4 // Which encryption schemes are present +#define sysFtrNumEncryptionMaskDES 0x00000001 // bit 0: 1 if DES is present + +#define sysFtrNumCountry 5 // International ROM identifier + // Result is of type CountryType as defined in Preferences.h. + // Result is essentially the "default" country for this ROM. + // Assume cUnitedStates if sysFtrNumROMVersion >= 02000000 + // and feature does not exist. Result is in low sixteen bits. + +#define sysFtrNumLanguage 6 // Language identifier + // Result is of untyped; values are defined in Incs:BuildRules.h + // Result is essentially the "default" language for this ROM. + // This is new for the WorkPad (v2.0.2) and did NOT exist for any of the + // following: GermanPersonal, GermanPro, FrenchPersonal, FrenchPro + // Thus we can't really assume anything if the feature doesn't exist, + // though the actual language MAY be determined from sysFtrNumCountry, + // above. Result is in low sixteen bits. + +#define sysFtrNumDisplayDepth 7 // Display depth + // Result is the "default" display depth for the screen. (PalmOS 3.0) + // This value is used by ScrDisplayMode when setting the default display depth. + +#define sysFtrNumHwrMiscFlags 8 // GHwrMiscFlags value (PalmOS 3.1) +#define sysFtrNumHwrMiscFlagsExt 9 // GHwrMiscFlagsExt value (PalmOS 3.1) + +#define sysFtrNumIntlMgr 10 + // Result is a set of flags that define functionality supported + // by the Int'l Manager. (PalmOS 3.1) + +#define sysFtrNumEncoding 11 + // Result is the character encoding (defined in 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) + +#define sysFtrDefaultFont 12 + // Default font ID used for displaying text. (PalmOS 3.1) + +#define sysFtrDefaultBoldFont 13 + // Default font ID used for displaying bold text. (PalmOS 3.1) + +#define sysFtrNumGremlinsSupportGlobals 14 // Globals for supporting gremlins. + // This value is a pointer to a memory location that stores global variables needed + // for intelligently supporting gremlins. Currently, it is only used in Progress.c. + // It is only initialized on first use (gremlins and progress bar in combination) + // when ERROR_CHECK_LEVEL == ERROR_CHECK_FULL. (PalmOS 3.2) + +#define sysFtrNumVendor 15 + // Result is the vendor id, in the low sixteen bits. (PalmOS 3.3) + +#define sysFtrNumCharEncodingFlags 16 + // Flags for a given character encoding, specified in TextMgr.h (PalmOS 3.5) + +#define sysFtrNumNotifyMgrVersion 17 // version of the NotifyMgr, if any (PalmOS 3.5) + +#define sysFtrNumOEMROMVersion 18 // Supplemental ROM version, provided by OEM + // This value may be present in OEM devices, and is in the same format + // as sysFtrNumROMVersion. (PalmOS 3.5) + +#define sysFtrNumErrorCheckLevel 19 // ROM build setting of ERROR_CHECK_LEVEL + // May be set to ERROR_CHECK_NONE, ERROR_CHECK_PARTIAL, or ERROR_CHECK_FULL + // as defined in . (PalmOS 3.5) + +#define sysFtrNumOEMCompanyID 20 // GHwrOEMCompanyID value (PalmOS 3.5) +#define sysFtrNumOEMDeviceID 21 // GHwrOEMDeviceID value (PalmOS 3.5) +#define sysFtrNumOEMHALID 22 // GHwrOEMHALID value (PalmOS 3.5) +#define sysFtrNumDefaultCompression 23 // Default Clipper's compression (Palmos 3.5) + +#define sysFtrNumWinVersion 24 // Window version (PalmOS 4.0) + +#define sysFtrNumAccessorTrapPresent 25 // If accessor trap exists (PalmOS 4.0) + +/************************************************************ + * ROM token information (for SysGetROMToken, below) + *************************************************************/ +// Additional tokens and token information is located in +#define sysROMTokenSnum 'snum' // Memory Card Flash ID (serial number) + + +/************************************************************ + * Macros for extracting and combining ROM/OS version components + *************************************************************/ + +// ROM/OS stage numbers +#define sysROMStageDevelopment (0) +#define sysROMStageAlpha (1) +#define sysROMStageBeta (2) +#define sysROMStageRelease (3) + + +// MACRO: sysMakeROMVersion +// +// Builds a ROM version value from the major, minor, fix, stage, and build numbers +// +#define sysMakeROMVersion(major, minor, fix, stage, buildNum) \ + ( \ + (((UInt32)((UInt8)(major) & 0x0FF)) << 24) | \ + (((UInt32)((UInt8)(minor) & 0x00F)) << 20) | \ + (((UInt32)((UInt8)(fix) & 0x00F)) << 16) | \ + (((UInt32)((UInt8)(stage) & 0x00F)) << 12) | \ + (((UInt32)((UInt16)(buildNum) & 0x0FFF))) \ + ) + + +// Macros for parsing the ROM version number +// (the system OS version is obtained by calling +// FtrGet(sysFtrCreator, sysFtrNumROMVersion, dwOSVerP), where dwOSVerP is +// a pointer to to a UInt32 variable that is to receive the OS version number) +#define sysGetROMVerMajor(dwROMVer) (((UInt16)((dwROMVer) >> 24)) & 0x00FF) +#define sysGetROMVerMinor(dwROMVer) (((UInt16)((dwROMVer) >> 20)) & 0x000F) +#define sysGetROMVerFix(dwROMVer) (((UInt16)((dwROMVer) >> 16)) & 0x000F) +#define sysGetROMVerStage(dwROMVer) (((UInt16)((dwROMVer) >> 12)) & 0x000F) +#define sysGetROMVerBuild(dwROMVer) (((UInt16)(dwROMVer)) & 0x0FFF) + + + + +/************************************************************ + * System Types + *************************************************************/ + +// Types of batteries installed. +typedef enum { + sysBatteryKindAlkaline=0, + sysBatteryKindNiCad, + sysBatteryKindLiIon, + sysBatteryKindRechAlk, + sysBatteryKindNiMH, + sysBatteryKindLiIon1400, + sysBatteryKindLast=0xFF // insert new battery types BEFORE this one + } SysBatteryKind; + +// Different battery states (output of hwrBattery) +typedef enum { + sysBatteryStateNormal=0, + sysBatteryStateLowBattery, + sysBatteryStateCritBattery, + sysBatteryStateShutdown + } SysBatteryState; + + +// SysCreateDataBaseList can generate a list of database. +typedef struct + { + Char name[dmDBNameLength]; + UInt32 creator; + UInt32 type; + UInt16 version; + LocalID dbID; + UInt16 cardNo; + BitmapPtr iconP; + } SysDBListItemType; + + +// Structure of a generic message that can be send to a mailbox +// through the SysMailboxSend call. Note, this structure MUST +// be CJ_MAXMSZ bytes large, where CJ_MAXMSZ is defined in +// the AMX includes. +typedef struct { + UInt32 data[3]; + } SysMailboxMsgType; + + +// Constants used by the SysEvGroupSignal call +#define sysEvGroupSignalConstant 0 +#define sysEvGroupSignalPulse 1 + +// Constants used by the SysEvGroupWait call +#define sysEvGroupWaitOR 0 +#define sysEvGroupWaitAND 1 + + + +/************************************************************ + * System Pre-defined "file descriptors" + * These are used by applications that use the Net Library's + * NetLibSelect() call + *************************************************************/ +#define sysFileDescStdIn 0 + + +//============================================================================ +// jhl 7/26/00 Integrate HSIMgr functionality +//============================================================================ +#define sysNotifyHSISerialPortInUseEvent 'hsiu' // Sent when serial port is in use +#define sysNotifyHSIPeripheralRespondedEvent 'hspr' // Sent with peripheral response +#define sysNotifyHSIPeripheralNotRespondingEvent 'hspn' // Sent when peripheral does not respond +#define sysNotifyHSINoConnectionEvent 'ncon' // Sent on VID of no connection +#define sysNotifyHSIUSBCradleEvent sysPortUSBDesktop // Sent on VID of USB Cradle +#define sysNotifyHSIRS232CradleEvent 'rs2c' // Sent on VID of RS232 Cradle +#define sysNotifyHSIUSBPeripheralEvent sysPortUSBPeripheral // Sent on VID of USB Peripheral +#define sysNotifyHSIRS232PeripheralEvent 'rs2p' // Sent on VID of RS232 Peripheral +#define sysNotifyHSIDebugEvent 'dbug' // Sent on VID of Debug + +#define sysMaxHSIResponseSize 64 +#define sysHSISerialInquiryBaud 9600 +#define sysHSISerialInquiryString "ATI3\015\012" +#define sysHSISerialInquiryStringLen 6 +#define sysHSISerialInterChrTimeout 3 // ticks (20-30 ms) +#define sysHSISerialInquiryTimeout 11 // ticks (100-110 ms) + +typedef struct SysHSIResponseType { + // "Voltage ID" from modem pin converted to 4 character VID +// UInt32 VID; + // Actual voltage detected on modem VID pin +// UInt16 mVolts; + // Character string received in response to inquiry string + // (will be NUL terminated) + Char responseBuffer[sysMaxHSIResponseSize]; + // Length of string in responseBuffer + UInt16 responseLength; +} SysHSIResponseType; + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// Prototype for Pilot applications entry point +UInt32 PilotMain(UInt16 cmd, void *cmdPBP, UInt16 launchFlags); + + +// SystemMgr routines +void SysUnimplemented(void) + SYS_TRAP(sysTrapSysUnimplemented); + +void SysColdBoot(void *card0P, UInt32 card0Size, + void *card1P, UInt32 card1Size, + UInt32 sysCardHeaderOffset) + SYS_TRAP(sysTrapSysColdBoot); + +void SysInit(void) + SYS_TRAP(sysTrapSysInit); + +void SysReset(void) + SYS_TRAP(sysTrapSysReset); + +void SysPowerOn(void *card0P, UInt32 card0Size, + void *card1P, UInt32 card1Size, + UInt32 sysCardHeaderOffset, Boolean reFormat); + + +void SysDoze(Boolean onlyNMI) + SYS_TRAP(sysTrapSysDoze); + +Err SysSetPerformance(UInt32 *sysClockP, UInt16 *cpuDutyP) + SYS_TRAP(sysTrapSysSetPerformance); + +void SysSleep(Boolean untilReset, Boolean emergency) + SYS_TRAP(sysTrapSysSleep); + +UInt16 SysSetAutoOffTime(UInt16 seconds) + SYS_TRAP(sysTrapSysSetAutoOffTime); + +UInt16 SysTicksPerSecond(void) + SYS_TRAP(sysTrapSysTicksPerSecond); + +Err SysLaunchConsole(void) + SYS_TRAP(sysTrapSysLaunchConsole); + +Boolean SysHandleEvent(EventPtr eventP) + SYS_TRAP(sysTrapSysHandleEvent); + +void SysUILaunch(void) + SYS_TRAP(sysTrapSysUILaunch); + +Err SysUIAppSwitch(UInt16 cardNo, LocalID dbID, UInt16 cmd, MemPtr cmdPBP) + SYS_TRAP(sysTrapSysUIAppSwitch); + +Err SysCurAppDatabase(UInt16 *cardNoP, LocalID *dbIDP) + SYS_TRAP(sysTrapSysCurAppDatabase); + +Err SysBroadcastActionCode(UInt16 cmd, MemPtr cmdPBP) + SYS_TRAP(sysTrapSysBroadcastActionCode); + +Err SysAppLaunch(UInt16 cardNo, LocalID dbID, UInt16 launchFlags, + UInt16 cmd, MemPtr cmdPBP, UInt32 *resultP) + SYS_TRAP(sysTrapSysAppLaunch); + +UInt16 SysNewOwnerID(void) + SYS_TRAP(sysTrapSysNewOwnerID); + +UInt32 SysSetA5(UInt32 newValue) + SYS_TRAP(sysTrapSysSetA5); + +// Routines used by startup code +Err SysAppStartup(SysAppInfoPtr *appInfoPP, MemPtr *prevGlobalsP, + MemPtr *globalsPtrP) + SYS_TRAP(sysTrapSysAppStartup); + +Err SysAppExit(SysAppInfoPtr appInfoP, MemPtr prevGlobalsP, MemPtr globalsP) + SYS_TRAP(sysTrapSysAppExit); + + +#if EMULATION_LEVEL != EMULATION_NONE +// Simulator-specific routines +MemPtr SysCardImageInfo(UInt16 cardNo, UInt32 *sizeP); + +void SysCardImageDeleted(UInt16 cardNo); +#endif // EMULATION_LEVEL != EMULATION_NONE + +UInt16 SysUIBusy(Boolean set, Boolean value) + SYS_TRAP(sysTrapSysUIBusy); + +UInt8 SysLCDContrast(Boolean set, UInt8 newContrastLevel) + SYS_TRAP(sysTrapSysLCDContrast); + +UInt8 SysLCDBrightness(Boolean set, UInt8 newBrightnessLevel) + SYS_TRAP(sysTrapSysLCDBrightness); + + +// System Dialogs +void SysBatteryDialog(void) + SYS_TRAP(sysTrapSysBatteryDialog); + +// Utilities +Err SysSetTrapAddress(UInt16 trapNum, void *procP) + SYS_TRAP(sysTrapSysSetTrapAddress); + +void * SysGetTrapAddress(UInt16 trapNum) + SYS_TRAP(sysTrapSysGetTrapAddress); + +UInt16 SysDisableInts(void) + SYS_TRAP(sysTrapSysDisableInts); + +void SysRestoreStatus(UInt16 status) + SYS_TRAP(sysTrapSysRestoreStatus); + +extern Char * SysGetOSVersionString() + SYS_TRAP(sysTrapSysGetOSVersionString); + +// The following trap is a public definition of HwrGetROMToken from +// See token definitions (like sysROMTokenSerial) above... +Err SysGetROMToken(UInt16 cardNo, UInt32 token, UInt8 **dataP, UInt16 *sizeP ) + SYS_TRAP(sysTrapHwrGetROMToken); + + +// Library Management +Err SysLibInstall(SysLibEntryProcPtr libraryP, UInt16 *refNumP) + SYS_TRAP(sysTrapSysLibInstall); + +Err SysLibLoad(UInt32 libType, UInt32 libCreator, UInt16 *refNumP) + SYS_TRAP(sysTrapSysLibLoad); + + +Err SysLibRemove(UInt16 refNum) + SYS_TRAP(sysTrapSysLibRemove); + +Err SysLibFind(const Char *nameP, UInt16 *refNumP) + SYS_TRAP(sysTrapSysLibFind); + +SysLibTblEntryPtr SysLibTblEntry(UInt16 refNum) + SYS_TRAP(sysTrapSysLibTblEntry); + +// Generic Library calls +Err SysLibOpen(UInt16 refNum) + SYS_TRAP(sysLibTrapOpen); +Err SysLibClose(UInt16 refNum) + SYS_TRAP(sysLibTrapClose); +Err SysLibSleep(UInt16 refNum) + SYS_TRAP(sysLibTrapSleep); +Err SysLibWake(UInt16 refNum) + SYS_TRAP(sysLibTrapWake); + + +//----------------------------------------------------- +// Kernel Prototypes +//----------------------------------------------------- +// Task Creation and deleation +Err SysTranslateKernelErr(Err err) + SYS_TRAP(sysTrapSysTranslateKernelErr); + +Err SysTaskCreate(UInt32 *taskIDP, UInt32 *creator, ProcPtr codeP, + MemPtr stackP, UInt32 stackSize, UInt32 attr, UInt32 priority, + UInt32 tSlice) + SYS_TRAP(sysTrapSysTaskCreate); + +Err SysTaskDelete(UInt32 taskID, UInt32 priority) + SYS_TRAP(sysTrapSysTaskDelete); + +Err SysTaskTrigger(UInt32 taskID) + SYS_TRAP(sysTrapSysTaskTrigger); + +UInt32 SysTaskID() + SYS_TRAP(sysTrapSysTaskID); + +Err SysTaskDelay(Int32 delay) + SYS_TRAP(sysTrapSysTaskDelay); + +Err SysTaskSetTermProc(UInt32 taskID, SysTermProcPtr termProcP) + SYS_TRAP(sysTrapSysTaskSetTermProc); + +Err SysTaskSwitching(Boolean enable) + SYS_TRAP(sysTrapSysTaskSwitching); + +Err SysTaskWait(Int32 timeout) + SYS_TRAP(sysTrapSysTaskWait); + +Err SysTaskWake(UInt32 taskID) + SYS_TRAP(sysTrapSysTaskWake); + +void SysTaskWaitClr(void) + SYS_TRAP(sysTrapSysTaskWaitClr); + +Err SysTaskSuspend(UInt32 taskID) + SYS_TRAP(sysTrapSysTaskSuspend); + +Err SysTaskResume(UInt32 taskID) + SYS_TRAP(sysTrapSysTaskResume); + + +// Counting Semaphores +Err SysSemaphoreCreate(UInt32 *smIDP, UInt32 *tagP, Int32 initValue) + SYS_TRAP(sysTrapSysSemaphoreCreate); + +Err SysSemaphoreDelete(UInt32 smID) + SYS_TRAP(sysTrapSysSemaphoreDelete); + +Err SysSemaphoreWait(UInt32 smID, UInt32 priority, Int32 timeout) + SYS_TRAP(sysTrapSysSemaphoreWait); + +Err SysSemaphoreSignal(UInt32 smID) + SYS_TRAP(sysTrapSysSemaphoreSignal); + +Err SysSemaphoreSet(UInt32 smID) + SYS_TRAP(sysTrapSysSemaphoreSet); + + +// Resource Semaphores +Err SysResSemaphoreCreate(UInt32 *smIDP, UInt32 *tagP) + SYS_TRAP(sysTrapSysResSemaphoreCreate); + +Err SysResSemaphoreDelete(UInt32 smID) + SYS_TRAP(sysTrapSysResSemaphoreDelete); + +Err SysResSemaphoreReserve(UInt32 smID, UInt32 priority, Int32 timeout) + SYS_TRAP(sysTrapSysResSemaphoreReserve); + +Err SysResSemaphoreRelease(UInt32 smID) + SYS_TRAP(sysTrapSysResSemaphoreRelease); + + + +// Timers +Err SysTimerCreate(UInt32 *timerIDP, UInt32 *tagP, + SysTimerProcPtr timerProc, UInt32 periodicDelay, + UInt32 param) + SYS_TRAP(sysTrapSysTimerCreate); + +Err SysTimerDelete(UInt32 timerID) + SYS_TRAP(sysTrapSysTimerDelete); + +Err SysTimerWrite(UInt32 timerID, UInt32 value) + SYS_TRAP(sysTrapSysTimerWrite); + +Err SysTimerRead(UInt32 timerID, UInt32 *valueP) + SYS_TRAP(sysTrapSysTimerRead); + + +// Information +Err SysKernelInfo(void *paramP) + SYS_TRAP(sysTrapSysKernelInfo); + +Boolean SysCreateDataBaseList(UInt32 type, UInt32 creator, UInt16 *dbCount, + MemHandle *dbIDs, Boolean lookupName) + SYS_TRAP(sysTrapSysCreateDataBaseList); + +Boolean SysCreatePanelList(UInt16 *panelCount, MemHandle *panelIDs) + SYS_TRAP(sysTrapSysCreatePanelList); + +UInt16 SysBatteryInfo(Boolean set, UInt16 *warnThresholdP, UInt16 *criticalThresholdP, + Int16 *maxTicksP, SysBatteryKind* kindP, Boolean *pluggedIn, UInt8 *percentP) + SYS_TRAP(sysTrapSysBatteryInfo); + +UInt16 SysBatteryInfoV20(Boolean set, UInt16 *warnThresholdP, UInt16 *criticalThresholdP, + Int16 *maxTicksP, SysBatteryKind* kindP, Boolean *pluggedIn) + SYS_TRAP(sysTrapSysBatteryInfoV20); + +Boolean SysGetStackInfo(MemPtr *startPP, MemPtr *endPP) + SYS_TRAP(sysTrapSysGetStackInfo); + + + +// Mailboxes +Err SysMailboxCreate(UInt32 *mbIDP, UInt32 *tagP, UInt32 depth) + SYS_TRAP(sysTrapSysMailboxCreate); + +Err SysMailboxDelete(UInt32 mbID) + SYS_TRAP(sysTrapSysMailboxDelete); + +Err SysMailboxFlush(UInt32 mbID) + SYS_TRAP(sysTrapSysMailboxFlush); + +Err SysMailboxSend(UInt32 mbID, void *msgP, UInt32 wAck) + SYS_TRAP(sysTrapSysMailboxSend); + +Err SysMailboxWait(UInt32 mbID, void *msgP, UInt32 priority, + Int32 timeout) + SYS_TRAP(sysTrapSysMailboxWait); + +// Event Groups +Err SysEvGroupCreate(UInt32 *evIDP, UInt32 *tagP, UInt32 init) + SYS_TRAP(sysTrapSysEvGroupCreate); + +//Err SysEvGroupDelete(UInt32 evID) // save trap table space - don't need + //SYS_TRAP(sysTrapSysEvGroupDelete); + +Err SysEvGroupSignal(UInt32 evID, UInt32 mask, UInt32 value, Int32 type) + SYS_TRAP(sysTrapSysEvGroupSignal); + +Err SysEvGroupRead(UInt32 evID, UInt32 *valueP) + SYS_TRAP(sysTrapSysEvGroupRead); + +Err SysEvGroupWait(UInt32 evID, UInt32 mask, UInt32 value, Int32 matchType, + Int32 timeout) + SYS_TRAP(sysTrapSysEvGroupWait); + +#ifdef __cplusplus +} +#endif + + + +/************************************************************ + * Assembly Function Prototypes + *************************************************************/ +#define _SysSemaphoreSignal \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSignal) + +#define _SysSemaphoreSet \ + ASM_SYS_TRAP(sysTrapSysSemaphoreSet) + +#define _SysDoze \ + ASM_SYS_TRAP(sysTrapSysDoze) + + +#endif //__SYSTEMMGR_H__ diff --git a/sdk-4/include/Core/System/SystemPkt.h b/sdk-4/include/Core/System/SystemPkt.h new file mode 100644 index 0000000..bd0f203 --- /dev/null +++ b/sdk-4/include/Core/System/SystemPkt.h @@ -0,0 +1,431 @@ +/****************************************************************************** + * + * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SystemPkt.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Structure of System Packets for the Serial Link Manager. These + * packets are used by the Debugger, Console, and Remote UI modules + * for communication with the host computer. + * + * History: + * 6/26/95 RM - Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __SYSTEM_PKT_H__ +#define __SYSTEM_PKT_H__ + +#include + + +//************************************************************************* +// Constants for System Packets +// +//************************************************************************* + +// Max # of bytes we can read/write at a time with the ReadMem and WriteMem +// commands; +#define sysPktMaxMemChunk 256 + +// Maximum body size for System Packets. This is big enough to have +// 256 bytes of data for the Read and Write Mem command plus whatever other +// parameters are in the body for these commands. +#define sysPktMaxBodySize (sysPktMaxMemChunk+16) + + +// Default nitial timeout value for packet receive routines in ticks +#define sysPktInitialTimeout (sysTicksPerSecond*10) + + + +//************************************************************************* +// Packet Body Structure +//************************************************************************* + +// Common fields at the start of every body +#define _sysPktBodyCommon \ + UInt8 command; \ + UInt8 _filler + + +// Generic System Packet Body +typedef struct SysPktBodyType { + _sysPktBodyCommon; + UInt8 data[sysPktMaxBodySize-2]; + } SysPktBodyType; +typedef SysPktBodyType* SysPktBodyPtr; + + + +//************************************************************************* +// The max size of the array of SlkWriteDataTypes used by System Packet +// assembly routines in order to minimize stack usage. +//************************************************************************* +#define sysPktMaxBodyChunks 3 + + + +//************************************************************************* +// packet commands +//************************************************************************* + +//-------------------------------------------------------------------- +// get state command +//-------------------------------------------------------------------- +#define sysPktStateCmd 0x00 +#define sysPktStateRsp 0x80 + +//-------------------------------------------------------------------- +// read memory command +//-------------------------------------------------------------------- +#define sysPktReadMemCmd 0x01 +#define sysPktReadMemRsp 0x81 + +typedef struct SysPktReadMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to read + UInt16 numBytes; // # of bytes to read + } SysPktReadMemCmdType; +typedef SysPktReadMemCmdType* SysPktReadMemCmdPtr; + +typedef struct SysPktReadMemRspType { + _sysPktBodyCommon; // Common Body header + // UInt8 data[?]; // variable size + } SysPktReadMemRspType; +typedef SysPktReadMemRspType* SysPktReadMemRspPtr; + + +//-------------------------------------------------------------------- +// write memory command +//-------------------------------------------------------------------- +#define sysPktWriteMemCmd 0x02 +#define sysPktWriteMemRsp 0x82 + +typedef struct SysPktWriteMemCmdType { + _sysPktBodyCommon; // Common Body header + void* address; // Address to write + UInt16 numBytes; // # of bytes to write + // UInt8 data[?]; // variable size data + } SysPktWriteMemCmdType; +typedef SysPktWriteMemCmdType* SysPktWriteMemCmdPtr; + +typedef struct SysPktWriteMemRspType { + _sysPktBodyCommon; // Common Body header + } SysPktWriteMemRspType; +typedef SysPktWriteMemRspType* SysPktWriteMemRspPtr; + + +//-------------------------------------------------------------------- +// single-step command +//-------------------------------------------------------------------- +#define sysPktSingleStepCmd 0x03 +// no response + +//-------------------------------------------------------------------- +// get routine name command +//-------------------------------------------------------------------- +#define sysPktGetRtnNameCmd 0x04 +#define sysPktGetRtnNameRsp 0x84 + +//-------------------------------------------------------------------- +// read registers command +//-------------------------------------------------------------------- +#define sysPktReadRegsCmd 0x05 +#define sysPktReadRegsRsp 0x85 + + +//-------------------------------------------------------------------- +// write registers command +//-------------------------------------------------------------------- +#define sysPktWriteRegsCmd 0x06 +#define sysPktWriteRegsRsp 0x86 + +//-------------------------------------------------------------------- +// continue command +//-------------------------------------------------------------------- +#define sysPktContinueCmd 0x07 +// no response + + +//-------------------------------------------------------------------- +// Remote Procedure call +//-------------------------------------------------------------------- +#define sysPktRPCCmd 0x0A +#define sysPktRPCRsp 0x8A + +typedef struct SysPktRPCParamInfo { + UInt8 byRef; // true if param is by reference + UInt8 size; // # of Bytes of paramData (must be even) + UInt16 data[1]; // variable length array of paramData + } SysPktRPCParamType; + +typedef struct SysPktRPCType { + _sysPktBodyCommon; // Common Body header + UInt16 trapWord; // which trap to execute + UInt32 resultD0; // result from D0 placed here + UInt32 resultA0; // result from A0 placed here + UInt16 numParams; // how many parameters follow + // Following is a variable length array ofSlkRPCParamInfo's + SysPktRPCParamType param[1]; + } SysPktRPCType; + + +//-------------------------------------------------------------------- +// Set/Get breakpoints +//-------------------------------------------------------------------- +#define sysPktGetBreakpointsCmd 0x0B +#define sysPktGetBreakpointsRsp 0x8B +#define sysPktSetBreakpointsCmd 0x0C +#define sysPktSetBreakpointsRsp 0x8C + + +//-------------------------------------------------------------------- +// Remote UI Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktRemoteUIUpdCmd 0x0C + +typedef struct SysPktRemoteUIUpdCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from traget to host after drawing operations + UInt16 rowBytes; // rowbytes of update area + UInt16 fromY; // top of update rect + UInt16 fromX; // left of update rect + UInt16 toY; // top of screen rect + UInt16 toX; // left of screen rect + UInt16 height; // bottom of update rect + UInt16 width; // right of update rect + + // The actual pixels of the update area follow + UInt16 pixels; // variable length... + + } SysPktRemoteUIUpdCmdType; + + +#define sysPktRemoteEvtCmd 0x0D + +typedef struct SysPktRemoteEvtCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from host to target to feed pen and keyboard + // events. They do not require a response. + Boolean penDown; // true if pen down + UInt8 padding1; + Int16 penX; // X location of pen + Int16 penY; // Y location of pen + + Boolean keyPress; // true if key event follows + UInt8 padding2; + UInt16 keyModifiers; // keyboard modifiers + WChar keyAscii; // key ascii code + UInt16 keyCode; // key virtual code + + } SysPktRemoteEvtCmdType; + + +//-------------------------------------------------------------------- +// Enable/Disable DbgBreak's command +//-------------------------------------------------------------------- +#define sysPktDbgBreakToggleCmd 0x0D +#define sysPktDbgBreakToggleRsp 0x8D + + +//-------------------------------------------------------------------- +// Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns info on the flash in: +// manuf - manufacturer code +// device - device code +//-------------------------------------------------------------------- +#define sysPktFlashCmd 0x0E // OBSOLETE AS OF 3.0! SEE BELOW! +#define sysPktFlashRsp 0x8E // OSBOLETE AS OF 3.0! SEE BELOW! + + +//-------------------------------------------------------------------- +// Get/Set communication parameters +//-------------------------------------------------------------------- +#define sysPktCommCmd 0x0F +#define sysPktCommRsp 0x8F + +typedef struct SysPktCommCmdType { + _sysPktBodyCommon; // Common Body header + Boolean set; // true to change parameters + UInt8 padding; + UInt32 baudRate; // new baud rate + UInt32 flags; // new flags + } SysPktCommCmdType; +typedef SysPktCommCmdType *SysPktCommCmdPtr; + +typedef struct SysPktCommRspType { + _sysPktBodyCommon; // Common Body header + UInt32 baudRate; // current baud rate + UInt32 flags; // current flags + } SysPktCommRspType; +typedef SysPktCommRspType *SysPktCommRspPtr; + + +//-------------------------------------------------------------------- +// Get/Set Trap Breaks +//-------------------------------------------------------------------- +#define sysPktGetTrapBreaksCmd 0x10 +#define sysPktGetTrapBreaksRsp 0x90 +#define sysPktSetTrapBreaksCmd 0x11 +#define sysPktSetTrapBreaksRsp 0x91 + + +//-------------------------------------------------------------------- +// Gremlins Support - These packets are used by the screen driver +// and event manager to support remote viewing and control of a Pilot +// over the serial port. +//-------------------------------------------------------------------- +#define sysPktGremlinsCmd 0x12 + +typedef struct SysPktGremlinsCmdType { + _sysPktBodyCommon; // Common Body header + + // These parameters are sent from target to host to send Gremlins stuff + UInt16 action; + UInt8 data[32]; + + } SysPktGremlinsCmdType; + +// Gremlins action codes +#define sysPktGremlinsIdle 1 +#define sysPktGremlinsEvent 2 + + +//-------------------------------------------------------------------- +// Find data - searches a range of addresses for data +//-------------------------------------------------------------------- +#define sysPktFindCmd 0x13 +#define sysPktFindRsp (sysPktFindCmd | 0x80) + +typedef struct SysPktFindCmdType { + _sysPktBodyCommon; // Common Body header + + UInt32 firstAddr; // first address to search + UInt32 lastAddr; // last address to begin searching + UInt16 numBytes; // number of data bytes to match + Boolean caseInsensitive; // if true, perform a case-insensitive search + UInt8 padding; + } SysPktFindCmdType; +typedef SysPktFindCmdType* SysPktFindCmdPtr; + +typedef struct SysPktFindRspType { + _sysPktBodyCommon; // Common Body header + + UInt32 addr; // address where data was found + Boolean found; // true if data was found + UInt8 padding; + + } SysPktFindRspType; +typedef SysPktFindRspType* SysPktFindRspPtr; + + +//-------------------------------------------------------------------- +// Get/Set Trap Conditionals. These are used to tell the debugger +// to conditionally break on a trap depending on the value of the +// first word on the stack. They are used when setting a-traps on +// library calls. This is a 3.0 feature. +//-------------------------------------------------------------------- +#define sysPktGetTrapConditionsCmd 0x14 +#define sysPktGetTrapConditionsRsp 0x94 +#define sysPktSetTrapConditionsCmd 0x15 +#define sysPktSetTrapConditionsRsp 0x95 + + +//-------------------------------------------------------------------- +// Checksum data - checksums a range of memory. +// This is a (late) 3.0 feature. +//-------------------------------------------------------------------- +#define sysPktChecksumCmd 0x16 +#define sysPktChecksumRsp (sysPktChecksumCmd | 0x80) + +typedef struct SysPktChecksumType { + _sysPktBodyCommon; // Common Body header + + UInt32 firstAddr; // -> first address to checksum + UInt16 numBytes; // -> number of bytes to checksum + UInt16 seed; // -> initial checksum value + UInt16 checksum; // <- checksum result + } SysPktChecksumType; +typedef SysPktChecksumType* SysPktChecksumPtr; + + +//-------------------------------------------------------------------- +// NEW Program Flash command - programs one sector of the FLASH ram +// If numBytes is 0, this routine returns address to store flash code. +// Supercedes Obsolete 1.0 and 2.0 sysPktFlashCmd call above in the 3.0 ROM +//-------------------------------------------------------------------- +#define sysPktExecFlashCmd 0x17 +#define sysPktExecFlashRsp (sysPktExecFlashCmd | 0x80) + + +//-------------------------------------------------------------------- +// message from remote unit +//-------------------------------------------------------------------- +#define sysPktRemoteMsgCmd 0x7f + + +//-------------------------------------------------------------------- +// sysPktRemoteMsg +// Send a text message +//-------------------------------------------------------------------- +typedef struct SysPktRemoteMsgCmdType { + _sysPktBodyCommon; // Common Body header + //UInt8 text; // variable length text goes here + } SysPktRemoteMsgCmdType; +typedef SysPktRemoteMsgCmdType *SysPktRemoteMsgCmdPtr; + + + + + +/******************************************************************* + * Prototypes + *******************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +//================================================================ +// +// Host Only Routines. +// +//================================================================ +#if (EMULATION_LEVEL != EMULATION_NONE) + + + //------------------------------------------------------------------- + // RPC + //------------------------------------------------------------------ + // Init preparate on an RPC packet header and body. + Err SlkRPCInitPacket(SlkPktHeaderType *headerP, UInt16 dstSocket, + SysPktRPCType *bodyP, UInt16 trapWord); + + + // Stuff a parameter into an RPC packet body + void * SlkRPCStuffParam(SysPktRPCType *bodyP, const void *dataP, + Int16 dataSize, Boolean byRef); + + // Send RPC packet and wait for response. + Err SlkRPCExecute(SlkPktHeaderPtr headerP, SysPktRPCType *bodyP, + Boolean async); + +#endif // (EMULATION_LEVEL != EMULATION_NONE) + + +#ifdef __cplusplus +} +#endif + + + + +#endif //__SYSTEM_PKT_H__ diff --git a/sdk-4/include/Core/System/SystemPublic.h b/sdk-4/include/Core/System/SystemPublic.h new file mode 100644 index 0000000..da176f4 --- /dev/null +++ b/sdk-4/include/Core/System/SystemPublic.h @@ -0,0 +1,110 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SystemPublic.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Group file, include this to get all public System includes. + * + * History: + * 07/13/99 bob Created by Bob Ebert + * 08/08/99 kwk Deleted JapaneseFEP.h from include list, since it's + * a private header in /Libraries/TextServices. + * 04/30/00 CS Added new LocaleMgr.h. + * 05/12/00 kwk Removed Blitter.h. + * 06/02/00 CS Added new PalmLocale.h. + * 10/05/00 kwk Removed CharAttr.h, since everything useful in it is now in + * in TextMgr.h + * + *****************************************************************************/ + +#ifndef __SYSTEMPUBLIC_H__ +#define __SYSTEMPUBLIC_H__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // must come before NetMgr.h due to weird dependency in NetMgr.h +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// from Unix sub-folder +/* +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +*/ + + +#endif // __SYSTEMPUBLIC_H__ diff --git a/sdk-4/include/Core/System/SystemResources.h b/sdk-4/include/Core/System/SystemResources.h new file mode 100644 index 0000000..7af1932 --- /dev/null +++ b/sdk-4/include/Core/System/SystemResources.h @@ -0,0 +1,421 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __SYSTEMRESOURCES_H__ +#define __SYSTEMRESOURCES_H__ + +//----------------------------------------------------------- +// This section is common to both the C and Resource Compiler +//----------------------------------------------------------- + +//................................................................ +// File types and creators +// +// Each database shall have a creator ID and a type. +// +// The creator ID shall establish which application, patch, or extension +// a particular database is associated with. The creator ID should identify +// the application/patch/extension, NOT who created it. +// +// The type will determine which part of an application, +// patch, or extension a particular database is. +// +// There can be only one database per application, patch, or extension +// which has type 'application', 'patch', or 'extension'. +// +// Creators: +// +// ROM-based applications created by Palm Computing have all-lower case +// creator ID's. Third-party applications have creator ID's which +// are either all caps, or mixed case. The same requirements go for +// system patches and extensions. +// +// All applications, system patches and extensions shall have unique creator +// ID's. +// +// Types: +// +// 'Application', 'Extension', and 'Patch' file/database types for ROM-based +// apps shall be all-lower case (they are defined below). Other +// file/database types must be mixed-case, +// or all caps. These other types are internal to the applications, and +// therefore the system is unconcerned with their exact values. +//................................................................ +#define sysFileCSystem 'psys' // Creator type for System files +#define sysFileCOEMSystem 'poem' // Creator type for OEM System files +#define sysFileCPalmDevice 'pdvc' // Creator type for Palm Devices, analogous to 'poem' + +#define sysFileCGraffiti 'graf' // Creator type for Graffiti databases +#define sysFileCSystemPatch 'ptch' // Creator for System resource file patches + +#define sysFileCCalculator 'calc' // Creator type for Calculator App +#define sysFileCSecurity 'secr' // Creator type for Security App +#define sysFileCPreferences 'pref' // Creator type for Preferences App +#define sysFileCAddress 'addr' // Creator type for Address App +#define sysFileCToDo 'todo' // Creator type for To Do App +#define sysFileCDatebook 'date' // Creator type for Datebook App +#define sysFileCMemo 'memo' // Creator type for MemoPad App +#define sysFileCSync 'sync' // Creator type for HotSync App +#define sysFileCMemory 'memr' // Creator type for Memory App +#define sysFileCMail 'mail' // Creator type for Mail App +#define sysFileCExpense 'exps' // Creator type for Expense App +#define sysFileCLauncher 'lnch' // Creator type for Launcher App +#define sysFileCClipper 'clpr' // Creator type for clipper app. +#define sysFileCDial 'dial' // Creator type for dial app. +#define sysFileCSetup 'setp' // Creator type for setup app. +#define sysFileCActivate 'actv' // Creator type for activation app. +#define sysFileCGenenicActivate 'gafd' // New Generic Activation application working for all Palm models +#define sysFileCFlashInstaller 'fins' // Creator type for FlashInstaller app. +#define sysFileCRFDiag 'rfdg' // Creator type for RF diagnostics app. +#define sysFileCMessaging 'msgs' // Creator type for Messaging App +#define sysFileCModemFlashTool 'gsmf' // Creator type for Palm V modem flash app. +#define sysFileCJEDict 'dict' // Creator type for JEDict app. +#define sysFileHotSyncServer 'srvr' // Creator type for HotSync(R) Server app. +#define sysFileHotSyncServerUpdate 'hssu' // Creator type for HotSync(R) Server update app. +#define sysFileCCardInfo 'cinf' // Creator type for the Card info app. +#define sysFileCPhone 'fone' // Creator type for integrated phone components. +#define sysFileCSmsMessenger 'smsm' // Creator type for SMS messenger app. +#define sysFileCNetTrace 'nett' // Creator type for Net Trace StdIO app. +#define sysFileCPing 'ping' // Creator type for Ping StdIO app. +#define sysFileCLanguagePicker 'lpkr' // Creator type for Language Picker app. + +// The following apps are manufacturing, calibration and maintenance related +#define sysFileCMfgExtension 'mfx1' // Creator type for Manufacturing Extension. +#define sysFileCMfgFunctional 'mfgf' // Creator type for Manufacturing functional test autostart app. +#define sysFileCMfgCalibration 'mfgc' // Creator type for Manufacturing radio calibration app. + +// Demo Apps +#define sysFileCGraffitiDemo 'gdem' // Creator type for Graffiti Demo +#define sysFileCMailDemo 'mdem' // Creator type for Mail Demo + +#define sysFileCFirstApp sysFileCPreferences // Creator type for First App after reset +#define sysFileCAltFirstApp sysFileCSetup // Creator type for First alternate App after reset (with hard key pressed) +#define sysFileCDefaultApp sysFileCPreferences // Creator type for Default app +#define sysFileCDefaultButton1App sysFileCDatebook // Creator type for dflt hard button 1 app +#define sysFileCDefaultButton2App sysFileCAddress // Creator type for dflt hard button 2 app +#define sysFileCDefaultButton3App sysFileCToDo // Creator type for dflt hard button 3 app +#define sysFileCDefaultButton4App sysFileCMemo // Creator type for dflt hard button 4 app +#define sysFileCDefaultCalcButtonApp sysFileCCalculator // Creator type for dflt calc button app +#define sysFileCDefaultCradleApp sysFileCSync // Creator type for dflt hot sync button app +#define sysFileCDefaultModemApp sysFileCSync // Creator type for dflt modem button app +#define sysFileCDefaultAntennaButtonApp sysFileCLauncher // Creator type for dflt antenna up button app +#define sysFileCNullApp '0000' // Creator type for non-existing app +#define sysFileCSimulator '\?\?\?\?' // Creator type for Simulator files (app.tres, sys.tres) + // '????' does not compile with VC++ (Elaine Server) + +#define sysFileCDigitizer 'digi' // Creator type for Digitizer Panel +#define sysFileCDateTime 'dttm' // Creator type for Date & Time Panel +#define sysFileCGeneral 'gnrl' // Creator type for General Panel +#define sysFileCFormats 'frmt' // Creator type for Formats Panel +#define sysFileCShortCuts 'shct' // Creator type for ShortCuts Panel +#define sysFileCButtons 'bttn' // Creator type for Buttons Panel +#define sysFileCOwner 'ownr' // Creator type for Owner Panel +#define sysFileCModemPanel 'modm' // Creator type for Modem Panel +#define sysFileCDialPanel 'dial' // Creator type for Dial Panel +#define sysFileCNetworkPanel 'netw' // Creator type for Network Panel +#define sysFileCWirelessPanel 'wclp' // Creator type for the Web Clipping Panel. +#define sysFileCUserDict 'udic' // Creator type for the UserDict panel. +#define sysFileCPADHtal 'hpad' // Creator type for PAD HTAL library +#define sysFileCTCPHtal 'htcp' // Creator type for TCP HTAL library +#define sysFileCRELHtal 'hrel' // Creator type for REL HTAL library +#define sysFileCMineHunt 'mine' // Creator type for MineHunt App +#define sysFileCPuzzle15 'puzl' // Creator type for Puzzle "15" App +#define sysFileCOpenLibInfo 'olbi' // Creator type for Feature Manager features + // used for saving open library info under PalmOS v1.x +#define sysFileCHwrFlashMgr 'flsh' // Creator type for HwrFlashMgr features +#define sysFileCPhonePanel 'phop' // Creator type for Phone Panel + +// Added by BGT, 08/01/2000 +#define sysFileDRAMFixOriginal 'mmfx' // Creator type for 1.0 DRAM Fix +#define sysFileDRAMFix '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. +#define sysFileTLibrary 'libr' // File type of Shared Libraries +#define sysFileTLibraryExtension 'libx' // File type of library extensions + +#define sysFileCNet 'netl' // Creator type for Net (TCP/IP) Library +#define sysFileCRmpLib 'netp' // Creator type for RMP Library (NetLib plug-in) +#define sysFileCINetLib 'inet' // Creator type for INet Library +#define sysFileCSecLib 'secl' // Creator type for Ir Library +#define sysFileCWebLib 'webl' // Creator type for Web Library +#define sysFileCIrLib 'irda' // Creator type for Ir Library +#define sysFileCBtLib 'blth' // Creator type for Bt Library +#define sysFileCBtTransLib 'bttx' // Creator for the Bt HCI Transport library +#define sysFileCLocalLib 'locl' // Creator type for Local exchange library +#define sysFileCLz77Lib 'lz77' // Creator type for LZ77 Library (Registered) +#define sysFileCSmsLib 'smsl' // Creator type for SMS Library +#define sysFileCBtExgLib 'btex' // Creator type for Bluetooth Exchange Library +#define sysFileCPdiLib 'pdil' // Creator type for PDI Library +#define sysFileCTelMgrLib 'tmgr' // Creator type for Telephony Manager Library +#define sysFileCTelTaskSerial 'spht' // Creator type for Serial Telephony Task +#define sysFileTTelTaskSerial 'ttsk' // File type for Serial Telephony Task +#define sysFileCBaseATDriver 'patd' // Creator type for the Base AT Driver +#define sysFileTBaseATDriver 'patd' // File type for the Base AT Driver (same as Creator) +#define sysFileCStandardGsm 'stgd' // Creator type for the Standard GSM Driver +#define sysFileTPhoneDriver 'pdrv' // File type for Phone Drivers of Telephony Task + +#define sysFileCSerialMgr 'smgr' // Creator for SerialMgrNew used for features. +#define sysFileCSerialWrapper 'swrp' // Creator type for Serial Wrapper Library. +#define sysFileCIrSerialWrapper 'iwrp' // Creator type for Ir Serial Wrapper Library. +#define sysFileCTextServices 'tsml' // Creator type for Text Services Library. + +#define sysFileTUartPlugIn 'sdrv' // File type for SerialMgrNew physical port plug-in. +#define sysFileTVirtPlugin 'vdrv' // Flir type for SerialMgrNew virtual port plug-in. +#define sysFileCUart328 'u328' // Creator type for '328 UART plug-in +#define sysFileCUart328EZ 'u8EZ' // Creator type for '328EZ UART plug-in +#define sysFileCUart650 'u650' // Creator type for '650 UART plug-in +#define sysFileCVirtIrComm 'ircm' // Creator type for IrComm virtual port plug-in. +#define sysFileCVirtRfComm 'rfcm' // Creator type for RfComm (Bluetooth) virtual port plug-in. +#define sysFileCBtConnectPanelHelper 'btcp' // Creator type for the Bt Connection Panel helper app. + +#define sysFileCPDIUSBD12 'pusb' // Creator type for USB database +#define sysPortUSBDesktop 'usbd' // Creator type for USB Desktop +#define sysPortUSBConsole 'usbc' // Creator type for USB Console +#define sysPortUSBPeripheral 'usbp' // Creator type for USB Peripheral + +#define sysFileCExternalConnector 'econ' // Creator type for the external connector + +#define sysFileCExpansionMgr 'expn' // Creator of Expansion Manager extension database +#define sysFileCVFSMgr 'vfsm' // Creator code for VFSMgr... +#define sysFileCFATFS 'fatf' // Creator type for FAT filesystem library + +#define sysFileCSdSpiCard 'sdsd' // Creator type for Slot Driver: SD bus, SPI mode, memory cards + +#define sysFileCSlotDriverPnps 'pnps' //Creator ID for Pnps Serial Peripheral Slot Driver + +#define sysFileTSystem 'rsrc' // File type for Main System File +#define sysFileTSystemPatch 'ptch' // File type for System resource file patches +#define sysFileTKernel 'krnl' // File type for System Kernel (AMX) +#define sysFileTBoot 'boot' // File type for SmallROM System File +#define sysFileTSmallHal 'shal' // File type for SmallROM HAL File +#define sysFileTBigHal 'bhal' // File type for Main ROM HAL File +#define sysFileTSplash 'spls' // File type for Main ROM Splash File +#define sysFileTUIAppShell 'uish' // File type for UI Application Shell +#define sysFileTOverlay 'ovly' // File type for UI overlay database +#define sysFileTExtension 'extn' // File type for System Extensions +#define sysFileTApplication 'appl' // File type for applications +#define sysFileTPanel 'panl' // File type for preference panels +#define sysFileTSavedPreferences 'sprf' // File type for saved preferences +#define sysFileTPreferences 'pref' // File type for preferences +#define sysFileTMidi 'smfr' // File type for Standard MIDI File record databases +#define sysFileTpqa 'pqa ' // File type for the PQA files. +#define sysFileTLocaleModule 'locm' // File type for locale modules. +#define sysFileTActivationPlugin 'actp' // File type for activation plug-ins. +#define sysFileTUserDictionary 'dict' // File type for input method user dictionary. +#define sysFileTLearningData 'lean' // File type for input method learning data. + +#define sysFileTGraffitiMacros 'macr' // Graffiti Macros database + +#define sysFileTHtalLib 'htal' // HTAL library + +#define sysFileTExgLib 'exgl' // Type of Exchange libraries + +#define sysFileTSlotDriver 'libs' // File type for slot driver libraries +#define sysFileTFileSystem 'libf' // File type for file system libraries + +#define sysFileTFileStream 'strm' // Default File Stream database type + +#define sysFileTTemp 'temp' // Temporary database type; as of Palm OS 4.0, the + // system WILL automatically delete any db's of + // this type at reset time (however, apps are still + // responsible for deleting the ones they create + // before exiting to protect valuable storage space) + +// Begin Change - BGT 03/21/2000 + +#define sysFileTNetworkPanelPlugin 'nppi' // File type for network preference panel plug-ins + +// End Change - BGT 03/21/2000 + +#define sysFileTScriptPlugin 'scpt' // File type for plugin to the Network Panel to + //extend scripting capabilities. + +#define sysFileTStdIO 'sdio' // File type for standard IO apps + +#define sysFileTSimulator '\?\?\?\?' // File type for Simulator files (app.tres, sys.tres) + // '????' does not compile with VC++ (Elaine Server) + +//................................................................ +// Resource types and IDs +//................................................................ +#define sysResTBootCode 'boot' // Resource type of boot resources +#define sysResIDBootReset 10000 // Reset code +#define sysResIDBootInitCode 10001 // Init code +#define sysResIDBootSysCodeStart 10100 // System code resources start here +#define sysResIDBootSysCodeMin 10102 // IDs 'Start' to this must exist!! +#define sysResIDBootUICodeStart 10200 // UI code resources start here +#define sysResIDBootUICodeMin 10203 // IDs 'Start' to this must exist!! + +#define sysResIDBootHAL 19000 // HAL initial code resource (from HAL.prc) +#define sysResIDBootHALCodeStart 19100 // start of additional high-level HAL code resources + +#define sysResIDBitmapSplash 19000 // ID of (boot) splash screen bitmap +#define sysResIDBitmapConfirm 19001 // ID of hard reset confirmation bitmap + +#define sysResTAppPrefs 'pref' // Resource type of App preferences resources +#define sysResIDAppPrefs 0 // Application preference + +#define sysResTExtPrefs 'xprf' // Resource type of extended preferences +#define sysResIDExtPrefs 0 // Extended preferences + +#define sysResTAppCode 'code' // Resource type of App code resources +#define sysResTAppGData 'data' // Resource type of App global data resources + +#define sysResTExtensionCode 'extn' // Resource type of Extensions code +#define sysResTExtensionOEMCode 'exte' // Resource type of OEM Extensions code + +#define sysResTFeatures 'feat' // Resource type of System features table +#define sysResIDFeatures 10000 // Resource ID of System features table +#define sysResIDOverlayFeatures 10001 // Resource ID of system overlay feature table. + +#define sysResTLibrary 'libr' // Resource type of System Libraries +//#define sysResIDLibrarySerMgr328 10000 // Dragonball (68328) UART +//#define sysResIDLibrarySerMgr681 10001 // 68681 UART +//#define sysResIDLibraryRMPPlugIn 10002 // Reliable Message Protocol NetLib Plug-in + +#define sysResTSilkscreen 'silk' // Resource type of silkscreen info. + +#define sysResTGrfTemplate 'tmpl' // Graffiti templates "file" +#define sysResIDGrfTemplate 10000 // Graffiti templates "file" ID +#define sysResTGrfDictionary 'dict' // Graffiti dictionary "file" +#define sysResIDGrfDictionary 10000 // Graffiti dictionary "file" ID +#define sysResIDGrfDefaultMacros 10000 // sysResTDefaultDB resource with Graffiti Macros database + +#define sysResTDefaultDB 'dflt' // Default database resource type +#define sysResIDDefaultDB 1 // resource ID of sysResTDefaultDB in each app + +#define sysResTCompressedDB 'cpdb' // Compressed database resource type +#define sysResIDCompressedDB 10000 // resource ID of first sysResTCompressedDB + +#define sysResTErrStrings 'tSTL' // list of error strings +#define sysResIDErrStrings 10000 // resource ID is (errno>>8)+sysResIDErrStrings + +#define sysResIDOEMDBVersion 20001 // resource ID of "tver" and "tint" versions in OEM stamped databases + +#define sysResTButtonDefaults 'hsbd' // Hard/soft button default apps +#define sysResIDButtonDefaults 10000 // resource ID of system button defaults resource + +// System Preferences +#define sysResTSysPref sysFileCSystem +#define sysResIDSysPrefMain 0 // Main preferences +#define sysResIDSysPrefPassword 1 // Password +#define sysResIDSysPrefFindStr 2 // Find string +#define sysResIDSysPrefCalibration 3 // Digitizer calibration. +#define sysResIDDlkUserInfo 4 // Desktop Link user information. +#define sysResIDDlkLocalPC 5 // Desktop Link local PC host name +#define sysResIDDlkCondFilterTab 6 // Desktop Link conduit filter table +#define sysResIDModemMgrPref 7 // Modem Manager preferences +#define sysResIDDlkLocalPCAddr 8 // Desktop Link local PC host address +#define sysResIDDlkLocalPCMask 9 // Desktop Link local PC host subnet mask + +// These prefs store parameters to pass to an app when launched with a button +#define sysResIDButton1Param 10 // Parameter for hard button 1 app +#define sysResIDButton2Param 11 // Parameter for hard button 2 app +#define sysResIDButton3Param 12 // Parameter for hard button 3 app +#define sysResIDButton4Param 13 // Parameter for hard button 4 app +#define sysResIDCalcButtonParam 14 // Parameter for calc button app +#define sysResIDCradleParam 15 // Parameter for hot sync button app +#define sysResIDModemParam 16 // Parameter for modem button app +#define sysResIDAntennaButtonParam 17 // Parameter for antenna up button app + +// New for Color, user's color preferences +#define sysResIDPrefUIColorTableBase 17 // base + depth = ID of actual pref +#define sysResIDPrefUIColorTable1 18 // User's UI colors for 1bpp displays +#define sysResIDPrefUIColorTable2 19 // User's UI colors for 2bpp displays +#define sysResIDPrefUIColorTable4 21 // User's UI colors for 4bpp displays +#define sysResIDPrefUIColorTable8 25 // User's UI colors for 8bpp displays + +#define sysResIDSysPrefPasswordHint 26 // Password hint +#define sysResIDSysPrefPasswordHash 27 // Password hash (MD5) + + +// FlashMgr Resources - old +#define sysResTFlashMgr 'flsh' +#define sysResIDFlashMgrWorkspace 1 // RAM workspace during flash activity + +// FlashMgr Resources - new +#define sysResTHwrFlashIdent 'flid' // Flash identification code resource +#define sysResIDHwrFlashIdent 10000 // Flash identification code resource + +#define sysResTHwrFlashCode 'flcd' // Flash programming code resource + // (resource ID determined by device type) + +// FontMgr Resources +#define sysResTFontMap 'fntm' // Font map resource + +// OEM Feature type and id. +#define sysFtrTOEMSys sysFileCOEMSystem +#define sysFtrIDOEMSysHideBatteryGauge 1 + +// Onscreen keyboard features +#define sysFtrTKeyboard 'keyb' +#define sysFtrIDKeyboardActive 1 // Boolean value, true => keyboard is active. + // Currently only used for Japanese. + +// Activation status values. +#define sysActivateStatusFeatureIndex 1 +#define sysActivateNeedGeorgeQuery 0 +#define sysActivateNeedMortyQuery 1 +#define sysActivateFullyActivated 2 + +#define sysMaxUserDomainNameLength 64 + +// Current clipper feature indeces +#define sysClipperPQACardNoIndex 1 +#define sysClipperPQADbIDIndex 2 + +//----------------------------------------------------------- +// This section is only valid when running the resource compiler +// +// Actually, this section is obsolete. Instear, .r files should +// inlude SysResTypes.rh to get these definitions. +// +//----------------------------------------------------------- + +#ifdef RESOURCE_COMPILER + +#include + +#endif + + +#endif // __SYSTEMRESOURCES_H__ diff --git a/sdk-4/include/Core/System/TextMgr.h b/sdk-4/include/Core/System/TextMgr.h new file mode 100644 index 0000000..6bf5bba --- /dev/null +++ b/sdk-4/include/Core/System/TextMgr.h @@ -0,0 +1,411 @@ +/****************************************************************************** + * + * 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_ as substitutes for the old + * character attribute flags in CharAttr.h (e.g. _XA, _LO). + * kwk Moved sizeOf7BitChar here from CharAttr.h + * 11/21/00 kwk Undeprecated TxtCharWidth, in anticipation of future, + * proper deprecation. + * 11/24/00 kwk Reverted maxCharBytes to 3 (was 4). You only need more than + * three bytes for surrogate Unicode characters, which we don't + * support, as this would require a 32 bit WChar variable to + * hold the result (potentially 21 bits of data). Since we + * never use more than 3 bytes, it's OK to shrink this back down. + * + *****************************************************************************/ + +#ifndef __TEXTMGR_H__ +#define __TEXTMGR_H__ + +#include +#include + +/*********************************************************************** + * Public types & constants + ***********************************************************************/ + +// See PalmLocale.h for encoding constants of type CharEncodingType, and +// character encoding names. +typedef UInt8 CharEncodingType; + +// Transliteration operations for the TxtTransliterate call. We don't use +// an enum, since each character encoding contains its own set of special +// transliteration operations (which begin at translitOpCustomBase). +typedef UInt16 TranslitOpType; + +// Standard transliteration operations. +#define translitOpStandardBase 0 // Beginning of standard operations. + +#define translitOpUpperCase 0 +#define translitOpLowerCase 1 +#define translitOpReserved2 2 +#define translitOpReserved3 3 + +// Custom transliteration operations (defined in CharXXXX.h encoding-specific +// header files. +#define translitOpCustomBase 1000 // Beginning of char-encoding specific ops. + +#define translitOpPreprocess 0x8000 // Mask for pre-process option, where + // no transliteration actually is done. + +// Structure used to maintain state across calls to TxtConvertEncoding, for +// proper handling of source or destination encodings with have modes. +#define kTxtConvertStateSize 32 + +typedef struct { + UInt8 ioSrcState[kTxtConvertStateSize]; + UInt8 ioDstState[kTxtConvertStateSize]; +} TxtConvertStateType; + +// Flags available in the sysFtrNumCharEncodingFlags feature attribute. +#define charEncodingOnlySingleByte 0x00000001 +#define charEncodingHasDoubleByte 0x00000002 +#define charEncodingHasLigatures 0x00000004 +#define charEncodingLeftToRight 0x00000008 + +// Various byte attribute flags. Note that multiple flags can be +// set, thus a byte could be both a single-byte character, or the first +// byte of a multi-byte character. +#define byteAttrFirst 0x80 // First byte of multi-byte char. +#define byteAttrLast 0x40 // Last byte of multi-byte char. +#define byteAttrMiddle 0x20 // Middle byte of muli-byte char. +#define byteAttrSingle 0x01 // Single byte. + +// Character attribute flags. These replace the old flags defined in +// CharAttr.h, but are bit-compatible. +#define charAttr_XA 0x0200 // extra alphabetic +#define charAttr_XS 0x0100 // extra space +#define charAttr_BB 0x0080 // BEL, BS, etc. +#define charAttr_CN 0x0040 // CR, FF, HT, NL, VT +#define charAttr_DI 0x0020 // '0'-'9' +#define charAttr_LO 0x0010 // 'a'-'z' and lowercase extended chars. +#define charAttr_PU 0x0008 // punctuation +#define charAttr_SP 0x0004 // space +#define charAttr_UP 0x0002 // 'A'-'Z' and uppercase extended chars. +#define charAttr_XD 0x0001 // '0'-'9', 'A'-'F', 'a'-'f' + +// Various sets of character attribute flags. +#define charAttrPrint (charAttr_DI|charAttr_LO|charAttr_PU|charAttr_SP|charAttr_UP|charAttr_XA) +#define charAttrSpace (charAttr_CN|charAttr_SP|charAttr_XS) +#define charAttrAlNum (charAttr_DI|charAttr_LO|charAttr_UP|charAttr_XA) +#define charAttrAlpha (charAttr_LO|charAttr_UP|charAttr_XA) +#define charAttrCntrl (charAttr_BB|charAttr_CN) +#define charAttrGraph (charAttr_DI|charAttr_LO|charAttr_PU|charAttr_UP|charAttr_XA) +#define charAttrDelim (charAttr_SP|charAttr_PU) + +// Remember that sizeof(0x0D) == 2 because 0x0D is treated like an int. The +// same is true of sizeof('a'), sizeof('\0'), and sizeof(chrNull). For this +// reason it's safest to use the sizeOf7BitChar macro to document buffer size +// and string length calcs. Note that this can only be used with low-ascii +// characters, as anything else might be the high byte of a double-byte char. +#define sizeOf7BitChar(c) 1 + +// Maximum size a single WChar character will occupy in a text string. +#define maxCharBytes 3 + +// Text manager error codes. +#define txtErrUknownTranslitOp (txtErrorClass | 1) +#define txtErrTranslitOverrun (txtErrorClass | 2) +#define txtErrTranslitOverflow (txtErrorClass | 3) +#define txtErrConvertOverflow (txtErrorClass | 4) +#define txtErrConvertUnderflow (txtErrorClass | 5) +#define txtErrUnknownEncoding (txtErrorClass | 6) +#define txtErrNoCharMapping (txtErrorClass | 7) +#define txtErrTranslitUnderflow (txtErrorClass | 8) + +/*********************************************************************** + * Public macros + ***********************************************************************/ + +#define TxtCharIsSpace(ch) ((TxtCharAttr(ch) & charAttrSpace) != 0) +#define TxtCharIsPrint(ch) ((TxtCharAttr(ch) & charAttrPrint) != 0) +#define TxtCharIsDigit(ch) ((TxtCharAttr(ch) & charAttr_DI) != 0) +#define TxtCharIsAlNum(ch) ((TxtCharAttr(ch) & charAttrAlNum) != 0) +#define TxtCharIsAlpha(ch) ((TxtCharAttr(ch) & charAttrAlpha) != 0) +#define TxtCharIsCntrl(ch) ((TxtCharAttr(ch) & charAttrCntrl) != 0) +#define TxtCharIsGraph(ch) ((TxtCharAttr(ch) & charAttrGraph) != 0) +#define TxtCharIsLower(ch) ((TxtCharAttr(ch) & charAttr_LO) != 0) +#define TxtCharIsPunct(ch) ((TxtCharAttr(ch) & charAttr_PU) != 0) +#define TxtCharIsUpper(ch) ((TxtCharAttr(ch) & charAttr_UP) != 0) +#define TxtCharIsHex(ch) ((TxtCharAttr(ch) & charAttr_XD) != 0) +#define TxtCharIsDelim(ch) ((TxtCharAttr(ch) & charAttrDelim) != 0) + +// is a hard key if the event modifier has the command bit set +// and is either in the proper range or is the calculator character. +#define TxtCharIsHardKey(m, c) ((((m) & commandKeyMask) != 0) && \ + ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr))) + +// is a virtual character if the event modifier has the command +// bit set. WARNING!!! This macro is only safe to use on Palm OS 3.5 or +// later. With earlier versions of the OS, use TxtGlueCharIsVirtual() +// in PalmOSGlue.lib +#define TxtCharIsVirtual(m, c) (((m) & commandKeyMask) != 0) + +#define TxtPreviousCharSize(inText, inOffset) TxtGetPreviousChar((inText), (inOffset), NULL) +#define TxtNextCharSize(inText, inOffset) TxtGetNextChar((inText), (inOffset), NULL) + + +/*********************************************************************** + * Public routines + ***********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +// DOLATER kwk - fix up parameter names to use i, o versus in, out + +// Return back byte attribute (first, last, single, middle) for . + +UInt8 TxtByteAttr(UInt8 inByte) + INTL_TRAP(intlTxtByteAttr); + +// Return back the standard attribute bits for . + +UInt16 TxtCharAttr(WChar inChar) + INTL_TRAP(intlTxtCharAttr); + +// Return back the extended attribute bits for . + +UInt16 TxtCharXAttr(WChar inChar) + INTL_TRAP(intlTxtCharXAttr); + +// Return the size (in bytes) of the character . This represents +// how many bytes would be required to store the character in a string. + +UInt16 TxtCharSize(WChar inChar) + INTL_TRAP(intlTxtCharSize); + +// Return the width (in pixels) of the character . You should +// use FntWCharWidth or FntGlueWCharWidth instead of this routine. + +Int16 TxtCharWidth(WChar inChar) + INTL_TRAP(intlTxtCharWidth); + +// Load the character before offset in the text. Return +// back the size of the character. + +UInt16 TxtGetPreviousChar(const Char *inText, UInt32 inOffset, WChar *outChar) + INTL_TRAP(intlTxtGetPreviousChar); + +// Load the character at offset in the text. Return +// back the size of the character. + +UInt16 TxtGetNextChar(const Char *inText, UInt32 inOffset, WChar *outChar) + INTL_TRAP(intlTxtGetNextChar); + +// Return the character at offset in the text. + +WChar TxtGetChar(const Char *inText, UInt32 inOffset) + INTL_TRAP(intlTxtGetChar); + +// Set the character at offset in the text, and +// return back the size of the character. + +UInt16 TxtSetNextChar(Char *ioText, UInt32 inOffset, WChar inChar) + INTL_TRAP(intlTxtSetNextChar); + +// Replace the substring "^X" (where X is 0..9, as specified by ) +// with the string . If is NULL then don't modify . +// Make sure the resulting string doesn't contain more than bytes, +// excluding the terminating null. Return back the number of occurances of +// the substring found in . + +UInt16 TxtReplaceStr(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, UInt16 inParamNum) + INTL_TRAP(intlTxtReplaceStr); + +// Allocate a handle containing the result of substituting param0...param3 +// for ^0...^3 in , and return the locked result. If a parameter +// is NULL, replace the corresponding substring in the template with "". + +Char *TxtParamString(const Char *inTemplate, const Char *param0, + const Char *param1, const Char *param2, const Char *param3) + INTL_TRAP(intlTxtParamString); + +// Return the bounds of the character at in the +// text, via the & offsets, and also return the +// actual value of character at or following . + +WChar TxtCharBounds(const Char *inText, UInt32 inOffset, UInt32 *outStart, UInt32 *outEnd) + INTL_TRAP(intlTxtCharBounds); + +// Return the appropriate byte position for truncating such that it is +// at most bytes long. + +UInt32 TxtGetTruncationOffset(const Char *inText, UInt32 inOffset) + INTL_TRAP(intlTxtGetTruncationOffset); + +// Search for in . If found return true and pass back +// the found position (byte offset) in , and the length of the matched +// text in . + +Boolean TxtFindString(const Char *inSourceStr, const Char *inTargetStr, + UInt32 *outPos, UInt16 *outLength) + INTL_TRAP(intlTxtFindString); + +// Find the bounds of the word that contains the character at . +// Return the offsets in <*outStart> and <*outEnd>. Return true if the +// word we found was not empty & not a delimiter (attribute of first char +// in word not equal to space or punct). + +Boolean TxtWordBounds(const Char *inText, UInt32 inLength, UInt32 inOffset, + UInt32 *outStart, UInt32 *outEnd) + INTL_TRAP(intlTxtWordBounds); + +// Return the offset of the first break position (for text wrapping) that +// occurs at or before in . Note that this routine will +// also add trailing spaces and a trailing linefeed to the break position, +// thus the result could be greater than . + +UInt32 TxtGetWordWrapOffset(const Char *iTextP, UInt32 iOffset) + INTL_TRAP(intlTxtGetWordWrapOffset); + +// Return the minimum (lowest) encoding required for . If we +// don't know about the character, return encoding_Unknown. + +CharEncodingType TxtCharEncoding(WChar inChar) + INTL_TRAP(intlTxtCharEncoding); + +// Return the minimum (lowest) encoding required to represent . +// This is the maximum encoding of any character in the string, where +// highest is unknown, and lowest is ascii. + +CharEncodingType TxtStrEncoding(const Char *inStr) + INTL_TRAP(intlTxtStrEncoding); + +// Return the higher (max) encoding of and . + +CharEncodingType TxtMaxEncoding(CharEncodingType a, CharEncodingType b) + INTL_TRAP(intlTxtMaxEncoding); + +// Return a pointer to the 'standard' name for . If the +// encoding is unknown, return a pointer to an empty string. + +const Char *TxtEncodingName(CharEncodingType inEncoding) + INTL_TRAP(intlTxtEncodingName); + +// Map from a character set name to a CharEncodingType. +// If the character set name is unknown, return charEncodingUnknown. + +CharEncodingType TxtNameToEncoding(const Char* iEncodingName) + INTL_TRAP(intlTxtNameToEncoding); + +// Transliterate bytes of text found in , based +// on the requested operation. Place the results in , +// and set the resulting length in . On entry +// must contain the maximum size of the buffer. If the +// buffer isn't large enough, return an error (note that outDestText +// might have been modified during the operation). Note that if +// has the preprocess bit set, then is not modified, and +// will contain the total space required in the destination +// buffer in order to perform the operation. + +Err TxtTransliterate(const Char *inSrcText, UInt16 inSrcLength, Char *outDstText, + UInt16 *ioDstLength, TranslitOpType inOp) + INTL_TRAP(intlTxtTransliterate); + +// Convert <*ioSrcBytes> of text from between the +// and character encodings. If 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 pointing to the beginning of +// a string or text buffer, 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 . 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 parameter. If it is NULL, +// then <*ioSrcBytes> will be set to the offset of the unconvertable character, +// will be set to the number of successfully converted resulting +// bytes, and , 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 parameter in subsequent calls to TxtConvertEncoding). +// If is not NULL, then this string is written to the +// destination buffer when an unconvertable character is encountered in the +// source text, and the source character is skipped. Processing continues, though +// the error code will still be returned when the routine terminates. Note that +// if a more serious error occurs during processing (e.g. buffer overflow) then +// that error will be returned even if there was an earlier unconvertable character. +// Note that the substitution string must use the destination character encoding. + +Err TxtConvertEncoding(Boolean newConversion, TxtConvertStateType* ioStateP, + const Char* srcTextP, UInt16* ioSrcBytes, CharEncodingType srcEncoding, + Char* dstTextP, UInt16* ioDstBytes, CharEncodingType dstEncoding, + const Char* substitutionStr, UInt16 substitutionLen) + INTL_TRAP(intlTxtConvertEncoding); + +// Return true if is a valid (drawable) character. Note that we'll +// return false if it is a virtual character code. + +Boolean TxtCharIsValid(WChar inChar) + INTL_TRAP(intlTxtCharIsValid); + +// Compare the first bytes of with the first bytes +// of . Return the results of the comparison: < 0 if sorts before +// , > 0 if sorts after , and 0 if they are equal. Also return +// the number of bytes that matched in and +// (either one of which can be NULL if the match length is not needed). +// This comparison is "caseless", in the same manner as a find operation, +// thus case, character size, etc. don't matter. + +Int16 TxtCaselessCompare(const Char *s1, UInt16 s1Len, UInt16 *s1MatchLen, + const Char *s2, UInt16 s2Len, UInt16 *s2MatchLen) + INTL_TRAP(intlTxtCaselessCompare); + +// Compare the first bytes of with the first bytes +// of . Return the results of the comparison: < 0 if sorts before +// , > 0 if sorts after , and 0 if they are equal. Also return +// the number of bytes that matched in and +// (either one of which can be NULL if the match length is not needed). + +Int16 TxtCompare(const Char *s1, UInt16 s1Len, UInt16 *s1MatchLen, + const Char *s2, UInt16 s2Len, UInt16 *s2MatchLen) + INTL_TRAP(intlTxtCompare); + +#ifdef __cplusplus + } +#endif + +#endif // __TEXTMGR_H__ diff --git a/sdk-4/include/Core/System/TextServicesMgr.h b/sdk-4/include/Core/System/TextServicesMgr.h new file mode 100644 index 0000000..014a53f --- /dev/null +++ b/sdk-4/include/Core/System/TextServicesMgr.h @@ -0,0 +1,118 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __TEXTSERVICESMGR_H__ +#define __TEXTSERVICESMGR_H__ + +#include +#include +#include + +#ifndef USE_TSM_TRAPS + #if (EMULATION_LEVEL == EMULATION_NONE) + #define USE_TSM_TRAPS 1 + #else + #define USE_TSM_TRAPS 0 + #endif +#endif + +#if USE_TSM_TRAPS + #define TSM_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapTsmDispatch, sel) +#else + #define TSM_TRAP(tsmSelectorNum) +#endif + +/*********************************************************************** + * Public constants + ***********************************************************************/ + +// Feature Creators and numbers, for use with the FtrGet() call. +#define tsmFtrCreator sysFileCTextServices + +// Selector used with call to FtrGet(tsmFtrCreator, xxx) to get the +// Text Services Manager flags. +#define tsmFtrNumFlags 0 + +// Flags returned by FtrGet(tsmFtrCreator, tsmFtrNumFlags) call. +#define tsmFtrFlagsHasFep 0x00000001L // 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. +typedef UInt16 TsmSelector; + +#define tsmGetFepMode 0 +#define tsmSetFepMode 1 +#define tsmHandleEvent 2 +#define tsmInit 3 // new in 4.0 +#define tsmDrawMode 4 // new in 4.0 +#define tsmGetSystemFep 5 // new in 4.0 +#define tsmSetSystemFep 6 // new in 4.0 +#define tsmGetCurrentFep 7 // new in 4.0 +#define tsmSetCurrentFep 8 // new in 4.0 + +#define tsmMaxSelector tsmSetCurrentFep + +// Input mode - used with TsmGet/SetFepMode. +typedef UInt16 TsmFepModeType; + +#define tsmFepModeDefault ((TsmFepModeType)0) +#define tsmFepModeOff ((TsmFepModeType)1) +#define tsmFepModeCustom ((TsmFepModeType)128) + + +/*********************************************************************** + * Public types + ***********************************************************************/ + +/*********************************************************************** + * Public routines + ***********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Return the current mode for the active FEP. The parameter +// is unused and must be set to NULL. +TsmFepModeType TsmGetFepMode(void* nullParam) + TSM_TRAP(tsmGetFepMode); + +// Set the mode for the active FEP to be . The previous mode +// is returned. The parameter is unused and must be set +// to NULL. +TsmFepModeType TsmSetFepMode(void* nullParam, TsmFepModeType inNewMode) + TSM_TRAP(tsmSetFepMode); + +#ifdef __cplusplus +} +#endif + +#endif // __TEXTSERVICESMGR_H__ diff --git a/sdk-4/include/Core/System/TimeMgr.h b/sdk-4/include/Core/System/TimeMgr.h new file mode 100644 index 0000000..1137537 --- /dev/null +++ b/sdk-4/include/Core/System/TimeMgr.h @@ -0,0 +1,73 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __TIMEMGR_H__ +#define __TIMEMGR_H__ + + +// Include elementary types +#include +#include // Trap Numbers. + + + +/************************************************************ + * Time Manager result codes + * (timErrorClass is defined in SystemMgr.h) + *************************************************************/ +#define timErrMemory (timErrorClass | 1) + + + +/************************************************************ + * Function Prototypes + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + + +//------------------------------------------------------------------- +// Initialization +//------------------------------------------------------------------- +Err TimInit(void) SYS_TRAP(sysTrapTimInit); + + +//------------------------------------------------------------------- +// API +//------------------------------------------------------------------- + +// seconds since 1/1/1904 +UInt32 TimGetSeconds(void) + SYS_TRAP(sysTrapTimGetSeconds); + +// seconds since 1/1/1904 +void TimSetSeconds(UInt32 seconds) + SYS_TRAP(sysTrapTimSetSeconds); + +// ticks since power on +UInt32 TimGetTicks(void) + SYS_TRAP(sysTrapTimGetTicks); + + +#ifdef __cplusplus +} +#endif + + + +#endif // __TIMEMGR_H__ diff --git a/sdk-4/include/Core/System/TraceMgr.h b/sdk-4/include/Core/System/TraceMgr.h new file mode 100644 index 0000000..3b6c058 --- /dev/null +++ b/sdk-4/include/Core/System/TraceMgr.h @@ -0,0 +1,79 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: TraceMgr.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Tracing API + * + *****************************************************************************/ + +#ifndef __TRACEMGR_H__ +#define __TRACEMGR_H__ + +/* ------------------------------------------------------------------- + +Expected syntax: + TraceInit() + TraceOutput(T (errorClass,"format",...) ) + TraceOutput(TL (errorClass,"format",...) ) + TraceOutput(B (errorClass,addr,count) ) + TraceOutput(VT (errorClass,"format",va_list) ) + TraceOutput(VTL (errorClass,"format",va_list) ) + TraceClose() + +Error classes listed in Incs\Core\System\ErrorBase.h starting with +Palm OS 3.5, in SystemMgr.h for earlier Palm OS versions. Applications +should use appErrorClass. + +Format string: % flags width type + +Supported flags: +- Left justified display (default is right justified) ++ Always displays the sign symbol (default: display only '-') +space Displays a space instead of a '+' symbol + +Supported types: +ld Int32 +lu UInt32 +lx,lX UInt32 in hexadecimal +hd Int16 +hu UInt16 +hx,hX UInt16 in hexadecimal +s 0 terminated string +c character +% the % character + +---------------------------------------------------------------------- */ + +#include + +/* ------------------------------------------------------------------- */ + +#define TRACE_OUTPUT_OFF 0 +#define TRACE_OUTPUT_ON 1 + +#include + +#if (TRACE_OUTPUT == TRACE_OUTPUT_ON) + #define TraceInit HostTraceInit + #define TraceClose HostTraceClose + #define TraceOutput(X) Host##TraceOutput##X +#else + #define TraceOutput(X) + #define TraceInit() + #define TraceClose() +#endif + +/* ------------------------------------------------------------------- */ + +#define TraceDefine(x,y) (x+y) // Used for custom error classes +// ex: #define myErrorClass TraceDefine(appErrorClass,3) + +/* --------------------------------------------------------------------------- */ + +#endif /* __TRACEMGR_H__ */ diff --git a/sdk-4/include/Core/System/UDAMgr.h b/sdk-4/include/Core/System/UDAMgr.h new file mode 100644 index 0000000..46193f5 --- /dev/null +++ b/sdk-4/include/Core/System/UDAMgr.h @@ -0,0 +1,195 @@ + /*********************************************************************** + * + * 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 + * + ************************************************************************/ + +#ifndef __UDAMGR_H__ +#define __UDAMGR_H__ + +#include +#include +#include +#include + + /*********************************************************************** + * Generic options flags + ************************************************************************/ + +#define kUDAEndOfReader ((UInt16) 1) +#define kUDAMoreData ((UInt16) 2) + + + /*********************************************************************** + * Generic control + ************************************************************************/ + +#define kUDAReinitialize ((UInt16) 1) + + /*********************************************************************** + * Generic error codes + ************************************************************************/ + +#define udaErrControl ((Err) udaErrorClass | 1) + + /*********************************************************************** + * General types + ************************************************************************/ + +typedef UInt16 UDABufferSize; + +#define kUDAZeroTerminatedBuffer 0xFFFF + +struct UDAObjectTag; +struct UDAReaderTag; +struct UDAFilterTag; +struct UDAWriterTag; + + /*********************************************************************** + * Types of callback functions + ************************************************************************/ + +typedef void (*UDADeleteFunction) (struct UDAObjectTag** ioObject); +typedef Err (*UDAControlFunction) (struct UDAObjectTag* ioObject, UInt16 parameter, va_list args); + +typedef UDABufferSize (*UDAReadFunction) (struct UDAReaderTag* ioReader, UInt8* buffer, UDABufferSize bufferSize, Err* error); + +typedef Err (*UDAWriteFunction)(struct UDAWriterTag* ioWriter); +typedef Err (*UDAFlushFunction)(struct UDAWriterTag* ioWriter); + +typedef struct UDAObjectTag { + UInt16 optionFlags; + UDADeleteFunction deleteF; + UDAControlFunction controlF; +} UDAObjectType; + +typedef struct UDAReaderTag { + // The Reader is a base object + UInt16 optionFlags; + UDADeleteFunction deleteF; + UDAControlFunction controlF; + + // Specific Reader fields + UDAReadFunction readF; +} UDAReaderType; + +typedef struct UDAFilterTag { + // The Filter is a base Object + UInt16 optionFlags; + UDADeleteFunction deleteF; + UDAControlFunction controlF; + + // The Filter is a Reader + UDAReadFunction readF; + + // Specific Filter fields + UDAReaderType* upperReader; +} UDAFilterType; + +typedef struct UDAWriterTag { + // The Writer is a base Object + UInt16 optionFlags; + UDADeleteFunction deleteF; + UDAControlFunction controlF; + + // Specific Writer fields + UDAWriteFunction initiateWriteF; + UDAFlushFunction flushF; + UDAReaderType* upperReader; +} 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 + ****************************************************************/ + +// For simulator builds, always direct calls +#ifndef BUILDING_UDA_MGR +# if EMULATION_LEVEL != EMULATION_NONE +# define BUILDING_UDA_MGR 1 +# endif +#endif + +// When using UDAMgr, use systraps w/ selector +// When building UDAMgr, use direct calls +#ifndef BUILDING_UDA_MGR +# define UDA_MGR_TRAP(udaSelectorNum) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapUdaMgrDispatch, udaSelectorNum) +#else +# define UDA_MGR_TRAP(udaSelectorNum) +#endif + +// Public UDAMgr function selectors +#define sysUdaControl 0 +#define sysUdaMemoryReaderNew 1 +#define sysUdaExchangeReaderNew 11 +#define sysUdaExchangeWriterNew 12 + + +// UDAMgr function prototypes + +#ifdef __cplusplus +extern "C" { +#endif + +extern Err UDAControl(UDAObjectType* ioObject, UInt16 parameter, ...) + UDA_MGR_TRAP(sysUdaControl); + +extern UDAReaderType* UDAExchangeReaderNew(ExgSocketType* socket) + UDA_MGR_TRAP(sysUdaExchangeReaderNew); + +extern UDAWriterType* UDAExchangeWriterNew(ExgSocketType* socket, UDABufferSize bufferSize) + UDA_MGR_TRAP(sysUdaExchangeWriterNew); + + /*********************************************************************** + * Memory reader + ************************************************************************/ + +extern UDAReaderType* UDAMemoryReaderNew(const UInt8* bufferP, UDABufferSize bufferSizeInBytes) + UDA_MGR_TRAP(sysUdaMemoryReaderNew); + +#ifdef __cplusplus +} +#endif + +#endif // __UDAMGR_H__ diff --git a/sdk-4/include/Core/System/Unix/arpa_inet.h b/sdk-4/include/Core/System/Unix/arpa_inet.h new file mode 100644 index 0000000..64940e8 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/arpa_inet.h @@ -0,0 +1,71 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: arpa_inet.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)inet.h 1.8 88/08/19 SMI; from UCB 5.1 5/30/85 */ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * External definitions for + * functions in inet(3N) + */ + +#ifndef __UNIX_ARPA_INET_H__ +#define __UNIX_ARPA_INET_H__ + +#include + +//=========================================================================== +// Macros that convert Unix calls into native Pilot calls. +//=========================================================================== +// Convert a dotted decimal string representation into an IP address. +// return -1 on error +#define inet_addr(s) \ + NetLibAddrAToIN(AppNetRefnum, s) + +// Return a dotted decimal string representation of an IP address +#define inet_ntoa(in) \ + NetLibAddrINToA(AppNetRefnum, (in).s_addr, AppINETString) + + +//=========================================================================== +// Functions implemented through glue code +//=========================================================================== + +#ifdef __cplusplus +extern "C" { +#endif + +// Merge network number and local network address into an IP address +struct in_addr inet_makeaddr(UInt32 net, UInt32 lna); + +// Return the NBO network number of the dotted decimal string +UInt32 inet_network(Char * s); + +// Return the local network address of an IP address +UInt32 inet_lnaof(struct in_addr in); + +// Return the network number of an IP address +UInt32 inet_netof(struct in_addr in); + +#ifdef __cplusplus +} +#endif + +#endif /* __UNIX_ARPA_INET_H__ */ diff --git a/sdk-4/include/Core/System/Unix/netdb.h b/sdk-4/include/Core/System/Unix/netdb.h new file mode 100644 index 0000000..264fd74 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/netdb.h @@ -0,0 +1,119 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netdb.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +/* @(#)netdb.h 1.11 88/08/19 SMI from UCB 5.9 4/5/88 */ +/* + * Copyright (c) 1980,1983,1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + + + +#ifndef __UNIX_NETDB_H__ +#define __UNIX_NETDB_H__ + +#include + + +/* + * Structures returned by network data base library. + * All addresses are supplied in host order, and + * returned in network order (suitable for use in system calls). + */ + +struct hostent { + Char *h_name; /* official name of host */ + Char **h_aliases; /* alias list */ + UInt16 h_addrtype; /* host address type */ + UInt16 h_length; /* length of address */ + Char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + Char *n_name; /* official name of net */ + Char **n_aliases; /* alias list */ + UInt16 n_addrtype; /* net address type */ + UInt32 n_net; /* network # */ +}; + +struct servent { + Char *s_name; /* official service name */ + Char **s_aliases; /* alias list */ + UInt16 s_port; /* port # */ + Char *s_proto; /* protocol to use */ +}; + +struct protoent { + Char *p_name; /* official protocol name */ + Char **p_aliases; /* alias list */ + UInt16 p_proto; /* protocol # */ +}; + +struct rpcent { + Char *r_name; /* name of server for this rpc program */ + Char **r_aliases; /* alias list */ + Int16 r_number; /* rpc program number */ +}; + + +// Supported calls +#define gethostbyname(nameP) \ + ((struct hostent*)NetLibGetHostByName(AppNetRefnum, nameP,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define gethostbyaddr(addr,len,type) \ + ((struct hostent*)NetLibGetHostByAddr(AppNetRefnum, (UInt8 *)addr,len,type,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define getservbyname(serv,proto) \ + ((struct servent*)NetLibGetServByName(AppNetRefnum, serv,proto,&AppServInfo,AppNetTimeout,&h_errno)) + + +// Unsupported calls +// struct hostent *gethostent(); +// struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); +// struct servent *getservbyport(), *getservent(); +// struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); +// struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver) + */ + +extern Err h_errno; + +#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + + +#endif /* __UNIX_NETDB_H__ */ diff --git a/sdk-4/include/Core/System/Unix/netinet_in.h b/sdk-4/include/Core/System/Unix/netinet_in.h new file mode 100644 index 0000000..60f1c4f --- /dev/null +++ b/sdk-4/include/Core/System/Unix/netinet_in.h @@ -0,0 +1,201 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netinet_in.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)in.h 1.19 90/07/27 SMI; from UCB 7.5 2/22/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981. + */ + +#ifndef __UNIX_NETINET_IN_H__ +#define __UNIX_NETINET_IN_H__ + +#include + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group control protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_HELLO 63 /* "hello" routing protocol */ +#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + +/* + * Port/socket numbers: network standard functions + */ +#define IPPORT_ECHO 7 +#define IPPORT_DISCARD 9 +#define IPPORT_SYSTAT 11 +#define IPPORT_DAYTIME 13 +#define IPPORT_NETSTAT 15 +#define IPPORT_FTP 21 +#define IPPORT_TELNET 23 +#define IPPORT_SMTP 25 +#define IPPORT_TIMESERVER 37 +#define IPPORT_NAMESERVER 42 +#define IPPORT_WHOIS 43 +#define IPPORT_MTP 57 + +/* + * Port/socket numbers: host specific functions + */ +#define IPPORT_TFTP 69 +#define IPPORT_RJE 77 +#define IPPORT_FINGER 79 +#define IPPORT_TTYLINK 87 +#define IPPORT_SUPDUP 95 + +/* + * UNIX TCP sockets + */ +#define IPPORT_EXECSERVER 512 +#define IPPORT_LOGINSERVER 513 +#define IPPORT_CMDSERVER 514 +#define IPPORT_EFSSERVER 520 + +/* + * UNIX UDP sockets + */ +#define IPPORT_BIFFUDP 512 +#define IPPORT_WHOSERVER 513 +#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Link numbers + */ +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 + +/* + * Internet address + * This definition contains obsolete fields for compatibility + * with SunOS 3.x and 4.2bsd. The presence of subnets renders + * divisions into fixed fields misleading at best. New code + * should use only the s_addr field. + */ +struct in_addr { + union { + struct { UInt8 s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { UInt16 s_w1,s_w2; } S_un_w; + UInt32 S_addr; + } S_un; +#define s_addr S_un.S_addr /* should be used for all code */ +#define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */ +#define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */ +#define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */ +#define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */ +#define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */ +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_NONE (u_long)0xFFFFFFFF /* error from inet_aton */ +#define INADDR_LOOPBACK (u_long)0x7F000001 +#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Define a macro to stuff the loopback address into an Internet address + */ +#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ + (a)->sin_family = AF_INET;} + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + Int16 sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + */ +#define IP_OPTIONS netSocketOptIPOptions /* set/get IP per-packet options */ + +/* + * Macros for number representation conversion. + */ +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + + +#endif /* __UNIX_NETINET_IN_H__ */ diff --git a/sdk-4/include/Core/System/Unix/netinet_in_systm.h b/sdk-4/include/Core/System/Unix/netinet_in_systm.h new file mode 100644 index 0000000..74a6664 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/netinet_in_systm.h @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netinet_in_systm.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)in_systm.h 1.8 88/08/19 SMI; from UCB 7.1 6/5/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +#ifndef __UNIX_NETINET_IN_SYSTM_H__ +#define __UNIX_NETINET_IN_SYSTM_H__ + +#include + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +typedef u_short n_short; /* Int16 as received from the net */ +typedef u_long n_long; /* long as received from the net */ + +typedef u_long n_time; /* ms since 00:00 GMT, byte rev */ + +#endif /* __UNIX_NETINET_IN_SYSTM_H__ */ diff --git a/sdk-4/include/Core/System/Unix/netinet_ip.h b/sdk-4/include/Core/System/Unix/netinet_ip.h new file mode 100644 index 0000000..56a1eb9 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/netinet_ip.h @@ -0,0 +1,139 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netinet_ip.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)ip.h 1.13 88/08/19 SMI; from UCB 7.6.1.1 3/15/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ + +#ifndef __UNIX_NETINET_IP_H__ +#define __UNIX_NETINET_IP_H__ + +#include +#include + +#define IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + * + * We declare ip_len and ip_off to be Int16, rather than u_short + * pragmatically since otherwise unsigned comparisons can result + * against negative integers quite easily, and fail in subtle ways. + */ +struct ip { + u_char ip_v:4, /* version */ + ip_hl:4; /* header length */ + u_char ip_tos; /* type of service */ + Int16 ip_len; /* total length */ + u_short ip_id; /* identification */ + Int16 ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + u_char ipt_code; /* IPOPT_TS */ + u_char ipt_len; /* size of structure (variable) */ + u_char ipt_ptr; /* index of current entry */ + u_char ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ + union ipt_timestamp { + n_long ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + n_long ipt_time; + } ipt_ta[1]; + } ipt_timestamp; +}; + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 2 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +#endif /* __UNIX_NETINET_IP_H__ */ diff --git a/sdk-4/include/Core/System/Unix/netinet_tcp.h b/sdk-4/include/Core/System/Unix/netinet_tcp.h new file mode 100644 index 0000000..6d758cb --- /dev/null +++ b/sdk-4/include/Core/System/Unix/netinet_tcp.h @@ -0,0 +1,75 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: netinet_tcp.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)tcp.h 1.11 88/08/19 SMI; from UCB 7.2 10/28/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __UNIX_NETINET_TCP_H__ +#define __UNIX_NETINET_TCP_H__ + +#include + +typedef UInt32 tcp_seq; +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + UInt16 th_sport; /* source port */ + UInt16 th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ + UInt8 th_off:4, /* data offset */ + th_x2:4; /* (unused) */ + UInt8 th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + UInt16 th_win; /* window */ + UInt16 th_sum; /* checksum */ + UInt16 th_urp; /* urgent pointer */ +}; + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + */ +#ifdef lint +#define TCP_MSS 536 +#else +#define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) +#endif + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY netSocketOptTCPNoDelay /* don't delay send to coalesce packets */ +#define TCP_MAXSEG netSocketOptTCPMaxSeg /* set maximum segment size */ + +#endif /* __UNIX_NETINET_TCP_H__ */ diff --git a/sdk-4/include/Core/System/Unix/sys_errno.h b/sdk-4/include/Core/System/Unix/sys_errno.h new file mode 100644 index 0000000..1bb51e9 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/sys_errno.h @@ -0,0 +1,149 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_errno.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the equivalent of the unix header + * for use in Pilot applications that wish to use the Berkeley sockets API + * + * History: + * 5/23/96 Created by Ron Marianetti + * + *****************************************************************************/ + +/* @(#)errno.h 2.14 90/01/23 SMI; from UCB 4.1 82/12/28 */ + +/* + * If error codes are added or changed here, they should be updated in + * /usr/src/lib/libc/gen/common/errlst.c as well. + */ + + +#ifndef _sys_errno_h +#define _sys_errno_h + +#define EPERM 1 /* Not owner */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR netErrTimeout /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No children */ +#define EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Not enough core */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Mount device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory*/ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ + +/* math software */ +#define EDOM 33 /* Argument too large */ +#define ERANGE 34 /* Result too large */ + +/* non-blocking and interrupt i/o */ +#define EWOULDBLOCK netErrWouldBlock /* Operation would block */ +#define EINPROGRESS netErrSocketBusy /* Operation now in progress */ +#define EALREADY netErrAlreadyInProgress /* Operation already in progress */ +/* ipc/network software */ + + /* argument errors */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported on socket */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by proto +col family */ +#define EADDRINUSE netErrPortInUse /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ + + /* operational errors */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH netErrNoInterfaces /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN netErrSocketAlreadyConnected /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT netErrTimeout /* Connection timed out */ +#define ECONNREFUSED 61 /* Connection refused */ + + /* */ +#define ELOOP 62 /* Too many levels of symbolic links */ +#define ENAMETOOLONG 63 /* File name too long */ + +/* should be rearranged */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ + +/* quotas & mush */ +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disc quota exceeded */ + +/* Network File System */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ + +/* streams */ +#define ENOSTR 72 /* Device is not a stream */ +#define ETIME 73 /* Timer expired */ +#define ENOSR 74 /* Out of streams resources */ +#define ENOMSG 75 /* No message of desired type */ +#define EBADMSG 76 /* Trying to read unreadable message */ + +/* SystemV IPC */ +#define EIDRM 77 /* Identifier removed */ + +/* SystemV Record Locking */ +#define EDEADLK 78 /* Deadlock condition. */ +#define ENOLCK 79 /* No record locks available. */ + +/* RFS */ +#define ENONET 80 /* Machine is not on the network */ +#define ERREMOTE 81 /* Object is remote */ +#define ENOLINK 82 /* the link has been severed */ +#define EADV 83 /* advertise error */ +#define ESRMNT 84 /* srmount error */ +#define ECOMM 85 /* Communication error on send */ +#define EPROTO 86 /* Protocol error */ +#define EMULTIHOP 87 /* multihop attempted */ +#define EDOTDOT 88 /* Cross mount point (not an error) */ +#define EREMCHG 89 /* Remote address changed */ + +/* POSIX */ +#define ENOSYS 90 /* function not implemented */ + +#endif /*!_sys_errno_h*/ diff --git a/sdk-4/include/Core/System/Unix/sys_socket.h b/sdk-4/include/Core/System/Unix/sys_socket.h new file mode 100644 index 0000000..eb6458a --- /dev/null +++ b/sdk-4/include/Core/System/Unix/sys_socket.h @@ -0,0 +1,313 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_socket.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __UNIX_SYS_SOCKET_H__ +#define __UNIX_SYS_SOCKET_H__ + +// Include System headers +#include + +// Include the Pilot Net Manager defines +#include + +// Include other Unix headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// This is a set of unix calls that get stubbed out or replaced by +// PilotOS calls. +// +// Although these don't really "belong" here, it seems like the best solution +// rather than having a ton of other unix like header files that don't +// provide all the functionality that unix does. +#define sleep(x) SysTaskDelay(x*sysTicksPerSecond) +#define isatty(x) 1 +#define fork() -1 // can't support fork +#define abort(x) + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB +#define getenv(x) 0 +#endif + +/*=================================================================== + * Definitions related to sockets: types, address families, options. + ===================================================================*/ + +/* + * Types + */ +#define SOCK_STREAM netSocketTypeStream /* stream socket */ +#define SOCK_DGRAM netSocketTypeDatagram /* datagram socket */ +#define SOCK_RAW netSocketTypeRaw /* raw-protocol interface */ +#define SOCK_RDM netSocketTypeReliableMsg /* reliable message */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG netSocketOptSockDebug /* turn on debugging info recording */ +#define SO_ACCEPTCONN netSocketOptSockAcceptConn /* socket has had listen() */ +#define SO_REUSEADDR netSocketOptSockReuseAddr /* allow local address reuse */ +#define SO_KEEPALIVE netSocketOptSockKeepAlive /* keep connections alive */ +#define SO_DONTROUTE netSocketOptSockDontRoute /* just use interface addresses */ +#define SO_BROADCAST netSocketOptSockBroadcast /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK netSocketOptSockUseLoopback /* bypass hardware when possible */ +#define SO_LINGER netSocketOptSockLinger /* linger on close if data present */ +#define SO_OOBINLINE netSocketOptSockOOBInLine /* leave received OOB data in line */ +/* + * N.B.: The following definition is present only for compatibility + * with release 3.0. It will disappear in later releases. + */ +#define SO_DONTLINGER (~SO_LINGER) /* ~SO_LINGER */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF netSocketOptSockSndBufSize /* send buffer size */ +#define SO_RCVBUF netSocketOptSockRcvBufSize /* receive buffer size */ +#define SO_SNDLOWAT netSocketOptSockSndLowWater /* send low-water mark */ +#define SO_RCVLOWAT netSocketOptSockRcvLowWater /* receive low-water mark */ +#define SO_SNDTIMEO netSocketOptSockSndTimeout /* send timeout */ +#define SO_RCVTIMEO netSocketOptSockRcvTimeout /* receive timeout */ +#define SO_ERROR netSocketOptSockErrorStatus /* get error status and clear */ +#define SO_TYPE netSocketOptSockSocketType /* get socket type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + Int16 l_onoff; /* option on/off */ + Int16 l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET netSocketOptLevelSocket /* options for socket level */ + +/* + * Address families. + */ +#define AF_INET netSocketAddrINET /* internetwork: UDP, TCP, etc. */ +#define AF_RAW netSocketAddrRaw /* raw access to data-link interface */ + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + Int16 sa_family; /* address family */ + UInt8 sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + UInt16 sp_family; /* address family */ + UInt16 sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_INET AF_INET +#define PF_RAW AF_RAW + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct msghdr { + Char * msg_name; /* optional address */ + Int16 msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + Int16 msg_iovlen; /* # elements in msg_iov */ + Char * msg_accrights; /* access rights sent/received */ + Int16 msg_accrightslen; + }; + +#define MSG_OOB netIOFlagOutOfBand /* process out-of-band data */ +#define MSG_PEEK netIOFlagPeek /* peek at incoming message */ +#define MSG_DONTROUTE netIOFlagDontRoute /* send without using routing tables */ + +#define MSG_MAXIOVLEN netIOVecMaxLen + + +//=========================================================================== +// Globals used by the Sockets API. These are declard in the Socket.c module +// which must be linked in with any application that uses the sockets API. +//=========================================================================== +extern Err errno; +extern Int32 AppNetTimeout; +extern Char AppINETString[]; +extern NetHostInfoBufType AppHostInfo; +extern NetServInfoBufType AppServInfo; +extern UInt16 AppNetRefnum; + + +//=========================================================================== +// Macros that convert BSD Sockets calls into native Pilot calls. +//=========================================================================== +#define accept(socket,addr,addrlen) \ + NetLibSocketAccept(AppNetRefnum,socket,(NetSocketAddrType*)addr,(Int16 *)addrlen,AppNetTimeout,&errno) + +#define bind(socket,localaddr,addrlen) \ + NetLibSocketBind(AppNetRefnum, socket,(NetSocketAddrType*)localaddr,addrlen,AppNetTimeout,&errno) + +#define close(socket) \ + NetLibSocketClose(AppNetRefnum, socket,AppNetTimeout,&errno) + +#define connect(socket,addr,addrlen) \ + NetLibSocketConnect(AppNetRefnum, socket,(NetSocketAddrType*)addr,addrlen,AppNetTimeout,&errno) + +#define getsockopt(socket,level,opt,optvalP,optlenP) \ + NetLibSocketOptionGet(AppNetRefnum, socket,level,opt,optvalP,(UInt16 *)optlenP,AppNetTimeout,&errno) + +#define listen(socket,queuelen) \ + NetLibSocketListen(AppNetRefnum, socket,queuelen,AppNetTimeout,&errno) + +#define read(socket,buffer,buflen) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,0,0,0,AppNetTimeout,&errno) + +#define recv(socket,buffer,buflen,flags) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,flags,0,0,AppNetTimeout,&errno) + +#define recvfrom(socket,buffer,buflen,flags,from,fromlen) \ + NetLibReceive(AppNetRefnum, socket,buffer,buflen,flags,from,(UInt16 *)fromlen,AppNetTimeout,&errno) + +#define recvmsg(socket,msg,flags) \ + NetLibReceivePB(AppNetRefnum, socket,(NetIOParamType*)msg,flags,AppNetTimeout,&errno) + +#define send(socket,buf,buflen,flags) \ + NetLibSend(AppNetRefnum, socket,buf,buflen,flags,0,0,AppNetTimeout,&errno) + +#define sendmsg(socket,msg,flags) \ + NetLibSendPB(AppNetRefnum, socket,(NetIOParamType*)msg,flags,AppNetTimeout,&errno) + +#define sendto(socket,buf,buflen,flags,to,tolen) \ + NetLibSend(AppNetRefnum, socket,buf,buflen,flags,to,tolen,AppNetTimeout,&errno) + +#define setsockopt(socket,level,opt,optvalP,optlen) \ + NetLibSocketOptionSet(AppNetRefnum, socket,level,opt,optvalP,optlen,AppNetTimeout,&errno) + +#define shutdown(socket,direction) \ + NetLibSocketShutdown(AppNetRefnum, socket,direction,AppNetTimeout,&errno) + +#define socket(domain,type,protocol) \ + NetLibSocketOpen(AppNetRefnum, domain,type,protocol,AppNetTimeout,&errno) + +#define write(socket,buf,buflen) \ + NetLibSend(AppNetRefnum, socket,(void *) buf,buflen,0,0,0,AppNetTimeout,&errno) + +#define getpeername(socket,nameP,nameLenP) \ + NetLibSocketAddr(AppNetRefnum, socket, 0, 0, (NetSocketAddrType*)nameP, (Int16 *)nameLenP, AppNetTimeout, &errno) + +#define getsockname(socket,nameP,nameLenP) \ + NetLibSocketAddr(AppNetRefnum, socket, (NetSocketAddrType*)nameP, (Int16 *)nameLenP, 0, 0, AppNetTimeout, &errno) + + +//=========================================================================== +// Sockets API calls that go through glue +//=========================================================================== + +#ifdef __cplusplus +extern "C" { +#endif + +Int16 getdomainname(Char * nameP, Int16 namelen); + +Int16 setdomainname(Char * nameP, Int16 namelen); + +Int16 gethostname(Char * nameP, Int16 namelen); + +Int16 sethostname(Char * nameP, Int16 namelen); + +Int16 select(Int16 width, fd_set* readfds, fd_set* writefds, + fd_set* exceptfds, struct timeval* timeout); + +Int16 gettimeofday(struct timeval* tp, struct timezone* tzp); + +Int16 settimeofday(struct timeval* tp, struct timezone* tzp); + + +void * MemCalloc(UInt32 nmemb, UInt32 size); + +void * MemRealloc(void * p, UInt32 size); + +#ifdef __cplusplus +} +#endif + + + +//=========================================================================== +// These are high level convenience functions. +//=========================================================================== + +#ifdef __cplusplus +extern "C" { +#endif + +// Initialize the NetSocket glue code globals if not already initialized. +// In particular, this sets up the AppNetRefnum global with the refnum of +// the NetLib. +Err NetUInit (void); + +// Open up a TCP socket and connect to the given host. If port is 0, the port +// number will be looked up by the serviceName parameter. Returns socket +// descriptor or -1 on error +NetSocketRef NetUTCPOpen(const Char * hostName, const Char * serviceName, Int16 port); + +// Read N bytes from a descriptor. This call automatically makes repeated read +// calls to the socket until all N bytes have been received +// Returns number of bytes read or -1 if error +Int32 NetUReadN(NetSocketRef fd, UInt8 * bufP, UInt32 numBytes); + + +// Write N bytes to a descriptor. This call automatically makes repeated write +// calls to the socket until all N bytes have been sent +// Returns number of bytes written or -1 if error +Int32 NetUWriteN(NetSocketRef fd, UInt8 * bufP, UInt32 numBytes); + +#ifdef __cplusplus +} +#endif + + +#endif /* __UNIX_SYS_SOCKET_H__ */ diff --git a/sdk-4/include/Core/System/Unix/sys_socketvar.h b/sdk-4/include/Core/System/Unix/sys_socketvar.h new file mode 100644 index 0000000..31dcee4 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/sys_socketvar.h @@ -0,0 +1,40 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_socketvar.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __UNIX_SYS_SOCKETVAR_H__ +#define __UNIX_SYS_SOCKETVAR_H__ + + +/* + * Socket state bits. + */ +#define SS_NOFDREF 0x001 /* no file table ref any more */ +#define SS_ISCONNECTED 0x002 /* socket connected to a peer */ +#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */ +#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ +#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */ +#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ +#define SS_RCVATMARK 0x040 /* at mark on input */ + +#define SS_PRIV 0x080 /* privileged for broadcast, raw... */ +#define SS_NBIO 0x100 /* non-blocking ops */ +#define SS_ASYNC 0x200 /* async i/o notify */ +#define SS_PIPE 0x400 /* pipe behavior for POSIX & SVID */ + +#endif /* __UNIX_SYS_SOCKETVAR_H__ */ diff --git a/sdk-4/include/Core/System/Unix/sys_time.h b/sdk-4/include/Core/System/Unix/sys_time.h new file mode 100644 index 0000000..4d5d6aa --- /dev/null +++ b/sdk-4/include/Core/System/Unix/sys_time.h @@ -0,0 +1,54 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_time.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the equivalent of the unix header + * for use in Pilot applications that wish to use the Berkeley sockets API + * + * History: + * 5/23/96 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __UNIX_SYS_TIME_H__ +#define __UNIX_SYS_TIME_H__ + +#include + + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ + +struct timeval { + Int32 tv_sec; /* seconds */ + Int32 tv_usec; /* and microseconds */ +}; + + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ +#define DST_GB 7 /* Great Britain and Eire */ +#define DST_RUM 8 /* Rumania */ +#define DST_TUR 9 /* Turkey */ +#define DST_AUSTALT 10 /* Australian style with shift in 1986 */ + + +#endif /* __UNIX_SYS_TIME_H__ */ diff --git a/sdk-4/include/Core/System/Unix/sys_types.h b/sdk-4/include/Core/System/Unix/sys_types.h new file mode 100644 index 0000000..32d1073 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/sys_types.h @@ -0,0 +1,59 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_types.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the Pilot equivalent of the "standard" unix + * header file + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +#ifndef __UNIX_SYS_TYPES_H__ +#define __UNIX_SYS_TYPES_H__ + +#include // Include Pilot Net Manager equates + +// Common Unix types +typedef UInt8 u_char; +typedef UInt16 u_short; +typedef UInt16 u_int; +typedef UInt32 u_long; + +typedef UInt16 ushort; /* System V compatibility */ +typedef UInt16 uint; /* System V compatibility */ + +// Define this so we don't get duplicate define warnings. +#define __size_t__ +typedef UInt32 size_t; // must be signed for some unix apps + +// File Descriptor Utilities, Pilot native forms in +typedef NetFDSetType fd_set; +#define FD_SETSIZE netFDSetSize + +#define FD_SET(n,p) netFDSet(n,p) +#define FD_CLR(n,p) netFDClr(n,p) +#define FD_ISSET(n,p) netFDIsSet(n,p) +#define FD_ZERO(p) netFDZero(p) + + +// Basic functions +#define bcopy(b1,b2,len) \ + MemMove(b2,b1,len) + +#define bzero(b,len) \ + MemSet(b,len,0) + +#define bcmp(b1,b2,len) \ + MemCmp(b1,b2,len) + + + +#endif /* __UNIX_SYS_TYPES_H__ */ diff --git a/sdk-4/include/Core/System/Unix/sys_uio.h b/sdk-4/include/Core/System/Unix/sys_uio.h new file mode 100644 index 0000000..74bc127 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/sys_uio.h @@ -0,0 +1,35 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: sys_uio.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)uio.h 2.9 89/06/27 SMI; from UCB 7.1 6/4/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ +#ifndef __UNIX_SYS_UIO_H__ +#define __UNIX_SYS_UIO_H__ + +#include + +struct iovec { + UInt8 * iov_base; + UInt16 iov_len; +}; + + +#endif /* __UNIX_SYS_UIO_H__ */ diff --git a/sdk-4/include/Core/System/Unix/unix_fcntl.h b/sdk-4/include/Core/System/Unix/unix_fcntl.h new file mode 100644 index 0000000..596fe85 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/unix_fcntl.h @@ -0,0 +1,85 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_fcntl.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +/* @(#)fcntlcom.h 1.13 91/06/18 SMI; from UCB fcntl.h 5.2 1/8/86 */ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __fcntl_h +#define __fcntl_h + +#include + +/* + * Rewack the FXXXXX values as _FXXXX so that _POSIX_SOURCE works. + */ +#define _FOPEN (-1) /* from sys/file.h, kernel use only */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FSETBLK 0x0010 /* use block offsets */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ +#define _FMARK 0x10000 /* internal; mark during gc() */ +#define _FDEFER 0x20000 /* internal; defer for next gc pass */ + + +/* + * Flags that work for fcntl(fd, F_SETFL, FXXXX) + */ +#define FAPPEND _FAPPEND +#define FSYNC _FSYNC +#define FASYNC _FASYNC +#define FNBIO _FNBIO +#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */ +#define FNDELAY _FNDELAY + + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags (close on exec) */ +#define F_SETFD 2 /* Set fildes flags (close on exec) */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ + +/* Prototypes */ + +#define fcntl(a,b,c) NetFCntl(a,b,c) + +#ifdef __cplusplus +extern "C" { +#endif + +Int16 NetFCntl(Int16 fd, Int16 cmd, Int16 arg); + +#ifdef __cplusplus +} +#endif + +#endif /* !__fcntl_h */ diff --git a/sdk-4/include/Core/System/Unix/unix_netdb.h b/sdk-4/include/Core/System/Unix/unix_netdb.h new file mode 100644 index 0000000..9af5136 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/unix_netdb.h @@ -0,0 +1,119 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_netdb.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + * History: + * 2/14/96 Created by Ron Marianetti + * + *****************************************************************************/ + +/* @(#)netdb.h 1.11 88/08/19 SMI from UCB 5.9 4/5/88 */ +/* + * Copyright (c) 1980,1983,1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + + + +#ifndef __UNIX_NETDB_H__ +#define __UNIX_NETDB_H__ + +#include + + +/* + * Structures returned by network data base library. + * All addresses are supplied in host order, and + * returned in network order (suitable for use in system calls). + */ + +struct hostent { + Char *h_name; /* official name of host */ + Char **h_aliases; /* alias list */ + UInt16 h_addrtype; /* host address type */ + UInt16 h_length; /* length of address */ + Char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + Char *n_name; /* official name of net */ + Char **n_aliases; /* alias list */ + UInt16 n_addrtype; /* net address type */ + UInt32 n_net; /* network # */ +}; + +struct servent { + Char *s_name; /* official service name */ + Char **s_aliases; /* alias list */ + UInt16 s_port; /* port # */ + Char *s_proto; /* protocol to use */ +}; + +struct protoent { + Char *p_name; /* official protocol name */ + Char **p_aliases; /* alias list */ + UInt16 p_proto; /* protocol # */ +}; + +struct rpcent { + Char *r_name; /* name of server for this rpc program */ + Char **r_aliases; /* alias list */ + Int16 r_number; /* rpc program number */ +}; + + +// Supported calls +#define gethostbyname(nameP) \ + ((struct hostent*)NetLibGetHostByName(AppNetRefnum, nameP,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define gethostbyaddr(addr,len,type) \ + ((struct hostent*)NetLibGetHostByAddr(AppNetRefnum, (UInt8 *)addr,len,type,&AppHostInfo,AppNetTimeout,&h_errno)) + +#define getservbyname(serv,proto) \ + ((struct servent*)NetLibGetServByName(AppNetRefnum, serv,proto,&AppServInfo,AppNetTimeout,&h_errno)) + + +// Unsupported calls +// struct hostent *gethostent(); +// struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); +// struct servent *getservbyport(), *getservent(); +// struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); +// struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver) + */ + +extern Err h_errno; + +#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + + +#endif /* __UNIX_NETDB_H__ */ diff --git a/sdk-4/include/Core/System/Unix/unix_stdarg.h b/sdk-4/include/Core/System/Unix/unix_stdarg.h new file mode 100644 index 0000000..03dc7b5 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/unix_stdarg.h @@ -0,0 +1,39 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_stdarg.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +#if defined(EMULATION_LEVEL) && (EMULATION_LEVEL != EMULATION_NONE) + +#include // use the native stdarg + +#else + +#ifndef __stdarg_h +#define __stdarg_h + +#ifndef __va_list__ + #define __va_list__ + typedef char * va_list; // from +#endif /* __va_list__ */ + +#define __va_start(parm) (va_list) (&parm + 1) + +#define va_start(ap, parm) ap = __va_start(parm) +#define va_end(ap) + +#define va_arg(ap, type) (* (((type *) (ap += sizeof(type))) - 1) ) + +#endif /* !__stdarg_h */ +#endif /* EMULATION_LEVEL != EMULATION_NONE */ diff --git a/sdk-4/include/Core/System/Unix/unix_stdio.h b/sdk-4/include/Core/System/Unix/unix_stdio.h new file mode 100644 index 0000000..e1c1e33 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/unix_stdio.h @@ -0,0 +1,99 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_stdio.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +#ifndef __stdio_h +#define __stdio_h + +#include // Palm OS code uses this instead of + +#ifndef EOF + #define EOF -1 +#endif + +#define STDIN_FILENO sysFileDescStdIn + + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB + #define sprintf StrPrintF + #define vsprintf(x,y,z) StrVPrintF(x,(const Char *)y,z) + +#else + +#ifdef __cplusplus + extern "C" { +#endif + + int vsprintf(char *, const char *, _Va_list); + +#ifdef __cplusplus + } +#endif + +#endif + + + +// The following are macros that simply substitute an error code +// for functions which have no equivalent in the PilotOS. To +// ignore these, #define IGNORE_STDIO_STUBS ahead of this header +#ifndef IGNORE_STDIO_STUBS + +#ifndef _STDIO_H +#define stderr ((unsigned char *) - 1) +#define stdout ((unsigned char *) - 1) +#define stdin ((char *) - 1) +#endif // _STDIO_H + +#define STDOUT_FILENO -1 + +#define fclose(x) (-1) +#define fopen(x,y) (0) +#define tmpnam(x) (0) +#define S_ISREG(x) (0) + +#define fflush(x) 0 +#define fread(a,b,c,d) (0) +#define fwrite(a,b,c,d) (0) +#define ferror(x) (-1) + +#define unlink(s) (-1) +#define rmdir(x) (-1) +#define mkdir(x) (-1) +#define rename(x,y) (-1) +#define open(x,y) (-1) +#define getcwd(x,y) (0) + +#endif //IGNORE_STDIO_STUBS + + +// Function prototypes + +#ifdef __cplusplus +extern "C" { +#endif + +int sscanf(const char *, const char *, ...); + +#ifdef __cplusplus +} +#endif + + +#endif /* !__stdio_h */ diff --git a/sdk-4/include/Core/System/Unix/unix_stdlib.h b/sdk-4/include/Core/System/Unix/unix_stdlib.h new file mode 100644 index 0000000..0ac577c --- /dev/null +++ b/sdk-4/include/Core/System/Unix/unix_stdlib.h @@ -0,0 +1,35 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_stdlib.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +#ifndef __stdlib_h +#define __stdlib_h + +// The following macros are only included if we're building without the +// help of the standard ANSI C library, i.e. Native Pilot code only. +// Essentially, if you include above this header, this stuff +// does not get used. +#ifndef _STDLIB + +#define malloc(x) MemPtrNew(x) +#define calloc(x,y) MemCalloc(x,y) +#define realloc(x,y) MemRealloc(x,y) +#define free(x) MemPtrFree(x) +#define atoi(x) StrAToI(x) +#define atol(x) StrAToI(x) + +#endif + +#endif /* !__stdlib_h */ diff --git a/sdk-4/include/Core/System/Unix/unix_string.h b/sdk-4/include/Core/System/Unix/unix_string.h new file mode 100644 index 0000000..e7e7f56 --- /dev/null +++ b/sdk-4/include/Core/System/Unix/unix_string.h @@ -0,0 +1,36 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: unix_string.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * This module contains the interface definitions that are + * typically found in the unix header for use by + * Pilot applications that wish to use the sockets API calls. + * + *****************************************************************************/ + +#ifndef __string_h +#define __string_h + +#include // Palm OS code uses this instead of + +#define strcpy(x,y) StrCopy((Char*)x,(Char*)y) +#define strncpy(x,y,z) StrNCopy(x,y,z) +#define strcmp(x,y) StrCompare(x,y) +#define strcat(x,y) StrCat(x,y) +#define strlen(x) StrLen((Char*)x) +#define strchr(x,y) StrChr(x,y) +#define strstr(x,y) StrStr(x,y) + +#define memcpy(x,y,z) (MemMove(x,(void *)y,z) ? x : x) +#define memset(x,y,z) (MemSet(x,z,y)) +#define memcmp(x,y,z) (MemCmp(x,y,z)) +#define index(x,y) StrChr(x,y) + + +#endif /* !__string.h */ diff --git a/sdk-4/include/Core/System/Window.h b/sdk-4/include/Core/System/Window.h new file mode 100644 index 0000000..fdc927a --- /dev/null +++ b/sdk-4/include/Core/System/Window.h @@ -0,0 +1,601 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __WINDOW_H__ +#define __WINDOW_H__ + +#include +#include +#include +#include +#include + +#include // #define ERROR_CHECK_LEVEL + +#ifdef _WIN32 + #pragma warning(disable: 4214) // nonstandard extension used : bit field types other than int +#endif + +#define kWinVersion 3 + +// enum for WinScrollRectangle +typedef enum { winUp = 0, winDown, winLeft, winRight } WinDirectionType; + + +// enum for WinCreateOffscreenWindow +typedef enum { screenFormat = 0, genericFormat } WindowFormatType; + + +// enum for WinLockScreen +typedef enum {winLockCopy, winLockErase, winLockDontCare} WinLockInitType; + + +// operations for the WinScreenMode function +typedef enum { + winScreenModeGetDefaults, + winScreenModeGet, + winScreenModeSetToDefaults, + winScreenModeSet, + winScreenModeGetSupportedDepths, + winScreenModeGetSupportsColor +} WinScreenModeOperation; + +// Operations for the WinPalette function +#define winPaletteGet 0 +#define winPaletteSet 1 +#define winPaletteSetToDefault 2 +#define winPaletteInit 3 // for internal use only + +// transfer modes for color drawing +typedef enum {winPaint, winErase, winMask, winInvert, winOverlay, winPaintInverse, winSwap} WinDrawOperation; + + +typedef enum { blackPattern, whitePattern, grayPattern, customPattern } PatternType; +#define noPattern blackPattern +#define grayHLinePattern 0xAA +#define grayHLinePatternOdd 0x55 + + +// grayUnderline means dotted current foreground color +// solidUnderline means solid current foreground color +// colorUnderline redundant, use solidUnderline instead +typedef enum { noUnderline, grayUnderline, solidUnderline, colorUnderline } UnderlineModeType; + +#define WinMaxSupportedDepth 8 +#define WinNumSupportedColors 4 + +typedef UInt8 IndexedColorType; // 1-, 2-, 4-, or 8-bit index + +typedef UInt8 CustomPatternType [8]; // 8x8 1-bit deep pattern + +// for WinPalette startIndex value, respect indexes in passed table +#define WinUseTableIndexes -1 + +//----------------------------------------------- +// Draw state structures. +//----------------------------------------------- + + +typedef struct DrawStateType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS // These fields will not be available in the next OS release! +{ + WinDrawOperation transferMode; + PatternType pattern; + UnderlineModeType underlineMode; + FontID fontId; + FontPtr font; + CustomPatternType patternData; + + // These are only valid for indexed color bitmaps + IndexedColorType foreColor; + IndexedColorType backColor; + IndexedColorType textColor; + UInt8 reserved; + + // These are only valid for direct color bitmaps + RGBColorType foreColorRGB; + RGBColorType backColorRGB; + RGBColorType textColorRGB; +} +#endif +DrawStateType; + + +#define DrawStateStackSize 5 // enough for a control in a field in a window + + + + +//----------------------------------------------- +// The Window Structures. +//----------------------------------------------- + +typedef union FrameBitsType { + struct { + UInt16 cornerDiam : 8; // corner diameter, max 38 + UInt16 reserved_3 : 3; + UInt16 threeD : 1; // Draw 3D button + UInt16 shadowWidth : 2; // Width of shadow + UInt16 width : 2; // Width frame + } bits; + UInt16 word; // IMPORTANT: INITIALIZE word to zero before setting bits! +} FrameBitsType; + +typedef UInt16 FrameType; + +// Standard Frame Types +#define noFrame 0 +#define simpleFrame 1 +#define rectangleFrame 1 +#define simple3DFrame 0x0012 // 3d, frame = 2 +#define roundFrame 0x0401 // corner = 7, frame = 1 +#define boldRoundFrame 0x0702 // corner = 7, frame = 2 +#define popupFrame 0x0205 // corner = 2, frame = 1, shadow = 1 +#define dialogFrame 0x0302 // corner = 3, frame = 2 +#define menuFrame popupFrame + + +#define winDefaultDepthFlag 0xFF + +typedef struct WindowFlagsType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS // These fields will not be available in the next OS release! +{ + 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 +WindowFlagsType; + +typedef struct WindowType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS // These fields will not be available in the next OS release! +{ + Coord displayWidthV20; // use WinGetDisplayExtent instead + Coord displayHeightV20; // use WinGetDisplayExtent instead + void * displayAddrV20; // use the drawing functions instead + WindowFlagsType windowFlags; + RectangleType windowBounds; + AbsRectType clippingBounds; + BitmapPtr bitmapP; + FrameBitsType frameType; + DrawStateType * drawStateP; // was GraphicStatePtr + struct WindowType * nextWindow; +} +#endif +WindowType; + +typedef WindowType *WinPtr; +typedef WindowType *WinHandle; + + +//----------------------------------------------- +// More graphics shapes +//----------------------------------------------- +typedef struct WinLineType { + Coord x1; + Coord y1; + Coord x2; + Coord y2; +} WinLineType; + +// Rectangles, Points defined in Rect.h + + + +//----------------------------------------------- +// Low Memory Globals +//----------------------------------------------- + +// This is the structure of a low memory global reserved for the Window Manager +// In GRAPHIC_VERSION_2, it held a single drawing state. In this version, it +// holds stack information for structures that are allocated from the dynamic heap +typedef struct GraphicStateType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS // These fields will not be available in the next OS release! +{ + DrawStateType * drawStateP; + DrawStateType * drawStateStackP; + Int16 drawStateIndex; + UInt16 unused; // was screenLockCount +} +#endif +GraphicStateType; + +// ---------------------- +// Window manager errors +// ---------------------- +#define winErrPalette (winErrorClass | 1) + + + +//----------------------------------------------- +// Macros +//----------------------------------------------- + +// For now, the window handle is a pointer to a window structure, +// this however may change, so use the following macros. + +#define WinGetWindowPointer(winHandle) ((WindowType *) winHandle) + +#define WinGetWindowHandle(winPtr) ((WinHandle) winPtr) + +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define ECWinValidateHandle(winHandle) WinValidateHandle(winHandle) +#else +#define ECWinValidateHandle(winHandle) +#endif + + + + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------- +// Routines relating to windows management +//----------------------------------------------- + +Boolean WinValidateHandle (WinHandle winHandle) + SYS_TRAP(sysTrapWinValidateHandle); + +WinHandle WinCreateWindow (const RectangleType *bounds, FrameType frame, + Boolean modal, Boolean focusable, UInt16 *error) + SYS_TRAP(sysTrapWinCreateWindow); + +WinHandle WinCreateOffscreenWindow (Coord width, Coord height, + WindowFormatType format, UInt16 *error) + SYS_TRAP(sysTrapWinCreateOffscreenWindow); + +WinHandle WinCreateBitmapWindow (BitmapType *bitmapP, UInt16 *error) + SYS_TRAP(sysTrapWinCreateBitmapWindow); + +void WinDeleteWindow (WinHandle winHandle, Boolean eraseIt) + SYS_TRAP(sysTrapWinDeleteWindow); + +void WinInitializeWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinInitializeWindow); + +void WinAddWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinAddWindow); + +void WinRemoveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinRemoveWindow); + +void WinMoveWindowAddr (WindowType *oldLocationP, WindowType *newLocationP) + SYS_TRAP(sysTrapWinMoveWindowAddr); + +void WinSetActiveWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetActiveWindow); + +WinHandle WinSetDrawWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinSetDrawWindow); + +WinHandle WinGetDrawWindow (void) + SYS_TRAP(sysTrapWinGetDrawWindow); + +WinHandle WinGetActiveWindow (void) + SYS_TRAP(sysTrapWinGetActiveWindow); + +WinHandle WinGetDisplayWindow (void) + SYS_TRAP(sysTrapWinGetDisplayWindow); + +WinHandle WinGetFirstWindow (void) + SYS_TRAP(sysTrapWinGetFirstWindow); + +void WinEnableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinEnableWindow); + +void WinDisableWindow (WinHandle winHandle) + SYS_TRAP(sysTrapWinDisableWindow); + +void WinGetWindowFrameRect (WinHandle winHandle, RectangleType *r) + SYS_TRAP(sysTrapWinGetWindowFrameRect); + +void WinDrawWindowFrame (void) + SYS_TRAP(sysTrapWinDrawWindowFrame); + +void WinEraseWindow (void) + SYS_TRAP(sysTrapWinEraseWindow); + +WinHandle WinSaveBits (const RectangleType *source, UInt16 *error) + SYS_TRAP(sysTrapWinSaveBits); + +void WinRestoreBits (WinHandle winHandle, Coord destX, Coord destY) + SYS_TRAP(sysTrapWinRestoreBits); + +void WinCopyRectangle (WinHandle srcWin, WinHandle dstWin, + const RectangleType *srcRect, Coord destX, Coord destY, WinDrawOperation mode) + SYS_TRAP(sysTrapWinCopyRectangle); + +void WinScrollRectangle (const RectangleType *rP, WinDirectionType direction, + Coord distance, RectangleType *vacatedP) + SYS_TRAP(sysTrapWinScrollRectangle); + +void WinGetDisplayExtent (Coord *extentX, Coord *extentY) + SYS_TRAP(sysTrapWinGetDisplayExtent); + +void WinGetDrawWindowBounds (RectangleType *rP) + SYS_TRAP(sysTrapWinGetDrawWindowBounds); + +void WinGetBounds (WinHandle winH, RectangleType *rP) + SYS_TRAP(sysTrapWinGetBounds); + +void WinSetBounds (WinHandle winHandle, const RectangleType *rP) + SYS_TRAP(sysTrapWinSetBounds); + +#ifdef ALLOW_OLD_API_NAMES + +#define WinGetWindowBounds(rP) (WinGetDrawWindowBounds((rP))) +#define WinSetWindowBounds(winH, rP) (WinSetBounds((winH), (rP))) + +#endif + +void WinGetWindowExtent (Coord *extentX, Coord *extentY) + SYS_TRAP(sysTrapWinGetWindowExtent); + +void WinDisplayToWindowPt (Coord *extentX, Coord *extentY) + SYS_TRAP(sysTrapWinDisplayToWindowPt); + +void WinWindowToDisplayPt (Coord *extentX, Coord *extentY) + SYS_TRAP(sysTrapWinWindowToDisplayPt); + +BitmapType *WinGetBitmap (WinHandle winHandle) + SYS_TRAP(sysTrapWinGetBitmap); + +void WinGetClip (RectangleType *rP) + SYS_TRAP(sysTrapWinGetClip); + +void WinSetClip (const RectangleType *rP) + SYS_TRAP(sysTrapWinSetClip); + +void WinResetClip (void) + SYS_TRAP(sysTrapWinResetClip); + +void WinClipRectangle (RectangleType *rP) + SYS_TRAP(sysTrapWinClipRectangle); + +Boolean WinModal (WinHandle winHandle) + SYS_TRAP(sysTrapWinModal); + +//----------------------------------------------- +// Routines to draw shapes or frames shapes +//----------------------------------------------- + +// Pixel(s) +IndexedColorType WinGetPixel (Coord x, Coord y) + SYS_TRAP(sysTrapWinGetPixel); + +Err WinGetPixelRGB (Coord x, Coord y, RGBColorType* rgbP) // Direct color version + SYS_TRAP (sysTrapWinGetPixelRGB); + +void WinPaintPixel (Coord x, Coord y) // uses drawing mode + SYS_TRAP(sysTrapWinPaintPixel); + +void WinDrawPixel (Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawPixel); + +void WinErasePixel (Coord x, Coord y) + SYS_TRAP(sysTrapWinErasePixel); + +void WinInvertPixel (Coord x, Coord y) + SYS_TRAP(sysTrapWinInvertPixel); + +void WinPaintPixels (UInt16 numPoints, PointType pts[]) + SYS_TRAP(sysTrapWinPaintPixels); + +// Line(s) +void WinPaintLines (UInt16 numLines, WinLineType lines[]) + SYS_TRAP(sysTrapWinPaintLines); + +void WinPaintLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinPaintLine); + +void WinDrawLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinDrawLine); + +void WinDrawGrayLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinDrawGrayLine); + +void WinEraseLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinEraseLine); + +void WinInvertLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinInvertLine); + +void WinFillLine (Coord x1, Coord y1, Coord x2, Coord y2) + SYS_TRAP(sysTrapWinFillLine); + + +// Rectangle +void WinPaintRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinPaintRectangle); + +void WinDrawRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinDrawRectangle); + +void WinEraseRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinEraseRectangle); + +void WinInvertRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinInvertRectangle); + +void WinFillRectangle (const RectangleType *rP, UInt16 cornerDiam) + SYS_TRAP(sysTrapWinFillRectangle); + +// Rectangle frames +void WinPaintRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinPaintRectangleFrame); + +void WinDrawRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinDrawRectangleFrame); + +void WinDrawGrayRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinDrawGrayRectangleFrame); + +void WinEraseRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinEraseRectangleFrame); + +void WinInvertRectangleFrame (FrameType frame, const RectangleType *rP) + SYS_TRAP(sysTrapWinInvertRectangleFrame); + +void WinGetFramesRectangle (FrameType frame, const RectangleType *rP, + RectangleType *obscuredRect) + SYS_TRAP(sysTrapWinGetFramesRectangle); + + +// Bitmap +void WinDrawBitmap (BitmapPtr bitmapP, Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawBitmap); + +void WinPaintBitmap (BitmapType *bitmapP, Coord x, Coord y) + SYS_TRAP(sysTrapWinPaintBitmap); + + +// Characters +void WinDrawChar (WChar theChar, Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawChar); + +void WinDrawChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawChars); + +void WinPaintChar (WChar theChar, Coord x, Coord y) + SYS_TRAP(sysTrapWinPaintChar); + +void WinPaintChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinPaintChars); + +void WinDrawInvertedChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinDrawInvertedChars); + +void WinDrawTruncChars(const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth) + SYS_TRAP(sysTrapWinDrawTruncChars); + +void WinEraseChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinEraseChars); + +void WinInvertChars (const Char *chars, Int16 len, Coord x, Coord y) + SYS_TRAP(sysTrapWinInvertChars); + +UnderlineModeType WinSetUnderlineMode (UnderlineModeType mode) + SYS_TRAP(sysTrapWinSetUnderlineMode); + + + +//----------------------------------------------- +// Routines for patterns and colors +//----------------------------------------------- + +void WinPushDrawState (void) // "save" fore, back, text color, pattern, underline mode, font + SYS_TRAP(sysTrapWinPushDrawState); + +void WinPopDrawState (void) // "restore" saved drawing variables + SYS_TRAP(sysTrapWinPopDrawState); + + +WinDrawOperation WinSetDrawMode (WinDrawOperation newMode) + SYS_TRAP(sysTrapWinSetDrawMode); + + +IndexedColorType WinSetForeColor (IndexedColorType foreColor) + SYS_TRAP(sysTrapWinSetForeColor); + +IndexedColorType WinSetBackColor (IndexedColorType backColor) + SYS_TRAP(sysTrapWinSetBackColor); + +IndexedColorType WinSetTextColor (IndexedColorType textColor) + SYS_TRAP(sysTrapWinSetTextColor); + +// Direct color versions +void WinSetForeColorRGB (const RGBColorType* newRgbP, RGBColorType* prevRgbP) + SYS_TRAP (sysTrapWinSetForeColorRGB); + +void WinSetBackColorRGB (const RGBColorType* newRgbP, RGBColorType* prevRgbP) + SYS_TRAP (sysTrapWinSetBackColorRGB); + +void WinSetTextColorRGB (const RGBColorType* newRgbP, RGBColorType* prevRgbP) + SYS_TRAP (sysTrapWinSetTextColorRGB); + +void WinGetPattern (CustomPatternType *patternP) + SYS_TRAP(sysTrapWinGetPattern); + +PatternType WinGetPatternType (void) + SYS_TRAP(sysTrapWinGetPatternType); + +void WinSetPattern (const CustomPatternType *patternP) + SYS_TRAP(sysTrapWinSetPattern); + +void WinSetPatternType (PatternType newPattern) + SYS_TRAP(sysTrapWinSetPatternType); + +Err WinPalette(UInt8 operation, Int16 startIndex, + UInt16 paletteEntries, RGBColorType *tableP) + SYS_TRAP(sysTrapWinPalette); + +IndexedColorType WinRGBToIndex(const RGBColorType *rgbP) + SYS_TRAP(sysTrapWinRGBToIndex); + +void WinIndexToRGB(IndexedColorType i, RGBColorType *rgbP) + SYS_TRAP(sysTrapWinIndexToRGB); + +// "obsolete" color call, supported for backwards compatibility +void WinSetColors(const RGBColorType *newForeColorP, RGBColorType *oldForeColorP, + const RGBColorType *newBackColorP, RGBColorType *oldBackColorP) + SYS_TRAP(sysTrapWinSetColors); + + +//----------------------------------------------- +// WinScreen functions +//----------------------------------------------- + +void WinScreenInit(void) + SYS_TRAP(sysTrapWinScreenInit); + +Err WinScreenMode(WinScreenModeOperation operation, + UInt32 *widthP, + UInt32 *heightP, + UInt32 *depthP, + Boolean *enableColorP) + SYS_TRAP(sysTrapWinScreenMode); + + +//----------------------------------------------- +// Screen tracking (double buffering) support +//----------------------------------------------- +UInt8 *WinScreenLock(WinLockInitType initMode) + SYS_TRAP(sysTrapWinScreenLock); + +void WinScreenUnlock(void) + SYS_TRAP(sysTrapWinScreenUnlock); + +#ifdef __cplusplus +} +#endif + + +#endif //__WINDOW_H__ diff --git a/sdk-4/include/Core/UI/AboutBox.h b/sdk-4/include/Core/UI/AboutBox.h new file mode 100644 index 0000000..31d13a2 --- /dev/null +++ b/sdk-4/include/Core/UI/AboutBox.h @@ -0,0 +1,38 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __ABOUTBOX_H__ +#define __ABOUTBOX_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// 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. +void AbtShowAbout (UInt32 creator) + SYS_TRAP(sysTrapAbtShowAbout); + +#ifdef __cplusplus +} +#endif + +#endif // __ABOUTBOX_H__ diff --git a/sdk-4/include/Core/UI/AttentionMgr.h b/sdk-4/include/Core/UI/AttentionMgr.h new file mode 100644 index 0000000..a126b24 --- /dev/null +++ b/sdk-4/include/Core/UI/AttentionMgr.h @@ -0,0 +1,207 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __ATTENTION_MGR_H__ +#define __ATTENTION_MGR_H__ + +#include +#include +#include +#include +#include + +/************************************************************ + * Attention Manager result codes + * (attnErrorClass is defined in ErrorBase) + *************************************************************/ +#define attnErrMemory (attnErrorClass | 1) // ran out of memory + + +/************************************************************ + * Attention Indicator bounds + *************************************************************/ +#define kAttnIndicatorLeft 0 +#define kAttnIndicatorTop 0 +#define kAttnIndicatorWidth 16 +#define 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. + *************************************************************/ +#define kAttnListMaxIconWidth 15 +#define kAttnListTextOffset 17 + + +/******************************************************************** + * Attention Manager Structures + ********************************************************************/ + +typedef UInt32 AttnFlagsType; + +#define kAttnFlagsSoundBit ((AttnFlagsType)0x0001) +#define kAttnFlagsLEDBit ((AttnFlagsType)0x0002) +#define kAttnFlagsVibrateBit ((AttnFlagsType)0x0004) +#define kAttnFlagsCustomEffectBit ((AttnFlagsType)0x0008) + // Note: More bits can be defined if/when hardware capability increases + +#define kAttnFlagsAllBits ((AttnFlagsType)0xFFFF) + + +// The following are passed to AttnGetAttention() and AttnUpdate to specify +// overrides from the user settings for an attention request. +#define kAttnFlagsUseUserSettings ((AttnFlagsType)0x00000000) + +#define kAttnFlagsAlwaysSound (kAttnFlagsSoundBit) +#define kAttnFlagsAlwaysLED (kAttnFlagsLEDBit) +#define kAttnFlagsAlwaysVibrate (kAttnFlagsVibrateBit) +#define kAttnFlagsAlwaysCustomEffect (kAttnFlagsCustomEffectBit) +#define kAttnFlagsEverything (kAttnFlagsAllBits) + +#define kAttnFlagsNoSound (kAttnFlagsSoundBit<<16) +#define kAttnFlagsNoLED (kAttnFlagsLEDBit<<16) +#define kAttnFlagsNoVibrate (kAttnFlagsVibrateBit<<16) +#define kAttnFlagsNoCustomEffect (kAttnFlagsCustomEffectBit<<16) +#define kAttnFlagsNothing (kAttnFlagsAllBits<<16) + + +// The following are used to interpret the feature. +#define kAttnFtrCreator 'attn' +#define kAttnFtrCapabilities 0 // Read to determine device capabilities and user settings. + +#define kAttnFlagsUserWantsSound (kAttnFlagsSoundBit) +#define kAttnFlagsUserWantsLED (kAttnFlagsLEDBit) +#define kAttnFlagsUserWantsVibrate (kAttnFlagsVibrateBit) +#define kAttnFlagsUserWantsCustomEffect (kAttnFlagsCustomEffectBit) // Always false +#define kAttnFlagsUserSettingsMask (kAttnFlagsAllBits) + +#define kAttnFlagsHasSound (kAttnFlagsSoundBit<<16) +#define kAttnFlagsHasLED (kAttnFlagsLEDBit<<16) +#define kAttnFlagsHasVibrate (kAttnFlagsVibrateBit<<16) +#define kAttnFlagsHasCustomEffect (kAttnFlagsCustomEffectBit<<16) // Always true +#define kAttnFlagsCapabilitiesMask (kAttnFlagsAllBits<<16) + + +typedef UInt16 AttnLevelType; + #define kAttnLevelInsistent ((AttnLevelType)0) + #define kAttnLevelSubtle ((AttnLevelType)1) + +typedef UInt16 AttnCommandType; + #define kAttnCommandDrawDetail ((AttnCommandType)1) + #define kAttnCommandDrawList ((AttnCommandType)2) + #define kAttnCommandPlaySound ((AttnCommandType)3) + #define kAttnCommandCustomEffect ((AttnCommandType)4) + #define kAttnCommandGoThere ((AttnCommandType)5) + #define kAttnCommandGotIt ((AttnCommandType)6) + #define kAttnCommandSnooze ((AttnCommandType)7) + #define kAttnCommandIterate ((AttnCommandType)8) + +typedef union AttnCommandArgsTag { + struct AttnCommandArgsDrawDetailTag{ + RectangleType bounds; + Boolean firstTime; + AttnFlagsType flags; + } drawDetail; + + struct AttnCommandArgsDrawListTag { + RectangleType bounds; + Boolean firstTime; + AttnFlagsType flags; + Boolean selected; + } drawList; + + struct AttnCommandArgsGotItTag { + Boolean dismissedByUser; + } gotIt; + + struct AttnCommandArgsIterateTag { + UInt32 iterationData; + } iterate; +} AttnCommandArgsType; + +typedef struct { + AttnCommandType command; + UInt32 userData; + AttnCommandArgsType *commandArgsP; +} AttnLaunchCodeArgsType; + +typedef Err AttnCallbackProc (AttnCommandType command, UInt32 userData, AttnCommandArgsType *commandArgsP); + +// These details go with the sysNotifyGotUsersAttention notification. +typedef struct { + AttnFlagsType flags; +} AttnNotifyDetailsType; + + +/******************************************************************** + * Public Attention Manager Routines + ********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +Err AttnGetAttention (UInt16 cardNo, LocalID dbID, UInt32 userData, + AttnCallbackProc *callbackFnP, AttnLevelType level, AttnFlagsType flags, + UInt16 nagRateInSeconds, UInt16 nagRepeatLimit) + SYS_TRAP(sysTrapAttnGetAttention); + +Boolean AttnUpdate (UInt16 cardNo, LocalID dbID, UInt32 userData, + AttnCallbackProc *callbackFnP, AttnFlagsType *flagsP, + UInt16 *nagRateInSecondsP, UInt16 *nagRepeatLimitP) + SYS_TRAP(sysTrapAttnUpdate); + +Boolean AttnForgetIt (UInt16 cardNo, LocalID dbID, UInt32 userData) + SYS_TRAP(sysTrapAttnForgetIt); + +UInt16 AttnGetCounts (UInt16 cardNo, LocalID dbID, UInt16 *insistentCountP, UInt16 *subtleCountP) + SYS_TRAP(sysTrapAttnGetCounts); + +void AttnListOpen (void) + SYS_TRAP(sysTrapAttnListOpen); + +void AttnIterate (UInt16 cardNo, LocalID dbID, UInt32 iterationData) + SYS_TRAP(sysTrapAttnIterate); + +Err AttnDoSpecialEffects(AttnFlagsType flags) + SYS_TRAP(sysTrapAttnDoSpecialEffects); + +void AttnIndicatorEnable(Boolean enableIt) + SYS_TRAP(sysTrapAttnIndicatorEnable); + +Boolean AttnIndicatorEnabled(void) + SYS_TRAP(sysTrapAttnIndicatorEnabled); + + +#ifdef __cplusplus +} +#endif + +#endif // __ATTENTION_MGR_H__ diff --git a/sdk-4/include/Core/UI/Category.h b/sdk-4/include/Core/UI/Category.h new file mode 100644 index 0000000..26c60dd --- /dev/null +++ b/sdk-4/include/Core/UI/Category.h @@ -0,0 +1,121 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __CATEGORY_H__ +#define __CATEGORY_H__ + +#include +#include + +#include +#include + +// 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. + +#define categoryHideEditCategory 10000 +#define categoryDefaultEditCategoryString 10001 + + +typedef struct AppInfoTag { + UInt16 renamedCategories; + Char categoryLabels [dmRecNumCategories] [dmCategoryLength]; + UInt8 categoryUniqIDs[dmRecNumCategories]; + UInt8 lastUniqID; // Uniq IDs generated by the device are between + // 0 - 127. Those from the PC are 128 - 255. + UInt8 padding; +} AppInfoType; + +typedef AppInfoType *AppInfoPtr; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CategoryCreateListV10 (DmOpenRef db, ListType *lst, + UInt16 currentCategory, Boolean showAll) + SYS_TRAP(sysTrapCategoryCreateListV10); + +extern void CategoryCreateList (DmOpenRef db, ListType *listP, + UInt16 currentCategory, Boolean showAll, + Boolean showUneditables, UInt8 numUneditableCategories, + UInt32 editingStrID, Boolean resizeList) + SYS_TRAP(sysTrapCategoryCreateList); + + +extern void CategoryFreeListV10 (DmOpenRef db, ListType *lst) + SYS_TRAP(sysTrapCategoryFreeListV10); + +extern void CategoryFreeList (DmOpenRef db, ListType *listP, + Boolean showAll, UInt32 editingStrID) + SYS_TRAP(sysTrapCategoryFreeList); + +extern UInt16 CategoryFind (DmOpenRef db, const Char *name) + SYS_TRAP(sysTrapCategoryFind); + +extern void CategoryGetName (DmOpenRef db, UInt16 index, Char *name) + SYS_TRAP(sysTrapCategoryGetName); + +extern Boolean CategoryEditV10 (DmOpenRef db, UInt16 *category) + SYS_TRAP(sysTrapCategoryEditV10); + +extern Boolean CategoryEditV20 (DmOpenRef db, UInt16 *category, + UInt32 titleStrID) + SYS_TRAP(sysTrapCategoryEditV20); + +extern Boolean CategoryEdit (DmOpenRef db, UInt16 *category, + UInt32 titleStrID, UInt8 numUneditableCategories) + SYS_TRAP(sysTrapCategoryEdit); + +extern Boolean CategorySelectV10 (DmOpenRef db, const FormType *frm, + UInt16 ctlID, UInt16 lstID, Boolean title, UInt16 *categoryP, + Char *categoryName) + SYS_TRAP(sysTrapCategorySelectV10); + +extern Boolean CategorySelect (DmOpenRef db, const FormType *frm, + UInt16 ctlID, UInt16 lstID, Boolean title, UInt16 *categoryP, + Char *categoryName, UInt8 numUneditableCategories, UInt32 editingStrID) + SYS_TRAP(sysTrapCategorySelect); + +extern UInt16 CategoryGetNext (DmOpenRef db, UInt16 index) + SYS_TRAP(sysTrapCategoryGetNext); + +extern void CategorySetTriggerLabel (ControlType *ctl, Char *name) + SYS_TRAP(sysTrapCategorySetTriggerLabel); + +extern void CategoryTruncateName (Char *name, UInt16 maxWidth) + SYS_TRAP(sysTrapCategoryTruncateName); + +extern void CategoryInitialize (AppInfoPtr appInfoP, UInt16 localizedAppInfoStrID) + SYS_TRAP(sysTrapCategoryInitialize); + + +extern void CategorySetName (DmOpenRef db, UInt16 index, const Char *nameP) + SYS_TRAP(sysTrapCategorySetName); + +#ifdef __cplusplus +} +#endif + +#endif // __CATEGORY_H__ diff --git a/sdk-4/include/Core/UI/Clipboard.h b/sdk-4/include/Core/UI/Clipboard.h new file mode 100644 index 0000000..fe09722 --- /dev/null +++ b/sdk-4/include/Core/UI/Clipboard.h @@ -0,0 +1,67 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __CLIPBOARD_H__ +#define __CLIPBOARD_H__ + +#include +#include + +#define numClipboardForamts 3 +#define numClipboardFormats numClipboardForamts +#define cbdMaxTextLength 1000 + + +// Clipboard standard formats +enum clipboardFormats { clipboardText, clipboardInk, clipboardBitmap }; + +typedef enum clipboardFormats ClipboardFormatType; + +typedef struct ClipboardItemTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CLIPBOARDS // These fields will not be available in the next OS release! +{ + MemHandle item; + UInt16 length; +} +#endif +ClipboardItem; + +//---------------------------------------------------------- +// Clipboard Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void ClipboardAddItem + (const ClipboardFormatType format, const void *ptr, UInt16 length) + SYS_TRAP(sysTrapClipboardAddItem); + +extern Err ClipboardAppendItem + (const ClipboardFormatType format, const void *ptr, UInt16 length) + SYS_TRAP(sysTrapClipboardAppendItem); + +extern MemHandle ClipboardGetItem (const ClipboardFormatType format, + UInt16 *length) + SYS_TRAP(sysTrapClipboardGetItem); + +#ifdef __cplusplus +} +#endif + +#endif // __CLIPBOARD_H__ diff --git a/sdk-4/include/Core/UI/Control.h b/sdk-4/include/Core/UI/Control.h new file mode 100644 index 0000000..f05e71a --- /dev/null +++ b/sdk-4/include/Core/UI/Control.h @@ -0,0 +1,206 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __CONTROL_H__ +#define __CONTROL_H__ + +#include +#include +#include +#include + +typedef struct ControlAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS // These fields will not be available in the next OS release! +{ + 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 +ControlAttrType; + + +enum controlStyles {buttonCtl, pushButtonCtl, checkboxCtl, popupTriggerCtl, + selectorTriggerCtl, repeatingButtonCtl, sliderCtl, + feedbackSliderCtl }; +typedef enum controlStyles ControlStyleType; + +enum buttonFrames {noButtonFrame, standardButtonFrame, boldButtonFrame, + rectangleButtonFrame}; +typedef enum buttonFrames ButtonFrameType; + + +typedef struct ControlType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS // These fields will not be available in the next OS release! +{ + UInt16 id; + RectangleType bounds; + Char * text; + ControlAttrType attr; + ControlStyleType style; + FontID font; + UInt8 group; + UInt8 reserved; +} +#endif +ControlType; + +typedef ControlType *ControlPtr; // 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) + +typedef struct GraphicControlType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS // These fields will not be available in the next OS release! +{ + UInt16 id; + RectangleType bounds; + DmResID bitmapID; // overlays text in ControlType + DmResID selectedBitmapID; // overlays text in ControlType + ControlAttrType attr; + ControlStyleType style; + FontID unused; + UInt8 group; + UInt8 reserved; +} +#endif +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) + +typedef struct SliderControlType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS // These fields will not be available in the next OS release! +{ + UInt16 id; + RectangleType bounds; + DmResID thumbID; // overlays text in ControlType + DmResID backgroundID; // overlays text in ControlType + ControlAttrType attr; // graphical *is* set + ControlStyleType style; // must be sliderCtl or repeatingSliderCtl + UInt8 reserved; + Int16 minValue; + Int16 maxValue; + Int16 pageSize; + Int16 value; + MemPtr activeSliderP; +} +#endif +SliderControlType; + + +//---------------------------------------------------------- +// Control Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void CtlDrawControl (ControlType *controlP) + SYS_TRAP(sysTrapCtlDrawControl); + +extern void CtlEraseControl (ControlType *controlP) + SYS_TRAP(sysTrapCtlEraseControl); + +extern void CtlHideControl (ControlType *controlP) + SYS_TRAP(sysTrapCtlHideControl); + +extern void CtlShowControl (ControlType *controlP) + SYS_TRAP(sysTrapCtlShowControl); + +extern Boolean CtlEnabled (const ControlType *controlP) + SYS_TRAP(sysTrapCtlEnabled); + +extern void CtlSetEnabled (ControlType *controlP, Boolean usable) + SYS_TRAP(sysTrapCtlSetEnabled); + +extern void CtlSetUsable (ControlType *controlP, Boolean usable) + SYS_TRAP(sysTrapCtlSetUsable); + +extern Int16 CtlGetValue (const ControlType *controlP) + SYS_TRAP(sysTrapCtlGetValue); + +extern void CtlSetValue (ControlType *controlP, Int16 newValue) + SYS_TRAP(sysTrapCtlSetValue); + +extern const Char *CtlGetLabel (const ControlType *controlP) + SYS_TRAP(sysTrapCtlGetLabel); + +extern void CtlSetLabel (ControlType *controlP, const Char *newLabel) + SYS_TRAP(sysTrapCtlSetLabel); + +extern void CtlSetGraphics (ControlType *ctlP, + DmResID newBitmapID, DmResID newSelectedBitmapID) + SYS_TRAP(sysTrapCtlSetGraphics); + +extern void CtlSetSliderValues(ControlType *ctlP, const UInt16 *minValueP, const UInt16 *maxValueP, + const UInt16 *pageSizeP, const UInt16 *valueP) + SYS_TRAP(sysTrapCtlSetSliderValues); + +extern void CtlGetSliderValues(const ControlType *ctlP, UInt16 *minValueP, UInt16 *maxValueP, + UInt16 *pageSizeP, UInt16 *valueP) + SYS_TRAP(sysTrapCtlGetSliderValues); + +extern void CtlHitControl (const ControlType *controlP) + SYS_TRAP(sysTrapCtlHitControl); + +extern Boolean CtlHandleEvent (ControlType *controlP, EventType *pEvent) + SYS_TRAP(sysTrapCtlHandleEvent); + +extern Boolean CtlValidatePointer (const ControlType *controlP) + SYS_TRAP(sysTrapCtlValidatePointer); + +extern ControlType *CtlNewControl (void **formPP, UInt16 ID, + ControlStyleType style, const Char *textP, + Coord x, Coord y, Coord width, Coord height, + FontID font, UInt8 group, Boolean leftAnchor) + SYS_TRAP(sysTrapCtlNewControl); + +extern GraphicControlType *CtlNewGraphicControl (void **formPP, UInt16 ID, + ControlStyleType style, DmResID bitmapID, DmResID selectedBitmapID, + Coord x, Coord y, Coord width, Coord height, + UInt8 group, Boolean leftAnchor) + SYS_TRAP(sysTrapCtlNewGraphicControl); + +extern SliderControlType *CtlNewSliderControl (void **formPP, UInt16 ID, + ControlStyleType style, DmResID thumbID, DmResID backgroundID, + Coord x, Coord y, Coord width, Coord height, UInt16 minValue, UInt16 maxValue, + UInt16 pageSize, UInt16 value) + SYS_TRAP(sysTrapCtlNewSliderControl); + +#ifdef __cplusplus +} +#endif + + +#endif //__CONTROL_H__ diff --git a/sdk-4/include/Core/UI/Day.h b/sdk-4/include/Core/UI/Day.h new file mode 100644 index 0000000..24d2dbd --- /dev/null +++ b/sdk-4/include/Core/UI/Day.h @@ -0,0 +1,68 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __DAY_H__ +#define __DAY_H__ + +#include +#include + +#include +#include + +typedef enum + { + selectDayByDay, // return d/m/y + selectDayByWeek, // return d/m/y with d as same day of the week + selectDayByMonth // return d/m/y with d as same day of the month + } SelectDayType; + +typedef struct DaySelectorType +{ + RectangleType bounds; + Boolean visible; + UInt8 reserved1; + Int16 visibleMonth; // month actually displayed + Int16 visibleYear; // year actually displayed + DateTimeType selected; + SelectDayType selectDayBy; + UInt8 reserved2; +} +DaySelectorType; + +typedef DaySelectorType *DaySelectorPtr; + +#ifdef __cplusplus +extern "C" { +#endif + +void DayDrawDaySelector (const DaySelectorType *selectorP) + SYS_TRAP(sysTrapDayDrawDaySelector); + +Boolean DayHandleEvent (DaySelectorType *selectorP, + const EventType *pEvent) + SYS_TRAP(sysTrapDayHandleEvent); + +void DayDrawDays (const DaySelectorType *selectorP) + SYS_TRAP(sysTrapDayDrawDays); + +#ifdef __cplusplus +} +#endif + +#endif //__DAY_H__ diff --git a/sdk-4/include/Core/UI/Event.h b/sdk-4/include/Core/UI/Event.h new file mode 100644 index 0000000..5db4ddd --- /dev/null +++ b/sdk-4/include/Core/UI/Event.h @@ -0,0 +1,347 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __EVENT_H__ +#define __EVENT_H__ + +#include +#include +#include +#include +#include +#include + + +typedef enum { + nilEvent = 0, // system level + penDownEvent, // system level + penUpEvent, // system level + penMoveEvent, // system level + keyDownEvent, // system level + winEnterEvent, // system level + winExitEvent, // system level + ctlEnterEvent, + ctlExitEvent, + ctlSelectEvent, + ctlRepeatEvent, + lstEnterEvent, + lstSelectEvent, + lstExitEvent, + popSelectEvent, + fldEnterEvent, + fldHeightChangedEvent, + fldChangedEvent, + tblEnterEvent, + tblSelectEvent, + daySelectEvent, + menuEvent, + appStopEvent = 22, // system level + frmLoadEvent, + frmOpenEvent, + frmGotoEvent, + frmUpdateEvent, + frmSaveEvent, + frmCloseEvent, + frmTitleEnterEvent, + frmTitleSelectEvent, + tblExitEvent, + sclEnterEvent, + sclExitEvent, + sclRepeatEvent, + tsmConfirmEvent = 35, // system level + tsmFepButtonEvent, // system level + tsmFepModeEvent, // system level +//DOLATER - peter: remove this: frmTitleChangedEvent, // system level + attnIndicatorEnterEvent, // for attention manager's indicator + attnIndicatorSelectEvent, // for attention manager's indicator + + // add future UI level events in this numeric space + // to save room for new system level events + menuCmdBarOpenEvent = 0x0800, + menuOpenEvent, + menuCloseEvent, + frmGadgetEnterEvent, + frmGadgetMiscEvent, + + // Equates added for library events + firstINetLibEvent = 0x1000, + firstWebLibEvent = 0x1100, + + // Changed firstUserEvent from 32767 (0x7FFF) to 0x6000 + // Enums are signed ints, so 32767 technically only allowed for ONE event. + firstUserEvent = 0x6000, + lastUserEvent = 0x7FFF +} eventsEnum; + + +// The event record. +typedef struct EventType { + eventsEnum eType; + Boolean penDown; + UInt8 tapCount; + Int16 screenX; + Int16 screenY; + union { + struct _GenericEventType generic; + struct _PenUpEventType penUp; + struct _KeyDownEventType keyDown; + struct _WinEnterEventType winEnter; + struct _WinExitEventType winExit; + struct _TSMConfirmType tsmConfirm; + struct _TSMFepButtonType tsmFepButton; + struct _TSMFepModeEventType tsmFepMode; + + struct ctlEnter { + UInt16 controlID; + struct ControlType *pControl; + } ctlEnter; + + struct ctlSelect { + UInt16 controlID; + struct ControlType *pControl; + Boolean on; + UInt8 reserved1; + UInt16 value; // used for slider controls only + } ctlSelect; + + struct ctlRepeat { + UInt16 controlID; + struct ControlType *pControl; + UInt32 time; + UInt16 value; // used for slider controls only + } ctlRepeat; + + struct ctlExit { + UInt16 controlID; + struct ControlType *pControl; + } ctlExit; + + struct fldEnter { + UInt16 fieldID; + struct FieldType *pField; + } fldEnter; + + struct fldHeightChanged { + UInt16 fieldID; + struct FieldType *pField; + Int16 newHeight; + UInt16 currentPos; + } fldHeightChanged; + + struct fldChanged { + UInt16 fieldID; + struct FieldType *pField; + } fldChanged; + + struct fldExit { + UInt16 fieldID; + struct FieldType *pField; + } fldExit; + + struct lstEnter { + UInt16 listID; + struct ListType *pList; + Int16 selection; + } lstEnter; + + struct lstExit { + UInt16 listID; + struct ListType *pList; + } lstExit; + + struct lstSelect { + UInt16 listID; + struct ListType *pList; + Int16 selection; + } lstSelect; + + struct tblEnter { + UInt16 tableID; + struct TableType *pTable; + Int16 row; + Int16 column; + } tblEnter; + + struct tblExit { + UInt16 tableID; + struct TableType *pTable; + Int16 row; + Int16 column; + } tblExit; + + struct tblSelect { + UInt16 tableID; + struct TableType *pTable; + Int16 row; + Int16 column; + } tblSelect; + + struct frmLoad { + UInt16 formID; + } frmLoad; + + struct frmOpen { + UInt16 formID; + } frmOpen; + + struct frmGoto { + UInt16 formID; + UInt16 recordNum; // index of record that contain a match + UInt16 matchPos; // postion in record of the match. + UInt16 matchLen; // length of match. + UInt16 matchFieldNum; // field number string was found int + UInt32 matchCustom; // application specific info + } frmGoto; + + struct frmClose { + UInt16 formID; + } frmClose; + + struct frmUpdate { + UInt16 formID; + UInt16 updateCode; // Application specific + } frmUpdate; + + struct frmTitleEnter { + UInt16 formID; + } frmTitleEnter; + + struct frmTitleSelect { + UInt16 formID; + } frmTitleSelect; + + struct attnIndicatorEnter { + UInt16 formID; + } attnIndicatorEnter; + + struct attnIndicatorSelect { + UInt16 formID; + } attnIndicatorSelect; + + struct daySelect { + struct DaySelectorType *pSelector; + Int16 selection; + Boolean useThisDate; + UInt8 reserved1; + } daySelect; + + struct menu { + UInt16 itemID; + } menu; + + struct popSelect { + UInt16 controlID; + struct ControlType *controlP; + UInt16 listID; + struct ListType *listP; + Int16 selection; + Int16 priorSelection; + } popSelect; + + struct sclEnter { + UInt16 scrollBarID; + struct ScrollBarType *pScrollBar; + } sclEnter; + + struct sclExit { + UInt16 scrollBarID; + struct ScrollBarType *pScrollBar; + Int16 value; + Int16 newValue; + } sclExit; + + struct sclRepeat { + UInt16 scrollBarID; + struct ScrollBarType *pScrollBar; + Int16 value; + Int16 newValue; + Int32 time; + } sclRepeat; + + struct menuCmdBarOpen { + Boolean preventFieldButtons; // set to stop the field from automatically adding cut/copy/paste + UInt8 reserved; // alignment padding + } menuCmdBarOpen; + + struct menuOpen { + UInt16 menuRscID; + //struct MenuBarType *pMenu; + Int16 cause; + } menuOpen; + + struct gadgetEnter { + UInt16 gadgetID; // must be same as gadgetMisc + struct FormGadgetType * gadgetP; // must be same as gadgetMisc + } gadgetEnter; + + struct gadgetMisc { + UInt16 gadgetID; // must be same as gadgetEnter + struct FormGadgetType * gadgetP; // must be same as gadgetEnter + UInt16 selector; + void * dataP; + } gadgetMisc; + + } data; + +} EventType; + +typedef EventType *EventPtr; + +// Evaluate to true if 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 +#define EvtKeydownIsVirtual(eventP) (((eventP)->data.keyDown.modifiers & virtualKeyMask) != 0) + +#ifdef __cplusplus +extern "C" { +#endif + +//--------------------------------------------------------------------- +// Event Functions +//--------------------------------------------------------------------- + +void EvtAddEventToQueue (const EventType *event) + SYS_TRAP(sysTrapEvtAddEventToQueue); + +void EvtAddUniqueEventToQueue(const EventType *eventP, UInt32 id, + Boolean inPlace) + SYS_TRAP(sysTrapEvtAddUniqueEventToQueue); + +void EvtCopyEvent (const EventType *source, EventType *dest) + SYS_TRAP(sysTrapEvtCopyEvent); + +void EvtGetEvent (EventType *event, Int32 timeout) + SYS_TRAP(sysTrapEvtGetEvent); + +Boolean EvtEventAvail (void) + SYS_TRAP(sysTrapEvtEventAvail); + +void EvtGetPen(Int16 *pScreenX, Int16 *pScreenY, Boolean *pPenDown) + SYS_TRAP(sysTrapEvtGetPen); + +#ifdef __cplusplus +} +#endif + + +#endif // __EVENT_H__ diff --git a/sdk-4/include/Core/UI/FatalAlert.h b/sdk-4/include/Core/UI/FatalAlert.h new file mode 100644 index 0000000..e554f99 --- /dev/null +++ b/sdk-4/include/Core/UI/FatalAlert.h @@ -0,0 +1,43 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __FATALALERT_H__ +#define __FATALALERT_H__ + +#include +#include + +// Value returned by SysFatalAlert +#define fatalReset 0 +#define fatalEnterDebugger 1 +#define fatalDoNothing 0xFFFFU + +#ifdef __cplusplus +extern "C" { +#endif + +UInt16 SysFatalAlert (const Char *msg) + SYS_TRAP(sysTrapSysFatalAlert); + +void SysFatalAlertInit (void) + SYS_TRAP(sysTrapSysFatalAlertInit); + +#ifdef __cplusplus +} +#endif + +#endif // __FATALALERT_H__ diff --git a/sdk-4/include/Core/UI/Field.h b/sdk-4/include/Core/UI/Field.h new file mode 100644 index 0000000..f11527c --- /dev/null +++ b/sdk-4/include/Core/UI/Field.h @@ -0,0 +1,293 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __FIELD_H__ +#define __FIELD_H__ + +#include + +#include +#include +#include + +#define maxFieldTextLen 0x7fff + +// default maximun number of line the a dynamicly sizing field will expand to. +// Can be changed with FldSetMaxVisibleLines +#define maxFieldLines 11 + + +// kind alignment values +enum justifications {leftAlign, centerAlign, rightAlign}; +typedef enum justifications JustificationType; + + +#define undoBufferSize 100 + +typedef enum { undoNone, undoTyping, undoBackspace, undoDelete, + undoPaste, undoCut, undoInput } UndoMode; + +typedef struct FieldUndoTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS // These fields will not be available in the next OS release! +{ + UndoMode mode; + UInt8 reserved; + UInt16 start; + UInt16 end; + UInt16 bufferLen; + Char *buffer; +} +#endif +FieldUndoType; + + +typedef struct FieldAttrTag +{ + 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 +} FieldAttrType; + +typedef FieldAttrType *FieldAttrPtr; + +typedef struct LineInfoTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS // These fields will not be available in the next OS release! +{ + UInt16 start; // position in text string of first char. + UInt16 length; // number of character in the line +} +#endif +LineInfoType; + +typedef LineInfoType *LineInfoPtr; + + +typedef struct FieldType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS // These fields will not be available in the next OS release! +{ + UInt16 id; + RectangleType rect; + FieldAttrType attr; + Char *text; // pointer to the start of text string + MemHandle textHandle; // block the contains the text string + LineInfoPtr lines; + UInt16 textLen; + UInt16 textBlockSize; + UInt16 maxChars; + UInt16 selFirstPos; + UInt16 selLastPos; + UInt16 insPtXPos; + UInt16 insPtYPos; + FontID fontID; + UInt8 maxVisibleLines; // added in 4.0 to support FldSetMaxVisibleLines +} +#endif +FieldType; + + +typedef FieldType *FieldPtr; // deprecated, use FieldType * + + +//--------------------------------------------------------------------- +// Field Functions +//--------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern void FldCopy (const FieldType *fldP) + SYS_TRAP(sysTrapFldCopy); + +extern void FldCut (FieldType *fldP) + SYS_TRAP(sysTrapFldCut); + +extern void FldDrawField (FieldType *fldP) + SYS_TRAP(sysTrapFldDrawField); + +extern void FldEraseField (FieldType *fldP) + SYS_TRAP(sysTrapFldEraseField); + +extern void FldFreeMemory (FieldType *fldP) + SYS_TRAP(sysTrapFldFreeMemory); + +extern void FldGetBounds (const FieldType *fldP, RectanglePtr rect) + SYS_TRAP(sysTrapFldGetBounds); + +extern FontID FldGetFont (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetFont); + +extern void FldGetSelection (const FieldType *fldP, UInt16 *startPosition, UInt16 *endPosition) + SYS_TRAP(sysTrapFldGetSelection); + +extern MemHandle FldGetTextHandle (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextHandle); + +extern Char * FldGetTextPtr (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextPtr); + +extern Boolean FldHandleEvent (FieldType *fldP, EventType *eventP) + SYS_TRAP(sysTrapFldHandleEvent); + +extern void FldPaste (FieldType *fldP) + SYS_TRAP(sysTrapFldPaste); + +extern void FldRecalculateField (FieldType *fldP, Boolean redraw) + SYS_TRAP(sysTrapFldRecalculateField); + +extern void FldSetBounds (FieldType *fldP, const RectangleType *rP) + SYS_TRAP(sysTrapFldSetBounds); + +extern void FldSetFont (FieldType *fldP, FontID fontID) + SYS_TRAP(sysTrapFldSetFont); + +extern void FldSetText (FieldType *fldP, MemHandle textHandle, UInt16 offset, UInt16 size) + SYS_TRAP(sysTrapFldSetText); + +extern void FldSetTextHandle (FieldType *fldP, MemHandle textHandle) + SYS_TRAP(sysTrapFldSetTextHandle); + +extern void FldSetTextPtr (FieldType *fldP, Char *textP) + SYS_TRAP(sysTrapFldSetTextPtr); + +extern void FldSetUsable (FieldType *fldP, Boolean usable) + SYS_TRAP(sysTrapFldSetUsable); + +extern void FldSetSelection (FieldType *fldP, UInt16 startPosition, UInt16 endPosition) + SYS_TRAP(sysTrapFldSetSelection); + +extern void FldGrabFocus (FieldType *fldP) + SYS_TRAP(sysTrapFldGrabFocus); + +extern void FldReleaseFocus (FieldType *fldP) + SYS_TRAP(sysTrapFldReleaseFocus); + +extern UInt16 FldGetInsPtPosition (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetInsPtPosition); + +extern void FldSetInsPtPosition (FieldType *fldP, UInt16 pos) + SYS_TRAP(sysTrapFldSetInsPtPosition); + +extern void FldSetInsertionPoint (FieldType *fldP, UInt16 pos) + SYS_TRAP(sysTrapFldSetInsertionPoint); + +extern UInt16 FldGetScrollPosition (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetScrollPosition); + +extern void FldSetScrollPosition (FieldType *fldP, UInt16 pos) + SYS_TRAP(sysTrapFldSetScrollPosition); + +extern void FldGetScrollValues (const FieldType *fldP, UInt16 *scrollPosP, + UInt16 *textHeightP, UInt16 *fieldHeightP) + SYS_TRAP(sysTrapFldGetScrollValues); + +extern UInt16 FldGetTextLength (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextLength); + +extern void FldScrollField (FieldType *fldP, UInt16 linesToScroll, WinDirectionType direction) + SYS_TRAP(sysTrapFldScrollField); + +extern Boolean FldScrollable (const FieldType *fldP, WinDirectionType direction) + SYS_TRAP(sysTrapFldScrollable); + +extern UInt16 FldGetVisibleLines (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetVisibleLines); + +extern UInt16 FldGetTextHeight (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextHeight); + +extern UInt16 FldCalcFieldHeight (const Char *chars, UInt16 maxWidth) + SYS_TRAP(sysTrapFldCalcFieldHeight); + +extern UInt16 FldWordWrap (const Char *chars, Int16 maxWidth) + SYS_TRAP(sysTrapFldWordWrap); + +extern void FldCompactText (FieldType *fldP) + SYS_TRAP(sysTrapFldCompactText); + +extern Boolean FldDirty (const FieldType *fldP) + SYS_TRAP(sysTrapFldDirty); + +extern void FldSetDirty (FieldType *fldP, Boolean dirty) + SYS_TRAP(sysTrapFldSetDirty); + +extern UInt16 FldGetMaxChars (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetMaxChars); + +extern void FldSetMaxChars (FieldType *fldP, UInt16 maxChars) + SYS_TRAP(sysTrapFldSetMaxChars); + +extern Boolean FldInsert (FieldType *fldP, const Char *insertChars, UInt16 insertLen) + SYS_TRAP(sysTrapFldInsert); + +extern void FldDelete (FieldType *fldP, UInt16 start, UInt16 end) + SYS_TRAP(sysTrapFldDelete); + +extern void FldUndo (FieldType *fldP) + SYS_TRAP(sysTrapFldUndo); + +extern UInt16 FldGetTextAllocatedSize (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetTextAllocatedSize); + +extern void FldSetTextAllocatedSize (FieldType *fldP, UInt16 allocatedSize) + SYS_TRAP(sysTrapFldSetTextAllocatedSize); + +extern void FldGetAttributes (const FieldType *fldP, FieldAttrPtr attrP) + SYS_TRAP(sysTrapFldGetAttributes); + +extern void FldSetAttributes (FieldType *fldP, const FieldAttrType *attrP) + SYS_TRAP(sysTrapFldSetAttributes); + +extern void FldSendChangeNotification (const FieldType *fldP) + SYS_TRAP(sysTrapFldSendChangeNotification); + +extern void FldSendHeightChangeNotification (const FieldType *fldP, UInt16 pos, Int16 numLines) + SYS_TRAP(sysTrapFldSendHeightChangeNotification); + +extern Boolean FldMakeFullyVisible (FieldType *fldP) + SYS_TRAP(sysTrapFldMakeFullyVisible); + +extern UInt16 FldGetNumberOfBlankLines (const FieldType *fldP) + SYS_TRAP(sysTrapFldGetNumberOfBlankLines); + +extern FieldType *FldNewField (void **formPP, UInt16 id, + Coord x, Coord y, Coord width, Coord height, + FontID font, UInt32 maxChars, Boolean editable, Boolean underlined, + Boolean singleLine, Boolean dynamicSize, JustificationType justification, + Boolean autoShift, Boolean hasScrollBar, Boolean numeric) + SYS_TRAP(sysTrapFldNewField); + +// added in 4.0 +extern void FldSetMaxVisibleLines (FieldType *fldP, UInt8 maxLines) + SYS_TRAP(sysTrapFldSetMaxVisibleLines); + +#ifdef __cplusplus +} +#endif + +#endif // __FIELD_H__ diff --git a/sdk-4/include/Core/UI/Find.h b/sdk-4/include/Core/UI/Find.h new file mode 100644 index 0000000..2594992 --- /dev/null +++ b/sdk-4/include/Core/UI/Find.h @@ -0,0 +1,131 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __FIND_H__ +#define __FIND_H__ + +#include +#include + +#include +#include + +#define maxFinds 9 +#define maxFindStrLen 16 + +typedef struct { + UInt16 appCardNo; // card number of the application + LocalID appDbID; // LocalID of the application + Boolean foundInCaller; // true if found in app that called Find + UInt8 reserved; + + UInt16 dbCardNo; // card number of the database record was found in + LocalID dbID; // LocalID of the database record was found in + UInt16 recordNum; // index of record that contain a match + UInt16 matchPos; // postion in record of the match. + UInt16 matchFieldNum; // field number + UInt32 matchCustom; // app specific data + } FindMatchType; + +typedef FindMatchType *FindMatchPtr; + +typedef struct { + + // These fields are used by the applications. + UInt16 dbAccesMode; // read mode and maybe show secret + UInt16 recordNum; // index of last record that contained a match + Boolean more; // true of more matches to display + Char strAsTyped [maxFindStrLen+1]; // search string as entered + Char strToFind [maxFindStrLen+1]; // search string is lower case + UInt8 reserved1; + + + // 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! + UInt16 numMatches; // # of matches + UInt16 lineNumber; // next line in the results tabel + Boolean continuation; // true if contining search of same app + Boolean searchedCaller; // true after we've searched app that initiated the find + + LocalID callerAppDbID; // dbID of app that initiated search + UInt16 callerAppCardNo; // cardNo of app that initiated search + + LocalID appDbID; // dbID of app that we're currently searching + UInt16 appCardNo; // card number of app that we're currently searching + + Boolean newSearch; // true for first search + UInt8 reserved2; + DmSearchStateType searchState; // search state + FindMatchType match [maxFinds]; +#else + UInt16 noAccessAllowed1; // # of matches + UInt16 lineNumber; // next line in the results tabel + Boolean continuation; // true if contining search of same app + Boolean noAccessAllowed2; // padding +#endif +} FindParamsType; + +typedef FindParamsType *FindParamsPtr; + + +// Param Block passsed with the sysAppLaunchCmdGoto Command +typedef struct { + Int16 searchStrLen; // length of search string. + UInt16 dbCardNo; // card number of the database + LocalID dbID; // LocalID of the database + UInt16 recordNum; // index of record that contain a match + UInt16 matchPos; // postion in record of the match. + UInt16 matchFieldNum; // field number string was found int + UInt32 matchCustom; // application specific info + } GoToParamsType; + +typedef GoToParamsType *GoToParamsPtr; + + +//---------------------------------------------------------- +// Find Functions +//---------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +void Find (GoToParamsPtr goToP) + SYS_TRAP(sysTrapFind); + + +Boolean FindStrInStr (Char const *strToSearch, Char const *strToFind, + UInt16 *posP) + SYS_TRAP(sysTrapFindStrInStr); + +Boolean FindSaveMatch (FindParamsPtr findParams, UInt16 recordNum, + UInt16 pos, UInt16 fieldNum, UInt32 appCustom, UInt16 cardNo, LocalID dbID) + SYS_TRAP(sysTrapFindSaveMatch); + +void FindGetLineBounds (const FindParamsType *findParams, RectanglePtr r) + SYS_TRAP(sysTrapFindGetLineBounds); + +Boolean FindDrawHeader (FindParamsPtr findParams, Char const *title) + SYS_TRAP(sysTrapFindDrawHeader); + +#ifdef __cplusplus +} +#endif + +#endif //__FIND_H__ diff --git a/sdk-4/include/Core/UI/FontSelect.h b/sdk-4/include/Core/UI/FontSelect.h new file mode 100644 index 0000000..762b165 --- /dev/null +++ b/sdk-4/include/Core/UI/FontSelect.h @@ -0,0 +1,38 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __FONTSELECT_H__ +#define __FONTSELECT_H__ + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern FontID FontSelect (FontID fontID) + SYS_TRAP(sysTrapFontSelect); + + +#ifdef __cplusplus +} +#endif + +#endif // __FONTSELECT_H__ diff --git a/sdk-4/include/Core/UI/Form.h b/sdk-4/include/Core/UI/Form.h new file mode 100644 index 0000000..0c4bf48 --- /dev/null +++ b/sdk-4/include/Core/UI/Form.h @@ -0,0 +1,579 @@ +/****************************************************************************** + * + * 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) + * + *****************************************************************************/ + +#ifndef __FORM_H__ +#define __FORM_H__ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#define noFocus 0xffff + +#define frmInvalidObjectId 0xffff +#define frmNoSelectedControl 0xff + +// Update code send as part of a frmUpdate event. +#define frmRedrawUpdateCode 0x8000 + +// Magic button IDs used by FrmCustomResponseAlert callbacks +#define frmResponseCreate 1974 +#define frmResponseQuit ((Int16) 0xBEEF) + + +// Alert constants and structures +enum alertTypes { + informationAlert, + confirmationAlert, + warningAlert, + errorAlert +}; +typedef enum alertTypes AlertType; + +typedef struct AlertTemplateTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + UInt16 alertType; + UInt16 helpRscID; + UInt16 numButtons; + UInt16 defaultButton; +} +#endif +AlertTemplateType; + + +// Types of object in a dialog box +enum formObjects { + frmFieldObj, + frmControlObj, + frmListObj, + frmTableObj, + frmBitmapObj, + frmLineObj, + frmFrameObj, + frmRectangleObj, + frmLabelObj, + frmTitleObj, + frmPopupObj, + frmGraffitiStateObj, + frmGadgetObj, + frmScrollBarObj }; +typedef enum formObjects FormObjectKind; + + +typedef struct FormObjAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + UInt16 usable :1; // Set if part of ui + UInt16 reserved :15; // pad it out +} +#endif +FormObjAttrType; + + +// Gadget support: +#define formGadgetDrawCmd 0 // paramP is unspecified +#define formGadgetEraseCmd 1 // paramP is unspecified +#define formGadgetHandleEventCmd 2 // paramP is an EventType *for the relevant event. +#define formGadgetDeleteCmd 3 // paramP is unspecified. + + +typedef struct FormGadgetAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + 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 +FormGadgetAttrType; + +struct FormType; // forward reference to FormType so we can declare the handler type: +typedef Boolean (FormGadgetHandlerType) (struct FormGadgetType *gadgetP, UInt16 cmd, void *paramP); + +typedef struct FormGadgetType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + UInt16 id; + FormGadgetAttrType attr; + RectangleType rect; + const void * data; + FormGadgetHandlerType *handler; +} +#endif +FormGadgetType; + + +// All of the smaller form objects: + +typedef struct FormBitmapTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + FormObjAttrType attr; + PointType pos; + UInt16 rscID; +} +#endif +FormBitmapType; + + +typedef struct FormLineTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + FormObjAttrType attr; + PointType point1; + PointType point2; +} +#endif +FormLineType; + + +typedef struct FormFrameTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + UInt16 id; + FormObjAttrType attr; + RectangleType rect; + UInt16 frameType; +} +#endif +FormFrameType; + + +typedef struct FormRectangleTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + FormObjAttrType attr; + RectangleType rect; +} +#endif +FormRectangleType; + + +typedef struct FormLabelTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + UInt16 id; + PointType pos; + FormObjAttrType attr; + FontID fontID; + UInt8 reserved; + Char * text; +} +#endif +FormLabelType; + + +typedef struct FormTitleTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + RectangleType rect; + Char * text; +} +#endif +FormTitleType; + + +typedef struct FormPopupTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + UInt16 controlID; + UInt16 listID; +} +#endif +FormPopupType; + + +typedef struct FormGraffitiStateTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + PointType pos; +} +#endif +FrmGraffitiStateType; + + +typedef union FormObjectTag +{ + void * ptr; + FieldType * field; + ControlType * control; + GraphicControlType * graphicControl; + SliderControlType * sliderControl; + ListType * list; + TableType * table; + FormBitmapType * bitmap; +// FormLineType * line; +// FormFrameType * frame; +// FormRectangleType * rectangle; + FormLabelType * label; + FormTitleType * title; + FormPopupType * popup; + FrmGraffitiStateType * grfState; + FormGadgetType * gadget; + ScrollBarType * scrollBar; +} +FormObjectType; + +// typedef FormObjectType *FormObjectPtr; + + +typedef struct FormObjListTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + FormObjectKind objectType; + UInt8 reserved; + FormObjectType object; +} +#endif +FormObjListType; + + +typedef struct FormAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + 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 + UInt16 reserved2; // FormAttrType now explicitly 32-bits wide. +} +#endif +FormAttrType; + + +typedef Boolean FormEventHandlerType (EventType *eventP); + +typedef FormEventHandlerType *FormEventHandlerPtr; + +typedef struct FormType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS // These fields will not be available in the next OS release! +{ + WindowType window; + UInt16 formId; + FormAttrType attr; + WinHandle bitsBehindForm; + FormEventHandlerType * handler; + UInt16 focus; + UInt16 defaultButton; + UInt16 helpRscId; + UInt16 menuRscId; + UInt16 numObjects; + FormObjListType * objects; +} +#endif +FormType; + +typedef FormType *FormPtr; + + +// 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 +typedef struct FormActiveStateType { + UInt16 data[11]; +} FormActiveStateType; + + +// FrmCustomResponseAlert callback routine prototype +typedef Boolean FormCheckResponseFuncType + (Int16 button, Char * attempt); + +typedef FormCheckResponseFuncType *FormCheckResponseFuncPtr; + + +//----------------------------------------------- +// Macros +//----------------------------------------------- + +#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL +#define ECFrmValidatePtr(formP) FrmValidatePtr(formP) +#else +#define ECFrmValidatePtr(formP) +#endif + +//-------------------------------------------------------------------- +// +// Form Function +// +//-------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern FormType * FrmInitForm (UInt16 rscID) + SYS_TRAP(sysTrapFrmInitForm); + +extern void FrmDeleteForm (FormType *formP) + SYS_TRAP(sysTrapFrmDeleteForm); + +extern void FrmDrawForm (FormType *formP) + SYS_TRAP(sysTrapFrmDrawForm); + +extern void FrmEraseForm (FormType *formP) + SYS_TRAP(sysTrapFrmEraseForm); + +extern FormType * FrmGetActiveForm (void) + SYS_TRAP(sysTrapFrmGetActiveForm); + +extern void FrmSetActiveForm (FormType *formP) + SYS_TRAP(sysTrapFrmSetActiveForm); + +extern UInt16 FrmGetActiveFormID (void) + SYS_TRAP(sysTrapFrmGetActiveFormID); + +extern FieldType* FrmGetActiveField(const FormType* formP) + SYS_TRAP(sysTrapFrmGetActiveField); + +extern Boolean FrmGetUserModifiedState (const FormType *formP) + SYS_TRAP(sysTrapFrmGetUserModifiedState); + +extern void FrmSetNotUserModified (FormType *formP) + SYS_TRAP(sysTrapFrmSetNotUserModified); + +extern UInt16 FrmGetFocus (const FormType *formP) + SYS_TRAP(sysTrapFrmGetFocus); + +extern void FrmSetFocus (FormType *formP, UInt16 fieldIndex) + SYS_TRAP(sysTrapFrmSetFocus); + +extern Boolean FrmHandleEvent (FormType *formP, EventType *eventP) + SYS_TRAP(sysTrapFrmHandleEvent); + +extern void FrmGetFormBounds (const FormType *formP, RectangleType *rP) + SYS_TRAP(sysTrapFrmGetFormBounds); + +extern WinHandle FrmGetWindowHandle (const FormType *formP) + SYS_TRAP(sysTrapFrmGetWindowHandle); + +extern UInt16 FrmGetFormId (const FormType *formP) + SYS_TRAP(sysTrapFrmGetFormId); + +extern FormType *FrmGetFormPtr (UInt16 formId) + SYS_TRAP(sysTrapFrmGetFormPtr); + +extern FormType *FrmGetFirstForm (void) + SYS_TRAP(sysTrapFrmGetFirstForm); + +extern UInt16 FrmGetNumberOfObjects (const FormType *formP) + SYS_TRAP(sysTrapFrmGetNumberOfObjects); + +extern UInt16 FrmGetObjectIndex (const FormType *formP, UInt16 objID) + SYS_TRAP(sysTrapFrmGetObjectIndex); + +extern UInt16 FrmGetObjectIndexFromPtr (const FormType *formP, void* objP) + SYS_TRAP(sysTrapFrmGetObjectIndexFromPtr); + +extern UInt16 FrmGetObjectId (const FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmGetObjectId); + +extern FormObjectKind FrmGetObjectType (const FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmGetObjectType); + +extern void *FrmGetObjectPtr (const FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmGetObjectPtr); + +extern void FrmGetObjectBounds (const FormType *formP, UInt16 objIndex, + RectangleType *rP) + SYS_TRAP(sysTrapFrmGetObjectBounds); + +extern void FrmHideObject (FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmHideObject); + +extern void FrmShowObject (FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmShowObject); + +extern void FrmGetObjectPosition (const FormType *formP, UInt16 objIndex, + Coord *x, Coord *y) + SYS_TRAP(sysTrapFrmGetObjectPosition); + +extern void FrmSetObjectPosition (FormType *formP, UInt16 objIndex, + Coord x, Coord y) + SYS_TRAP(sysTrapFrmSetObjectPosition); + +extern void FrmSetObjectBounds (FormType *formP, UInt16 objIndex, + const RectangleType *bounds) + SYS_TRAP(sysTrapFrmSetObjectBounds); + +extern Int16 FrmGetControlValue (const FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmGetControlValue); + +extern void FrmSetControlValue (const FormType *formP, UInt16 objIndex, + Int16 newValue) + SYS_TRAP(sysTrapFrmSetControlValue); + +extern UInt16 FrmGetControlGroupSelection (const FormType *formP, + UInt8 groupNum) + SYS_TRAP(sysTrapFrmGetControlGroupSelection); + +extern void FrmSetControlGroupSelection (const FormType *formP, + UInt8 groupNum, UInt16 controlID) + SYS_TRAP(sysTrapFrmSetControlGroupSelection); + +extern void FrmCopyLabel (FormType *formP, UInt16 labelID, + const Char *newLabel) + SYS_TRAP(sysTrapFrmCopyLabel); + +extern const Char *FrmGetLabel (const FormType *formP, UInt16 labelID) + SYS_TRAP(sysTrapFrmGetLabel); + +extern void FrmSetCategoryLabel (const FormType *formP, UInt16 objIndex, + Char *newLabel) + SYS_TRAP(sysTrapFrmSetCategoryLabel); + +extern const Char *FrmGetTitle (const FormType *formP) + SYS_TRAP(sysTrapFrmGetTitle); + +extern void FrmSetTitle (FormType *formP, Char *newTitle) + SYS_TRAP(sysTrapFrmSetTitle); + +extern void FrmCopyTitle (FormType *formP, const Char *newTitle) + SYS_TRAP(sysTrapFrmCopyTitle); + +extern void *FrmGetGadgetData (const FormType *formP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmGetGadgetData); + +extern void FrmSetGadgetData (FormType *formP, UInt16 objIndex, + const void *data) + SYS_TRAP(sysTrapFrmSetGadgetData); + +extern void FrmSetGadgetHandler (FormType *formP, UInt16 objIndex, + FormGadgetHandlerType *attrP) + SYS_TRAP(sysTrapFrmSetGadgetHandler); + +extern UInt16 FrmDoDialog (FormType *formP) + SYS_TRAP(sysTrapFrmDoDialog); + +extern UInt16 FrmAlert (UInt16 alertId) + SYS_TRAP(sysTrapFrmAlert); + +extern UInt16 FrmCustomAlert (UInt16 alertId, const Char *s1, + const Char *s2, const Char *s3) + SYS_TRAP(sysTrapFrmCustomAlert); + +extern void FrmHelp (UInt16 helpMsgId) + SYS_TRAP(sysTrapFrmHelp); + +extern void FrmUpdateScrollers (FormType *formP, UInt16 upIndex, + UInt16 downIndex, Boolean scrollableUp, Boolean scrollableDown) + SYS_TRAP(sysTrapFrmUpdateScrollers); + +extern Boolean FrmVisible (const FormType *formP) + SYS_TRAP(sysTrapFrmVisible); + +extern void FrmSetEventHandler (FormType *formP, FormEventHandlerType *handler) + SYS_TRAP(sysTrapFrmSetEventHandler); + +extern Boolean FrmDispatchEvent (EventType *eventP) + SYS_TRAP(sysTrapFrmDispatchEvent); + + + + +extern void FrmPopupForm (UInt16 formId) + SYS_TRAP(sysTrapFrmPopupForm); + +extern void FrmGotoForm (UInt16 formId) + SYS_TRAP(sysTrapFrmGotoForm); + +extern void FrmUpdateForm (UInt16 formId, UInt16 updateCode) + SYS_TRAP(sysTrapFrmUpdateForm); + +extern void FrmReturnToForm (UInt16 formId) + SYS_TRAP(sysTrapFrmReturnToForm); + +extern void FrmCloseAllForms (void) + SYS_TRAP(sysTrapFrmCloseAllForms); + +extern void FrmSaveAllForms (void) + SYS_TRAP(sysTrapFrmSaveAllForms); + + + +extern Boolean FrmPointInTitle (const FormType *formP, Coord x, Coord y) + SYS_TRAP(sysTrapFrmPointInTitle); + +extern void FrmSetMenu (FormType *formP, UInt16 menuRscID) + SYS_TRAP(sysTrapFrmSetMenu); + +extern Boolean FrmValidatePtr (const FormType *formP) + SYS_TRAP(sysTrapFrmValidatePtr); + +extern Err FrmAddSpaceForObject (FormType **formPP, MemPtr *objectPP, + FormObjectKind objectKind, UInt16 objectSize) + SYS_TRAP(sysTrapFrmAddSpaceForObject); + +extern Err FrmRemoveObject (FormType **formPP, UInt16 objIndex) + SYS_TRAP(sysTrapFrmRemoveObject); + +extern FormType *FrmNewForm (UInt16 formID, const Char *titleStrP, + Coord x, Coord y, Coord width, Coord height, Boolean modal, + UInt16 defaultButton, UInt16 helpRscID, UInt16 menuRscID) + SYS_TRAP(sysTrapFrmNewForm); + +extern FormLabelType *FrmNewLabel (FormType **formPP, UInt16 ID, const Char *textP, + Coord x, Coord y, FontID font) + SYS_TRAP(sysTrapFrmNewLabel); + +extern FormBitmapType *FrmNewBitmap (FormType **formPP, UInt16 ID, + UInt16 rscID, Coord x, Coord y) + SYS_TRAP(sysTrapFrmNewBitmap); + +extern FormGadgetType *FrmNewGadget (FormType **formPP, UInt16 id, + Coord x, Coord y, Coord width, Coord height) + SYS_TRAP(sysTrapFrmNewGadget); + +extern Err FrmActiveState (FormActiveStateType *stateP, Boolean save) + SYS_TRAP(sysTrapFrmActiveState); + +extern UInt16 FrmCustomResponseAlert (UInt16 alertId, const Char *s1, const Char *s2, + const Char *s3, Char *entryStringBuf, Int16 entryStringBufLength, + FormCheckResponseFuncPtr callback) + SYS_TRAP(sysTrapFrmCustomResponseAlert); + +extern FrmGraffitiStateType *FrmNewGsi (FormType **formPP, Coord x, Coord y) + SYS_TRAP(sysTrapFrmNewGsi); + +#define FrmSaveActiveState(stateP) FrmActiveState(stateP, true) +#define FrmRestoreActiveState(stateP) FrmActiveState(stateP, false) + + + +#ifdef __cplusplus +} +#endif + +#endif // __FORM_H__ diff --git a/sdk-4/include/Core/UI/GraffitiReference.h b/sdk-4/include/Core/UI/GraffitiReference.h new file mode 100644 index 0000000..f9d4d2c --- /dev/null +++ b/sdk-4/include/Core/UI/GraffitiReference.h @@ -0,0 +1,54 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __GRAFFITIREFERENCE_H__ +#define __GRAFFITIREFERENCE_H__ + +#include +#include + +typedef enum + { + referenceDefault = 0xff // based on graffiti mode + } ReferenceType; + +/************************************************************ + * Graffiti Reference procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef BUILDING_GRAFFITI_EXT +#define GRF_TRAP(x) +#else +#define GRF_TRAP SYS_TRAP +#endif + + +extern void SysGraffitiReferenceDialog (ReferenceType referenceType) + GRF_TRAP(sysTrapSysGraffitiReferenceDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __GRAFFITIREFERENCE_H__ diff --git a/sdk-4/include/Core/UI/GraffitiShift.h b/sdk-4/include/Core/UI/GraffitiShift.h new file mode 100644 index 0000000..5868c50 --- /dev/null +++ b/sdk-4/include/Core/UI/GraffitiShift.h @@ -0,0 +1,63 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __GRAFFITISHIFT_H__ +#define __GRAFFITISHIFT_H__ + +#include +#include + +// Graffiti lock flags +#define glfCapsLock 0x01 +#define glfNumLock 0x02 + + +typedef enum { gsiShiftNone, // no indicator + gsiNumLock, // numeric lock + gsiCapsLock, // capital lock + gsiShiftPunctuation, // punctuation shift + gsiShiftExtended, // extented punctuation shift + gsiShiftUpper, // alpha upper case shift + gsiShiftLower // alpha lower case + } GsiShiftState; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void GsiInitialize (void) + SYS_TRAP(sysTrapGsiInitialize); + +extern void GsiSetLocation (const Int16 x, const Int16 y) + SYS_TRAP(sysTrapGsiSetLocation); + +extern void GsiEnable (const Boolean enableIt) + SYS_TRAP(sysTrapGsiEnable); + +extern Boolean GsiEnabled (void) + SYS_TRAP(sysTrapGsiEnabled); + +extern void GsiSetShiftState (const UInt16 lockFlags, const UInt16 tempShift) + SYS_TRAP(sysTrapGsiSetShiftState); + +#ifdef __cplusplus +} +#endif + +#endif //__GRAFFITISHIFT_H__ diff --git a/sdk-4/include/Core/UI/InsPoint.h b/sdk-4/include/Core/UI/InsPoint.h new file mode 100644 index 0000000..f97ca10 --- /dev/null +++ b/sdk-4/include/Core/UI/InsPoint.h @@ -0,0 +1,60 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __INSPOINT_H__ +#define __INSPOINT_H__ + +#include +#include + +// Blink interval is half of a second +#define insPtBlinkInterval (sysTicksPerSecond / 2) +#define insPtWidth 2 + +#ifdef __cplusplus +extern "C" { +#endif + +extern void InsPtInitialize (void) + SYS_TRAP(sysTrapInsPtInitialize); + +extern void InsPtSetLocation (const Int16 x, const Int16 y) + SYS_TRAP(sysTrapInsPtSetLocation); + +extern void InsPtGetLocation (Int16 *x, Int16 *y) + SYS_TRAP(sysTrapInsPtGetLocation); + +extern void InsPtEnable (Boolean enableIt) + SYS_TRAP(sysTrapInsPtEnable); + +extern Boolean InsPtEnabled (void) + SYS_TRAP(sysTrapInsPtEnabled); + +extern void InsPtSetHeight (const Int16 height) + SYS_TRAP(sysTrapInsPtSetHeight); + +extern Int16 InsPtGetHeight (void) + SYS_TRAP(sysTrapInsPtGetHeight); + +extern void InsPtCheckBlink (void) + SYS_TRAP(sysTrapInsPtCheckBlink); + +#ifdef __cplusplus +} +#endif + +#endif //__INSPOINT_H__ diff --git a/sdk-4/include/Core/UI/Keyboard.h b/sdk-4/include/Core/UI/Keyboard.h new file mode 100644 index 0000000..885ab99 --- /dev/null +++ b/sdk-4/include/Core/UI/Keyboard.h @@ -0,0 +1,114 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __KEYBOARD_H__ +#define __KEYBOARD_H__ + +#include +#include + +#include // for EventType +#include // for PointType + + +#define kbdReturnKey linefeedChr +#define kbdTabKey tabChr +#define kbdBackspaceKey backspaceChr +#define kbdShiftKey 2 +#define kbdCapsKey 1 +#define kbdNoKey 0xff + + +typedef enum + { + kbdAlpha = 0, + kbdNumbersAndPunc = 1, + kbdAccent = 2, + kbdDefault = 0xff // based on graffiti mode (usually alphaKeyboard) + } KeyboardType; + + +typedef struct KeyboardStatus KeyboardStatus; + +// Shift state flags +#define KeyboardShiftFlag 0x0001 +#define KeyboardCapslockFlag 0x0002 + + +/************************************************************ + * Keyboard procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// 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. + +extern void SysKeyboardDialogV10 () + SYS_TRAP(sysTrapSysKeyboardDialogV10); + +extern void SysKeyboardDialog (KeyboardType kbd) + SYS_TRAP(sysTrapSysKeyboardDialog); + + +KeyboardStatus *KeyboardStatusNew(UInt16 keyboardID) + SYS_TRAP(sysTrapKeyboardStatusNew); + +void KeyboardStatusFree(KeyboardStatus *ks) + SYS_TRAP(sysTrapKeyboardStatusFree); + + +void KbdSetLayout(KeyboardStatus *ks, UInt16 layout) + SYS_TRAP(sysTrapKbdSetLayout); + +UInt16 KbdGetLayout(const KeyboardStatus *ks) + SYS_TRAP(sysTrapKbdGetLayout); + + +void KbdSetPosition(KeyboardStatus *ks, const PointType *p) + SYS_TRAP(sysTrapKbdSetPosition); + +void KbdGetPosition(const KeyboardStatus *ks, PointType *p) + SYS_TRAP(sysTrapKbdGetPosition); + + +void KbdSetShiftState(KeyboardStatus *ks, UInt16 shiftState) + SYS_TRAP(sysTrapKbdSetShiftState); + +UInt16 KbdGetShiftState(const KeyboardStatus *ks) + SYS_TRAP(sysTrapKbdGetShiftState); + + +void KbdDraw(KeyboardStatus *ks, Boolean keyTopsOnly, Boolean ignoreModifiers) + SYS_TRAP(sysTrapKbdDraw); + +void KbdErase(KeyboardStatus *ks) + SYS_TRAP(sysTrapKbdErase); + + +Boolean KbdHandleEvent(KeyboardStatus *ks, EventType * pEvent) + SYS_TRAP(sysTrapKbdHandleEvent); + + +#ifdef __cplusplus +} +#endif + +#endif // __KEYBOARD_H__ diff --git a/sdk-4/include/Core/UI/Launcher.h b/sdk-4/include/Core/UI/Launcher.h new file mode 100644 index 0000000..ed15a36 --- /dev/null +++ b/sdk-4/include/Core/UI/Launcher.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __LAUNCHER_H__ +#define __LAUNCHER_H__ + +#include +#include + + +/************************************************************ + * Launcher procedures + *************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +// We're leaving the trap in place for now, but it just does a SysUIAppSwitch to +// launch the real launcher. --Bob 21-Jul-00 + +void SysAppLauncherDialog() + SYS_TRAP(sysTrapSysAppLauncherDialog); + + +#ifdef __cplusplus +} +#endif + +#endif // __LAUNCHER_H__ diff --git a/sdk-4/include/Core/UI/List.h b/sdk-4/include/Core/UI/List.h new file mode 100644 index 0000000..ffdac5e --- /dev/null +++ b/sdk-4/include/Core/UI/List.h @@ -0,0 +1,146 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __LIST_H__ +#define __LIST_H__ + +#include +#include + +#include + +#define noListSelection -1 + +//------------------------------------------------------------------- +// List structures +//------------------------------------------------------------------- + +typedef struct ListAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_LISTS // These fields will not be available in the next OS release! +{ + 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 :10; // reserved for future use +} +#endif +ListAttrType; + + +// Load data callback routine prototype +typedef void ListDrawDataFuncType (Int16 itemNum, RectangleType *bounds, + Char **itemsText); + +typedef ListDrawDataFuncType *ListDrawDataFuncPtr; + + +typedef struct ListType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_LISTS // These fields will not be available in the next OS release! +{ + UInt16 id; + RectangleType bounds; + ListAttrType attr; + Char * *itemsText; + Int16 numItems; // number of choices in the list + Int16 currentItem; // currently display choice + Int16 topItem; // top item visible when poped up + FontID font; // font used to draw list + UInt8 reserved; + WinHandle popupWin; // used only by popup lists + ListDrawDataFuncPtr drawItemsCallback; // 0 indicates no function +} +#endif +ListType; + +typedef ListType *ListPtr; + + +//------------------------------------------------------------------- +// List routines +//------------------------------------------------------------------- +#ifdef __cplusplus +extern "C" { +#endif + +extern void LstDrawList (ListType *listP) + SYS_TRAP(sysTrapLstDrawList); + +extern void LstEraseList (ListType *listP) + SYS_TRAP(sysTrapLstEraseList); + +extern Int16 LstGetSelection (const ListType *listP) + SYS_TRAP(sysTrapLstGetSelection); + +extern Char * LstGetSelectionText (const ListType *listP, Int16 itemNum) + SYS_TRAP(sysTrapLstGetSelectionText); + +extern Boolean LstHandleEvent (ListType *listP, const EventType *eventP) + SYS_TRAP(sysTrapLstHandleEvent); + +extern void LstSetHeight (ListType *listP, Int16 visibleItems) + SYS_TRAP(sysTrapLstSetHeight); + +extern void LstSetPosition (ListType *listP, Coord x, Coord y) + SYS_TRAP(sysTrapLstSetPosition); + +extern void LstSetSelection (ListType *listP, Int16 itemNum) + SYS_TRAP(sysTrapLstSetSelection); + +extern void LstSetListChoices (ListType *listP, Char **itemsText, Int16 numItems) + SYS_TRAP(sysTrapLstSetListChoices); + +extern void LstSetDrawFunction (ListType *listP, ListDrawDataFuncPtr func) + SYS_TRAP(sysTrapLstSetDrawFunction); + +extern void LstSetTopItem (ListType *listP, Int16 itemNum) + SYS_TRAP(sysTrapLstSetTopItem); + +extern void LstMakeItemVisible (ListType *listP, Int16 itemNum) + SYS_TRAP(sysTrapLstMakeItemVisible); + +extern Int16 LstGetNumberOfItems (const ListType *listP) + SYS_TRAP(sysTrapLstGetNumberOfItems); + +extern Int16 LstPopupList (ListType *listP) + SYS_TRAP(sysTrapLstPopupList); + +extern Boolean LstScrollList(ListType *listP, WinDirectionType direction, Int16 itemCount) + SYS_TRAP(sysTrapLstScrollList); + +extern Int16 LstGetVisibleItems (const ListType *listP) + SYS_TRAP(sysTrapLstGetVisibleItems); + +extern Err LstNewList (void **formPP, UInt16 id, + Coord x, Coord y, Coord width, Coord height, + FontID font, Int16 visibleItems, Int16 triggerId) + SYS_TRAP(sysTrapLstNewList); + +extern Int16 LstGetTopItem (const ListType *listP) + SYS_TRAP(sysTrapLstGetTopItem); + + +#ifdef __cplusplus +} +#endif + +#endif // __LIST_H__ diff --git a/sdk-4/include/Core/UI/Menu.h b/sdk-4/include/Core/UI/Menu.h new file mode 100644 index 0000000..25f3003 --- /dev/null +++ b/sdk-4/include/Core/UI/Menu.h @@ -0,0 +1,217 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __MENU_H__ +#define __MENU_H__ + +#include +#include + +#include +#include +#include + +// Errors returned by Menu routines + +#define menuErrNoMenu (menuErrorClass | 1) +#define menuErrNotFound (menuErrorClass | 2) +#define menuErrSameId (menuErrorClass | 3) +#define menuErrTooManyItems (menuErrorClass | 4) +#define menuErrOutOfMemory (menuErrorClass | 5) + + +// Command bar structures + +typedef enum { + menuCmdBarResultNone, // send nothing (this'd be quite unusual but is allowed) + menuCmdBarResultChar, // char to send (with commandKeyMask bit set) + menuCmdBarResultMenuItem, // id of the menu item + menuCmdBarResultNotify // Nofication Manager notification type +} MenuCmdBarResultType; + +// maximum length of the prompt string to display in the command bar +#define menuCmdBarMaxTextLength 20 + +typedef struct MenuCmdBarButtonTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS // These fields will not be available in the next OS release! +{ + UInt16 bitmapId; + Char name[menuCmdBarMaxTextLength]; + MenuCmdBarResultType resultType; + UInt8 reserved; // alignment padding + UInt32 result; +} +#endif +MenuCmdBarButtonType; + +typedef struct MenuCmdBarType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS // These fields will not be available in the next OS release! +{ + WinHandle bitsBehind; + Int32 timeoutTick; // tick to disappear on + Coord top; + Int16 numButtons; + Boolean insPtWasEnabled; + Boolean gsiWasEnabled; + Boolean feedbackMode; // set when just displaying confirmation feedback + MenuCmdBarButtonType * buttonsData; +} +#endif +MenuCmdBarType; + +// to tell MenuCmdBarAddButton where to add the button: on right or left. +#define menuCmdBarOnRight 0 +#define menuCmdBarOnLeft 0xff + + + +////Menu-specific + +#define noMenuSelection -1 +#define noMenuItemSelection -1 +#define separatorItemSelection -2 + +// cause codes for menuOpen Event +#define menuButtonCause 0 +#define 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. +#define MenuSeparatorChar '-' + +typedef struct MenuItemTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS // These fields will not be available in the next OS release! +{ + UInt16 id; // id of the menu item + Char command; // command key + UInt8 hidden: 1; // true if menu item is hidden + UInt8 reserved: 7; + Char * itemStr; // string to be displayed +} +#endif +MenuItemType; + + +typedef struct MenuPullDownTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS // These fields will not be available in the next OS release! +{ + WinHandle menuWin; // window of pull-down menu + RectangleType bounds; // bounds of the pulldown + WinHandle bitsBehind; // saving bits behind pull-down menu + RectangleType titleBounds; // bounds of the title in menu bar + Char * title; // menu title displayed in menu bar + UInt16 hidden: 1; // true if pulldown is hidden + UInt16 numItems: 15; // number of items in the menu + MenuItemType * items; // array of menu items +} +#endif +MenuPullDownType; + +typedef MenuPullDownType *MenuPullDownPtr; + +typedef struct MenuBarAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS // These fields will not be available in the next OS release! +{ + 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 +MenuBarAttrType; + +typedef struct MenuBarTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS // These fields will not be available in the next OS release! +{ + WinHandle barWin; // window of menu bar + WinHandle bitsBehind; // saving bits behind menu bar + WinHandle savedActiveWin; + WinHandle bitsBehindStatus; + MenuBarAttrType attr; + Int16 curMenu; // current menu or -1 if none + Int16 curItem; // current item in curMenu, -1 if none + Int32 commandTick; // + Int16 numMenus; // number of menus + MenuPullDownPtr menus; // array of menus +} +#endif +MenuBarType; + +typedef MenuBarType *MenuBarPtr; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern MenuBarType *MenuInit (UInt16 resourceId) + SYS_TRAP(sysTrapMenuInit); + +extern MenuBarType *MenuGetActiveMenu (void) + SYS_TRAP(sysTrapMenuGetActiveMenu); + +extern MenuBarType *MenuSetActiveMenu (MenuBarType *menuP) + SYS_TRAP(sysTrapMenuSetActiveMenu); + +extern void MenuDispose (MenuBarType *menuP) + SYS_TRAP(sysTrapMenuDispose); + +extern Boolean MenuHandleEvent (MenuBarType *menuP, EventType *event, UInt16 *error) + SYS_TRAP(sysTrapMenuHandleEvent); + +extern void MenuDrawMenu (MenuBarType *menuP) + SYS_TRAP(sysTrapMenuDrawMenu); + +extern void MenuEraseStatus (MenuBarType *menuP) + SYS_TRAP(sysTrapMenuEraseStatus); + +extern void MenuSetActiveMenuRscID (UInt16 resourceId) + SYS_TRAP(sysTrapMenuSetActiveMenuRscID); + +extern Err MenuCmdBarAddButton(UInt8 where, UInt16 bitmapId, + MenuCmdBarResultType resultType, UInt32 result, Char *nameP) + SYS_TRAP(sysTrapMenuCmdBarAddButton); + +extern Boolean MenuCmdBarGetButtonData(Int16 buttonIndex, UInt16 *bitmapIdP, + MenuCmdBarResultType *resultTypeP, UInt32 *resultP, Char *nameP) + SYS_TRAP(sysTrapMenuCmdBarGetButtonData); + +extern void MenuCmdBarDisplay (void) + SYS_TRAP(sysTrapMenuCmdBarDisplay); + +extern Boolean MenuShowItem(UInt16 id) + SYS_TRAP(sysTrapMenuShowItem); + +extern Boolean MenuHideItem(UInt16 id) + SYS_TRAP(sysTrapMenuHideItem); + +extern Err MenuAddItem(UInt16 positionId, UInt16 id, Char cmd, const Char *textP) + SYS_TRAP(sysTrapMenuAddItem); + + + +#ifdef __cplusplus +} +#endif + +#endif //__MENU_H__ diff --git a/sdk-4/include/Core/UI/PhoneLookup.h b/sdk-4/include/Core/UI/PhoneLookup.h new file mode 100644 index 0000000..559dd12 --- /dev/null +++ b/sdk-4/include/Core/UI/PhoneLookup.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __PHONE_LOOKUP_H__ +#define __PHONE_LOOKUP_H__ + +#include +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern void PhoneNumberLookup (FieldType *fldP) + SYS_TRAP(sysTrapPhoneNumberLookup); + +extern void PhoneNumberLookupCustom (FieldType *fldP, AddrLookupParamsType* params, Boolean useClipboard) + SYS_TRAP(sysTrapPhoneNumberLookupCustom); + +#ifdef __cplusplus +} +#endif + + +#endif // __PHONE_LOOKUP_H__ diff --git a/sdk-4/include/Core/UI/PrivateRecords.h b/sdk-4/include/Core/UI/PrivateRecords.h new file mode 100644 index 0000000..80ac398 --- /dev/null +++ b/sdk-4/include/Core/UI/PrivateRecords.h @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __PRIVATERECORDS_H__ +#define __PRIVATERECORDS_H__ + +#include + +// Defines needed for hidden record visual determination. +typedef enum privateRecordViewEnum { +showPrivateRecords = 0x00, +maskPrivateRecords, +hidePrivateRecords +} privateRecordViewEnum; + +//----------------------------------------------------------------------- +// Prototypes +//----------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +extern privateRecordViewEnum SecSelectViewStatus (void) + SYS_TRAP(sysTrapSecSelectViewStatus); + +extern Boolean SecVerifyPW (privateRecordViewEnum newSecLevel) + SYS_TRAP(sysTrapSecVerifyPW); + +#ifdef __cplusplus +} +#endif + +#endif //__PRIVATERECORDS_H__ diff --git a/sdk-4/include/Core/UI/Progress.h b/sdk-4/include/Core/UI/Progress.h new file mode 100644 index 0000000..dbb1f70 --- /dev/null +++ b/sdk-4/include/Core/UI/Progress.h @@ -0,0 +1,250 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __PROGRESS_H__ +#define __PROGRESS_H__ + +#include // Basic types +#include // Trap Numbers. + +#include +#include +#include + + +#define progressMaxMessage 128 +#define progressMaxTitle 31 // max size for title of progress dialog +#define 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... +typedef struct +{ + UInt16 stage; // <= current stage + Char *textP; // => buffer to hold text to display + UInt16 textLen; // <= length of text buffer + Char *message; // <= additional text for display + Err error; // <= current error + UInt16 bitmapId; // => resource ID of bitmap to display + 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 + UInt32 timeout; // <> timeout in ticks to force next update (for animation) + + //progress bar info (Not Implemented) + UInt32 barMaxValue; // the maximum value for the progress bar, if = 0 then the bar is + // not visible + UInt32 barCurValue; // the current value of the progress bar, the bar will be drawn + // filled the percentage of maxValue \ value + Char *barMessage; // additional text for display below the progress bar. + UInt16 barFlags; // reserved for future use. + + // + // *** The following fields were added in PalmOS 3.2 *** + // + + UInt16 delay:1; // => if true delay 1 second after updating form icon/msg + void * userDataP; // <= context pointer that caller passed to PrgStartDialog + +} PrgCallbackData, *PrgCallbackDataPtr; + +//typedef Boolean (*PrgCallbackFunc) (UInt16 stage,Boolean showDetails,Char *message,Boolean cancel,UInt16 error,Char *textP, UInt16 maxtextLen,UInt16 *bitmapID); +typedef Boolean (*PrgCallbackFunc) (PrgCallbackDataPtr cbP); + + + +//--------------------------------------------------------------------------- +// 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. +//--------------------------------------------------------------------------- + + +typedef struct { + +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_PROGRESS + // This field contains a pointer to the open progress dialog + FormPtr frmP; // 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 + UInt32 timeout; // max time to wait in ticks + + + // 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. + UInt16 error; // 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. + UInt16 stage; // 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(). + Char message[progressMaxMessage+1]; // connection stage message. + + UInt8 reserved1; + + // Used to cache current icon number so we don't unnecessarily redraw it + UInt16 lastBitmapID; + + // 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. + Char ctlLabel[progressMaxButtonText+1]; + + Char * serviceNameP; + + //progress bar stuff (Not implemented) + UInt32 lastBarMaxValue; + UInt32 lastBarCurValue; + + // stuff for saving old window state + WinHandle oldDrawWinH; + WinHandle oldActiveWinH; + FormPtr oldFrmP; + Boolean oldInsPtState; + UInt8 reserved2; + PointType oldInsPtPos; + + PrgCallbackFunc textCallback; + + char title[progressMaxTitle+1]; + + // + // *** The following field was added in PalmOS 3.2 *** + // + + void *userDataP; + +#else + UInt32 opaque1; + UInt32 opaque2; + + 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. + UInt16 error; // 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. + UInt16 stage; // which stage of the connection we're in +#endif + + } ProgressType, *ProgressPtr; + +// 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 +#define PrgUserCancel(prgP) (prgP)->cancel + +//----------------------------------------------------------------------- +// Prototypes +//----------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +ProgressPtr PrgStartDialogV31(const Char *title, PrgCallbackFunc textCallback) + SYS_TRAP(sysTrapPrgStartDialogV31); + +ProgressPtr PrgStartDialog(const Char *title, PrgCallbackFunc textCallback, void *userDataP) + SYS_TRAP(sysTrapPrgStartDialog); + +void PrgStopDialog(ProgressPtr prgP,Boolean force) + SYS_TRAP(sysTrapPrgStopDialog); + +void PrgUpdateDialog(ProgressPtr prgGP, UInt16 err, UInt16 stage, + const Char * messageP,Boolean updateNow) + SYS_TRAP(sysTrapPrgUpdateDialog); + +Boolean PrgHandleEvent(ProgressPtr prgGP,EventType *eventP) + SYS_TRAP(sysTrapPrgHandleEvent); + +#ifdef __cplusplus +} +#endif + +#endif //__PROGRESS_H__ diff --git a/sdk-4/include/Core/UI/ScrollBar.h b/sdk-4/include/Core/UI/ScrollBar.h new file mode 100644 index 0000000..9f3ed75 --- /dev/null +++ b/sdk-4/include/Core/UI/ScrollBar.h @@ -0,0 +1,86 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SCROLLBAR_H__ +#define __SCROLLBAR_H__ + +#include +#include + +#include +#include + +typedef enum { sclUpArrow, sclDownArrow, sclUpPage, sclDownPage, sclCar } + ScrollBarRegionType; + + +typedef struct ScrollBarAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_SCROLLBARS // These fields will not be available in the next OS release! +{ + 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 +ScrollBarAttrType; + + +typedef struct ScrollBarType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_SCROLLBARS // These fields will not be available in the next OS release! +{ + RectangleType bounds; + UInt16 id; + ScrollBarAttrType attr; + Int16 value; + Int16 minValue; + Int16 maxValue; + Int16 pageSize; + Int16 penPosInCar; + Int16 savePos; +} +#endif +ScrollBarType; + +typedef ScrollBarType *ScrollBarPtr; + +#ifdef __cplusplus +extern "C" { +#endif + +extern void SclGetScrollBar (const ScrollBarType *bar, Int16 *valueP, + Int16 *minP, Int16 *maxP, Int16 *pageSizeP) + SYS_TRAP(sysTrapSclGetScrollBar); + +extern void SclSetScrollBar (ScrollBarType *bar, Int16 value, + Int16 min, Int16 max, Int16 pageSize) + SYS_TRAP(sysTrapSclSetScrollBar); + +extern void SclDrawScrollBar (ScrollBarType *bar) + SYS_TRAP(sysTrapSclDrawScrollBar); + +extern Boolean SclHandleEvent (ScrollBarType *bar, const EventType *event) + SYS_TRAP(sysTrapSclHandleEvent); + +#ifdef __cplusplus +} +#endif + + +#endif //__SCROLLBAR_H__ diff --git a/sdk-4/include/Core/UI/SelDay.h b/sdk-4/include/Core/UI/SelDay.h new file mode 100644 index 0000000..ea5d962 --- /dev/null +++ b/sdk-4/include/Core/UI/SelDay.h @@ -0,0 +1,46 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SELDAY_H__ +#define __SELDAY_H__ + +#include +#include + +#include + +#define daySelectorMinYear firstYear +#define daySelectorMaxYear lastYear + +#ifdef __cplusplus +extern "C" { +#endif + +extern Boolean SelectDayV10 (Int16 *month, Int16 *day, Int16 *year, + const Char *title) + SYS_TRAP(sysTrapSelectDayV10); + +extern Boolean SelectDay (const SelectDayType selectDayBy, Int16 *month, + Int16 *day, Int16 *year, const Char *title) + SYS_TRAP(sysTrapSelectDay); + +#ifdef __cplusplus +} +#endif + +#endif //__SELDAY_H__ diff --git a/sdk-4/include/Core/UI/SelTime.h b/sdk-4/include/Core/UI/SelTime.h new file mode 100644 index 0000000..84ffeb8 --- /dev/null +++ b/sdk-4/include/Core/UI/SelTime.h @@ -0,0 +1,59 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SELTIME_H__ +#define __SELTIME_H__ + +#include +#include + +#include +//------------------------------------------------------------------- +// structures +//------------------------------------------------------------------- + + +typedef struct { + UInt8 hours; + UInt8 minutes; + UInt8 seconds; + UInt8 reserved; +} HMSTime; + +#ifdef __cplusplus +extern "C" { +#endif + +// This is slated to be deleted in the next version. +extern Boolean SelectTimeV33 (TimeType *startTimeP, TimeType *EndTimeP, + Boolean untimed, const Char *titleP, Int16 startOfDay) + SYS_TRAP(sysTrapSelectTimeV33); + +extern Boolean SelectTime (TimeType *startTimeP, TimeType *EndTimeP, + Boolean untimed, const Char *titleP, Int16 startOfDay, Int16 endOfDay, + Int16 startOfDisplay) + SYS_TRAP(sysTrapSelectTime); + +extern Boolean SelectOneTime(Int16 *hour, Int16 *minute, const Char *titleP) + SYS_TRAP(sysTrapSelectOneTime); + +#ifdef __cplusplus +} +#endif + +#endif // __SELTIME_H__ diff --git a/sdk-4/include/Core/UI/SelTimeZone.h b/sdk-4/include/Core/UI/SelTimeZone.h new file mode 100644 index 0000000..e02909a --- /dev/null +++ b/sdk-4/include/Core/UI/SelTimeZone.h @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __SELTIMEZONE_H__ +#define __SELTIMEZONE_H__ + +#include +#include + +#include +#include // LmLocaleType + +#ifdef __cplusplus +extern "C" { +#endif + +extern Boolean SelectTimeZone(Int16 *ioTimeZoneP, LmLocaleType* ioLocaleInTimeZoneP, + const Char *titleP, Boolean showTimes, Boolean anyLocale) + SYS_TRAP(sysTrapSelectTimeZone); + +#ifdef __cplusplus +} +#endif + +#endif // __SELTIMEZONE_H__ diff --git a/sdk-4/include/Core/UI/Table.h b/sdk-4/include/Core/UI/Table.h new file mode 100644 index 0000000..25d3269 --- /dev/null +++ b/sdk-4/include/Core/UI/Table.h @@ -0,0 +1,349 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __TABLE_H__ +#define __TABLE_H__ + +#include +#include + +#include + +//------------------------------------------------------------------- +// Table structures +//------------------------------------------------------------------- + +#define tableDefaultColumnSpacing 1 +#define tableNoteIndicatorWidth 7 +#define tableNoteIndicatorHeight 11 +#define tableMaxTextItemSize 255 // does not incude terminating null + +#define tblUnusableRow 0xffff + +// Display style of a table item +// +enum tableItemStyles { checkboxTableItem, + customTableItem, + dateTableItem, + labelTableItem, + numericTableItem, + popupTriggerTableItem, + textTableItem, + textWithNoteTableItem, + timeTableItem, + narrowTextTableItem, + tallCustomTableItem + }; +typedef enum tableItemStyles TableItemStyleType; + + +typedef struct TableItemTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES // These fields will not be available in the next OS release! +{ + TableItemStyleType itemType; + FontID fontID; // font for drawing text + Int16 intValue; + Char * ptr; +} +#endif +TableItemType; +typedef TableItemType *TableItemPtr; + + +// Draw item callback routine prototype, used only by customTableItem. +typedef void TableDrawItemFuncType + (void *tableP, Int16 row, Int16 column, RectangleType *bounds); + +typedef TableDrawItemFuncType *TableDrawItemFuncPtr; + + +// Load data callback routine prototype +typedef Err TableLoadDataFuncType + (void *tableP, Int16 row, Int16 column, Boolean editable, + MemHandle * dataH, Int16 *dataOffset, Int16 *dataSize, FieldPtr fld); + +typedef TableLoadDataFuncType *TableLoadDataFuncPtr; + + +// Save data callback routine prototype +typedef Boolean TableSaveDataFuncType + (void *tableP, Int16 row, Int16 column); + +typedef TableSaveDataFuncType *TableSaveDataFuncPtr; + +typedef struct TableColumnAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES // These fields will not be available in the next OS release! +{ + Coord width; // width in pixels + UInt16 reserved1 : 5; + UInt16 masked : 1; // if both row + column masked, draw only grey box + UInt16 editIndicator : 1; + UInt16 usable : 1; + UInt16 reserved2 : 8; + Coord spacing; // space after column + TableDrawItemFuncPtr drawCallback; + TableLoadDataFuncPtr loadDataCallback; + TableSaveDataFuncPtr saveDataCallback; +} +#endif +TableColumnAttrType; + + +typedef struct TableRowAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES // These fields will not be available in the next OS release! +{ + UInt16 id; + Coord height; // row height in pixels + UInt32 data; + + 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; + + UInt16 reserved3; +} +#endif +TableRowAttrType; + + +typedef struct TableAttrTag +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES // These fields will not be available in the next OS release! +{ + 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 +TableAttrType; + + +typedef struct TableType +#ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES // These fields will not be available in the next OS release! +{ + UInt16 id; + RectangleType bounds; + TableAttrType attr; + Int16 numColumns; + Int16 numRows; + Int16 currentRow; + Int16 currentColumn; + Int16 topRow; + TableColumnAttrType * columnAttrs; + TableRowAttrType * rowAttrs; + TableItemPtr items; + FieldType currentField; +} +#endif +TableType; + +typedef TableType *TablePtr; + + +//------------------------------------------------------------------- +// Table routines +//------------------------------------------------------------------- +#ifdef __cplusplus +extern "C" { +#endif + +extern void TblDrawTable (TableType *tableP) + SYS_TRAP(sysTrapTblDrawTable); + +extern void TblRedrawTable (TableType *tableP) + SYS_TRAP(sysTrapTblRedrawTable); + +extern void TblEraseTable (TableType *tableP) + SYS_TRAP(sysTrapTblEraseTable); + +extern Boolean TblHandleEvent (TableType *tableP, EventType *event) + SYS_TRAP(sysTrapTblHandleEvent); + +extern void TblGetItemBounds (const TableType *tableP, Int16 row, Int16 column, RectangleType *rP) + SYS_TRAP(sysTrapTblGetItemBounds); + +extern void TblSelectItem (TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblSelectItem); + +extern Int16 TblGetItemInt (const TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblGetItemInt); + +extern void TblSetItemInt (TableType *tableP, Int16 row, Int16 column, Int16 value) + SYS_TRAP(sysTrapTblSetItemInt); + +extern void TblSetItemPtr (TableType *tableP, Int16 row, Int16 column, void *value) + SYS_TRAP(sysTrapTblSetItemPtr); + +extern void TblSetItemStyle (TableType *tableP, Int16 row, Int16 column, TableItemStyleType type) + SYS_TRAP(sysTrapTblSetItemStyle); + +extern void TblUnhighlightSelection (TableType *tableP) + SYS_TRAP(sysTrapTblUnhighlightSelection); + +extern Boolean TblRowUsable (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRowUsable); + +extern void TblSetRowUsable (TableType *tableP, Int16 row, Boolean usable) + SYS_TRAP(sysTrapTblSetRowUsable); + +extern Int16 TblGetLastUsableRow (const TableType *tableP) + SYS_TRAP(sysTrapTblGetLastUsableRow); + +extern void TblSetColumnUsable (TableType *tableP, Int16 column, Boolean usable) + SYS_TRAP(sysTrapTblSetColumnUsable); + +extern void TblSetRowSelectable (TableType *tableP, Int16 row, Boolean selectable) + SYS_TRAP(sysTrapTblSetRowSelectable); + +extern Boolean TblRowSelectable (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRowSelectable); + +extern Int16 TblGetNumberOfRows (const TableType *tableP) + SYS_TRAP(sysTrapTblGetNumberOfRows); + +extern void TblSetCustomDrawProcedure (TableType *tableP, Int16 column, + TableDrawItemFuncPtr drawCallback) + SYS_TRAP(sysTrapTblSetCustomDrawProcedure); + +extern void TblSetLoadDataProcedure (TableType *tableP, Int16 column, + TableLoadDataFuncPtr loadDataCallback) + SYS_TRAP(sysTrapTblSetLoadDataProcedure); + +extern void TblSetSaveDataProcedure (TableType *tableP, Int16 column, + TableSaveDataFuncPtr saveDataCallback) + SYS_TRAP(sysTrapTblSetSaveDataProcedure); + +extern void TblGetBounds (const TableType *tableP, RectangleType *rP) + SYS_TRAP(sysTrapTblGetBounds); + +extern void TblSetBounds (TableType *tableP, const RectangleType *rP) + SYS_TRAP(sysTrapTblSetBounds); + +extern Coord TblGetRowHeight (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblGetRowHeight); + +extern void TblSetRowHeight (TableType *tableP, Int16 row, Coord height) + SYS_TRAP(sysTrapTblSetRowHeight); + +extern Coord TblGetColumnWidth (const TableType *tableP, Int16 column) + SYS_TRAP(sysTrapTblGetColumnWidth); + +extern void TblSetColumnWidth (TableType *tableP, Int16 column, Coord width) + SYS_TRAP(sysTrapTblSetColumnWidth); + +extern Coord TblGetColumnSpacing (const TableType *tableP, Int16 column) + SYS_TRAP(sysTrapTblGetColumnSpacing); + +extern void TblSetColumnSpacing (TableType *tableP, Int16 column, Coord spacing) + SYS_TRAP(sysTrapTblSetColumnSpacing); + +extern Boolean TblFindRowID (const TableType *tableP, UInt16 id, Int16 *rowP) + SYS_TRAP(sysTrapTblFindRowID); + +extern Boolean TblFindRowData (const TableType *tableP, UInt32 data, Int16 *rowP) + SYS_TRAP(sysTrapTblFindRowData); + +extern UInt16 TblGetRowID (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblGetRowID); + +extern void TblSetRowID (TableType *tableP, Int16 row, UInt16 id) + SYS_TRAP(sysTrapTblSetRowID); + +extern UInt32 TblGetRowData (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblGetRowData); + +extern void TblSetRowData (TableType *tableP, Int16 row, UInt32 data) + SYS_TRAP(sysTrapTblSetRowData); + +extern Boolean TblRowInvalid (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRowInvalid); + +extern void TblMarkRowInvalid (TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblMarkRowInvalid); + +extern void TblMarkTableInvalid (TableType *tableP) + SYS_TRAP(sysTrapTblMarkTableInvalid); + +extern Boolean TblGetSelection (const TableType *tableP, Int16 *rowP, Int16 *columnP) + SYS_TRAP(sysTrapTblGetSelection); + +extern void TblInsertRow (TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblInsertRow); + +extern void TblRemoveRow (TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRemoveRow); + +extern void TblReleaseFocus (TableType *tableP) + SYS_TRAP(sysTrapTblReleaseFocus); + +extern Boolean TblEditing (const TableType *tableP) + SYS_TRAP(sysTrapTblEditing); + +extern FieldPtr TblGetCurrentField (const TableType *tableP) + SYS_TRAP(sysTrapTblGetCurrentField); + +extern void TblGrabFocus (TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblGrabFocus); + +extern void TblSetColumnEditIndicator (TableType *tableP, Int16 column, Boolean editIndicator) + SYS_TRAP(sysTrapTblSetColumnEditIndicator); + +extern void TblSetRowStaticHeight (TableType *tableP, Int16 row, Boolean staticHeight) + SYS_TRAP(sysTrapTblSetRowStaticHeight); + +extern void TblHasScrollBar (TableType *tableP, Boolean hasScrollBar) + SYS_TRAP(sysTrapTblHasScrollBar); + +extern FontID TblGetItemFont (const TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblGetItemFont); + +extern void TblSetItemFont (TableType *tableP, Int16 row, Int16 column, FontID fontID) + SYS_TRAP(sysTrapTblSetItemFont); + +extern void *TblGetItemPtr (const TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblGetItemPtr); + +extern Boolean TblRowMasked (const TableType *tableP, Int16 row) + SYS_TRAP(sysTrapTblRowMasked); + +extern void TblSetRowMasked (TableType *tableP, Int16 row, Boolean masked) + SYS_TRAP(sysTrapTblSetRowMasked); + +extern void TblSetColumnMasked (TableType *tableP, Int16 column, Boolean masked) + SYS_TRAP(sysTrapTblSetColumnMasked); + +extern Int16 TblGetNumberOfColumns (const TableType *tableP) + SYS_TRAP(sysTrapTblGetNumberOfColumns); + +extern Int16 TblGetTopRow (const TableType *tableP) + SYS_TRAP(sysTrapTblGetTopRow); + +extern void TblSetSelection (TableType *tableP, Int16 row, Int16 column) + SYS_TRAP(sysTrapTblSetSelection); + +#ifdef __cplusplus +} +#endif + +#endif //__TABLE_H__ diff --git a/sdk-4/include/Core/UI/UIColor.h b/sdk-4/include/Core/UI/UIColor.h new file mode 100644 index 0000000..633214c --- /dev/null +++ b/sdk-4/include/Core/UI/UIColor.h @@ -0,0 +1,101 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __UICOLOR_H__ +#define __UICOLOR_H__ + +#include +#include + +#include + +typedef enum UIColorTableEntries { + UIObjectFrame = 0, + UIObjectFill, + UIObjectForeground, + UIObjectSelectedFill, + UIObjectSelectedForeground, + + UIMenuFrame, + UIMenuFill, + UIMenuForeground, + UIMenuSelectedFill, + UIMenuSelectedForeground, + + UIFieldBackground, + UIFieldText, + UIFieldTextLines, + UIFieldCaret, + UIFieldTextHighlightBackground, + UIFieldTextHighlightForeground, + UIFieldFepRawText, + UIFieldFepRawBackground, + UIFieldFepConvertedText, + UIFieldFepConvertedBackground, + UIFieldFepUnderline, + + UIFormFrame, + UIFormFill, + + UIDialogFrame, + UIDialogFill, + + UIAlertFrame, + UIAlertFill, + + UIOK, + UICaution, + UIWarning, + + UILastColorTableEntry +} UIColorTableEntries; + + + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------ +// UI Color Table Manipulation Routines +//------------------------------------------------------------ + +extern IndexedColorType UIColorGetTableEntryIndex(UIColorTableEntries which) + SYS_TRAP(sysTrapUIColorGetTableEntryIndex); + +extern void UIColorGetTableEntryRGB(UIColorTableEntries which, RGBColorType *rgbP) + SYS_TRAP(sysTrapUIColorGetTableEntryRGB); + +extern Err UIColorSetTableEntry(UIColorTableEntries which, const RGBColorType *rgbP) + SYS_TRAP(sysTrapUIColorSetTableEntry); + +extern Err UIColorPushTable(void) + SYS_TRAP(sysTrapUIColorPushTable); + +extern Err UIColorPopTable(void) + SYS_TRAP(sysTrapUIColorPopTable); + + +#ifdef __cplusplus +} +#endif + +#endif //__UICOLOR_H__ diff --git a/sdk-4/include/Core/UI/UIControls.h b/sdk-4/include/Core/UI/UIControls.h new file mode 100644 index 0000000..1411af3 --- /dev/null +++ b/sdk-4/include/Core/UI/UIControls.h @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __UICONTROLS_H__ +#define __UICONTROLS_H__ + +#include +#include + +// for UIPickColor +#define UIPickColorStartPalette 0 +#define UIPickColorStartRGB 1 + +typedef UInt16 UIPickColorStartType; + + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void UIContrastAdjust() + SYS_TRAP(sysTrapUIContrastAdjust); + +extern void UIBrightnessAdjust() + SYS_TRAP(sysTrapUIBrightnessAdjust); + +Boolean UIPickColor(IndexedColorType *indexP, RGBColorType *rgbP, + UIPickColorStartType start, const Char *titleP, + const Char *tipP) + SYS_TRAP(sysTrapUIPickColor); + + +#ifdef __cplusplus +} +#endif + +#endif // __UICONTROLS_H__ diff --git a/sdk-4/include/Core/UI/UIPublic.h b/sdk-4/include/Core/UI/UIPublic.h new file mode 100644 index 0000000..78a594d --- /dev/null +++ b/sdk-4/include/Core/UI/UIPublic.h @@ -0,0 +1,56 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: UIPublic.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Group file, include this to get all public UI includes. + * + * History: + * 7/13/99 Created by Bob Ebert + * mm/dd/yy initials - brief revision comment + * + *****************************************************************************/ + +#ifndef __UIPUBLIC_H__ +#define __UIPUBLIC_H__ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // __UIPUBLIC_H__ diff --git a/sdk-4/include/Core/UI/UIResDefs.r b/sdk-4/include/Core/UI/UIResDefs.r new file mode 100644 index 0000000..fad2796 --- /dev/null +++ b/sdk-4/include/Core/UI/UIResDefs.r @@ -0,0 +1,1425 @@ +/****************************************************************************** + * + * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: UIResDefs.r + * + * Release: + * + * Description: + * Type Declarations for Rez and DeRez + * + * Currently supported types: + * tAIB, taif, tAIN, tAIS, Talt, Tbmp, tbmf, tBTN, tCBX, + * tFBM, tFLD, tFRM, tgbn, tGDT, tgpb, tgrb, tGSI, tLBL, tLST, + * tPBN, tPUL, tPUT, tREP, tSCL, tSTL, tSTR, tTBL, tTTL, tver, + * tint, xprf, silk, wrdl + * + * Note: only *all lowercase* entries are reserved. We're OK with + * the existing ones, but newly added resource types should be + * all downcased. + * + * Conditionally supported types from MPW's SysTypes.r: + * NFNT, FONT + * (If you need SysTypes.r file, include it BEFORE UIResDefs.r) + * + * Conditionally supported types from MPW's Types.r: + * ICON, MBAR, MENU, PICT + * (If you need Types.r file, include it BEFORE UIResDefs.r) + * + * Other known but unsupported types: + * tkbd (in keyboard.rsrc, created by MakeKbd.c.) + * + * Note that private resource types are defined in SystemResDefsPrv.r + * + * Usage: + * Resource files can be DeRez'ed with the following command: + * derez MyRsrcFile.rsrc UIResDefs.r >MyRezSource.r + * + * Source files can be Rez'ed with the following command: + * rez UIResDefs.r MyRezSource.r -t rsrc -c RSED -o MyRsrcFile.rsrc + * + * Padding: + * For some reason, some cstring types are defined in the ResEdit + * templates as ECST and others are CSTR. It would appear that + * Rez aligns relative to the start of the resource, which doesn't + * quite jive with ResEdit's even padded cstring type. It's not clear + * that PalmOS (RezConvert.cp for example) requires even padding. + * All of the affected strings occur at the end of the resource type. + * If the ECST's are important, these rez templates should be tweaked. + * + * History: + * 08/29/96 SCL Created + * 09/03/96 SCL Added "Unique Currency Symbol" field to "cnty" resource + * 10/25/96 SCL Changed "tFLD" resource to new 2.0 definition + * 02/07/99 SCL Added largeBoldFont (new for Palm OS v3.0) + * 10/21/98 Bob Added tgbn, tgpb, rbmf, and taif types + * 12/23/98 Bob Added tAIB and Tbmp types + * 06/29/99 CS Added tint type to support ResLoadConstant + * 06/30/99 CS Added measurementSystem field to "cnty" type, + * and added align statements to remove compiler + * dependencies. + * 07/15/99 kwk Added 'silk' resource typedef. + * 09/20/99 gap added additional cXXXX country values. + * 09/20/99 gap cPRC -> cRepChina. + * 04/29/00 CS Created localeLanguage & localeCountry #defines that are + * used by 'cnty', 'silk', and 'locs' resource types, + * including full sets from ISO 639 & 3166 sets. + * CS Added a type declaration for new 'locs' resource. + * 05/16/00 CS LmCountryType/LmLanguageType are now back to + * CountryType/LanguageType. + * 06/06/00 kwk Font flags for 'FONT' is always 0x9000 for Palm fonts. + * kwk Moved 'locs' and 'cnty' to SystemResDefsPrv.r. + * 08/24/00 kwk Added 'wrdl' type. + * + *****************************************************************************/ + +#define alertType informationAlert=0, confirmationAlert=1, \ + warningAlert=2, errorAlert=3 + +#define palmFont stdFont=0, boldFont=1, largeFont=2, \ + symbolFont=3, checkboxFont=4, symbol11Font=4, \ + symbol7Font=5, ledFont=6, largeBoldFont=7 + +/* 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) LanguageType #defines in PalmLocale.h +*/ +#define localeLanguage \ + lEnglish=0, \ + lFrench, \ + lGerman, \ + lItalian, \ + lSpanish, \ + \ + lUnused, \ + \ + lJapanese, \ + lDutch, \ + \ + lAfar, \ + lAbkhazian, \ + lAfrikaans, \ + lAmharic, \ + lArabic, \ + lAssamese, \ + lAymara, \ + lAzerbaijani, \ + lBashkir, \ + lByelorussian, \ + lBulgarian, \ + lBihari, \ + lBislama, \ + lBengali, \ + lTibetan, \ + lBreton, \ + lCatalan, \ + lCorsican, \ + lCzech, \ + lWelsh, \ + lDanish, \ + lBhutani, \ + lGreek, \ + lEsperanto, \ + lEstonian, \ + lBasque, \ + lPersian, \ + lFinnish, \ + lFiji, \ + lFaroese, \ + lFrisian, \ + lIrish, \ + lScotsGaelic, \ + lGalician, \ + lGuarani, \ + lGujarati, \ + lHausa, \ + lHindi, \ + lCroatian, \ + lHungarian, \ + lArmenian, \ + lInterlingua, \ + lInterlingue, \ + lInupiak, \ + lIndonesian, \ + lIcelandic, \ + lHebrew, \ + lYiddish, \ + lJavanese, \ + lGeorgian, \ + lKazakh, \ + lGreenlandic, \ + lCambodian, \ + lKannada, \ + lKorean, \ + lKashmiri, \ + lKurdish, \ + lKirghiz, \ + lLatin, \ + lLingala, \ + lLaothian, \ + lLithuanian, \ + lLatvian, \ + lMalagasy, \ + lMaori, \ + lMacedonian, \ + lMalayalam, \ + lMongolian, \ + lMoldavian, \ + lMarathi, \ + lMalay, \ + lMaltese, \ + lBurmese, \ + lNauru, \ + lNepali, \ + lNorwegian, \ + lOccitan, \ + lAfan, \ + lOriya, \ + lPunjabi, \ + lPolish, \ + lPashto, \ + lPortuguese, \ + lQuechua, \ + lRhaetoRomance, \ + lKurundi, \ + lRomanian, \ + lRussian, \ + lKinyarwanda, \ + lSanskrit, \ + lSindhi, \ + lSangho, \ + lSerboCroatian, \ + lSinghalese, \ + lSlovak, \ + lSlovenian, \ + lSamoan, \ + lShona, \ + lSomali, \ + lAlbanian, \ + lSerbian, \ + lSiswati, \ + lSesotho, \ + lSudanese, \ + lSwedish, \ + lSwahili, \ + lTamil, \ + lTelugu, \ + lTajik, \ + lThai, \ + lTigrinya, \ + lTurkmen, \ + lTagalog, \ + lSetswana, \ + lTonga, \ + lTurkish, \ + lTsonga, \ + lTatar, \ + lTwi, \ + lUkrainian, \ + lUrdu, \ + lUzbek, \ + lVietnamese, \ + lVolapuk, \ + lWolof, \ + lXhosa, \ + lYoruba, \ + lChinese, \ + lZulu + +/* 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) CountryType #defines in PalmLocale.h +*/ +#define localeCountry \ + cAustralia=0, \ + cAustria, \ + cBelgium, \ + cBrazil, \ + cCanada, \ + cDenmark, \ + cFinland, \ + cFrance, \ + cGermany, \ + cHongKong, \ + cIceland, \ + cIreland, \ + cItaly, \ + cJapan, \ + cLuxembourg, \ + cMexico, \ + cNetherlands, \ + cNewZealand, \ + cNorway, \ + cSpain, \ + cSweden, \ + cSwitzerland, \ + cUnitedKingdom, \ + cUnitedStates, \ + cIndia, \ + cIndonesia, \ + cRepublicOfKorea, \ + cMalaysia, \ + cChina, \ + cPhilippines, \ + cSingapore, \ + cThailand, \ + cTaiwan, \ + \ + cAndorra, \ + cUnitedArabEmirates, \ + cAfghanistan, \ + cAntiguaAndBarbuda, \ + cAnguilla, \ + cAlbania, \ + cArmenia, \ + cNetherlandsAntilles, \ + cAngola, \ + cAntarctica, \ + cArgentina, \ + cAmericanSamoa, \ + cAruba, \ + cAzerbaijan, \ + cBosniaAndHerzegovina, \ + cBarbados, \ + cBangladesh, \ + cBurkinaFaso, \ + cBulgaria, \ + cBahrain, \ + cBurundi, \ + cBenin, \ + cBermuda, \ + cBruneiDarussalam, \ + cBolivia, \ + cBahamas, \ + cBhutan, \ + cBouvetIsland, \ + cBotswana, \ + cBelarus, \ + cBelize, \ + cCocosIslands, \ + cDemocraticRepublicOfTheCongo, \ + cCentralAfricanRepublic, \ + cCongo, \ + cIvoryCoast, \ + cCookIslands, \ + cChile, \ + cCameroon, \ + cColumbia, \ + cCostaRica, \ + cCuba, \ + cCapeVerde, \ + cChristmasIsland, \ + cCyprus, \ + cCzechRepublic, \ + cDjibouti, \ + cDominica, \ + cDominicanRepublic, \ + cAlgeria, \ + cEcuador, \ + cEstonia, \ + cEgypt, \ + cWesternSahara, \ + cEritrea, \ + cEthiopia, \ + cFiji, \ + cFalklandIslands, \ + cMicronesia, \ + cFaeroeIslands, \ + cMetropolitanFrance, \ + cGabon, \ + cGrenada, \ + cGeorgia, \ + cFrenchGuiana, \ + cGhana, \ + cGibraltar, \ + cGreenland, \ + cGambia, \ + cGuinea, \ + cGuadeloupe, \ + cEquatorialGuinea, \ + cGreece, \ + cSouthGeorgiaAndTheSouthSandwichIslands, \ + cGuatemala, \ + cGuam, \ + cGuineaBisseu, \ + cGuyana, \ + cHeardAndMcDonaldIslands, \ + cHonduras, \ + cCroatia, \ + cHaiti, \ + cHungary, \ + cIsrael, \ + cBritishIndianOceanTerritory, \ + cIraq, \ + cIran, \ + cJamaica, \ + cJordan, \ + cKenya, \ + cKyrgyzstan, \ + cCambodia, \ + cKiribati, \ + cComoros, \ + cStKittsAndNevis, \ + cDemocraticPeoplesRepublicOfKorea, \ + cKuwait, \ + cCaymanIslands, \ + cKazakhstan, \ + cLaos, \ + cLebanon, \ + cStLucia, \ + cLiechtenstein, \ + cSriLanka, \ + cLiberia, \ + cLesotho, \ + cLithuania, \ + cLatvia, \ + cLibya, \ + cMorrocco, \ + cMonaco, \ + cMoldova, \ + cMadagascar, \ + cMarshallIslands, \ + cMacedonia, \ + cMali, \ + cMyanmar, \ + cMongolia, \ + cMacau, \ + cNorthernMarianaIslands, \ + cMartinique, \ + cMauritania, \ + cMontserrat, \ + cMalta, \ + cMauritius, \ + cMaldives, \ + cMalawi, \ + cMozambique, \ + cNamibia, \ + cNewCalidonia, \ + cNiger, \ + cNorfolkIsland, \ + cNigeria, \ + cNicaragua, \ + cNepal, \ + cNauru, \ + cNiue, \ + cOman, \ + cPanama, \ + cPeru, \ + cFrenchPolynesia, \ + cPapuaNewGuinea, \ + cPakistan, \ + cPoland, \ + cStPierreAndMiquelon, \ + cPitcairn, \ + cPuertoRico, \ + cPortugal, \ + cPalau, \ + cParaguay, \ + cQatar, \ + cReunion, \ + cRomania, \ + cRussianFederation, \ + cRwanda, \ + cSaudiArabia, \ + cSolomonIslands, \ + cSeychelles, \ + cSudan, \ + cStHelena, \ + cSlovenia, \ + cSvalbardAndJanMayenIslands, \ + cSlovakia, \ + cSierraLeone, \ + cSanMarino, \ + cSenegal, \ + cSomalia, \ + cSuriname, \ + cSaoTomeAndPrincipe, \ + cElSalvador, \ + cSyranArabRepublic, \ + cSwaziland, \ + cTurksAndCaicosIslands, \ + cChad, \ + cFrenchSouthernTerritories, \ + cTogo, \ + cTajikistan, \ + cTokelau, \ + cTurkmenistan, \ + cTunisia, \ + cTonga, \ + cEastTimor, \ + cTurkey, \ + cTrinidadAndTobago, \ + cTuvalu, \ + cTanzania, \ + cUkraine, \ + cUganda, \ + cUnitedStatesMinorOutlyingIslands, \ + cUruguay, \ + cUzbekistan, \ + cHolySee, \ + cStVincentAndTheGrenadines, \ + cVenezuela, \ + cBritishVirginIslands, \ + cUSVirginIslands, \ + cVietNam, \ + cVanuatu, \ + cWallisAndFutunaIslands, \ + cSamoa, \ + cYemen, \ + cMayotte, \ + cYugoslavia, \ + cSouthAfrica, \ + cZambia, \ + cZimbabwe + +/*======================================================================================*/ +#ifndef __SYSTYPES_R__ /* If MPW's SysTypes.r was NOT included, */ + /* then define NFNT and FONT */ + +/*----------------------------FONT Ľ Font Description-----------------------------------*/ +/* PROBLEMS: the offset to the offset/width table has been changed to a longint, with the + high word stored in the neg descent field (if its not -1). Rez can't handle + this. */ +type 'FONT' { + /* Font Type Flags */ +FontType: + integer = 0x9000; /* Standard Palm font */ + + FirstChar: + integer; /* first char */ + LastChar: + integer; /* last char */ + integer; /* width max */ + integer; /* kern max */ + integer; /* neg descent */ + integer; /* font rect width */ + Height: + integer; /* font rect height */ + Offset: + unsigned integer = ((WidthTable-Offset)/16); /* offset to off/wid tab*/ + integer; /* ascent */ + integer; /* descent */ + integer; /* leading */ + RowWords: + integer; /* row width (in words) */ + + /* Tables */ + /* Bit image */ + hex string [($$Word(RowWords) <<($$BitField(FontType, 12, 2) + & 3) + 1) * $$Word(Height)]; + + /* Location Table */ + array [$$Word(LastChar) - $$Word(FirstChar) + 3] { + integer; + }; + + /* Offset/Width Table */ + WidthTable: + array [$$Word(LastChar) - $$Word(FirstChar) + 3] { + integer; + }; + + /* Optional Character Width Table */ + Array [($$Word(FontType) & 0x0002) != 0] { + array [$$Word(LastChar) - $$Word(FirstChar) + 3] { + integer; + }; + }; + + /* Optional Image Height Table */ + Array [($$Word(FontType) & 0x0001) != 0] { + array [$$Word(LastChar) - $$Word(FirstChar) + 3] { + integer; + }; + }; +}; + +/*----------------------------NFNT Ľ Font Description-----------------------------------*/ +type 'NFNT' as 'FONT'; + +#endif // __SYSTYPES_R__ + + +/*======================================================================================*/ +#ifndef __TYPES_R__ /* If MPW's Types.r was NOT included, */ + /* then define ICON, MENU, MBAR, and PICT */ + +/*----------------------------ICON Ľ Icon-----------------------------------------------*/ +type 'ICON' { + hex string[128]; /* Icon data */ +}; + + +/*----------------------------MENU Ľ Menu-----------------------------------------------*/ +type 'MENU' { + integer; /* Menu ID */ + fill word[2]; + integer textMenuProc = 0; /* ID of menu def proc */ + fill word; + unsigned hex bitstring[31] + allEnabled = 0x7FFFFFFF; /* Enable flags */ + boolean disabled, enabled; /* Menu enable */ + pstring apple = "\0x14"; /* Menu Title */ + wide array { + pstring; /* Item title */ + byte noIcon; /* Icon number */ + char noKey = "\0x00", /* Key equivalent or */ + hierarchicalMenu = "\0x1B"; /* hierarchical menu */ + char noMark = "\0x00", /* Marking char or id */ + check = "\0x12"; /* of hierarchical menu */ + fill bit; + unsigned bitstring[7] + plain; /* Style */ + }; + byte = 0; +}; + + +/*----------------------------MBAR Ľ Menu Bar-------------------------------------------*/ +type 'MBAR' { + integer = $$CountOf(MenuArray); /* Number of menus */ + wide array MenuArray{ + integer; /* Menu resource ID */ + }; +}; + +#ifndef __PICT_R__ +/*----------------------------PICT Ľ Quickdraw Picture----------------------------------*/ +type 'PICT' { + unsigned integer; /* Length */ + rect; /* Frame */ + hex string; /* Data */ +}; +#endif // __PICT_R__ +#endif // __TYPES_R__ + + +#ifndef __PALMTYPES_R__ +#define __PALMTYPES_R__ + + +/*--------------------------------------------------------------------------------------*/ +type 'tAIB' { + array Images { + switch { + case Uncompressed: + integer; /* width; */ + Height: integer; /* height; */ + RowBytes: integer; /* rowBytes; */ + key integer = 0; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffset: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + fill byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + hex string[$$Word(RowBytes[$$ArrayIndex(Images)]) * $$Word(Height[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed: + integer; /* width; */ + HeightComp: integer; /* height; */ + RowBytesComp: integer; /* rowBytes; */ + key integer = -32768; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetComp: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + fill byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + hex string[(($$Word(NextOffsetComp[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasTransparency: + integer; /* width; */ + HeightT: integer; /* height; */ + RowBytesT: integer; /* rowBytes; */ + key integer = 8192; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetT: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + unsigned byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + hex string[$$Word(RowBytesT[$$ArrayIndex(Images)]) * $$Word(HeightT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasTransparency: + integer; /* width; */ + HeightCompT: integer; /* height; */ + RowBytesCompT: integer; /* rowBytes; */ + key integer = -24576; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompT:integer; /* nextDepthOffset - # of DWords to next BitmapType */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + hex string[(($$Word(NextOffsetCompT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasColorTable: + integer; /* width; */ + HeightCT: integer; /* height; */ + RowBytesCT: integer; /* rowBytes; */ + key integer = 16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCT: integer; /* nextDepthOffset (dword) */ + fill byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[$$Word(RowBytesCT[$$ArrayIndex(Images)]) * $$Word(HeightCT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasColorTable: + integer; /* width; */ + HeightCompCT: integer; /* height; */ + RowBytesCompCT:integer; /* rowBytes; */ + key integer = -16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompCT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[(($$Word(NextOffsetCompCT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasColorTable_HasTransparency: + integer; /* width; */ + HeightCTT: integer; /* height; */ + RowBytesCTT: integer; /* rowBytes; */ + key integer = 16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCTT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[$$Word(RowBytesCTT[$$ArrayIndex(Images)]) * $$Word(HeightCTT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasColorTable_HasTransparency: + integer; /* width; */ + HeightCompCTT: integer; /* height; */ + RowBytesCompCTT:integer; /* rowBytes; */ + key integer = -16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompCTT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[(($$Word(NextOffsetCompCTT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + }; + }; +}; /* end tAIB */ + + +/*--------------------------------------------------------------------------------------*/ +type 'taif' { + integer; /* App Icon ID */ + integer; /* width */ + integer; /* height */ + integer = $$CountOf(PICTArray); /* Number of images */ + wide array PICTArray { + integer; /* depth */ + byte uncompressed=0, compressed=1; /* compression flag */ + fill byte; + byte noTransprency=0, hasTransparency=1; /* transparency flag */ + fill byte; + integer; /* PICT id for data */ + integer; /* compression type */ + integer; /* transparent index */ + integer reserved=0; /* reserved, must be 0 (colorTable) */ + }; +}; /* end taif */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tAIN' { + cstring; /* App Icon Name */ + align word; /* App Icon Name is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tAIN */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tAIS' { + /* dmRecNumCategories = 16 categories */ + cstring; /* Localize app info string[0] */ + cstring; /* Localize app info string[1] */ + cstring; /* Localize app info string[2] */ + cstring; /* Localize app info string[3] */ + cstring; /* Localize app info string[4] */ + cstring; /* Localize app info string[5] */ + cstring; /* Localize app info string[6] */ + cstring; /* Localize app info string[7] */ + cstring; /* Localize app info string[8] */ + cstring; /* Localize app info string[9] */ + cstring; /* Localize app info string[10] */ + cstring; /* Localize app info string[11] */ + cstring; /* Localize app info string[12] */ + cstring; /* Localize app info string[13] */ + cstring; /* Localize app info string[14] */ + cstring; /* Localize app info string[15] */ +}; /* end tAIS */ + + +/*--------------------------------------------------------------------------------------*/ +type 'Talt' { + integer alertType; /* Alert Type */ + integer; /* Help Rsc ID */ + integer; /* # Buttons */ + integer; /* Default Button ID */ + cstring; /* Title */ + cstring; /* Message */ + + array ButtonArray { + cstring; /* Button Text */ + }; +}; /* end Talt */ + + +/*--------------------------------------------------------------------------------------*/ +type 'Tbmp' { + array Images { + switch { + case Uncompressed: + integer; /* width; */ + Height: integer; /* height; */ + RowBytes: integer; /* rowBytes; */ + key integer = 0; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffset: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + fill byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + hex string[$$Word(RowBytes[$$ArrayIndex(Images)]) * $$Word(Height[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed: + integer; /* width; */ + HeightComp: integer; /* height; */ + RowBytesComp: integer; /* rowBytes; */ + key integer = -32768; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetComp: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + fill byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + hex string[(($$Word(NextOffsetComp[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasTransparency: + integer; /* width; */ + HeightT: integer; /* height; */ + RowBytesT: integer; /* rowBytes; */ + key integer = 8192; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetT: integer; /* nextDepthOffset - # of DWords to next BitmapType */ + unsigned byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + hex string[$$Word(RowBytesT[$$ArrayIndex(Images)]) * $$Word(HeightT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasTransparency: + integer; /* width; */ + HeightCompT: integer; /* height; */ + RowBytesCompT: integer; /* rowBytes; */ + key integer = -24576; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompT:integer; /* nextDepthOffset - # of DWords to next BitmapType */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + hex string[(($$Word(NextOffsetCompT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasColorTable: + integer; /* width; */ + HeightCT: integer; /* height; */ + RowBytesCT: integer; /* rowBytes; */ + key integer = 16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCT: integer; /* nextDepthOffset (dword) */ + fill byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[$$Word(RowBytesCT[$$ArrayIndex(Images)]) * $$Word(HeightCT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasColorTable: + integer; /* width; */ + HeightCompCT: integer; /* height; */ + RowBytesCompCT:integer; /* rowBytes; */ + key integer = -16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompCT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[(($$Word(NextOffsetCompCT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + + case Uncompressed_HasColorTable_HasTransparency: + integer; /* width; */ + HeightCTT: integer; /* height; */ + RowBytesCTT: integer; /* rowBytes; */ + key integer = 16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCTT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + fill byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[$$Word(RowBytesCTT[$$ArrayIndex(Images)]) * $$Word(HeightCTT[$$ArrayIndex(Images)])]; + align LONG; + + case Compressed_HasColorTable_HasTransparency: + integer; /* width; */ + HeightCompCTT: integer; /* height; */ + RowBytesCompCTT:integer; /* rowBytes; */ + key integer = -16384; /* flags; */ + byte; /* pixelSize; bits/pixel */ + byte; /* version; */ + NextOffsetCompCTT: integer; /* nextDepthOffset (dword) */ + unsigned byte; /* transparent index */ + byte; /* compression type */ + fill word; /* reserved */ + integer noColorTable = 0; /* color table */ + hex string[(($$Word(NextOffsetCompCTT[$$ArrayIndex(Images)]) - 4) << 2)]; + align LONG; + }; + }; +}; /* end Tbmp */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tbmf' { + integer; /* Bitmap ID */ + integer; /* width */ + integer; /* height */ + integer = $$CountOf(PICTArray); /* Number of images */ + wide array PICTArray { + integer; /* depth */ + byte uncompressed=0, compressed=1; /* compression flag */ + fill byte; + byte noTransprency=0, hasTransparency=1; /* transparency flag */ + fill byte; + integer; /* PICT id for data */ + integer; /* compression type */ + integer; /* transparent index */ + integer reserved=0; /* reserved, must be 0 (colorTable) */ + }; +}; /* end tbmf */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tBTN' { + integer; /* Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte noFrame=0, frame=1; /* Frame */ + fill byte; + byte boldFrame=0, nonBoldFrame=1; /* Non-bold frame */ + fill byte; + byte palmFont; /* Font ID */ + cstring; /* Button Label */ +}; /* end tBTN */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tCBX' { + integer; /* Check Box ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte notSelected=0, selected=1; /* Selected */ + fill byte; + byte; /* Group ID */ + byte palmFont; /* Font ID */ + cstring; /* Check Box Label */ + align word; /* Check Box Label is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tCBX */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tclt' { + unsigned integer; /* numEntries */ + wide array { + unsigned byte; /* index/reserved */ + unsigned hex byte; /* red */ + unsigned hex byte; /* green */ + unsigned hex byte; /* blue */ + }; +}; /* end tclt */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tFBM' { + integer; /* X position */ + integer; /* Y position */ + integer; /* Bitmap Rsc ID */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; +}; /* end tFBM */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tFLD' { + integer; /* Field ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte notEditable=0, editable=1; /* Editable */ + fill byte; + byte notUnderlined=0, underlined=1; /* Underlined */ + fill byte; + fill word; /* Solid Underline (???) */ + byte notSingleLine=0, singleLine=1; /* Single Line */ + fill byte; + byte notDynamicSize=0, dynamicSize=1; /* Dynamic Size */ + fill byte; + byte notLeftJustified=0, leftJustified=1; /* Left Justified */ + fill byte; + integer; /* Max chars */ + byte palmFont; /* Font ID */ + fill byte; + byte notAutoShift=0, autoShift=1; /* Autoshift */ + fill byte; + byte notHasScrollbar=0, hasScrollbar=1; /* Has Scrollbar */ + fill byte; + byte notNumeric=0, numeric=1; /* Numeric */ + fill byte; +}; /* end tFLD */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tFRM' { + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte notModal=0, modal=1; /* Modal */ + fill byte; + byte noSaveBehind=0, saveBehind=1; /* Save behind */ + fill byte; + fill word; + fill word; + integer; /* Form ID */ + integer; /* Help Rsc ID */ + integer; /* Menu Rsc ID */ + integer; /* Default Button ID */ + fill word; + fill word; + + integer = $$Countof(ObjectArray); /* Item count */ + wide array ObjectArray { + integer; /* Object ID */ + string[4]; /* Object Type */ + }; +}; /* end tFRM */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tgbn' { + integer; /* Graphic Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte noFrame=0, frame=1; /* Frame */ + fill byte; + byte boldFrame=0, nonBoldFrame=1; /* Non-bold frame */ + fill byte; + integer; /* Bitmap (Tbmp) ID */ + integer; /* Selected Bitmap ID (0 for none) */ +}; /* end tgbn */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tGDT' { + integer; /* Gadget ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; +}; /* end tGDT */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tgpb' { + integer; /* Graphic Push Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte; /* Group ID */ + fill byte; + integer; /* Bitmap (Tbmp) ID */ + integer; /* Selected Bitmap ID (0 for none) */ +}; /* end tgpb */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tgrb' { + integer; /* Graphic Repeating Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte noFrame=0, frame=1; /* Frame */ + fill byte; + byte boldFrame=0, nonBoldFrame=1; /* Non-bold frame */ + fill byte; + integer; /* Bitmap (Tbmp) ID */ + integer; /* Selected Bitmap ID (0 for none) */ +}; /* end tgrb */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tGSI' { + integer; /* X position */ + integer; /* Y position */ +}; /* end tGSI */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tLBL' { + integer; /* Label ID */ + integer; /* Left */ + integer; /* Top */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte palmFont; /* Font ID */ + cstring; /* Label */ +}; /* end tLBL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tLST' { + integer; /* Label ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte palmFont; /* Font ID */ + fill byte; + integer; /* Visible Items */ + integer = $$Countof(StringArray); /* Item count */ + array StringArray { + cstring; /* Label */ + }; +}; /* end tLST */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tPBN' { + integer; /* Push Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte; /* Group ID */ + byte palmFont; /* Font ID */ + cstring; /* Button Label */ +}; /* end tPBN */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tPUL' { + integer; /* Control ID */ + integer; /* List ID */ +}; /* end tPUL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tPUT' { + integer; /* Popup Trigger */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte palmFont; /* Font ID */ + cstring; /* Popup Label */ + align word; /* Popup Label is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tPUT */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tREP' { + integer; /* Button ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + byte rightAnchor=0, leftAnchor=1; /* Left Anchor */ + fill byte; + byte noFrame=0, frame=1; /* Frame */ + fill byte; + byte boldFrame=0, nonBoldFrame=1; /* Non-bold frame */ + fill byte; + byte palmFont; /* Font ID */ + cstring; /* Button Label */ +}; /* end tREP */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tSCL' { + integer; /* Scroll Bar ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + integer; /* Value */ + integer; /* Minimum Value */ + integer; /* Maximum Value */ + integer; /* Page Size */ +}; /* end tSCL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tsld' { + integer; /* Slider ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + integer; /* Value */ + integer; /* Minimum Value */ + integer; /* Maximum Value */ + integer; /* Page Size */ + byte horizontal=0, vertical=1; /* Horizontal? */ + fill byte; + integer; /* Thumb (Tbmp) ID, 0 for default */ + integer; /* Background (Tbmp) ID, 0 for default */ +}; /* end tSCL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tslf' { + integer; /* Feedback Slider ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notUsable=0, usable=1; /* Usable */ + fill byte; + integer; /* Value */ + integer; /* Minimum Value */ + integer; /* Maximum Value */ + integer; /* Page Size */ + byte horizontal=0, vertical=1; /* Horizontal? */ + fill byte; + integer; /* Thumb (Tbmp) ID, 0 for default */ + integer; /* Background (Tbmp) ID, 0 for default */ +}; /* end tSCL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tSTL' { // Beware - Item count is one-based, but the system routine + // must be passed a zero-based value to retrieve strings... + cstring; /* Prefix */ + + integer = $$Countof(StringArray); /* Item count */ + array StringArray { + cstring; /* Text */ + }; +}; /* end tSTL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tSTR' { + cstring; /* The String */ + /* TMPL allows additional hex data */ +}; /* end tSTR */ + + +/*----------------------------tint Ľ Soft Constant--------------------------------------*/ +type 'tint' { + unsigned longint; /* The Constant */ +}; /* end tint */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tTBL' { + integer; /* Table ID */ + integer; /* Left */ + integer; /* Top */ + integer; /* Width */ + integer; /* Height */ + byte notEditable=0, editable=1; /* Editable */ + fill byte; + fill word; /* reserved 1 */ + fill word; /* reserved 2 */ + fill word; /* reserved 3 */ + integer; /* Rows */ + integer = $$Countof(ColumnArray); /* Columns */ + array ColumnArray { + integer; /* Column Width */ + }; +}; /* end tTBL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tTTL' { + cstring; /* Title */ + align word; /* Title string is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tTTL */ + + +/*--------------------------------------------------------------------------------------*/ +type 'tver' { + cstring; /* Version String */ + align word; /* Version String is defined in */ + /* TMPL as an even-padded cString. */ +}; /* end tver */ + + +/*--------------------------------------------------------------------------------------*/ +type 'xprf' { + integer = 0x0001; /* Version number */ + fill bit[31]; /* Reserved flags */ + boolean allowOverlays, disableOverlays; /* T->disable overlays */ +}; /* end xprf */ + + +/*--------------------------------------------------------------------------------------*/ +#define alphaGraffitiSilkscreenArea 0 +#define numericGraffitiSilkscreenArea 1 + +type 'silk' { + integer = 0x0001; // version + + literal longint; // vendor creator ('psys' for 3Com) + + integer localeLanguage; // locale language + + integer localeCountry; // locale country + + integer = $$Countof(RectArray); // rectangle count + wide array RectArray { + point; // topLeft of bounds. + point; // extent of bounds. + + literal longint // area type + screenArea = 'scrn', + graffitiArea = 'graf'; + + integer; // area index + }; + + integer = $$Countof(ButtonArray); + wide array ButtonArray { + point; // topLeft of bounds. + point; // extent of bounds. + + hex integer // keyDown.chr + vchrMenu = 0x0105, + vchrLaunch = 0x0108, + vchrKeyboard = 0x0109, + vchrFind = 0x010a, + vchrCalc = 0x010b, + vchrKeyboardAlpha = 0x0110, + vchrKeyboardNumeric = 0x0111, + vchrTsm1 = 0x0118, + vchrTsm2 = 0x0119, + vchrTsm3 = 0x011a, + vchrTsm4 = 0x011b; + hex integer; // keyDown.keyCode + hex integer // keyDown.modifiers + commandKeyMask = 0x0008; + }; +}; + +/*--------------------------------------------------------------------------------------*/ +type 'feat' { + integer = $$Countof(CreatorArray); + wide array CreatorArray { + literal longint; // Creator, e.g. 'psys' + integer = $$Countof(FeatureArray); + wide array FeatureArray { + integer; // Feature number + longint; // Feature value. + }; + }; +}; + + +/*--------------------------------------------------------------------------------------*/ +type 'wrdl' { + integer = $$Countof(IntegerArray); /* Item count */ + array IntegerArray { + integer; + }; +}; + + +#endif // __PALMTYPES_R__ diff --git a/sdk-4/include/Core/UI/UIResources.h b/sdk-4/include/Core/UI/UIResources.h new file mode 100644 index 0000000..e6614bd --- /dev/null +++ b/sdk-4/include/Core/UI/UIResources.h @@ -0,0 +1,322 @@ +/****************************************************************************** + * + * 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). + * + *****************************************************************************/ + +#ifndef __UIRESOURCES_H__ +#define __UIRESOURCES_H__ + +#include + +// System Default app icon (for apps missing a tAIB) +#define defaultAppIconBitmap 10000 +#define defaultAppSmallIconBitmap 10001 + +// System version string ID - this is hidden in +// the SystemVersion.rsrc resource, because the 'system' resources +// don't have ResEdit formats. +#define systemVersionID 10000 + + +//------------------------------------------------------------ +// Resource Type Constants +//------------------------------------------------------------ + +#define strRsc 'tSTR' +#define ainRsc 'tAIN' +#define iconType 'tAIB' +#define bitmapRsc 'Tbmp' +#define bsBitmapRsc 'Tbsb' +#define alertRscType 'Talt' +#define kbdRscType 'tkbd' +#define MenuRscType 'MBAR' +#define fontRscType 'NFNT' +#define verRsc 'tver' +#define appInfoStringsRsc 'tAIS' +#define fontIndexType 'fnti' +#define midiRsc 'MIDI' +#define colorTableRsc 'tclt' +#define constantRscType 'tint' +#define formRscType 'tFRM' +#define strListRscType 'tSTL' +#define wrdListRscType 'wrdl' +#define defaultCategoryRscType 'taic' +#define binaryGeneralRscType 'tbin' + + +//------------------------------------------------------------ +// App Version Constants +//------------------------------------------------------------ + +#define appVersionID 1 // our apps use tver 1 resource +#define appVersionAlternateID 1000 // CW Constructor uses tver 1000 resource + // so we'll look for ours first, then try theirs +#define ainID 1000 + +#define oemVersionID 10001 // Per-DB version provided by OEMs + + +//------------------------------------------------------------ +// System Information Constants +//------------------------------------------------------------ + +#define maxCategoryWidthID 10001 // Max pixel width for category trigger. + +//------------------------------------------------------------ +// System Alerts +//------------------------------------------------------------ + +#define SelectACategoryAlert 10000 + +// This alert broke 1.0 applications and is now disabled until later. +// It is redefined below (10015). +//#define RemoveCategoryAlert 10001 +//#define RemoveCategoryRecordsButton 0 +//#define RemoveCategoryNameButton 1 +//#define RemoveCategoryCancelButton 2 + +#define LowBatteryAlert 10002 +#define VeryLowBatteryAlert 10003 +#define UndoAlert 10004 +#define UndoCancelButton 1 + +#define MergeCategoryAlert 10005 +#define MergeCategoryYes 0 +#define MergeCategoryNo 1 + +#define privateRecordInfoAlert 10006 + +#define ClipboardLimitAlert 10007 + +#define CategoryExistsAlert 10012 + +#define DeviceFullAlert 10013 + +#define categoryAllUsedAlert 10014 + +#define RemoveCategoryAlert 10015 // See alert 10001 +#define RemoveCategoryYes 0 +#define RemoveCategoryNo 1 + +#define 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. +#define NoDataToBeamAlert 10017 +#define NoDataToSendAlert 10017 + +// New for PalmOS 3.1 +#define LowCradleChargedBatteryAlert 10018 // (Not present in Palm VII) +#define VeryLowCradleChargedBatteryAlert 10019 // (Not present in Palm VII) + +// New for PalmOS 3.1 (Instant Karma only) +#define CategoryTooLongAlert 10020 // (Not present in Palm VII) + +// New for PalmOS 3.2 - Alerts used by the ErrAlertCustom() call. +#define ErrOKAlert 10021 // Error Alert with just an OK button +#define ErrOKCancelAlert 10022 // Error Alert with an OK & Cancel button +#define ErrCancelAlert 10023 // Error Alert with just Cancel button. Special case for antenna down alert. +#define InfoOKAlert 10024 // Info alert with just an OK button +#define InfoOKCancelAlert 10025 // Info alert with an OK & Cancel button +#define InfoCancelAlert 10026 // Info alert with just a Cancel button +#define PrivacyWarningAlert 10027 // Privacy warning for weblib +#define ConfirmationOKAlert 10028 // Confirmation alert with just an OK button +#define ConfirmationOKCancelAlert 10029 // Confirmation alert with an OK & Cancel button +#define ConfirmationCancelAlert 10030 // Confirmation alert with just a Cancel button +#define WarningOKAlert 10031 // Warning Alert with just an OK button +#define WarningOKCancelAlert 10032 // Warning Alert with an OK & Cancel button +#define WarningCancelAlert 10033 // Warning Alert with just Cancel button. Special case for antenna down alert. + +// New for PalmOS 3.5 - Launch error alerts +#define StrippedBaseLaunchErrAlert 10034 // Launch error because of stripped base. +#define GenericLaunchErrAlert 10035 // Generic launch error. + +// New for PalmOS 3.5 - Fatal Alert template +#define sysFatalAlert 10100 // Template for fatal alert + +// New for PalmOS 3.5 - Alerts used by new security traps +#define secInvalidPasswordAlert 13250 +#define secGotoInvalidRecordAlert 13251 +#define secShowPrivatePermanentPassEntryAlert 13261 +#define secShowMaskedPrivatePermanentPassEntryAlert 13265 +#define secHideRecordsAlert 13268 +#define secMaskRecordsAlert 13269 +#define secHideMaskRecordsOK 0 +#define secHideMaskRecordsCancel 1 +// New for PalmOS 4.0 - General purpose password prompt alert +#define secEnterPasswordAlert 13300 +#define secEnterPasswordOK 0 +#define secEnterPasswordCancel 1 + + +// command-bar bitmaps +#define BarCutBitmap 10030 +#define BarCopyBitmap 10031 +#define BarPasteBitmap 10032 +#define BarUndoBitmap 10033 +#define BarBeamBitmap 10034 +#define BarSecureBitmap 10035 +#define BarDeleteBitmap 10036 +#define BarInfoBitmap 10037 + +//Masking bitmaps +#define SecLockBitmap 10050 +#define SecLockWidth 6 +#define SecLockHeight 8 + +// System Menu Bar and Menus +#define sysEditMenuID 10000 +#define sysEditMenuUndoCmd 10000 +#define sysEditMenuCutCmd 10001 +#define sysEditMenuCopyCmd 10002 +#define sysEditMenuPasteCmd 10003 +#define sysEditMenuSelectAllCmd 10004 +#define sysEditMenuSeparator 10005 +#define sysEditMenuKeyboardCmd 10006 +#define sysEditMenuGraffitiCmd 10007 + +#define sysNetworkProgress01Bitmap 10020 +#define sysNetworkProgress02Bitmap 10021 +#define sysNetworkProgress03Bitmap 10022 +#define sysNetworkProgress04Bitmap 10023 +#define sysNetworkProgress05Bitmap 10024 +#define sysNetworkProgress06Bitmap 10025 + +// Dynamically added to System Edit menu at runtime +#define sysEditMenuJapAddWord 10100 +#define sysEditMenuJapLookupWord 10101 + +// Note View Menu Bar and Menus +#define noteMenuID 10200 // Old NoteView MenuBar +#define noteUndoCmd sysEditMenuUndoCmd +#define noteCutCmd sysEditMenuCutCmd +#define noteCopyCmd sysEditMenuCopyCmd +#define notePasteCmd sysEditMenuPasteCmd +#define noteSelectAllCmd sysEditMenuSelectAllCmd +#define noteSeparator sysEditMenuSeparator +#define noteKeyboardCmd sysEditMenuKeyboardCmd +#define noteGraffitiCmd sysEditMenuKeyboardCmd + +#define noteFontCmd 10200 // These are here for backwards +#define noteTopOfPageCmd 10201 // compatibility. The built-in +#define noteBottomOfPageCmd 10202 // apps no longer use them. +#define notePhoneLookupCmd 10203 + +#define newNoteMenuID 10300 // The Edit Menu for the new NoteView. +#define newNoteFontCmd 10300 // MenuBar is the same as it is for +#define newNotePhoneLookupCmd 10301 // the old NoteView MenuBar. + +// Note View (used by Datebook, To Do, Address, and Expense apps) +#define NoteView 10900 // The new NoteView is "new" as of Palm OS 3.5. +#define NewNoteView 10950 // Same as old NoteView, but points to newNoteMenuID and doesn't ref UI objects listed below. +#define NoteField 10901 +#define NoteDoneButton 10902 +#define NoteSmallFontButton 10903 // Not in NewNoteView, use FontCmd instead. +#define NoteLargeFontButton 10904 // Not in NewNoteView, use FontCmd instead. +#define NoteDeleteButton 10905 +#define NoteUpButton 10906 // Not in NewNoteView, use scrollbars now. +#define NoteDownButton 10907 // Not in NewNoteView, use scrollbars now. +#define NoteScrollBar 10908 +#define NoteFontGroup 1 +#define noteViewMaxLength 4096 // not including null, tied to tFLD rsrc 10901 + + +// About Box - used by Datebook, Memo, Address, To Do, & others +#define aboutDialog 11000 +#define aboutNameLabel 11001 +#define aboutVersionLabel 11002 +#define aboutErrorStr 11003 + + +// Category New Name Dialog (used for new and renamed categories) +#define categoryNewNameDialog 11100 +#define categoryNewNameField 11103 +#define categoryNewNameOKButton 11104 + + +// Categories Edit Dialog +#define CategoriesEditForm 10000 +#define CategoriesEditList 10002 +#define CategoriesEditOKButton 10003 +#define CategoriesEditNewButton 10004 +#define CategoriesEditRenameButton 10005 +#define CategoriesEditDeleteButton 10006 + + +// Graffiti Reference Dialog +#define graffitiReferenceDialog 11200 +#define graffitiReferenceDoneButton 11202 +#define graffitiReferenceUpButton 11203 +#define graffitiReferenceDownButton 11204 +#define graffitiReferenceFirstBitmap 11205 + + +// System string resources +#define categoryAllStrID 10004 +#define categoryEditStrID 10005 +#define menuCommandStrID 10006 +#define launcherBatteryStrID 10007 +#define systemNameStrID 10008 +#define phoneLookupTitleStrID 10009 +#define phoneLookupAddStrID 10010 +#define phoneLookupFormatStrID 10011 + + +//------------------------------------------------------------ +// Misc. resource routines +//------------------------------------------------------------ +#ifdef __cplusplus +extern "C" { +#endif + +void * ResLoadForm (UInt16 rscID) + SYS_TRAP(sysTrapResLoadForm); + +void * ResLoadMenu (UInt16 rscID) + SYS_TRAP(sysTrapResLoadMenu); + + +Char * ResLoadString (UInt16 rscID); + +UInt32 ResLoadConstant (UInt16 rscID) + SYS_TRAP(sysTrapResLoadConstant); + +#ifdef __cplusplus +} +#endif + +#endif // __UIRESOURCES_H__ diff --git a/sdk-4/include/Dynamic/PalmOptErrorCheckLevel.Debug b/sdk-4/include/Dynamic/PalmOptErrorCheckLevel.Debug new file mode 100644 index 0000000..5e8e2cc --- /dev/null +++ b/sdk-4/include/Dynamic/PalmOptErrorCheckLevel.Debug @@ -0,0 +1,26 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOptErrorCheckLevel.Debug + * + * Release: + * + *****************************************************************************/ + +#ifndef __PALMOPTERRORCHECKLEVEL_H__ +#define __PALMOPTERRORCHECKLEVEL_H__ + +#include + + #ifdef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL + #endif + + #ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL ERROR_CHECK_FULL + #endif + +#endif diff --git a/sdk-4/include/Dynamic/PalmOptErrorCheckLevel.Release b/sdk-4/include/Dynamic/PalmOptErrorCheckLevel.Release new file mode 100644 index 0000000..79d497d --- /dev/null +++ b/sdk-4/include/Dynamic/PalmOptErrorCheckLevel.Release @@ -0,0 +1,26 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOptErrorCheckLevel.Release + * + * Release: + * + *****************************************************************************/ + +#ifndef __PALMOPTERRORCHECKLEVEL_H__ +#define __PALMOPTERRORCHECKLEVEL_H__ + +#include + + #ifdef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL + #endif + + #ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL ERROR_CHECK_PARTIAL + #endif + +#endif diff --git a/sdk-4/include/Dynamic/PalmOptErrorCheckLevel.h b/sdk-4/include/Dynamic/PalmOptErrorCheckLevel.h new file mode 100644 index 0000000..b52c868 --- /dev/null +++ b/sdk-4/include/Dynamic/PalmOptErrorCheckLevel.h @@ -0,0 +1,26 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOptErrorCheckLevel.Debug + * + * Release: Palm OS SDK 4.0 (63220) + * + *****************************************************************************/ + +#ifndef __PALMOPTERRORCHECKLEVEL_H__ +#define __PALMOPTERRORCHECKLEVEL_H__ + +#include + + #ifdef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL_OK_TO_REDEFINE + #undef ERROR_CHECK_LEVEL + #endif + + #ifndef ERROR_CHECK_LEVEL + #define ERROR_CHECK_LEVEL ERROR_CHECK_FULL + #endif + +#endif diff --git a/sdk-4/include/Dynamic/PalmOptTraceLevel.Off b/sdk-4/include/Dynamic/PalmOptTraceLevel.Off new file mode 100644 index 0000000..2d53bf1 --- /dev/null +++ b/sdk-4/include/Dynamic/PalmOptTraceLevel.Off @@ -0,0 +1,26 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOptTraceLevel.Off + * + * Release: + * + *****************************************************************************/ + +#ifndef __PALMOPTTRACELEVEL_H__ +#define __PALMOPTTRACELEVEL_H__ + +#include + + #ifdef TRACE_OUTPUT_OK_TO_REDEFINE + #undef TRACE_OUTPUT_OK_TO_REDEFINE + #undef TRACE_OUTPUT + #endif + + #ifndef TRACE_OUTPUT + #define TRACE_OUTPUT TRACE_OUTPUT_OFF + #endif + +#endif diff --git a/sdk-4/include/Dynamic/PalmOptTraceLevel.On b/sdk-4/include/Dynamic/PalmOptTraceLevel.On new file mode 100644 index 0000000..1e8ec82 --- /dev/null +++ b/sdk-4/include/Dynamic/PalmOptTraceLevel.On @@ -0,0 +1,26 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOptTraceLevel.On + * + * Release: + * + *****************************************************************************/ + +#ifndef __PALMOPTTRACELEVEL_H__ +#define __PALMOPTTRACELEVEL_H__ + +#include + + #ifdef TRACE_OUTPUT_OK_TO_REDEFINE + #undef TRACE_OUTPUT_OK_TO_REDEFINE + #undef TRACE_OUTPUT + #endif + + #ifndef TRACE_OUTPUT + #define TRACE_OUTPUT TRACE_OUTPUT_ON + #endif + +#endif diff --git a/sdk-4/include/Dynamic/PalmOptTraceLevel.h b/sdk-4/include/Dynamic/PalmOptTraceLevel.h new file mode 100644 index 0000000..86d3b59 --- /dev/null +++ b/sdk-4/include/Dynamic/PalmOptTraceLevel.h @@ -0,0 +1,26 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOptTraceLevel.Off + * + * Release: Palm OS SDK 4.0 (63220) + * + *****************************************************************************/ + +#ifndef __PALMOPTTRACELEVEL_H__ +#define __PALMOPTTRACELEVEL_H__ + +#include + + #ifdef TRACE_OUTPUT_OK_TO_REDEFINE + #undef TRACE_OUTPUT_OK_TO_REDEFINE + #undef TRACE_OUTPUT + #endif + + #ifndef TRACE_OUTPUT + #define TRACE_OUTPUT TRACE_OUTPUT_OFF + #endif + +#endif diff --git a/sdk-4/include/Extensions/ExpansionMgr/ExpansionMgr.h b/sdk-4/include/Extensions/ExpansionMgr/ExpansionMgr.h new file mode 100644 index 0000000..a5160aa --- /dev/null +++ b/sdk-4/include/Extensions/ExpansionMgr/ExpansionMgr.h @@ -0,0 +1,232 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __EXPANSIONMGR_H__ +#define __EXPANSIONMGR_H__ + +#include +#include +#include + +// When building the PalmOS 3.5 version of ExpansionMgr, +// since these constants were not in the 3.5 headers... +#ifdef BUILDING_AGAINST_PALMOS35 + #define sysTrapExpansionMgr sysTrapSysReserved2 + + #define expErrorClass 0x2900 // Post 3.5 this is defined in ErrorBase.h + + // Post 3.5 these are defined in NotifyMgr.h. + #define sysNotifyCardInsertedEvent '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 'handled' is set + // to true by a notification handler. + // PARAMETER: slot number cast as void* + + #define sysNotifyCardRemovedEvent '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 'handled' is set + // to true by a notification handler. + // PARAMETER: slot number cast as void* + + #define sysNotifyVolumeMountedEvent 'volm' // Broadcast when a VFSMgr volume is + // mounted, Always broadcast + // from UI task. + // PARAMETER: VFSAnyMountParamPtr cast as void* + + #define sysNotifyVolumeUnmountedEvent 'volu' // Broadcast when a VFSMgr volume is + // unmounted, Always broadcast + // from UI task. + // PARAMETER: volume refNum cast as void* + + + #define sysFileCExpansionMgr 'expn' // Type of Expansion Manager extension database + + #define sysFileTSlotDriver 'libs' // file type for slot driver libraries + +#else + #define sysTrapExpansionMgr sysTrapExpansionDispatch +#endif + + +#ifndef USE_EXPMGR_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_EXPMGR_TRAPS 1 + #else + #define USE_EXPMGR_TRAPS 0 + #endif +#endif + + +#ifdef BUILDING_EXPMGR_DISPATCH + #define EXPMGR_TRAP(expMgrSelectorNum) +#else + #define EXPMGR_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapExpansionMgr, sel) +#endif + + + + + +#define expFtrIDVersion 0 // ID of feature containing version of ExpansionMgr. + // Check existence of this feature to see if ExpMgr is installed. + +#define expMgrVersionNum ((UInt16)200) // version of the ExpansionMgr, obtained from the feature + +#define expInvalidSlotRefNum 0 + +typedef Err (*ExpPollingProcPtr)(UInt16 slotLibRefNum, + void *slotPollRefConP); + + +/************************************************************ + * Capabilities of the hardware device for ExpCardInfoType.capabilityFlags + *************************************************************/ +#define expCapabilityHasStorage 0x00000001 // card supports reading (& maybe writing) sectors +#define expCapabilityReadOnly 0x00000002 // card is read only +#define expCapabilitySerial 0x00000004 // card supports dumb serial interface + +#define expCardInfoStringMaxLen 31 + +typedef struct ExpCardInfoTag +{ + UInt32 capabilityFlags; // bits for different stuff the card supports + Char manufacturerStr[expCardInfoStringMaxLen+1]; // Manufacturer, e.g., "Palm", "Motorola", etc... + Char productStr[expCardInfoStringMaxLen+1]; // Name of product, e.g., "SafeBackup 32MB" + Char deviceClassStr[expCardInfoStringMaxLen+1]; // Type of product, e.g., "Backup", "Ethernet", etc. + Char deviceUniqueIDStr[expCardInfoStringMaxLen+1];// Unique identifier for product, e.g., a serial number. Set to "" if no such identifier exists. +} ExpCardInfoType, *ExpCardInfoPtr; + + +/************************************************************ + * Iterator start and stop constants. + * Used by ExpSlotEnumerate + *************************************************************/ +#define expIteratorStart 0L +#define expIteratorStop 0xffffffffL + + +/************************************************************ + * Bits in the 'handled' field used in Card Inserted and Removed notifications + *************************************************************/ +#define expHandledVolume 0x01 // any volumes associated with the card have been dealt with... the ExpansionMgr will not mount or unmount as appropriate. +#define expHandledSound 0x02 // Any pleasing sounds have already been played... the ExpansionMgr will not play a pleasing sound on this insertion/removal. + + +/************************************************************ + * Error codes + *************************************************************/ +#define expErrUnsupportedOperation (expErrorClass | 1) // unsupported or undefined opcode and/or creator +#define expErrNotEnoughPower (expErrorClass | 2) // the required power is not available + +#define expErrCardNotPresent (expErrorClass | 3) // no card is present +#define expErrInvalidSlotRefNum (expErrorClass | 4) // slot reference number is bad +#define expErrSlotDeallocated (expErrorClass | 5) // slot reference number is within valid range, but has been deallocated. +#define expErrCardNoSectorReadWrite (expErrorClass | 6) // the card does not support the + // SlotDriver block read/write API +#define expErrCardReadOnly (expErrorClass | 7) // the card does support R/W API + // but the card is read only +#define expErrCardBadSector (expErrorClass | 8) // the card does support R/W API + // but the sector is bad +#define expErrCardProtectedSector (expErrorClass | 9) // The card does support R/W API + // but the sector is protected +#define expErrNotOpen (expErrorClass | 10) // slot driver library has not been opened +#define expErrStillOpen (expErrorClass | 11) // slot driver library is still open - maybe it was opened > once +#define expErrUnimplemented (expErrorClass | 12) // Call is unimplemented +#define expErrEnumerationEmpty (expErrorClass | 13) // No values remaining to enumerate +#define expErrIncompatibleAPIVer (expErrorClass | 14) // The API version of this slot driver is not supported by this version of ExpansionMgr. + + +/************************************************************ + * Common media types. Used by SlotCardMediaType and SlotMediaType. + *************************************************************/ +#define expMediaType_Any 'wild' // matches all media types when looking up a default directory +#define expMediaType_MemoryStick 'mstk' +#define expMediaType_CompactFlash 'cfsh' +#define expMediaType_SecureDigital 'sdig' +#define expMediaType_MultiMediaCard 'mmcd' +#define expMediaType_SmartMedia 'smed' +#define expMediaType_RAMDisk 'ramd' // a RAM disk based media +#define expMediaType_PoserHost 'pose' // Host filesystem emulated by Poser +#define expMediaType_MacSim '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. + *************************************************************/ +#define expInit 0 +#define expSlotDriverInstall 1 +#define expSlotDriverRemove 2 +#define expSlotLibFind 3 +#define expSlotRegister 4 +#define expSlotUnregister 5 +#define expCardInserted 6 +#define expCardRemoved 7 +#define expCardPresent 8 +#define expCardInfo 9 +#define expSlotEnumerate 10 +#define expCardGetSerialPort 11 + +#define expMaxSelector expCardGetSerialPort + + +Err ExpInit(void) + EXPMGR_TRAP(expInit); + +Err ExpSlotDriverInstall(UInt32 dbCreator, UInt16 *slotLibRefNumP) + EXPMGR_TRAP(expSlotDriverInstall); + +Err ExpSlotDriverRemove(UInt16 slotLibRefNum) + EXPMGR_TRAP(expSlotDriverRemove); + +Err ExpSlotLibFind(UInt16 slotRefNum, UInt16 *slotLibRefNum) + EXPMGR_TRAP(expSlotLibFind); + +Err ExpSlotRegister(UInt16 slotLibRefNum, UInt16 *slotRefNum) + EXPMGR_TRAP(expSlotRegister); + +Err ExpSlotUnregister(UInt16 slotRefNum) + EXPMGR_TRAP(expSlotUnregister); + +Err ExpCardInserted(UInt16 slotRefNum) + EXPMGR_TRAP(expCardInserted); + +Err ExpCardRemoved(UInt16 slotRefNum) + EXPMGR_TRAP(expCardRemoved); + +Err ExpCardPresent(UInt16 slotRefNum) + EXPMGR_TRAP(expCardPresent); + +Err ExpCardInfo(UInt16 slotRefNum, ExpCardInfoType* infoP) + EXPMGR_TRAP(expCardInfo); + +Err ExpSlotEnumerate(UInt16 *slotRefNumP, UInt32 *slotIteratorP) + EXPMGR_TRAP(expSlotEnumerate); + +Err ExpCardGetSerialPort(UInt16 slotRefNum, UInt32* portP) + EXPMGR_TRAP(expCardGetSerialPort); + + + +#endif // __EXPANSIONMGR_H__ diff --git a/sdk-4/include/Extensions/ExpansionMgr/FSLib.h b/sdk-4/include/Extensions/ExpansionMgr/FSLib.h new file mode 100644 index 0000000..a30d2dd --- /dev/null +++ b/sdk-4/include/Extensions/ExpansionMgr/FSLib.h @@ -0,0 +1,277 @@ +/****************************************************************************** + * + * 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. + ********************************************************************/ + + +#ifndef __FS_LIB_H__ +#define __FS_LIB_H__ + + +#include // FileRef, etc. + + +// When building the PalmOS 3.5 version of ExpansionMgr, +// since this constant was not in the 3.5 SystemResources.h... +#ifdef BUILDING_AGAINST_PALMOS35 +#define sysFileTFileSystem 'libf' // File type for file system libraries +#endif // BUILDING_AGAINST_PALMOS35 + + + +// BUILDING_APPLICATION +#if BUILDING_APP_OR_LIB + // direct link to library code + #define FS_LIB_TRAP(trapNum) +#else + // else someone else is including this public header file; use traps + #define FS_LIB_TRAP(trapNum) SYS_TRAP(trapNum) +#endif + +#define fsLibAPIVersion 0x00000002 + + +/******************************************************************** + * 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!!! + ********************************************************************/ + +#define FSTrapLibAPIVersion (sysLibTrapCustom) +#define FSTrapCustomControl (sysLibTrapCustom+1) +#define FSTrapFilesystemType (sysLibTrapCustom+2) + +#define FSTrapFileCreate (sysLibTrapCustom+3) +#define FSTrapFileOpen (sysLibTrapCustom+4) +#define FSTrapFileClose (sysLibTrapCustom+5) +#define FSTrapFileRead (sysLibTrapCustom+6) +#define FSTrapFileWrite (sysLibTrapCustom+7) +#define FSTrapFileDelete (sysLibTrapCustom+8) +#define FSTrapFileRename (sysLibTrapCustom+9) +#define FSTrapFileSeek (sysLibTrapCustom+10) +#define FSTrapFileEOF (sysLibTrapCustom+11) +#define FSTrapFileTell (sysLibTrapCustom+12) +#define FSTrapFileResize (sysLibTrapCustom+13) +#define FSTrapFileGetAttributes (sysLibTrapCustom+14) +#define FSTrapFileSetAttributes (sysLibTrapCustom+15) +#define FSTrapFileGetDate (sysLibTrapCustom+16) +#define FSTrapFileSetDate (sysLibTrapCustom+17) +#define FSTrapFileSize (sysLibTrapCustom+18) + +#define FSTrapDirCreate (sysLibTrapCustom+19) +#define FSTrapDirEntryEnumerate (sysLibTrapCustom+20) + +#define FSTrapVolumeFormat (sysLibTrapCustom+21) +#define FSTrapVolumeMount (sysLibTrapCustom+22) +#define FSTrapVolumeUnmount (sysLibTrapCustom+23) +#define FSTrapVolumeInfo (sysLibTrapCustom+24) +#define FSTrapVolumeGetLabel (sysLibTrapCustom+25) +#define FSTrapVolumeSetLabel (sysLibTrapCustom+26) +#define FSTrapVolumeSize (sysLibTrapCustom+27) + +#define FSMaxSelector FSTrapVolumeSize + + +/******************************************************************** + * API Prototypes + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************** + * Standard library open, close, sleep and wake APIs: + ********************************************************************/ + +extern Err FSLibOpen(UInt16 fsLibRefNum) + FS_LIB_TRAP(sysLibTrapOpen); + +extern Err FSLibClose(UInt16 fsLibRefNum) + FS_LIB_TRAP(sysLibTrapClose); + +extern Err FSLibSleep(UInt16 fsLibRefNum) + FS_LIB_TRAP(sysLibTrapSleep); + +extern Err FSLibWake(UInt16 fsLibRefNum) + FS_LIB_TRAP(sysLibTrapWake); + + +/******************************************************************** + * Custom library APIs: + ********************************************************************/ + +extern UInt32 FSLibAPIVersion(UInt16 fsLibRefNum) + FS_LIB_TRAP(FSTrapLibAPIVersion); + +extern Err FSCustomControl(UInt16 fsLibRefNum, UInt32 apiCreator, UInt16 apiSelector, + void *valueP, UInt16 *valueLenP) + FS_LIB_TRAP(FSTrapCustomControl); + +extern Err FSFilesystemType(UInt16 fsLibRefNum, UInt32 *filesystemTypeP) + FS_LIB_TRAP(FSTrapFilesystemType); + + +/******************************************************************** + * File Stream APIs: + ********************************************************************/ + +extern Err FSFileCreate(UInt16 fsLibRefNum, UInt16 volRefNum, const Char *pathNameP) + FS_LIB_TRAP(FSTrapFileCreate); + +extern Err FSFileOpen(UInt16 fsLibRefNum, UInt16 volRefNum, const Char *pathNameP, + UInt16 openMode, FileRef *fileRefP) + FS_LIB_TRAP(FSTrapFileOpen); + +extern Err FSFileClose(UInt16 fsLibRefNum, FileRef fileRef) + FS_LIB_TRAP(FSTrapFileClose); + +extern Err FSFileRead(UInt16 fsLibRefNum, FileRef fileRef, UInt32 numBytes, + void *bufBaseP, UInt32 offset, Boolean dataStoreBased, + UInt32 *numBytesReadP) + FS_LIB_TRAP(FSTrapFileRead); + +extern Err FSFileWrite(UInt16 fsLibRefNum, FileRef fileRef, UInt32 numBytes, + const void *dataP, UInt32 *numBytesWrittenP) + FS_LIB_TRAP(FSTrapFileWrite); + +extern Err FSFileDelete(UInt16 fsLibRefNum, UInt16 volRefNum, const Char *pathNameP) + FS_LIB_TRAP(FSTrapFileDelete); + +extern Err FSFileRename(UInt16 fsLibRefNum, UInt16 volRefNum, const Char *pathNameP, const Char *newNameP) + FS_LIB_TRAP(FSTrapFileRename); + +extern Err FSFileSeek(UInt16 fsLibRefNum, FileRef fileRef, FileOrigin origin, Int32 offset) + FS_LIB_TRAP(FSTrapFileSeek); + +extern Err FSFileEOF(UInt16 fsLibRefNum, FileRef fileRef) + FS_LIB_TRAP(FSTrapFileEOF); + +extern Err FSFileTell(UInt16 fsLibRefNum, FileRef fileRef, UInt32 *filePosP) + FS_LIB_TRAP(FSTrapFileTell); + +extern Err FSFileResize(UInt16 fsLibRefNum, FileRef fileRef, UInt32 newSize) + FS_LIB_TRAP(FSTrapFileResize); + +extern Err FSFileGetAttributes(UInt16 fsLibRefNum, FileRef fileRef, UInt32 *attributesP) + FS_LIB_TRAP(FSTrapFileGetAttributes); + +extern Err FSFileSetAttributes(UInt16 fsLibRefNum, FileRef fileRef, UInt32 attributes) + FS_LIB_TRAP(FSTrapFileSetAttributes); + +extern Err FSFileGetDate(UInt16 fsLibRefNum, FileRef fileRef, UInt16 whichDate, UInt32 *dateP) + FS_LIB_TRAP(FSTrapFileGetDate); + +extern Err FSFileSetDate(UInt16 fsLibRefNum, FileRef fileRef, UInt16 whichDate, UInt32 date) + FS_LIB_TRAP(FSTrapFileSetDate); + +extern Err FSFileSize(UInt16 fsLibRefNum, FileRef fileRef, UInt32 *fileSizeP) + FS_LIB_TRAP(FSTrapFileSize); + + +/******************************************************************** + * Directory APIs: + ********************************************************************/ + +extern Err FSDirCreate(UInt16 fsLibRefNum, UInt16 volRefNum, const Char *dirNameP) + FS_LIB_TRAP(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 + * + *************************************************************/ +#define FSDirDelete(fsLibRefNum, volRefNum, dirNameP) \ + FSFileDelete(fsLibRefNum, volRefNum, dirNameP) + +extern Err FSDirEntryEnumerate(UInt16 fsLibRefNum, FileRef dirRef, UInt32 *dirEntryIteratorP, FileInfoType *infoP) + FS_LIB_TRAP(FSTrapDirEntryEnumerate); + +/******************************************************************** + * Volume APIs: + ********************************************************************/ + + +extern Err FSVolumeFormat(UInt16 fsLibRefNum, VFSAnyMountParamPtr vfsMountParamP) + FS_LIB_TRAP(FSTrapVolumeFormat); + +extern Err FSVolumeMount(UInt16 fsLibRefNum, VFSAnyMountParamPtr vfsMountParamP) + FS_LIB_TRAP(FSTrapVolumeMount); + +extern Err FSVolumeUnmount(UInt16 fsLibRefNum, UInt16 volRefNum) + FS_LIB_TRAP(FSTrapVolumeUnmount); + +extern Err FSVolumeInfo(UInt16 fsLibRefNum, UInt16 volRefNum, VolumeInfoType *volInfoP) + FS_LIB_TRAP(FSTrapVolumeInfo); + +extern Err FSVolumeGetLabel(UInt16 fsLibRefNum, UInt16 volRefNum, Char *labelP, UInt16 bufLen) + FS_LIB_TRAP(FSTrapVolumeGetLabel); + +extern Err FSVolumeSetLabel(UInt16 fsLibRefNum, UInt16 volRefNum, const Char *labelP) + FS_LIB_TRAP(FSTrapVolumeSetLabel); + +extern Err FSVolumeSize(UInt16 fsLibRefNum, UInt16 volRefNum, UInt32 *volumeUsedP, UInt32 *volumeTotalP) + FS_LIB_TRAP(FSTrapVolumeSize); + + +#ifdef __cplusplus +} +#endif + + +#endif // __FS_LIB_H__ diff --git a/sdk-4/include/Extensions/ExpansionMgr/SlotDrvrLib.h b/sdk-4/include/Extensions/ExpansionMgr/SlotDrvrLib.h new file mode 100644 index 0000000..3fd70d1 --- /dev/null +++ b/sdk-4/include/Extensions/ExpansionMgr/SlotDrvrLib.h @@ -0,0 +1,221 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SlotDrvr_LIB_H__ +#define __SlotDrvr_LIB_H__ + +#include "ExpansionMgr.h" + +// BUILDING_APPLICATION +#if BUILDING_APP_OR_LIB + // direct link to library code + #define SlotDrvr_LIB_TRAP(trapNum) +#else + // else someone else is including this public header file; use traps + #define SlotDrvr_LIB_TRAP(trapNum) SYS_TRAP(trapNum) +#endif + +#define slotDrvrAPIVersion 0x00000002 + +// The number of bytes per sector is fixed +#define 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. + ********************************************************************/ +#define slotDrvrPartitionTypeFAT12 (0x01) +#define slotDrvrPartitionTypeFAT16Under32MB (0x04) +#define slotDrvrPartitionTypeFAT16Over32MB (0x06) +#define slotDrvrBootablePartition (0x80) +#define slotDrvrNonBootablePartition (0x00) + +typedef struct CardMetricsTag { + UInt32 totalSectors; // 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) + UInt16 bytesPerSector; // The number of bytes in one sector. + // currently for Palm, this must be the standard 512 + UInt16 sectorsPerHead; // 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 + UInt16 headsPerCylinder; // 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 + UInt16 reserved1; // Reserved + UInt8 sectorsPerBlock; // 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 + UInt8 partitionType; // 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 + UInt8 bootIndicator; // 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 + UInt8 reserved2; // Reserved + UInt32 partitionStart; // 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 + UInt32 partitionSize; // 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 +} CardMetricsType, *CardMetricsPtr; + + +/******************************************************************** + * 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!!! + ********************************************************************/ + +#define SlotTrapLibAPIVersion (sysLibTrapCustom) +#define SlotTrapCustomControl (sysLibTrapCustom+1) +#define SlotTrapCardPresent (sysLibTrapCustom+2) +#define SlotTrapCardInfo (sysLibTrapCustom+3) +#define SlotTrapCardMediaType (sysLibTrapCustom+4) +#define SlotTrapCardIsFilesystemSupported (sysLibTrapCustom+5) +#define SlotTrapCardMetrics (sysLibTrapCustom+6) +#define SlotTrapCardLowLevelFormat (sysLibTrapCustom+7) +#define SlotTrapCardSectorRead (sysLibTrapCustom+8) +#define SlotTrapCardSectorWrite (sysLibTrapCustom+9) +#define SlotTrapPowerCheck (sysLibTrapCustom+10) +#define SlotTrapMediaType (sysLibTrapCustom+11) +#define SlotTrapCardReserve (sysLibTrapCustom+12) +#define SlotTrapCardRelease (sysLibTrapCustom+13) +#define SlotTrapCardGetSerialPort (sysLibTrapCustom+14) + + +/******************************************************************** + * API Prototypes + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************** + * Standard library open, close, sleep and wake functions + ********************************************************************/ + +extern Err SlotOpen(UInt16 slotLibRefNum) + SlotDrvr_LIB_TRAP(sysLibTrapOpen); + +extern Err SlotClose(UInt16 slotLibRefNum) + SlotDrvr_LIB_TRAP(sysLibTrapClose); + +extern Err SlotSleep(UInt16 slotLibRefNum) + SlotDrvr_LIB_TRAP(sysLibTrapSleep); + +extern Err SlotWake(UInt16 slotLibRefNum) + SlotDrvr_LIB_TRAP(sysLibTrapWake); + +/******************************************************************** + * Custom library API functions + ********************************************************************/ + +extern UInt32 SlotLibAPIVersion(UInt16 slotLibRefNum) + SlotDrvr_LIB_TRAP(SlotTrapLibAPIVersion); + +extern Err SlotCustomControl(UInt16 slotLibRefNum, UInt32 apiCreator, UInt16 apiSelector, + void *valueP, UInt16 *valueLenP) + SlotDrvr_LIB_TRAP(SlotTrapCustomControl); + +extern Err SlotCardPresent(UInt16 slotLibRefNum, UInt16 slotRefNum) + SlotDrvr_LIB_TRAP(SlotTrapCardPresent); + +extern Err SlotCardInfo(UInt16 slotLibRefNum, UInt16 slotRefNum, ExpCardInfoType *infoP) + SlotDrvr_LIB_TRAP(SlotTrapCardInfo); + +extern Err SlotCardMediaType(UInt16 slotLibRefNum, UInt16 slotRefNum, UInt32 *mediaTypeP) + SlotDrvr_LIB_TRAP(SlotTrapCardMediaType); + +extern Err SlotMediaType(UInt16 slotLibRefNum, UInt16 slotRefNum, UInt32 *mediaTypeP) + SlotDrvr_LIB_TRAP(SlotTrapMediaType); + +extern Err SlotCardReserve(UInt16 slotLibRefNum, UInt16 slotRefNum) + SlotDrvr_LIB_TRAP(SlotTrapCardReserve); + +extern Err SlotCardRelease(UInt16 slotLibRefNum, UInt16 slotRefNum) + SlotDrvr_LIB_TRAP(SlotTrapCardRelease); + +extern Err SlotCardGetSerialPort(UInt16 slotLibRefNum, UInt16 slotRefNum, UInt32* portP) + SlotDrvr_LIB_TRAP(SlotTrapCardGetSerialPort); + + + +/******************************************************************** + * SlotDriver Formatting APIs: + ********************************************************************/ + +extern Boolean SlotCardIsFilesystemSupported(UInt16 slotLibRefNum, UInt16 slotRefNum, UInt32 filesystemType) + SlotDrvr_LIB_TRAP(SlotTrapCardIsFilesystemSupported); + +extern Err SlotCardMetrics(UInt16 slotLibRefNum, UInt16 slotRefNum, CardMetricsPtr cardMetricsP) + SlotDrvr_LIB_TRAP(SlotTrapCardMetrics); + +extern Err SlotCardLowLevelFormat(UInt16 slotLibRefNum, UInt16 slotRefNum) + SlotDrvr_LIB_TRAP(SlotTrapCardLowLevelFormat); + + +/******************************************************************** + * SlotDriver Logical Block Read/Write APIs: + ********************************************************************/ + +extern Err SlotCardSectorRead(UInt16 slotLibRefNum, UInt16 slotRefNum, UInt32 sectorNumber, + UInt8 *bufferP, UInt32 *numSectorsP) + SlotDrvr_LIB_TRAP(SlotTrapCardSectorRead); + +extern Err SlotCardSectorWrite(UInt16 slotLibRefNum, UInt16 slotRefNum, UInt32 sectorNumber, + UInt8 *bufferP, UInt32 *numSectorsP) + SlotDrvr_LIB_TRAP(SlotTrapCardSectorWrite); + + +/******************************************************************** + * Power Mgmt APIs: + ********************************************************************/ + +#define slotLibPowerFlag_WakeUp 0x0001 // Add the power required to bring the slot hardware out of low-power mode +#define slotLibPowerFlag_FormatMedia 0x0002 // Add the power required to perform a low-level format of the card media + +extern Err SlotPowerCheck(UInt16 slotLibRefNum, UInt16 slotRefNum, UInt16 operationFlags, + UInt16 readBlocks, UInt16 writeBlocks) + SlotDrvr_LIB_TRAP(SlotTrapPowerCheck); + +#ifdef __cplusplus +} +#endif + + +#endif // __SlotDrvr_LIB_H__ diff --git a/sdk-4/include/Extensions/ExpansionMgr/VFSMgr.h b/sdk-4/include/Extensions/ExpansionMgr/VFSMgr.h new file mode 100644 index 0000000..e2ee5a1 --- /dev/null +++ b/sdk-4/include/Extensions/ExpansionMgr/VFSMgr.h @@ -0,0 +1,470 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __VFSMGR_H__ +#define __VFSMGR_H__ + +#include +#include +#include + +#include "ExpansionMgr.h" + +#ifdef BUILDING_AGAINST_PALMOS35 + #define sysTrapVFSMgr sysTrapSysReserved3 + + #define sysFileCVFSMgr 'vfsm' // Creator type for VFSMgr... + + #define vfsErrorClass 0x2A00 // Post-3.5 this is defined in ErrorBase.h +#else + #define sysTrapVFSMgr sysTrapFileSystemDispatch +#endif + + + +#ifdef BUILDING_VFSMGR_DISPATCH + #define VFSMGR_TRAP(VFSMgrSelectorNum) +#else + #define VFSMGR_TRAP(sel) \ + _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapVFSMgr, sel) +#endif + + + + +#define vfsFtrIDVersion 0 // ID of feature containing version of VFSMgr. + // Check existence of this feature to see if VFSMgr is installed. + +#define 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 + +#define vfsMgrVersionNum ((UInt16)200) // version of the VFSMgr, obtained from the feature + + +// MountClass constants: +#define vfsMountClass_SlotDriver sysFileTSlotDriver +#define vfsMountClass_Simulator sysFileTSimulator +#define vfsMountClass_POSE '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. :-) +typedef struct VFSAnyMountParamTag +{ + UInt16 volRefNum; // The volRefNum of the volume. + UInt16 reserved; + UInt32 mountClass; // 'libs' for slotDriver-based filesystems + + // Other fields here, depending on value of 'mountClass' + +} VFSAnyMountParamType; +typedef VFSAnyMountParamType *VFSAnyMountParamPtr ; + + +typedef struct VFSSlotMountParamTag +{ + VFSAnyMountParamType vfsMountParam; // mountClass = VFSMountClass_SlotDriver = 'libs' + UInt16 slotLibRefNum; + UInt16 slotRefNum; +} VFSSlotMountParamType; + +typedef struct VFSPOSEMountParamTag +{ + VFSAnyMountParamType vfsMountParam; // mountClass = VFSMountClass_POSE = 'pose' + UInt8 poseSlotNum; +} VFSPOSEMountParamType; + + +/* For Example... +typedef struct VFSOtherMountParamTag { + VFSAnyMountParamType vfsMountParam; // mountClass = 'othr' (for example) + UInt16 otherValue; +} VFSOtherMountParamType; +*/ + +typedef struct FileInfoTag +{ + UInt32 attributes; + Char *nameP; // buffer to receive full name; pass NULL to avoid getting name + UInt16 nameBufLen; // size of nameP buffer, in bytes +} FileInfoType, *FileInfoPtr; + + + +typedef struct VolumeInfoTag +{ + UInt32 attributes; // read-only etc. + UInt32 fsType; // Filesystem type for this volume (defined below) + UInt32 fsCreator; // Creator code of filesystem driver for this volume. For use with VFSCustomControl(). + UInt32 mountClass; // mount class that mounted this volume + + // For slot based filesystems: (mountClass = vfsMountClass_SlotDriver) + UInt16 slotLibRefNum; // Library on which the volume is mounted + UInt16 slotRefNum; // ExpMgr slot number of card containing volume + UInt32 mediaType; // Type of card media (mediaMemoryStick, mediaCompactFlash, etc...) + UInt32 reserved; // reserved for future use (other mountclasses may need more space) +} VolumeInfoType, *VolumeInfoPtr; + + +typedef UInt32 FileRef; + +#define 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*. +#define vfsInvalidFileRef 0L // 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). + *************************************************************/ +#define vfsOriginBeginning 0 // from the beginning (first data byte of file) +#define vfsOriginCurrent 1 // from the current position +#define vfsOriginEnd 2 // from the end of file (one position beyond last data byte, only negative offsets are legal) + +typedef UInt16 FileOrigin; + + +/************************************************************ + * openMode flags passed to VFSFileOpen + *************************************************************/ +#define vfsModeExclusive (0x0001U) // don't let anyone else open it +#define vfsModeRead (0x0002U) // open for read access +#define vfsModeWrite (0x0004U | vfsModeExclusive) // open for write access, implies exclusive +#define vfsModeCreate (0x0008U) // create the file if it doesn't already exist. Implemented in VFS layer, no FS lib call will ever have to handle this. +#define vfsModeTruncate (0x0010U) // 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. +#define vfsModeReadWrite (vfsModeWrite | vfsModeRead) // open for read/write access +#define vfsModeLeaveOpen (0x0020U) // Leave the file open even if when the foreground task closes + + + // Combination flag constants, for error checking purposes: +#define vfsModeAll (vfsModeExclusive | vfsModeRead | vfsModeWrite | vfsModeCreate | vfsModeTruncate | vfsModeReadWrite | vfsModeLeaveOpen) +#define vfsModeVFSLayerOnly (vfsModeCreate | vfsModeTruncate) // flags only used apps & the VFS layer, FS libraries will never see these. + + +/************************************************************ + * File Attributes + *************************************************************/ +#define vfsFileAttrReadOnly (0x00000001UL) +#define vfsFileAttrHidden (0x00000002UL) +#define vfsFileAttrSystem (0x00000004UL) +#define vfsFileAttrVolumeLabel (0x00000008UL) +#define vfsFileAttrDirectory (0x00000010UL) +#define vfsFileAttrArchive (0x00000020UL) +#define vfsFileAttrLink (0x00000040UL) + +#define vfsFileAttrAll (0x0000007fUL) + + +/************************************************************ + * Volume Attributes + *************************************************************/ +#define vfsVolumeAttrSlotBased (0x00000001UL) // reserved +#define vfsVolumeAttrReadOnly (0x00000002UL) // volume is read only +#define vfsVolumeAttrHidden (0x00000004UL) // volume should not be user-visible. + +/************************************************************ + * Date constants (for use with VFSFileGet/SetDate) + *************************************************************/ +#define vfsFileDateCreated 1 +#define vfsFileDateModified 2 +#define vfsFileDateAccessed 3 + +/************************************************************ + * Iterator start and stop constants. + * Used by VFSVolumeEnumerate, VFSDirEntryEnumerate, VFSDirEntryEnumerate + *************************************************************/ +#define vfsIteratorStart 0L +#define vfsIteratorStop 0xffffffffL + + +/************************************************************ + * 'handled' field bit constants + * (for use with Volume Mounted/Unmounted notifications) + *************************************************************/ +#define vfsHandledUIAppSwitch 0x01 // 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. +#define vfsHandledStartPrc 0x02 // 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) + *************************************************************/ +#define vfsMountFlagsUseThisFileSystem 0x01 // Mount/Format the volume with the filesystem specified +//#define vfsMountFlagsPrivate1 0x02 // for system use only +//#define vfsMountFlagsPrivate2 0x04 // for system use only +#define vfsMountFlagsReserved1 0x08 // reserved +#define vfsMountFlagsReserved2 0x10 // reserved +#define vfsMountFlagsReserved3 0x20 // reserved +#define vfsMountFlagsReserved4 0x40 // reserved +#define vfsMountFlagsReserved5 0x80 // reserved + + +/************************************************************ + * Common filesystem types. Used by FSFilesystemType and SlotCardIsFilesystemSupported. + *************************************************************/ +#define vfsFilesystemType_VFAT 'vfat' // FAT12 and FAT16 extended to handle long file names +#define vfsFilesystemType_FAT 'fats' // FAT12 and FAT16 which only handles 8.3 file names +#define vfsFilesystemType_NTFS 'ntfs' // Windows NT filesystem +#define vfsFilesystemType_HFSPlus 'hfse' // The Macintosh extended hierarchical filesystem +#define vfsFilesystemType_HFS 'hfss' // The Macintosh standard hierarchical filesystem +#define vfsFilesystemType_MFS 'mfso' // The Macintosh original filesystem +#define vfsFilesystemType_EXT2 'ext2' // Linux filesystem +#define vfsFilesystemType_FFS 'ffsb' // Unix Berkeley block based filesystem +#define vfsFilesystemType_NFS 'nfsu' // Unix Networked filesystem +#define vfsFilesystemType_AFS 'afsu' // Unix Andrew filesystem +#define vfsFilesystemType_Novell 'novl' // Novell filesystem +#define vfsFilesystemType_HPFS 'hpfs' // OS2 High Performance filesystem + + +/************************************************************ + * Error codes + *************************************************************/ +#define vfsErrBufferOverflow (vfsErrorClass | 1) // passed in buffer is too small +#define vfsErrFileGeneric (vfsErrorClass | 2) // Generic file error. +#define vfsErrFileBadRef (vfsErrorClass | 3) // the fileref is invalid (has been closed, or was not obtained from VFSFileOpen()) +#define vfsErrFileStillOpen (vfsErrorClass | 4) // returned from FSFileDelete if the file is still open +#define vfsErrFilePermissionDenied (vfsErrorClass | 5) // The file is read only +#define vfsErrFileAlreadyExists (vfsErrorClass | 6) // a file of this name exists already in this location +#define vfsErrFileEOF (vfsErrorClass | 7) // file pointer is at end of file +#define vfsErrFileNotFound (vfsErrorClass | 8) // file was not found at the path specified +#define vfsErrVolumeBadRef (vfsErrorClass | 9) // the volume refnum is invalid. +#define vfsErrVolumeStillMounted (vfsErrorClass | 10) // returned from FSVolumeFormat if the volume is still mounted +#define vfsErrNoFileSystem (vfsErrorClass | 11) // no installed filesystem supports this operation +#define vfsErrBadData (vfsErrorClass | 12) // operation could not be completed because of invalid data (i.e., import DB from .PRC file) +#define vfsErrDirNotEmpty (vfsErrorClass | 13) // can't delete a non-empty directory +#define vfsErrBadName (vfsErrorClass | 14) // invalid filename, or path, or volume label or something... +#define vfsErrVolumeFull (vfsErrorClass | 15) // not enough space left on volume +#define vfsErrUnimplemented (vfsErrorClass | 16) // this call is not implemented +#define vfsErrNotADirectory (vfsErrorClass | 17) // This operation requires a directory +#define vfsErrIsADirectory (vfsErrorClass | 18) // This operation requires a regular file, not a directory +#define vfsErrDirectoryNotFound (vfsErrorClass | 19) // Returned from VFSFileCreate when the path leading up to the new file does not exist +#define vfsErrNameShortened (vfsErrorClass | 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. + *************************************************************/ +#define vfsTrapInit 0 +#define vfsTrapCustomControl 1 + +#define vfsTrapFileCreate 2 +#define vfsTrapFileOpen 3 +#define vfsTrapFileClose 4 +#define vfsTrapFileReadData 5 +#define vfsTrapFileRead 6 +#define vfsTrapFileWrite 7 +#define vfsTrapFileDelete 8 +#define vfsTrapFileRename 9 +#define vfsTrapFileSeek 10 +#define vfsTrapFileEOF 11 +#define vfsTrapFileTell 12 +#define vfsTrapFileResize 13 +#define vfsTrapFileGetAttributes 14 +#define vfsTrapFileSetAttributes 15 +#define vfsTrapFileGetDate 16 +#define vfsTrapFileSetDate 17 +#define vfsTrapFileSize 18 + +#define vfsTrapDirCreate 19 +#define vfsTrapDirEntryEnumerate 20 +#define vfsTrapGetDefaultDirectory 21 +#define vfsTrapRegisterDefaultDirectory 22 +#define vfsTrapUnregisterDefaultDirectory 23 + +#define vfsTrapVolumeFormat 24 +#define vfsTrapVolumeMount 25 +#define vfsTrapVolumeUnmount 26 +#define vfsTrapVolumeEnumerate 27 +#define vfsTrapVolumeInfo 28 +#define vfsTrapVolumeGetLabel 29 +#define vfsTrapVolumeSetLabel 30 +#define vfsTrapVolumeSize 31 + +#define vfsTrapInstallFSLib 32 +#define vfsTrapRemoveFSLib 33 +#define vfsTrapImportDatabaseFromFile 34 +#define vfsTrapExportDatabaseToFile 35 +#define vfsTrapFileDBGetResource 36 +#define vfsTrapFileDBInfo 37 +#define vfsTrapFileDBGetRecord 38 + +#define vfsTrapImportDatabaseFromFileCustom 39 +#define vfsTrapExportDatabaseToFileCustom 40 + +// System use only +#define vfsTrapPrivate1 41 + +#define vfsMaxSelector vfsTrapPrivate1 + + +typedef Err (*VFSImportProcPtr) + (UInt32 totalBytes, UInt32 offset, void *userDataP); +typedef Err (*VFSExportProcPtr) + (UInt32 totalBytes, UInt32 offset, void *userDataP); + + +Err VFSInit(void) + VFSMGR_TRAP(vfsTrapInit); + +// if you pass NULL for fsCreator, VFS will iterate through +// all installed filesystems until it finds one that does not return an error. +Err VFSCustomControl(UInt32 fsCreator, UInt32 apiCreator, UInt16 apiSelector, + void *valueP, UInt16 *valueLenP) + VFSMGR_TRAP(vfsTrapCustomControl); + +Err VFSFileCreate(UInt16 volRefNum, const Char *pathNameP) + VFSMGR_TRAP(vfsTrapFileCreate); + +Err VFSFileOpen(UInt16 volRefNum, const Char *pathNameP, + UInt16 openMode, FileRef *fileRefP) + VFSMGR_TRAP(vfsTrapFileOpen); + +Err VFSFileClose(FileRef fileRef) + VFSMGR_TRAP(vfsTrapFileClose); + +Err VFSFileReadData(FileRef fileRef, UInt32 numBytes, void *bufBaseP, + UInt32 offset, UInt32 *numBytesReadP) + VFSMGR_TRAP(vfsTrapFileReadData); + +Err VFSFileRead(FileRef fileRef, UInt32 numBytes, void *bufP, UInt32 *numBytesReadP) + VFSMGR_TRAP(vfsTrapFileRead); + +Err VFSFileWrite(FileRef fileRef, UInt32 numBytes, const void *dataP, UInt32 *numBytesWrittenP) + VFSMGR_TRAP(vfsTrapFileWrite); + +// some file routines work on directories +Err VFSFileDelete(UInt16 volRefNum, const Char *pathNameP) + VFSMGR_TRAP(vfsTrapFileDelete); + +Err VFSFileRename(UInt16 volRefNum, const Char *pathNameP, const Char *newNameP) + VFSMGR_TRAP(vfsTrapFileRename); + +Err VFSFileSeek(FileRef fileRef, FileOrigin origin, Int32 offset) + VFSMGR_TRAP(vfsTrapFileSeek); + +Err VFSFileEOF(FileRef fileRef) + VFSMGR_TRAP(vfsTrapFileEOF); + +Err VFSFileTell(FileRef fileRef, UInt32 *filePosP) + VFSMGR_TRAP(vfsTrapFileTell); + +Err VFSFileSize(FileRef fileRef, UInt32 *fileSizeP) + VFSMGR_TRAP(vfsTrapFileSize); + +Err VFSFileResize(FileRef fileRef, UInt32 newSize) + VFSMGR_TRAP(vfsTrapFileResize); + +Err VFSFileGetAttributes(FileRef fileRef, UInt32 *attributesP) + VFSMGR_TRAP(vfsTrapFileGetAttributes); + +Err VFSFileSetAttributes(FileRef fileRef, UInt32 attributes) + VFSMGR_TRAP(vfsTrapFileSetAttributes); + +Err VFSFileGetDate(FileRef fileRef, UInt16 whichDate, UInt32 *dateP) + VFSMGR_TRAP(vfsTrapFileGetDate); + +Err VFSFileSetDate(FileRef fileRef, UInt16 whichDate, UInt32 date) + VFSMGR_TRAP(vfsTrapFileSetDate); + + +Err VFSDirCreate(UInt16 volRefNum, const Char *dirNameP) + VFSMGR_TRAP(vfsTrapDirCreate); + +Err VFSDirEntryEnumerate(FileRef dirRef, UInt32 *dirEntryIteratorP, FileInfoType *infoP) + VFSMGR_TRAP(vfsTrapDirEntryEnumerate); + + +Err VFSGetDefaultDirectory(UInt16 volRefNum, const Char *fileTypeStr, + Char *pathStr, UInt16 *bufLenP) + VFSMGR_TRAP(vfsTrapGetDefaultDirectory); + +Err VFSRegisterDefaultDirectory(const Char *fileTypeStr, UInt32 mediaType, + const Char *pathStr) + VFSMGR_TRAP(vfsTrapRegisterDefaultDirectory); + +Err VFSUnregisterDefaultDirectory(const Char *fileTypeStr, UInt32 mediaType) + VFSMGR_TRAP(vfsTrapUnregisterDefaultDirectory); + + + +Err VFSVolumeFormat(UInt8 flags, UInt16 fsLibRefNum, VFSAnyMountParamPtr vfsMountParamP) + VFSMGR_TRAP(vfsTrapVolumeFormat); + +Err VFSVolumeMount(UInt8 flags, UInt16 fsLibRefNum, VFSAnyMountParamPtr vfsMountParamP) + VFSMGR_TRAP(vfsTrapVolumeMount); + +Err VFSVolumeUnmount(UInt16 volRefNum) + VFSMGR_TRAP(vfsTrapVolumeUnmount); + +Err VFSVolumeEnumerate(UInt16 *volRefNumP, UInt32 *volIteratorP) + VFSMGR_TRAP(vfsTrapVolumeEnumerate); + +Err VFSVolumeInfo(UInt16 volRefNum, VolumeInfoType *volInfoP) + VFSMGR_TRAP(vfsTrapVolumeInfo); + +Err VFSVolumeGetLabel(UInt16 volRefNum, Char *labelP, UInt16 bufLen) + VFSMGR_TRAP(vfsTrapVolumeGetLabel); + +Err VFSVolumeSetLabel(UInt16 volRefNum, const Char *labelP) + VFSMGR_TRAP(vfsTrapVolumeSetLabel); + +Err VFSVolumeSize(UInt16 volRefNum, UInt32 *volumeUsedP, UInt32 *volumeTotalP) + VFSMGR_TRAP(vfsTrapVolumeSize); + +Err VFSInstallFSLib(UInt32 creator, UInt16 *fsLibRefNumP) + VFSMGR_TRAP(vfsTrapInstallFSLib); + +Err VFSRemoveFSLib(UInt16 fsLibRefNum) + VFSMGR_TRAP(vfsTrapRemoveFSLib); + +Err VFSImportDatabaseFromFile(UInt16 volRefNum, const Char *pathNameP, + UInt16 *cardNoP, LocalID *dbIDP) + VFSMGR_TRAP(vfsTrapImportDatabaseFromFile); + +Err VFSImportDatabaseFromFileCustom(UInt16 volRefNum, const Char *pathNameP, + UInt16 *cardNoP, LocalID *dbIDP, VFSImportProcPtr importProcP, + void *userDataP) + VFSMGR_TRAP(vfsTrapImportDatabaseFromFileCustom); + +Err VFSExportDatabaseToFile(UInt16 volRefNum, const Char *pathNameP, + UInt16 cardNo, LocalID dbID) + VFSMGR_TRAP(vfsTrapExportDatabaseToFile); + +Err VFSExportDatabaseToFileCustom(UInt16 volRefNum, const Char *pathNameP, + UInt16 cardNo, LocalID dbID, VFSExportProcPtr exportProcP, + void *userDataP) + VFSMGR_TRAP(vfsTrapExportDatabaseToFileCustom); + +Err VFSFileDBGetResource(FileRef ref, DmResType type, DmResID resID, MemHandle *resHP) + VFSMGR_TRAP(vfsTrapFileDBGetResource); + +Err VFSFileDBInfo(FileRef ref, Char *nameP, + UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, + UInt32 *modDateP, UInt32 *bckUpDateP, + UInt32 *modNumP, MemHandle *appInfoHP, + MemHandle *sortInfoHP, UInt32 *typeP, + UInt32 *creatorP, UInt16 *numRecordsP) + VFSMGR_TRAP(vfsTrapFileDBInfo); + +Err VFSFileDBGetRecord(FileRef ref, UInt16 recIndex, MemHandle *recHP, + UInt8 *recAttrP, UInt32 *uniqueIDP) + VFSMGR_TRAP(vfsTrapFileDBGetRecord); + +#endif // __VFSMGR_H__ diff --git a/sdk-4/include/Libraries/ExgLocal/ExgLocalLib.h b/sdk-4/include/Libraries/ExgLocal/ExgLocalLib.h new file mode 100644 index 0000000..79b1227 --- /dev/null +++ b/sdk-4/include/Libraries/ExgLocal/ExgLocalLib.h @@ -0,0 +1,56 @@ +/****************************************************************************** + * + * Copyright (c) 2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ExgLocalLib.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Public include file for ExgLocal Library + * + * History: + * 7/14/00 Created by Danny Epstein + * + *****************************************************************************/ + +#ifndef __EXG_LOCAL_LIB_H +#define __EXG_LOCAL_LIB_H + + +#include +#include +#include + + +// Name of Exg Local library. This name goes in the last slot of the dispatch table. +// It must match the name of the database, so that the Exchange Manager can map my +// creator ID to a reference number. It must have a creator ID suffix to conform to +// Palm OS naming conventions (to ensure uniqueness) and so that the Exchange Manaager +// can map my creator ID to a reference number on the simulator. +#define exgLocalLibName "ExgLocal Library-locl" + +// Specific scheme for Local exg lib +#define exgLocalScheme "_local" + +// Enum for operations in progress +#define exgLocalOpNone 0 +#define exgLocalOpPut 1 +#define exgLocalOpAccept 2 +#define exgLocalOpGet 3 +#define exgLocalOpGetSender 4 +typedef UInt8 ExgLocalOpType; + +// Structure pointed to by ExgSocketType.socketRef +typedef struct { + Boolean freeOnDisconnect; // whether to free this struct when the operation completes + Boolean noAsk; // whether to skip exgAskUser launch and ExgDoDialog call + ExgPreviewInfoType *previewInfoP; // if specified, object will be previewed only + FileHand tempFileH; // temp buffer + Err err; // error code to return to outer caller of ExgDisconnect + ExgLocalOpType op; // operation in progress, if any +} ExgLocalSocketInfoType; + + +#endif // EXG_LOCAL_LIB_H diff --git a/sdk-4/include/Libraries/INet/INetMgr.h b/sdk-4/include/Libraries/INet/INetMgr.h new file mode 100644 index 0000000..35d924d --- /dev/null +++ b/sdk-4/include/Libraries/INet/INetMgr.h @@ -0,0 +1,1010 @@ +/****************************************************************************** + * + * 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) + * + *****************************************************************************/ + +#ifndef __INETLIB_H__ +#define __INETLIB_H__ + +#include +#include +#include +#include + +#ifdef STATIC_BUILD +#define INETLIB_TRAP(x) +#else +#define INETLIB_TRAP SYS_TRAP +#endif + +#pragma mark Constants + +// Creator. Used for both the database that contains the INet Library and +// it's features for the feature manager. +#define inetCreator sysFileCINetLib // The Net Library creator + +// INet Library features have this creator +#define inetLibFtrCreator sysFileCINetLib // creatorID of INet Lib features. + +// Name of the InetLib +#define 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 +#define 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 +#define inetFtrNumCtpDeviceBits1 1 + +#define inetLibType sysFileTLibrary // Our Net Code Resources Database type + + +// ID for proxy IP address in flash +#define inetFlashProxyID 'IP' +#define 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 +//----------------------------------------------------------------------------- +#define netProxyIPManhattanHGA 0x0A0186A5 // Manhattan HGA = 10.1.134.165 or MAN 100005 +#define netProxyIPDefaultHGA netProxyIPManhattanHGA +#define netProxyIPDefaultHGAStr "10.1.134.165" //Should correspond to above value + +#pragma mark ErrorCodes +/******************************************************************** + * Error codes + ********************************************************************/ +#define inetErrNone 0 +#define inetErrTooManyClients (inetErrorClass | 1) // Too many clients already +#define inetErrHandleInvalid (inetErrorClass | 2) // Invalid inetH or sockH +#define inetErrParamsInvalid (inetErrorClass | 3) // +#define inetErrURLVersionInvalid (inetErrorClass | 4) // +#define inetErrURLBufTooSmall (inetErrorClass | 5) // +#define inetErrURLInvalid (inetErrorClass | 6) // +#define inetErrTooManySockets (inetErrorClass | 7) // +#define inetErrNoRequestCreated (inetErrorClass | 8) +#define inetErrNotConnected (inetErrorClass | 9) +#define inetErrInvalidRequest (inetErrorClass | 10) +#define inetErrNeedTime (inetErrorClass | 11) +#define inetErrHostnameInvalid (inetErrorClass | 12) +#define inetErrInvalidPort (inetErrorClass | 13) +#define inetErrInvalidHostAddr (inetErrorClass | 14) +#define inetErrNilBuffer (inetErrorClass | 15) +#define inetErrConnectTimeout (inetErrorClass | 16) +#define inetErrResolveTimeout (inetErrorClass | 17) +#define inetErrSendReqTimeout (inetErrorClass | 18) +#define inetErrReadTimeout (inetErrorClass | 19) +#define inetErrBufTooSmall (inetErrorClass | 20) +#define inetErrSchemeNotSupported (inetErrorClass | 21) +#define inetErrInvalidResponse (inetErrorClass | 22) +#define inetErrSettingTooLarge (inetErrorClass | 25) +#define inetErrSettingSizeInvalid (inetErrorClass | 26) +#define inetErrRequestTooLong (inetErrorClass | 27) +#define inetErrSettingNotImplemented (inetErrorClass | 28) + +// Configuration errors +#define inetErrConfigNotFound (inetErrorClass | 29) +#define inetErrConfigCantDelete (inetErrorClass | 30) +#define inetErrConfigTooMany (inetErrorClass | 31) +#define inetErrConfigBadName (inetErrorClass | 32) +#define inetErrConfigNotAlias (inetErrorClass | 33) +#define inetErrConfigCantPointToAlias (inetErrorClass | 34) +#define inetErrConfigEmpty (inetErrorClass | 35) +#define inetErrConfigAliasErr (inetErrorClass | 37) + +#define inetErrNoWirelessInterface (inetErrorClass | 38) + +// Encryption related errors +#define inetErrEncryptionNotAvail (inetErrorClass | 39) + // Need to re-send transaction because server told us to reset our + // encryption sequence number +#define inetErrNeedRetryEncSeqNum (inetErrorClass | 40) + // Need to re-send transaction because server sent us a new + // public key to use. +#define inetErrNeedRetryEncPublicKey (inetErrorClass | 41) + +#define inetErrResponseTooShort (inetErrorClass | 42) + +// errors specific to handling Mobitex ILLEGAL responses +#define inetErrMobitexIllegalOKHost (inetErrorClass | 43) +#define inetErrMobitexIllegalBadHost (inetErrorClass | 44) +// see error 92 also + +// HTTP errors +#define inetErrHTTPBadRequest (inetErrorClass | 45) +#define inetErrHTTPUnauthorized (inetErrorClass | 46) +#define inetErrHTTPForbidden (inetErrorClass | 47) +#define inetErrHTTPNotFound (inetErrorClass | 48) +#define inetErrHTTPMethodNotAllowed (inetErrorClass | 49) +#define inetErrHTTPNotAcceptable (inetErrorClass | 50) +#define inetErrHTTPProxyAuthRequired (inetErrorClass | 51) +#define inetErrHTTPRequestTimeout (inetErrorClass | 52) +#define inetErrHTTPConflict (inetErrorClass | 53) +#define inetErrHTTPGone (inetErrorClass | 54) +#define inetErrHTTPLengthRequired (inetErrorClass | 55) +#define inetErrHTTPPreconditionFailed (inetErrorClass | 56) +#define inetErrHTTPRequestTooLarge (inetErrorClass | 57) +#define inetErrHTTPRequestURITooLong (inetErrorClass | 58) +#define inetErrHTTPUnsupportedType (inetErrorClass | 59) +#define inetErrHTTPServerError (inetErrorClass | 60) + +// CTP errors +#define inetErrCTPServerError (inetErrorClass | 61) + +// Cache errors +#define inetErrTypeNotCached (inetErrorClass | 62) +#define inetErrCacheInvalid (inetErrorClass | 63) + +// Palm: and PalmCall: scheme errors +#define inetErrURLDispatched (inetErrorClass | 64) +#define inetErrDatabaseNotFound (inetErrorClass | 65) + +#define inetErrCTPMalformedRequest (inetErrorClass | 66) +#define inetErrCTPUnknownCommand (inetErrorClass | 67) +#define inetErrCTPTruncated (inetErrorClass | 68) +#define inetErrCTPUnknownError (inetErrorClass | 69) +#define inetErrCTPProxyError (inetErrorClass | 70) +#define inetErrCTPSocketErr (inetErrorClass | 71) + +#define inetErrCTPInvalidURL (inetErrorClass | 72) +#define inetErrCTPReferringPageOutOfDate (inetErrorClass | 73) +#define inetErrCTPBadRequest (inetErrorClass | 74) +#define inetErrUNUSED (inetErrorClass | 75) +#define inetErrCTPMailServerDown (inetErrorClass | 76) +#define inetErrCTPHostNotFound (inetErrorClass | 77) + + +// Content Conversion Errors +#define inetErrCTPContentInvalidTag (inetErrorClass | 78) +#define inetErrCTPContentInternal (inetErrorClass | 79) +#define inetErrCTPContentDataEnd (inetErrorClass | 80) +#define inetErrCTPContentResourceTooBig (inetErrorClass | 81) +#define inetErrCTPContentNoNoFrames (inetErrorClass | 82) +#define inetErrCTPContentUnsupportedContent (inetErrorClass | 83) +#define inetErrCTPContentUnsupportedEncoding (inetErrorClass | 84) +#define inetErrCTPContentBadForm (inetErrorClass | 85) +#define inetErrCTPContentBadFormMissingAction (inetErrorClass | 86) +#define inetErrCTPContentBadFormMissingMethod (inetErrorClass | 87) +#define inetErrCTPContentNoSourceData (inetErrorClass | 88) +#define inetErrCTPContentBadImage (inetErrorClass | 89) +#define inetErrCTPContentImageTooLarge (inetErrorClass | 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. +#define inetErrMobitexErrorHandled (inetErrorClass | 91) + +// Proxy down, non-default host, show dialog asking to revert to default +#define inetErrProxyDownBadHost (inetErrorClass | 92) + +// A second type of readtime. This should occur only when some data is received +// and the connection is lost. +#define inetErrHostConnectionLost (inetErrorClass | 93) + +// Unable to locate link record within a PQA file +#define inetErrLinkNotFound (inetErrorClass | 94) +// +#define inetErrCacheInvalidSort (inetErrorClass | 95) + +#pragma mark Types + +// 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. +#define inetCacheCompareByMasterURL (0x01) +#define inetCacheCompareByURL (0x02) +#define inetCacheCompareByTime (0x04) + + +/******************************************************************** + * Input flags + ********************************************************************/ +//----------------------------------------------------------------------------- +// flag word definitions for INetLibURLOpen +//----------------------------------------------------------------------------- +#define inetOpenURLFlagLookInCache 0x0001 +#define inetOpenURLFlagKeepInCache 0x0002 +#define inetOpenURLFlagForceEncOn 0x0008 // use encryption even if + // scheme does not desire it +#define inetOpenURLFlagForceEncOff 0x0010 // 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() +//----------------------------------------------------------------------------- +#define inetURLInfoFlagIsSecure 0x0001 +#define inetURLInfoFlagIsRemote 0x0002 +#define inetURLInfoFlagIsInCache 0x0004 + + +/******************************************************************** + * Configuration Support + ********************************************************************/ +//----------------------------------------------------------------------------- +// Names of built-in configuration aliases available through the +// INetLibConfigXXX calls +//----------------------------------------------------------------------------- +#define inetCfgNameDefault ".Default" // The default configuration +#define inetCfgNameDefWireline ".DefWireline" // The default wireline configuration +#define inetCfgNameDefWireless ".DefWireless" // The default wireless configuration +#define inetCfgNameCTPDefault ".CTPDefault" // Points to either .CTPWireline or .CTPWireless +#define inetCfgNameCTPWireline ".CTPWireline" // Wireline through the Jerry Proxy +#define inetCfgNameCTPWireless ".CTPWireless" // Wireless through the Jerry Proxy + + +//-------------------------------------------------------------------- +// Structure of a configuration name. Used by INetLibConfigXXX calls +//--------------------------------------------------------------------- +#define inetConfigNameSize 32 +typedef struct { + Char name[inetConfigNameSize]; // name of configuration + } INetConfigNameType, *INetConfigNamePtr; + + + + +/******************************************************************** + * Scheme Types + ********************************************************************/ +typedef enum { + inetSchemeUnknown = -1, + inetSchemeDefault = 0, + + inetSchemeHTTP, // http: + inetSchemeHTTPS, // https: + inetSchemeFTP, // ftp: + inetSchemeGopher, // gopher: + inetSchemeFile, // file: + inetSchemeNews, // news: + inetSchemeMailTo, // mailto: + inetSchemePalm, // palm: + inetSchemePalmCall, // palmcall: + + inetSchemeMail, // not applicable to URLS, but used + // for the INetLibSockOpen call when + // creating a socket for mail IO + inetSchemeMac, // mac: - Mac file system HTML + + inetSchemeFirst = inetSchemeHTTP, // first one + inetSchemeLast = inetSchemeMail // last one + } INetSchemeEnum; + + +/******************************************************************** + * Scheme Ports + ********************************************************************/ +#define inetPortFTP 21 +#define inetPortHTTP 80 +#define inetPortGopher 70 +#define inetPortNews 119 +#define inetPortHTTPS 44 + + + +/******************************************************************** + * Structure of a cracked URL. + ********************************************************************/ +typedef struct { + UInt16 version; // should be 0, for future compatibility + + UInt8 * schemeP; // ptr to scheme portion + UInt16 schemeLen; // size of scheme portion + UInt16 schemeEnum; // INetSchemEnum + + UInt8 * usernameP; // ptr to username portion + UInt16 usernameLen; // size of username + + UInt8 * passwordP; // ptr to password portion + UInt16 passwordLen; // size of password + + UInt8 * hostnameP; // ptr to host name portion + UInt16 hostnameLen; // size of host name + + UInt16 port; // port number + + UInt8 * pathP; // ptr to path portion + UInt16 pathLen; // size of path + + UInt8 * paramP; // param (;param) + UInt16 paramLen; // size of param + + UInt8 * queryP; // query (?query) + UInt16 queryLen; // size of query + + UInt8 * fragP; // fragment (#frag) + UInt16 fragLen; // size of fragment + } INetURLType; + + + +/******************************************************************** + * Structure for INetURLInfo. This structure is filled in with info + * about a URL. + ********************************************************************/ +typedef struct { + UInt16 version; // should be 0, for future compatibility + + UInt16 flags; // flags word, one or ore of + // inetURLInfoFlagXXX flags + UInt32 undefined; // reserved for future use + } INetURLInfoType; + + + +/******************************************************************** + * Content and Compression Type Enums(from proxy server or PQA Builder) + ********************************************************************/ +typedef enum { + inetContentTypeTextPlain = 0, + inetContentTypeTextHTML, + inetContentTypeImageGIF, + inetContentTypeImageJPEG, + inetContentTypeApplicationCML, + inetContentTypeImagePalmOS, + inetContentTypeOther + } INetContentTypeEnum; + +typedef enum { + inetCompressionTypeNone = 0, + inetCompressionTypeBitPacked, + inetCompressionTypeLZ77, + inetCompressionTypeBest, + inetCompressionTypeLZ77Primer1 + } INetCompressionTypeEnum; + +/******************************************************************** + * Proxy Types + ********************************************************************/ +typedef enum { + inetProxyNone = 0, // no proxy + inetProxyCTP = 1 // CTP (Jerry) proxy + } INetProxyEnum; + +/******************************************************************** + * Transport Types + ********************************************************************/ +typedef enum { + inetTransportPPP = 0, // PPP + inetTransportMobitex = 1 // Mobitex + } INetTransportEnum; + +/******************************************************************** + * Settings for the INetLibSettingSet/Get call. + ********************************************************************/ +typedef enum { + inetSettingProxyType, // (RW) UInt32, INetProxyEnum + + inetSettingProxyName, // (RW) Char[], name of proxy + inetSettingProxyPort, // (RW) UInt32, TCP port # of proxy + + inetSettingProxySocketType, // (RW) UInt32, which type of socket to use + // netSocketTypeXXX + + inetSettingCacheSize, // (RW) UInt32, max size of cache + inetSettingCacheRef, // (R) DmOpenRef, ref of cache DB + + inetSettingNetLibConfig, // (RW) UInt32, Which NetLib config to use. + + inetSettingRadioID, // (R) UInt32[2], the 64-bit radio ID + inetSettingBaseStationID, // (R) UInt32, the radio base station ID + + inetSettingMaxRspSize, // (W) UInt32 (in bytes) + inetSettingConvAlgorithm, // (W) UInt32 (CTPConvEnum) + inetSettingContentWidth, // (W) UInt32 (in pixels) + inetSettingContentVersion, // (W) UInt32 Content version (encoder version) + + inetSettingNoPersonalInfo, // (RW) UInt32 send no deviceID/zipcode + + inetSettingUserName, + + //--------------------------------------------------------------------------------- + // New Settings as of PalmOS 4.0 + //--------------------------------------------------------------------------------- + + inetSettingGraphicsSel, // (W) UInt8 (User Graphics selection) + + inetSettingTransportType, // (RW) UInt32, INetTransportEnum + + inetSettingServerBits1, // (RW) UInt32, bits sent by the server over ctp + inetSettingSendRawLocationInfo, // (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, // (RW) Boolean + // true: Cookies are enabled + // false: Cookies are disabled (default) + + inetSettingMaxCookieJarSize, // (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, // (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, // Default Name for this config + inetSettingProxyPortDefault, // Default Port for this config + inetSettingProxyNameEditable, // Is the proxy name editable? + inetSettingProxyPortEditable, // Is the proxy port editable? + + inetSettingPalmUserID, // The palm.net user id + + inetSettingLast + } INetSettingEnum; + + +/******************************************************************** + * Settings for the INetLibSockSettingSet/Get call. + ********************************************************************/ +typedef enum { + inetSockSettingScheme, // (R) UInt32, INetSchemeEnum + inetSockSettingSockContext, // (RW) UInt32, + + inetSockSettingCompressionType, // (R) Char[] + inetSockSettingCompressionTypeID, // (R) UInt32 (INetCompressionTypeEnum) + inetSockSettingContentType, // (R) Char[] + inetSockSettingContentTypeID, // (R) UInt32 (INetContentTypeEnum) + inetSockSettingData, // (R) UInt32, pointer to data + inetSockSettingDataHandle, // (R) UInt32, handle to data + inetSockSettingDataOffset, // (R) UInt32, offset to data from handle + + inetSockSettingTitle, // (RW) Char[] + inetSockSettingURL, // (R) Char[] + inetSockSettingIndexURL, // (RW) Char[] + + inetSockSettingFlags, // (W) UInt16, one or more of + // inetOpenURLFlagXXX flags + + inetSockSettingReadTimeout, // (RW) UInt32. Read timeout in ticks + + inetSockSettingContentVersion, // (R) UInt32, version number for content + + inetSockSettingLast + } INetSockSettingEnum; + + +/******************************************************************** + * Possible socket status values that can be returned from INetLibSockStatus + ********************************************************************/ +typedef enum { + inetStatusNew, // just opened + inetStatusResolvingName, // looking up host address + inetStatusNameResolved, // found host address + inetStatusConnecting, // connecting to host + inetStatusConnected, // connected to host + inetStatusSendingRequest, // sending request + inetStatusWaitingForResponse, // waiting for response + inetStatusReceivingResponse, // receiving response + inetStatusResponseReceived, // response received + inetStatusClosingConnection, // closing connection + inetStatusClosed, // closed + inetStatusAcquiringNetwork, // network temporarily + // unreachable; socket on hold + inetStatusPrvInvalid = 30 // internal value, not + // returned by INetMgr. Should + // be last. + } INetStatusEnum; + + + +/******************************************************************** + * 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 + ********************************************************************/ +typedef enum { + + // local error trying to communicate with server, if any + inetHTTPAttrCommErr, // (R) UInt32, read-only + + // object attributes, defined at creation + inetHTTPAttrEntityURL, // (-) Char[], which resource was requested + + + //----------------------------------------------------------- + // Request only attributes + //----------------------------------------------------------- + inetHTTPAttrReqAuthorization, // (-) Char[] + inetHTTPAttrReqFrom, // (-) Char[] + inetHTTPAttrReqIfModifiedSince, // (-) UInt32 + inetHTTPAttrReqReferer, // (-) Char[] + + // The following are ignored unless going through a CTP proxy + inetHTTPAttrWhichPart, // (W) UInt32 (0 -> N) + inetHTTPAttrIncHTTP, // (W) UInt32 (Boolean) only applicable + // when inetHTTPAttrConvAlgorithm set to + // ctpConvNone + inetHTTPAttrCheckMailHi, // (W) UInt32 + inetHTTPAttrCheckMailLo, // (W) UInt32 + inetHTTPAttrReqContentVersion, // (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, // (-) Char[] - entire HTTP response including + // data + inetHTTPAttrRspSize, // (R) UInt32 - entire HTTP Response size including + // header and data + inetHTTPAttrRspVersion, // (-) Char[] + inetHTTPAttrResult, // (R) UInt32 (ctpErrXXX when using CTP Proxy) + inetHTTPAttrErrDetail, // (R) UInt32 (server/proxy err code when + // using CTP Proxy) + inetHTTPAttrReason, // (R) Char[] + inetHTTPAttrDate, // (-) UInt32 + inetHTTPAttrNoCache, // (-) UInt32 + inetHTTPAttrPragma, // (-) Char[] + inetHTTPAttrServer, // (-) Char[] + inetHTTPAttrWWWAuthentication, // (-) Char[] + + + // Returned entity attributes + inetHTTPAttrContentAllow, // (-) Char[] + inetHTTPAttrContentLength, // (R) UInt32 + inetHTTPAttrContentLengthUncompressed, // (R) UInt32 (in bytes) + inetHTTPAttrContentPtr, // (-) Char * + inetHTTPAttrContentExpires, // (-) UInt32 + inetHTTPAttrContentLastModified, // (-) UInt32 + inetHTTPAttrContentLocation, // (-) Char[] + inetHTTPAttrContentLengthUntruncated, // (R) UInt32 + inetHTTPAttrContentVersion, // (R) UInt32, actual content version. Represented + // as 2 low bytes. Lowest byte is minor version, + // next higher byte is major version. + inetHTTPAttrContentCacheID, // (R) UInt32, cacheID for this item + inetHTTPAttrReqSize // (R) UInt32 size of request sent + + + } INetHTTPAttrEnum; + + + + +/******************************************************************** + * 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.... + ********************************************************************/ +#define inetSockReadyEvent firstINetLibEvent +#define inetSockStatusChangeEvent (firstINetLibEvent+1) +#define inetLastEvent (firstINetLibEvent+1) + +typedef struct { + UInt16 eType; + Boolean penDown; + UInt8 reserved; + Int16 screenX; + Int16 screenY; + union { + struct { + UInt16 datum[8]; + } generic; + + struct { + MemHandle sockH; // socket handle + UInt32 context; // application defined + Boolean inputReady; // true if ready for reads + Boolean outputReady; // true if ready for writes + } inetSockReady; + + struct { + MemHandle sockH; // socket handle + UInt32 context; // application defined + UInt16 status; // new status + Err sockErr; // socket err, if any + }inetSockStatusChange; + } data; + } INetEventType; + +/******************************************************************** + * Commands for INetLibWirelessIndicatorCmd (and INetLibWiCmd) + ********************************************************************/ +typedef enum { + wiCmdInit =0, + wiCmdClear, + wiCmdSetEnabled, + wiCmdDraw, + wiCmdEnabled, + wiCmdSetLocation, + wiCmdErase +} WiCmdEnum; + +/******************************************************************** + * INet Library functions. + ********************************************************************/ + +#pragma mark Traps + +#define inetLibTrapSettingGet (sysLibTrapCustom) +#define inetLibTrapSettingSet (sysLibTrapCustom+1) + +#define inetLibTrapGetEvent (sysLibTrapCustom+2) + +#define inetLibTrapURLOpen (sysLibTrapCustom+3) + +#define inetLibTrapSockRead (sysLibTrapCustom+4) +#define inetLibTrapSockWrite (sysLibTrapCustom+5) + +#define inetLibTrapSockOpen (sysLibTrapCustom+6) +#define inetLibTrapSockClose (sysLibTrapCustom+7) +#define inetLibTrapSockStatus (sysLibTrapCustom+8) +#define inetLibTrapSockSettingGet (sysLibTrapCustom+9) +#define inetLibTrapSockSettingSet (sysLibTrapCustom+10) +#define inetLibTrapSockConnect (sysLibTrapCustom+11) + +// Utilities +#define inetLibTrapURLCrack (sysLibTrapCustom+12) +#define inetLibTrapURLsAdd (sysLibTrapCustom+13) +#define inetLibTrapURLsCompare (sysLibTrapCustom+14) +#define inetLibTrapURLGetInfo (sysLibTrapCustom+15) + +// HTTP calls +#define inetLibTrapSockHTTPReqCreate (sysLibTrapCustom+16) +#define inetLibTrapSockHTTPAttrSet (sysLibTrapCustom+17) +#define inetLibTrapSockHTTPReqSend (sysLibTrapCustom+18) +#define inetLibTrapSockHTTPAttrGet (sysLibTrapCustom+19) + +// Mail traps +#define inetLibTrapSockMailReqCreate (sysLibTrapCustom+20) +#define inetLibTrapSockMailAttrSet (sysLibTrapCustom+21) +#define inetLibTrapSockMailReqAdd (sysLibTrapCustom+22) +#define inetLibTrapSockMailReqSend (sysLibTrapCustom+23) +#define inetLibTrapSockMailAttrGet (sysLibTrapCustom+24) +#define inetLibTrapSockMailQueryProgress (sysLibTrapCustom+25) + +// Cache calls +#define inetLibTrapCacheList (sysLibTrapCustom+26) +#define inetLibTrapCacheGetObject (sysLibTrapCustom+27) + +// Config calls +#define inetLibConfigMakeActive (sysLibTrapCustom+28) +#define inetLibConfigList (sysLibTrapCustom+29) +#define inetLibConfigIndexFromName (sysLibTrapCustom+30) +#define inetLibConfigDelete (sysLibTrapCustom+31) +#define inetLibConfigSaveAs (sysLibTrapCustom+32) +#define inetLibConfigRename (sysLibTrapCustom+33) +#define inetLibConfigAliasSet (sysLibTrapCustom+34) +#define inetLibConfigAliasGet (sysLibTrapCustom+35) + +// old wireless Indicator +#define inetLibTrapWiCmd (sysLibTrapCustom+36) + +// File Calls +#define inetLibTrapSockFileGetByIndex (sysLibTrapCustom+37) + +#define inetLibTrapCheckAntennaState (sysLibTrapCustom+38) + +#define inetLibTrapCTPSend (sysLibTrapCustom+39) + +// Additional Cache calls +#define inetLibTrapCachePurge (sysLibTrapCustom+40) + +// new wireless Indicator +#define inetLibTrapWirelessIndicatorCmd (sysLibTrapCustom+41) + +// Additional Cache calls +#define inetLibTrapCacheGetObjectV2 (sysLibTrapCustom+42) +#define inetLibTrapIndexedCacheFind (sysLibTrapCustom+43) +#define inetLibTrapPrepareCacheForHistory (sysLibTrapCustom+44) + + +//This should be at the END *********** +#define inetLibTrapLast (sysLibTrapCustom+45) + +/******************************************************************** + * 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 + ********************************************************************/ +typedef struct { + UInt8 * urlP; + UInt16 urlLen; + + UInt8 * titleP; + UInt16 titleLen; + + UInt32 lastViewed; // seconds since 1/1/1904 + UInt32 firstViewed; // seconds since 1/1/1904 +} INetCacheEntryType, *INetCacheEntryP; + +/******************************************************************** + * Structure for INetLibCacheGetObject. This structure is filled in with info + * about a cache entry. + ********************************************************************/ +typedef struct +{ + MemHandle recordH; + INetContentTypeEnum contentType; + INetCompressionTypeEnum encodingType; + UInt32 uncompressedDataSize; + UInt8 flags; + UInt8 reserved; + UInt16 dataOffset; // offset to content + UInt16 dataLength; // size of content + UInt16 urlOffset; // offset to URL + UInt32 viewTime; // time last viewed + UInt32 createTime; // time entry was created + UInt16 murlOffset; // offset to master URL + UInt32 serverBits1; // Bits sent by the server +} INetCacheInfoType, *INetCacheInfoPtr; + + +#pragma mark Functions + +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +Err INetLibOpen (UInt16 libRefnum, UInt16 config, UInt32 flags, + DmOpenRef cacheRef, UInt32 cacheSize, MemHandle* inetHP) + INETLIB_TRAP(sysLibTrapOpen); + +Err INetLibClose (UInt16 libRefnum, MemHandle inetH) + INETLIB_TRAP(sysLibTrapClose); + +Err INetLibSleep (UInt16 libRefnum) + INETLIB_TRAP(sysLibTrapSleep); + +Err INetLibWake (UInt16 libRefnum) + INETLIB_TRAP(sysLibTrapWake); + +//-------------------------------------------------- +// Settings +//-------------------------------------------------- +Err INetLibSettingGet(UInt16 libRefnum, MemHandle inetH, + UInt16 /*INetSettingEnum */ setting, + void * bufP, UInt16 * bufLenP) + INETLIB_TRAP(inetLibTrapSettingGet); + +Err INetLibSettingSet(UInt16 libRefnum, MemHandle inetH, + UInt16 /*INetSettingEnum*/ setting, + void * bufP, UInt16 bufLen) + INETLIB_TRAP(inetLibTrapSettingSet); + + +//-------------------------------------------------- +// Event Management +//-------------------------------------------------- + +void INetLibGetEvent(UInt16 libRefnum, MemHandle inetH, + INetEventType* eventP, Int32 timeout) + INETLIB_TRAP(inetLibTrapGetEvent); + + + +//-------------------------------------------------- +// High level calls +//-------------------------------------------------- + +Err INetLibURLOpen(UInt16 libRefnum, MemHandle inetH, UInt8 * urlP, + UInt8 * cacheIndexURLP, MemHandle* sockHP, Int32 timeout, UInt16 flags) + INETLIB_TRAP(inetLibTrapURLOpen); + +Err INetLibCTPSend(UInt16 libRefnum, MemHandle inetH, MemHandle *sockHP, + UInt8 *writeP, UInt32 writelen, Int32 timeout, UInt16 ctpCommand) + INETLIB_TRAP(inetLibTrapCTPSend); + +Err INetLibSockClose(UInt16 libRefnum, MemHandle socketH) + INETLIB_TRAP(inetLibTrapSockClose); + + +//-------------------------------------------------- +// Read/Write +//-------------------------------------------------- + +Err INetLibSockRead(UInt16 libRefnum, MemHandle sockH, void * bufP, + UInt32 reqBytes, UInt32 * actBytesP, Int32 timeout) + INETLIB_TRAP(inetLibTrapSockRead); + +Err INetLibSockWrite(UInt16 libRefnum, MemHandle sockH, void * bufP, + UInt32 reqBytes, UInt32 * actBytesP, Int32 timeout) + INETLIB_TRAP(inetLibTrapSockWrite); + + +//-------------------------------------------------- +// Low level Socket calls +//-------------------------------------------------- + +Err INetLibSockOpen(UInt16 libRefnum, MemHandle inetH, + UInt16 /*INetSchemEnum*/ scheme, MemHandle* sockHP) + INETLIB_TRAP(inetLibTrapSockOpen); + +Err INetLibSockStatus(UInt16 libRefnum, MemHandle socketH, UInt16 * statusP, + Err* sockErrP, Boolean* inputReadyP, Boolean* outputReadyP) + INETLIB_TRAP(inetLibTrapSockStatus); + +Err INetLibSockSettingGet(UInt16 libRefnum, MemHandle socketH, + UInt16 /*INetSockSettingEnum*/ setting, + void * bufP, UInt16 * bufLenP) + INETLIB_TRAP(inetLibTrapSockSettingGet); + +Err INetLibSockSettingSet(UInt16 libRefnum, MemHandle socketH, + UInt16 /*INetSockSettingEnum*/ setting, + void * bufP, UInt16 bufLen) + INETLIB_TRAP(inetLibTrapSockSettingSet); + +Err INetLibSockConnect(UInt16 libRefnum, MemHandle sockH, UInt8 * hostnameP, + UInt16 port, Int32 timeou) + INETLIB_TRAP(inetLibTrapSockConnect); + +//-------------------------------------------------- +// HTTP specific calls +//-------------------------------------------------- + +Err INetLibSockHTTPReqCreate(UInt16 libRefnum, MemHandle sockH, + UInt8 * verbP, UInt8 * resNameP, UInt8 * refererP) + INETLIB_TRAP(inetLibTrapSockHTTPReqCreate); + +Err INetLibSockHTTPAttrSet(UInt16 libRefnum, MemHandle sockH, + UInt16 /*inetHTTPAttrEnum*/ attr, UInt16 attrIndex, + UInt8 * bufP, UInt16 bufLen, UInt16 flags) + INETLIB_TRAP(inetLibTrapSockHTTPAttrSet); + +Err INetLibSockHTTPReqSend(UInt16 libRefnum, MemHandle sockH, + void * writeP, UInt32 writeLen, + Int32 timeout) + INETLIB_TRAP(inetLibTrapSockHTTPReqSend); + +Err INetLibSockHTTPAttrGet(UInt16 libRefnum, MemHandle sockH, + UInt16 /*inetHTTPAttrEnum*/ attr, UInt16 attrIndex, + void * bufP, UInt32 * bufLenP) + INETLIB_TRAP(inetLibTrapSockHTTPAttrGet); + + + +//-------------------------------------------------- +// Utilities +//-------------------------------------------------- + +Err INetLibURLCrack(UInt16 libRefnum, UInt8 * urlTextP, INetURLType* urlP) + INETLIB_TRAP(inetLibTrapURLCrack); + +Err INetLibURLsAdd(UInt16 libRefnum, Char * baseURLStr, Char * embeddedURLStr, + Char * resultURLStr, UInt16 * resultLenP) + INETLIB_TRAP(inetLibTrapURLsAdd); + +Int16 INetLibURLsCompare(UInt16 libRefnum, Char * URLStr1, Char * URLStr2) + INETLIB_TRAP(inetLibTrapURLsCompare); + +Err INetLibURLGetInfo(UInt16 libRefnum, MemHandle inetH, + UInt8 * urlTextP, INetURLInfoType* urlInfoP) + INETLIB_TRAP(inetLibTrapURLGetInfo); + +Boolean INetLibWiCmd(UInt16 refNum, UInt16 /*WiCmdEnum*/ cmd, int enableOrX, int y) + INETLIB_TRAP(inetLibTrapWiCmd); + +Boolean INetLibWirelessIndicatorCmd(UInt16 refNum, MemHandle inetH, UInt16 /*WiCmdEnum*/ cmd, int enableOrX, int y) + INETLIB_TRAP(inetLibTrapWirelessIndicatorCmd); + +Err INetLibCheckAntennaState(UInt16 refNum) + INETLIB_TRAP(inetLibTrapCheckAntennaState); + +//-------------------------------------------------- +// Cache interface +//-------------------------------------------------- + +Err INetLibCacheList(UInt16 libRefnum, MemHandle inetH, + UInt8 * cacheIndexURLP, UInt16 * indexP, UInt32 * uidP, + INetCacheEntryP cacheP) + INETLIB_TRAP(inetLibTrapCacheList); + +Err INetLibCacheGetObject(UInt16 libRefnum, MemHandle clientParamH, UInt8 * urlTextP, + UInt32 uniqueID, INetCacheInfoPtr cacheInfoP ) + INETLIB_TRAP(inetLibTrapCacheGetObject); + +Err INetLibCachePurge(UInt16 libRefnum, MemHandle clientParamH, UInt8 * urlTextP, UInt32 uniqueID) + INETLIB_TRAP(inetLibTrapCachePurge); + +Err INetLibCacheGetObjectV2(UInt16 libRefnum, MemHandle clientParamH, UInt8 * urlTextP, UInt32 uniqueID, + UInt16 rcIndex, INetCacheInfoPtr cacheInfoP, INetCacheEntryP cacheEntryP ) + INETLIB_TRAP(inetLibTrapCacheGetObjectV2); + +Err INetLibIndexedCacheFind(UInt16 libRefnum, DmOpenRef cacheDBRef, UInt8 * dataP, Int16 lookFor, UInt16 * indexP, + Int16 order, UInt32 * cacheIdP) + INETLIB_TRAP(inetLibTrapIndexedCacheFind); + +Err INetLibPrepareCacheForHistory(UInt16 libRefnum, MemHandle clientParamH) + INETLIB_TRAP(inetLibTrapPrepareCacheForHistory); + + +//-------------------------------------------------- +// Configuration Calls +//-------------------------------------------------- +Err INetLibConfigMakeActive( UInt16 refNum, MemHandle inetH, + UInt16 configIndex) + INETLIB_TRAP(inetLibConfigMakeActive); + +Err INetLibConfigList( UInt16 refNum, INetConfigNameType nameArray[], + UInt16 * arrayEntriesP) + INETLIB_TRAP(inetLibConfigList); + +Err INetLibConfigIndexFromName( UInt16 refNum, INetConfigNamePtr nameP, + UInt16 * indexP) + INETLIB_TRAP(inetLibConfigIndexFromName); + +Err INetLibConfigDelete( UInt16 refNum, UInt16 index) + INETLIB_TRAP(inetLibConfigDelete); + +Err INetLibConfigSaveAs( UInt16 refNum, MemHandle inetH, + INetConfigNamePtr nameP) + INETLIB_TRAP(inetLibConfigSaveAs); + +Err INetLibConfigRename( UInt16 refNum, UInt16 index, + INetConfigNamePtr newNameP) + INETLIB_TRAP(inetLibConfigRename); + +Err INetLibConfigAliasSet( UInt16 refNum, UInt16 configIndex, + UInt16 aliasToIndex) + INETLIB_TRAP(inetLibConfigAliasSet); + +Err INetLibConfigAliasGet( UInt16 refNum, UInt16 aliasIndex, + UInt16 * indexP, Boolean * isAnotherAliasP) + INETLIB_TRAP(inetLibConfigAliasGet); + +//-------------------------------------------------- +// File specific calls +//-------------------------------------------------- + +Err INetLibSockFileGetByIndex(UInt16 libRefnum, MemHandle sockH, + UInt32 index, MemHandle *handleP, UInt32 * offsetP, UInt32 * lengthP) + INETLIB_TRAP(inetLibTrapSockFileGetByIndex); + +#ifdef __cplusplus +} +#endif + +#endif //__INETLIB_H__ diff --git a/sdk-4/include/Libraries/LibTraps.h b/sdk-4/include/Libraries/LibTraps.h new file mode 100644 index 0000000..e75210d --- /dev/null +++ b/sdk-4/include/Libraries/LibTraps.h @@ -0,0 +1,42 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + + #ifndef __LIBTRAPS_H_ + #define __LIBTRAPS_H_ + +// Include elementary types +#include + +#if CPU_TYPE == CPU_68K +#include +#endif + +//-------------------------------------------------------------------- +// Define Library Trap Numbers +//-------------------------------------------------------------------- +// Library traps start here and go up by 1's +#define sysLibTrapBase 0xA800 + +#define sysLibTrapName 0xA800 +#define sysLibTrapOpen 0xA801 +#define sysLibTrapClose 0xA802 +#define sysLibTrapSleep 0xA803 +#define sysLibTrapWake 0xA804 +#define sysLibTrapCustom 0xA805 + +#endif //__LIBTRAPS_H_ diff --git a/sdk-4/include/Libraries/Lz77/Lz77Mgr.h b/sdk-4/include/Libraries/Lz77/Lz77Mgr.h new file mode 100644 index 0000000..4f93aa7 --- /dev/null +++ b/sdk-4/include/Libraries/Lz77/Lz77Mgr.h @@ -0,0 +1,188 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __LZ77MGR_H__ +#define __LZ77MGR_H__ + +#include + +// +// Common PalmOS and Windows section +// + +#define Lz77VerID 1 +#define Lz77LastSupportedVerID 1 + +#define lz77Compress true +#define lz77Expand false + +typedef Err Lz77ErrorType ; + +/******************************************************************** + * Error codes + ********************************************************************/ +#define lz77Success 0x00 +// Non Fatal Errors +#define lz77ErrNonFatalFirstErr (lz77ErrorClass | 0x00) +#define lz77ErrNonFatalInputBufferIncomplete (lz77ErrorClass | 0x01) +#define lz77ErrNonFatalOutputBufferFull (lz77ErrorClass | 0x02) +#define lz77ErrNonFatalLastErr (lz77ErrorClass | 0x7F) +// Fatal Errors +#define lz77ErrFatalFirstErr (lz77ErrorClass | 0x80) +#define lz77ErrFatalUnfinishedInputBuffer (lz77ErrorClass | 0x80) +#define lz77ErrFatalInputBufferIncomplete (lz77ErrorClass | 0x81) +#define lz77ErrFatalInputBufferInvalid (lz77ErrorClass | 0x82) +#define lz77ErrFatalMemAllocation (lz77ErrorClass | 0x83) +#define lz77ErrFatalHandleInvalid (lz77ErrorClass | 0x84) +#define lz77ErrFatalCantChangeToCompress (lz77ErrorClass | 0x85) +#define lz77ErrFatalUnknownVersion (lz77ErrorClass | 0x86) +#define lz77ErrFatalOutputBufferTooSmall (lz77ErrorClass | 0x87) +#define lz77ErrFatalInvalidArgument (lz77ErrorClass | 0x88) +#define lz77ErrFatalLastErr (lz77ErrorClass | 0xFF) + +#define lz77ErrIsFatal( err ) \ + ((err !=lz77Success) && ((err lz77ErrNonFatalLastErr))) + +#ifdef _WIN32 + +#else // PalmOS +// +// Specific PalmOS section +// + +#include +#include +#include + +#pragma mark Constants + +// Creator. Used for both the database that contains the LZ77 Library and +// it's features for the feature manager. +#define lz77Creator sysFileCLz77Lib // Lz77 Library creator +#define lz77LibName "Lz77.lib" // pass in to SysLibFind() + +/******************************************************************** + * LZ77 Library functions. + ********************************************************************/ + +#define lz77LibTrapChunk (sysLibTrapCustom) +#define lz77LibTrapMaxBufferSize (sysLibTrapCustom+1) +#define lz77LibTrapBufferGetInfo (sysLibTrapCustom+2) +#define lz77LibTrapBufferSetInfo (sysLibTrapCustom+3) + +#ifdef __cplusplus +extern "C" { +#endif + +#if EMULATION_LEVEL == EMULATION_NONE +#else // EMULATION_LEVEL == EMULATION_NONE + // The following functions are Traps on Palm OS + // and functions on the Simulator and on Windows Servers + #define Lz77LibOpen Lz77Open + #define Lz77LibClose Lz77Close + #define Lz77LibChunk Lz77Chunk + #define Lz77LibMaxBufferSize Lz77MaxBufferSize + #define Lz77LibBufferGetInfo Lz77BufferGetInfo + #define Lz77LibBufferSetInfo Lz77BufferSetInfo +#endif // EMULATION_LEVEL == EMULATION_NONE + +//-------------------------------------------------- +// Library initialization, shutdown, sleep and wake +//-------------------------------------------------- +Err Lz77LibOpen( + UInt16 libRefnum, // Palm OS reference calling number + MemHandle* lz77HandleP, // <- Pointer to returning LZ77 handle (NULL for error) + Boolean compressFlag, // -> TRUE = Compress; FALSE = Expand + UInt32 sourceSize, // -> Source size in bytes + MemHandle* destHP, // <-> If (*destHP != NULL) => use pre allocated memory + // (*destHP and *destSizeP) + // If (*destHP == NULL) => allocate memory in *destHP + UInt32 * destSizeP, // <-> 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 + UInt16 useVerNum, // -> 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) + UInt8 * primerP, // -> if (compressFlag ==lz77Compress) + // UncompressPrimer buffer pointer + // else CompressPrimer buffer pointer + // Must be valid compressed lz77 data + // compressed without a primer. + // NULL means no primer + UInt32 primerL, // -> Byte length of primer + UInt32 processedPrimerL) // -> Byte length of processed primer + // 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. + SYS_TRAP(sysLibTrapOpen); + +Err Lz77LibClose( + UInt16 libRefnum, // Palm OS reference calling number + MemHandle lz77Handle, // -> Lz77 Handle + UInt32 * ResultingSizeP ) // <- 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 + SYS_TRAP(sysLibTrapClose); + +Err Lz77LibSleep( UInt16 libRefnum) + SYS_TRAP(sysLibTrapSleep); + +Err Lz77LibWake( UInt16 libRefnum) + SYS_TRAP(sysLibTrapWake); + +Err Lz77LibChunk( + UInt16 libRefnum, // Palm OS reference calling number + MemHandle lz77Handle, // -> Lz77 Handle + UInt8 * sourceP, // -> Source buffer pointer + UInt32 sourceSize, // -> Source buffer Size (bytes) + UInt32 * sourceBitReadOffset ) // <-> Next bit to read from source + SYS_TRAP(lz77LibTrapChunk); + +Err Lz77LibMaxBufferSize( + UInt16 libRefnum, // Palm OS reference calling number + Boolean compressFlag, // -> TRUE = Compress; FALSE = Expand + UInt32 sourceSize, // -> Size of Source buffer + UInt32* maxBufferSizeP ) // <- result size pointer + SYS_TRAP(lz77LibTrapMaxBufferSize); + +Err Lz77LibBufferGetInfo( + UInt16 libRefnum, // Palm OS reference calling number + MemHandle lz77Handle, // -> Lz77 Handle + Boolean * compressFlagP, // <- Get compressFlag (true = compress mode; false = expand mode) + MemHandle* bufferHP, // <- Get the Pointer to the accumulated destination buffer + UInt32 * bufferByteSizeP, // <- Get destination buffer size in bytes + UInt32 * destBitOffsetP ) // <- Get destination bit offset + SYS_TRAP(lz77LibTrapBufferGetInfo); + +Err Lz77LibBufferSetInfo( + UInt16 libRefnum, // Palm OS reference calling number + MemHandle lz77Handle, // -> Lz77 Handle + Boolean compressFlag, // -> Set compressFlag (true = compress mode; false = expand mode) + MemHandle destH, // -> Set a Pointer to the accumulated destination buffer + UInt32 destByteSize, // -> Set destination buffer size in bytes + UInt32 destBitOffset ) // -> Set destination bit offset + SYS_TRAP(lz77LibTrapBufferSetInfo); + +#ifdef __cplusplus +} +#endif + +#endif // _WIN32 + +#endif //__LZ77LIB_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/BmpGlue.h b/sdk-4/include/Libraries/PalmOSGlue/BmpGlue.h new file mode 100644 index 0000000..88010df --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/BmpGlue.h @@ -0,0 +1,40 @@ +/****************************************************************************** + * + * Copyright (c) 2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: BmpGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Glue providing compatibility for applications that wish to make calls to + * some recent bitmap functions, but which might actually be running on a + * system which does not support newer calls. + * + * History: + * 2000-12-22 jwm Created. + * + *****************************************************************************/ + +#ifndef __BMPGLUE_H__ +#define __BMPGLUE_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void BmpGlueGetDimensions (const BitmapType *bitmapP, + Coord *widthP, Coord *heightP, UInt16 *rowBytesP); + +UInt8 BmpGlueGetBitDepth (const BitmapType *bitmapP); + +BitmapType *BmpGlueGetNextBitmap (BitmapType *bitmapP); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk-4/include/Libraries/PalmOSGlue/CtlGlue.h b/sdk-4/include/Libraries/PalmOSGlue/CtlGlue.h new file mode 100644 index 0000000..d9dabfa --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/CtlGlue.h @@ -0,0 +1,35 @@ +/****************************************************************************** + * + * Copyright (c) 2001 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: CtlGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Glue providing compatibility for applications that wish + * to make calls to the Control Manager, but which might be running + * on a system which does not support newer calls. + * + * History: + * 01/08/00 tlw Created by Tim Wiegman. + * + *****************************************************************************/ + +#ifndef __CTLGLUE_H__ +#define __CTLGLUE_H__ + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +ControlStyleType CtlGlueGetControlStyle(const ControlType *ctlP); + +#ifdef __cplusplus + } +#endif + +#endif // __CTLGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/DateGlue.h b/sdk-4/include/Libraries/PalmOSGlue/DateGlue.h new file mode 100644 index 0000000..e0e7644 --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/DateGlue.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: DateGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header file for DateGlue library routines. + * + * DateGlue provides compatibility for applications that wish to make + * calls to date routines, but which might actually be running on devices + * with roms that do not have newer routines available. + * + * History: + * 06/18/99 kwk Created by Ken Krugler. + * 01/31/00 kwk Removed unimplemented DateGlueToAscii. + * 12/14/00 kwk Added DateGlueTemplateToAscii. + * + *****************************************************************************/ + +#ifndef __DATEGLUE_H__ +#define __DATEGLUE_H__ + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +UInt16 DateGlueTemplateToAscii(const Char* templateP, UInt8 months, UInt8 days, + UInt16 years, Char* stringP, Int16 stringSize); + +void DateGlueToDOWDMFormat(UInt8 month, UInt8 day, UInt16 year, DateFormatType dateFormat, + Char* pString); + + +#ifdef __cplusplus + } +#endif + +#endif // __DATEGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/FldGlue.h b/sdk-4/include/Libraries/PalmOSGlue/FldGlue.h new file mode 100644 index 0000000..46d588d --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/FldGlue.h @@ -0,0 +1,35 @@ +/****************************************************************************** + * + * Copyright (c) 2001 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: FldGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Glue providing compatibility for applications that wish + * to make calls to the Field Manager, but which might be running + * on a system which does not support newer calls. + * + * History: + * 01/08/00 tlw Created by Tim Wiegman. + * + *****************************************************************************/ + +#ifndef __FLDGLUE_H__ +#define __FLDGLUE_H__ + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +Boolean FldGlueGetLineInfo(const FieldType *fldP, UInt16 lineNum, UInt16* startP, UInt16* lengthP); + +#ifdef __cplusplus + } +#endif + +#endif // __FLDGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/FntGlue.h b/sdk-4/include/Libraries/PalmOSGlue/FntGlue.h new file mode 100644 index 0000000..a0b206b --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/FntGlue.h @@ -0,0 +1,51 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: FntGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Glue providing compatibility for applications that wish + * to make calls to the Font Mgr, but which might actually be running + * on a system which does not support newer calls. + * + * History: + * 06/18/99 kwk Created by Ken Krugler. + * 06/27/99 kwk Added defaultBoldFont. + * 09/25/99 kwk Added FntGlueWidthToOffset. + * 05/12/00 kwk Added FntGlueWCharWidth. + * + *****************************************************************************/ + +#ifndef __FNTGLUE_H__ +#define __FNTGLUE_H__ + +#include + +enum fontDefaults { + defaultSmallFont = 0, + defaultLargeFont, + defaultBoldFont, + defaultSystemFont +}; +typedef enum fontDefaults FontDefaultType; + +#ifdef __cplusplus + extern "C" { +#endif + +FontID FntGlueGetDefaultFontID(FontDefaultType inFontType); + +Int16 FntGlueWCharWidth(WChar iChar); + +Int16 FntGlueWidthToOffset(const Char* charsP, UInt16 length, Int16 pixelWidth, + Boolean* leadingEdge, Int16* truncWidth); + +#ifdef __cplusplus + } +#endif + +#endif // __FNTGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/FrmGlue.h b/sdk-4/include/Libraries/PalmOSGlue/FrmGlue.h new file mode 100644 index 0000000..6490091 --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/FrmGlue.h @@ -0,0 +1,38 @@ +/****************************************************************************** + * + * Copyright (c) 2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: FrmGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Glue providing compatibility for applications that wish + * to make calls to the Form Manager, but which might be running + * on a system which does not support newer calls. + * + * History: + * 08/29/00 kwk Created by Ken Krugler. + * 01/08/01 tlw Added FrmGlueGetObjectUsable. + * + *****************************************************************************/ + +#ifndef __FRMGLUE_H__ +#define __FRMGLUE_H__ + +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + +FieldType* FrmGlueGetActiveField(const FormType* formP); +Boolean FrmGlueGetObjectUsable(const FormType *formP, UInt16 objIndex); + +#ifdef __cplusplus + } +#endif + +#endif // __FRMGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/IntlGlue.h b/sdk-4/include/Libraries/PalmOSGlue/IntlGlue.h new file mode 100644 index 0000000..8757efb --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/IntlGlue.h @@ -0,0 +1,87 @@ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: IntlGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header file for IntlGlue library routines. + * + * IntlGlue provides compatibility for applications that wish to make + * calls to Text Manager, but which might actually be running on devices + * with roms that do not have this support available, in which case the glue + * code executes the standard (Latin only) routines instead. This library + * can only be used on post-1.0 roms!!! + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 14 Sep 98 CSS Added this header and changed name (from IntlMgrLib.h). + * CSS Added new Text library-using macros. + * CSS All the Txt macros #defined in TextMgr.h are + * now #undef'ed here (#ifndef DIRECT_INTLMGR_CALLS) and + * then redefined to use our Text library-using macros. + * CSS Added an extern "C" wrapper around the routine + * declarations so non-C++ guys will see them. + * 15 Sep 98 kwk Sync'd with latest TextMgr.h header file. + * 15 Oct 98 kwk Sync'd again with latest TextMgr.h header file. + * kwk Added some missing macros for remapping Txt->Text routine names. + * kwk Added GetIntlRoutineAddress routine declaration. + * 02 Jun 99 kwk Changed names of routines to TxtGlueXXXX. + * 2000-11-15 jwm Reengineered IntlGlueGetRoutineAddress. + * + *****************************************************************************/ + +#ifndef __INTLGLUE_H__ +#define __INTLGLUE_H__ + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef _BUILDING_TXTLATIN +extern void + TxtLatinByteAttr(), TxtLatinCharAttr(), TxtLatinCharXAttr(), + TxtLatinCharSize(), TxtLatinCharWidth(), + TxtLatinGetPreviousChar(), TxtLatinGetNextChar(), TxtLatinGetChar(), + TxtLatinSetNextChar(), TxtLatinReplaceStr(), TxtLatinParamString(), + TxtLatinCharBounds(), TxtLatinGetTruncationOffset(), TxtLatinFindString(), + TxtLatinWordBounds(), TxtLatinGetWordWrapOffset(), TxtLatinCharEncoding(), + TxtLatinStrEncoding(), TxtLatinMaxEncoding(), TxtLatinEncodingName(), + TxtLatinNameToEncoding(), TxtLatinTransliterate(), TxtLatinCharIsValid(), + TxtLatinCaselessCompare(), TxtLatinCompare(), TxtLatinPrepFindString(); +#endif + +// IntlGlueGetRoutineAddress must be passed the desired selector (from the +// list in IntlMgr.h), just as with IntlGetRoutineAddress. You must also +// pass the corresponding latinSymbol from the list above. Being passed +// as an argument to IntlGlueGetRoutineAddress is the only useful use for +// these symbols -- don't try to do anything else with them. +// +// If the Int'l Mgr (and the appropriate Text Mgr routines) exists, then +// the result will be the same as calling IntlGetRoutineAddress() with the +// appropriate routine selector. If Text Mgr support is not available, then +// this call returns the address of the corresponding glue code routine. +// +// Note that the address returned is only valid so long as the application +// stays locked in memory, thus this routine should be called at or after +// your StartApplication routine, and only used up to the point where your +// application terminates. +// +// (In previous SDKs, there was an IntlGlueGetRoutineAddress function which +// took different parameters. It was never documented, and has been +// replaced by this one.) + +void *IntlGlueGetRoutineAddress(IntlSelector selector, const void *latinSymbol); + +#ifdef __cplusplus + } +#endif + +#endif // __INTLGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/LmGlue.h b/sdk-4/include/Libraries/PalmOSGlue/LmGlue.h new file mode 100644 index 0000000..1f04503 --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/LmGlue.h @@ -0,0 +1,60 @@ +/****************************************************************************** + * + * Copyright (c) 2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: LmGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Public header providing access to Locale Manager routines (independent of + * Palm OS version). + * + * History: + * 08/11/00 CS Created by Chris Schneider. + * + *****************************************************************************/ + +#ifndef __LMGLUE_H__ +#define __LMGLUE_H__ + +#include + +/*********************************************************************** + * Locale Manager glue routines + **********************************************************************/ + +#ifdef __cplusplus + extern "C" { +#endif + +/* Return the number of known locales (maximum locale index + 1). +*/ +UInt16 +LmGlueGetNumLocales(void); + +/* Convert to by locating it within the set of known +locales. +*/ +Err +LmGlueLocaleToIndex( const + LmLocaleType* iLocale, + UInt16* oLocaleIndex); + +/* Return in the setting identified by which is appropriate for +the locale identified by . Return lmErrSettingDataOverflow if the +data for occupies more than bytes. Display a non-fatal +error if is larger than the data for a fixed-size setting. +*/ +Err +LmGlueGetLocaleSetting( UInt16 iLocaleIndex, + LmLocaleSettingChoice iChoice, + void* oValue, + UInt16 iValueSize); + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/sdk-4/include/Libraries/PalmOSGlue/LstGlue.h b/sdk-4/include/Libraries/PalmOSGlue/LstGlue.h new file mode 100644 index 0000000..965bace --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/LstGlue.h @@ -0,0 +1,35 @@ +/****************************************************************************** + * + * Copyright (c) 2001 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: LstGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Glue providing compatibility for applications that wish to make calls to + * some recent list functions, but which might actually be running on a + * system which does not support these newer calls. + * + * History: + * 2001-02-26 jwm Created. + * + *****************************************************************************/ + +#ifndef __LSTGLUE_H__ +#define __LSTGLUE_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +Int16 LstGlueGetTopItem (const ListType *listP); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk-4/include/Libraries/PalmOSGlue/OmGlue.h b/sdk-4/include/Libraries/PalmOSGlue/OmGlue.h new file mode 100644 index 0000000..53c783a --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/OmGlue.h @@ -0,0 +1,37 @@ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: OmGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header file for OmGlue library routines. + * + * Glue providing overlay manager utility routines. + * + * History: + * 02/03/00 kwk Created by Ken Krugler. + * + *****************************************************************************/ + +#ifndef __OMGLUE_H__ +#define __OMGLUE_H__ + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +void OmGlueGetCurrentLocale(OmLocaleType *currentLocale); + +void OmGlueGetSystemLocale(OmLocaleType *systemLocale); + +#ifdef __cplusplus + } +#endif + +#endif // __OMGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/PalmOSGlue.h b/sdk-4/include/Libraries/PalmOSGlue/PalmOSGlue.h new file mode 100644 index 0000000..79299ff --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/PalmOSGlue.h @@ -0,0 +1,40 @@ +/****************************************************************************** + * + * Copyright (c) 2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOSGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Public includes for the whole PalmOSGlue library. + * + * History: + * 02/09/00 kwk Created by Ken Krugler. + * 08/11/00 CS Added LmGlue.h for new Locale Manager glue. + * 08/29/00 kwk Added FrmGlue.h for FrmGlueGetActiveField. + * + *****************************************************************************/ + +#ifndef __PALMOSGLUE_H__ +#define __PALMOSGLUE_H__ + +#include // Bitmap glue routines. +#include // Control glue routines. +#include // Date & time glue routines. +#include // Field manager glue routines. +#include // Font manager glue routines. +#include // Form glue routines. +#include // List glue routines. +#include // Int'l manager glue routines. +#include // Overlay manager glue routines. +#include // Locale manager glue routines. +#include // Resource utility glue routines. +#include // Table glue routines. +#include // Text services manager glue routines. +#include // Text manager glue routines. +#include // System manager glue routines. +#include // Window manager glue routines. + +#endif // __PALMOSGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/ResGlue.h b/sdk-4/include/Libraries/PalmOSGlue/ResGlue.h new file mode 100644 index 0000000..6b940da --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/ResGlue.h @@ -0,0 +1,35 @@ +/****************************************************************************** + * + * Copyright (c) 2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: ResGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header file for ResGlue library routines. + * + * Glue providing resource utility routines. + * + * History: + * 02/09/00 kwk Created by Ken Krugler. + * + *****************************************************************************/ + +#ifndef __RESGLUE_H__ +#define __RESGLUE_H__ + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +UInt32 ResGlueLoadConstant(UInt16 rscID); + +#ifdef __cplusplus + } +#endif + +#endif // __RESGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/SysGlue.h b/sdk-4/include/Libraries/PalmOSGlue/SysGlue.h new file mode 100644 index 0000000..b83cffc --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/SysGlue.h @@ -0,0 +1,47 @@ +/****************************************************************************** + * + * Copyright (c) 2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: SysGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header file for SysGlue library routines. + * + * Glue providing system manager utility routines & bug-fixed routines. + * + * History: + * 01/31/00 kwk Created by Ken Krugler. + * 02/09/00 kwk Added the SysGlueTrapExists macro. + * + *****************************************************************************/ + +#ifndef __SYSGLUE_H__ +#define __SYSGLUE_H__ + +#include + +// On the Simulator, we always assume that the trap (actually the routine) exists, +// since we're also assuming that the user is linking against the latest Palm OS +// core code, which will have a routine for every implemented trap. Since +// SysGetTrapAddress doesn't work on the Simulator, this is the best we can do. + +#if (EMULATION_LEVEL == EMULATION_NONE) +#define SysGlueTrapExists(trapNum) (SysGlueGetTrapAddress(trapNum) != SysGlueGetTrapAddress(sysTrapSysUnimplemented)) +#else +#define SysGlueTrapExists(trapNum) true +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +void* SysGlueGetTrapAddress(UInt16 trapNum); + +#ifdef __cplusplus + } +#endif + +#endif // __SYSGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/TblGlue.h b/sdk-4/include/Libraries/PalmOSGlue/TblGlue.h new file mode 100644 index 0000000..239378c --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/TblGlue.h @@ -0,0 +1,39 @@ +/****************************************************************************** + * + * Copyright (c) 2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: TblGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Glue providing compatibility for applications that wish to make calls to + * some recent table functions, but which might actually be running on a + * system which does not support newer calls. + * + * History: + * 2000-12-22 jwm Created. + * + *****************************************************************************/ + +#ifndef __TBLGLUE_H__ +#define __TBLGLUE_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +Int16 TblGlueGetNumberOfColumns (const TableType *tableP); + +Int16 TblGlueGetTopRow (const TableType *tableP); + +void TblGlueSetSelection (TableType *tableP, Int16 row, Int16 column); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk-4/include/Libraries/PalmOSGlue/TsmGlue.h b/sdk-4/include/Libraries/PalmOSGlue/TsmGlue.h new file mode 100644 index 0000000..fef0d6e --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/TsmGlue.h @@ -0,0 +1,41 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: TsmGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header file for TsmGlueXXX library routines. + * + * History: + * 06/02/99 kwk Created by Ken Krugler. + * 07/06/00 kwk Since the status ptr must now be NULL, changed the type + * to be void*. + * + *****************************************************************************/ + +#ifndef __TSMGLUE_H__ +#define __TSMGLUE_H__ + +#include + +// Library versions of all the Text Services Mgr routines: + +#ifdef __cplusplus + extern "C" { +#endif + +TsmFepModeType +TsmGlueGetFepMode(void* nullParam); + +TsmFepModeType +TsmGlueSetFepMode(void* nullParam, TsmFepModeType inNewMode); + +#ifdef __cplusplus + } +#endif + +#endif // __TSMGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/TxtGlue.h b/sdk-4/include/Libraries/PalmOSGlue/TxtGlue.h new file mode 100644 index 0000000..c14f4c0 --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/TxtGlue.h @@ -0,0 +1,146 @@ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: TxtGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header file for TxtGlue library routines. + * + * TxtGlue provides compatibility for applications that wish to make + * calls to Text Manager, but which might actually be running on devices + * with roms that do not have this support available, in which case the glue + * code executes the standard (Latin only) routines instead. This library + * can only be used on post-1.0 roms!!! + * + * History: + * 09/14/98 CS Added this header and changed name (from IntlMgrLib.h). + * CS Added new Text library-using macros. + * CS All the Txt macros #defined in TextMgr.h are + * now #undef'ed here (#ifndef DIRECT_INTLMGR_CALLS) and + * then redefined to use our Text library-using macros. + * CS Added an extern "C" wrapper around the routine + * declarations so non-C++ guys will see them. + * 09/15/98 kwk Sync'd with latest TextMgr.h header file. + * 10/15/98 kwk Sync'd again with latest TextMgr.h header file. + * kwk Added some missing macros for remapping Txt->Text routine names. + * kwk Added GetIntlRoutineAddress routine declaration. + * 06/02/99 kwk Changed names of routines to TxtGlueXXXX. + * 07/14/99 kek Deleted TxtGluePrepFindString. + * 11/06/99 kwk Put back in TxtGluePrepFindString, using the old API. + * 02/03/00 kwk Added TxtGlueTruncateString. + * 05/12/00 kwk Deprecated TxtGlueCharWidth. + * 12/11/00 kwk Removed duplicated declarations for TxtGlueUpper/LowerChar, etc. + * 2000-12-22 jwm TxtGlueCharWidth is still deprecated -- use + * FntGlueWCharWidth instead -- but we don't want to break code. + * + *****************************************************************************/ + +#ifndef __TXTGLUE_H__ +#define __TXTGLUE_H__ + +#include + +// Duplicate versions of all of the macros in TextMgr.h that call the library +// routines instead: + +#define TxtGlueCharIsSpace(ch) ((TxtGlueCharAttr(ch) & charAttrSpace) != 0) +#define TxtGlueCharIsPrint(ch) ((TxtGlueCharAttr(ch) & charAttrPrint) != 0) +#define TxtGlueCharIsDigit(ch) ((TxtGlueCharAttr(ch) & _DI) != 0) +#define TxtGlueCharIsAlNum(ch) ((TxtGlueCharAttr(ch) & charAttrAlNum) != 0) +#define TxtGlueCharIsAlpha(ch) ((TxtGlueCharAttr(ch) & charAttrAlpha) != 0) +#define TxtGlueCharIsCntrl(ch) ((TxtGlueCharAttr(ch) & charAttrCntrl) != 0) +#define TxtGlueCharIsGraph(ch) ((TxtGlueCharAttr(ch) & charAttrGraph) != 0) +#define TxtGlueCharIsLower(ch) ((TxtGlueCharAttr(ch) & _LO) != 0) +#define TxtGlueCharIsPunct(ch) ((TxtGlueCharAttr(ch) & _PU) != 0) +#define TxtGlueCharIsUpper(ch) ((TxtGlueCharAttr(ch) & _UP) != 0) +#define TxtGlueCharIsHex(ch) ((TxtGlueCharAttr(ch) & _XD) != 0) +#define TxtGlueCharIsDelim(ch) ((TxtGlueCharAttr(ch) & charAttrDelim) != 0) + +#define TxtGluePreviousCharSize(inText, inOffset) TxtGlueGetPreviousChar((inText), (inOffset), NULL) +#define TxtGlueNextCharSize(inText, inOffset) TxtGlueGetNextChar((inText), (inOffset), NULL) + +#ifdef __cplusplus + extern "C" { +#endif + +UInt8 TxtGlueByteAttr(UInt8 inByte); + +UInt16 TxtGlueCharAttr(WChar inChar); + +UInt16 TxtGlueCharXAttr(WChar inChar); + +UInt16 TxtGlueCharSize(WChar inChar); + +Int16 TxtGlueCharWidth(WChar inChar); + +UInt16 TxtGlueGetPreviousChar(const Char* inText, UInt32 inOffset, WChar* outChar); + +UInt16 TxtGlueGetNextChar(const Char* inText, UInt32 inOffset, WChar* outChar); + +WChar TxtGlueGetChar(const Char* inText, UInt32 inOffset); + +UInt16 TxtGlueReplaceStr(Char* ioStr, UInt16 inMaxLen, const Char* inParamStr, UInt16 inParamNum); + +UInt16 TxtGlueSetNextChar(Char* ioText, UInt32 inOffset, WChar inChar); + +WChar TxtGlueCharBounds(const Char* inText, UInt32 inOffset, UInt32* outStart, UInt32* outEnd); + +Boolean TxtGlueFindString(const Char* inSourceStr, const Char* inTargetStr, + UInt32* outPos, UInt16* outLength); + +Boolean TxtGlueWordBounds(const Char* inText, UInt32 inLength, UInt32 inOffset, + UInt32* outStart, UInt32* outEnd); + +CharEncodingType TxtGlueCharEncoding(WChar inChar); + +CharEncodingType TxtGlueStrEncoding(const Char* inStr); + +CharEncodingType TxtGlueMaxEncoding(CharEncodingType a, CharEncodingType b); + +const Char* TxtGlueEncodingName(CharEncodingType inEncoding); + +Err TxtGlueTransliterate(const Char* inSrcText, UInt16 inSrcLength, Char* outDstText, + UInt16* ioDstLength, TranslitOpType inOp); + +void TxtGlueUpperStr(Char* ioString, UInt16 inMaxLength); + +void TxtGlueLowerStr(Char* ioString, UInt16 inMaxLength); + +WChar TxtGlueUpperChar(WChar inChar); + +WChar TxtGlueLowerChar(WChar inChar); + +UInt32 TxtGlueGetTruncationOffset(const Char* inText, UInt32 inOffset); + +Boolean TxtGlueTruncateString(Char* ioStringP, UInt16 inMaxWidth); + +Boolean TxtGlueCharIsValid(WChar inChar); + +Int16 TxtGlueCaselessCompare(const Char* s1, UInt16 s1Len, UInt16* s1MatchLen, + const Char* s2, UInt16 s2Len, UInt16* s2MatchLen); + +Int16 TxtGlueCompare(const Char* s1, UInt16 s1Len, UInt16* s1MatchLen, + const Char* s2, UInt16 s2Len, UInt16* s2MatchLen); + +WChar TxtGlueGetNumericSpaceChar(void); + +WChar TxtGlueGetHorizEllipsisChar(void); + +Boolean TxtGlueCharIsVirtual(UInt16 inModifiers, WChar inChar); + +Char* TxtGlueStripSpaces(Char* ioStr, Boolean leading, Boolean trailing); + +Char* TxtGlueParamString(const Char* inTemplate, const Char* param0, + const Char* param1, const Char* param2, const Char* param3); + +void TxtGluePrepFindString(const Char* inSrcP, Char* outDstP, UInt16 inDstSize); + +#ifdef __cplusplus + } +#endif + +#endif // __TXTGLUE_H__ diff --git a/sdk-4/include/Libraries/PalmOSGlue/WinGlue.h b/sdk-4/include/Libraries/PalmOSGlue/WinGlue.h new file mode 100644 index 0000000..729af57 --- /dev/null +++ b/sdk-4/include/Libraries/PalmOSGlue/WinGlue.h @@ -0,0 +1,42 @@ +/****************************************************************************** + * + * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: WinGlue.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Header file for WinGlue library routines. + * + * WinGlue provides compatibility for applications that wish to make + * calls to Window routines, but which might actually be running on devices + * with roms that do not have newer routines available. + * + * Written by TransPac Software, Inc. + * + * History: + * Created by Ken Krugler + * 06/18/99 kwk New today. + * + *****************************************************************************/ + +#ifndef __WINGLUE_H__ +#define __WINGLUE_H__ + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +void WinGlueDrawChar(WChar theChar, Int16 x, Int16 y); + +void WinGlueDrawTruncChars(const Char* pChars, UInt16 length, Int16 x, Int16 y, Int16 maxWidth); + +#ifdef __cplusplus + } +#endif + +#endif // __WINGLUE_H__ diff --git a/sdk-4/include/Libraries/Pdi/PdiConst.h b/sdk-4/include/Libraries/Pdi/PdiConst.h new file mode 100644 index 0000000..7a1d37e --- /dev/null +++ b/sdk-4/include/Libraries/Pdi/PdiConst.h @@ -0,0 +1,279 @@ +/****************************************************************************** + * + * 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 + *****************************************************************************/ + +#define kPdiPVF_ADR_POST_OFFICE ((UInt8) 0) +#define kPdiPVF_ADR_EXTENDED ((UInt8) 1) +#define kPdiPVF_ADR_STREET ((UInt8) 2) +#define kPdiPVF_ADR_LOCALITY ((UInt8) 3) +#define kPdiPVF_ADR_REGION ((UInt8) 4) +#define kPdiPVF_ADR_POSTAL_CODE ((UInt8) 5) +#define kPdiPVF_ADR_COUNTRY ((UInt8) 6) +#define kPdiPVF_GEO_LATITUDE ((UInt8) 0) +#define kPdiPVF_GEO_LONGITUDE ((UInt8) 1) +#define kPdiPVF_N_FAMILY ((UInt8) 0) +#define kPdiPVF_N_GIVEN ((UInt8) 1) +#define kPdiPVF_N_ADDITIONAL ((UInt8) 2) +#define kPdiPVF_N_PREFIXES ((UInt8) 3) +#define kPdiPVF_N_SUFFIXES ((UInt8) 4) + +/****************************************************************************** + * Properties constants + *****************************************************************************/ + +#define kPdiPRN_FREEBUSY ((UInt16) 988) +#define kPdiPRN_X_PALM_CUSTOM ((UInt16) 1044) +#define kPdiPRN_METHOD ((UInt16) 1108) +#define kPdiPRN_ORG ((UInt16) 1236) +#define kPdiPRN_X_PALM_CATEGORY ((UInt16) 1250) +#define kPdiPRN_TITLE ((UInt16) 1488) +#define kPdiPRN_ORGANIZER ((UInt16) 1528) +#define kPdiPRN_TZ ((UInt16) 1566) +#define kPdiPRN_VERSION ((UInt16) 1682) +#define kPdiPRN_TZID ((UInt16) 1722) +#define kPdiPRN_CLASS ((UInt16) 1814) +#define kPdiPRN_TZURL ((UInt16) 1832) +#define kPdiPRN_EXDATE ((UInt16) 1886) +#define kPdiPRN_EXRULE ((UInt16) 1906) +#define kPdiPRN_PRODID ((UInt16) 1926) +#define kPdiPRN_TZNAME ((UInt16) 1946) +#define kPdiPRN_GEO ((UInt16) 1966) +#define kPdiPRN_UID ((UInt16) 1980) +#define kPdiPRN_PROFILE ((UInt16) 1994) +#define kPdiPRN_PRIORITY ((UInt16) 2032) +#define kPdiPRN_ROLE ((UInt16) 2056) +#define kPdiPRN_TZOFFSET ((UInt16) 2072) +#define kPdiPRN_AALARM ((UInt16) 2160) +#define kPdiPRN_TZOFFSETTO ((UInt16) 2180) +#define kPdiPRN_TZOFFSETFROM ((UInt16) 2244) +#define kPdiPRN_SOUND ((UInt16) 2312) +#define kPdiPRN_ACTION ((UInt16) 2410) +#define kPdiPRN_SOURCE ((UInt16) 2430) +#define kPdiPRN_ADR ((UInt16) 2472) +#define kPdiPRN_COMMENT ((UInt16) 2486) +#define kPdiPRN_CONTACT ((UInt16) 2530) +#define kPdiPRN_NICKNAME ((UInt16) 2568) +#define kPdiPRN_COMPLETED ((UInt16) 2620) +#define kPdiPRN_RRULE ((UInt16) 2646) +#define kPdiPRN_ATTACH ((UInt16) 2692) +#define kPdiPRN_SORT_STRING ((UInt16) 2728) +#define kPdiPRN_ATTENDEE ((UInt16) 2776) +#define kPdiPRN_LOGO ((UInt16) 2800) +#define kPdiPRN_EMAIL ((UInt16) 2832) +#define kPdiPRN_END ((UInt16) 2852) +#define kPdiPRN_BDAY ((UInt16) 2866) +#define kPdiPRN_CALSCALE ((UInt16) 2882) +#define kPdiPRN_LOCATION ((UInt16) 2906) +#define kPdiPRN_PERCENT_COMPLETE ((UInt16) 2930) +#define kPdiPRN_PHOTO ((UInt16) 2970) +#define kPdiPRN_RDATE ((UInt16) 2988) +#define kPdiPRN_CATEGORIES ((UInt16) 3026) +#define kPdiPRN_CREATED ((UInt16) 3074) +#define kPdiPRN_REV ((UInt16) 3096) +#define kPdiPRN_LABEL ((UInt16) 3226) +#define kPdiPRN_BEGIN ((UInt16) 3244) +#define kPdiPRN_END_VCARD ((UInt16) 3262) +#define kPdiPRN_END_VTODO ((UInt16) 3288) +#define kPdiPRN_AGENT ((UInt16) 3314) +#define kPdiPRN_DALARM ((UInt16) 3372) +#define kPdiPRN_FN ((UInt16) 3392) +#define kPdiPRN_REPEAT ((UInt16) 3404) +#define kPdiPRN_END_VEVENT ((UInt16) 3424) +#define kPdiPRN_END_VJOURNAL ((UInt16) 3560) +#define kPdiPRN_END_VCALENDAR ((UInt16) 3694) +#define kPdiPRN_RESOURCES ((UInt16) 3728) +#define kPdiPRN_END_VFREEBUSY ((UInt16) 3754) +#define kPdiPRN_END_VTIMEZONE ((UInt16) 3788) +#define kPdiPRN_STATUS ((UInt16) 3870) +#define kPdiPRN_RELATED_TO ((UInt16) 3890) +#define kPdiPRN_TRANSP ((UInt16) 3918) +#define kPdiPRN_KEY ((UInt16) 3938) +#define kPdiPRN_BEGIN_VCARD ((UInt16) 3952) +#define kPdiPRN_BEGIN_VTODO ((UInt16) 3982) +#define kPdiPRN_TRIGGER ((UInt16) 4012) +#define kPdiPRN_NOTE ((UInt16) 4034) +#define kPdiPRN_BEGIN_VEVENT ((UInt16) 4050) +#define kPdiPRN_N ((UInt16) 4118) +#define kPdiPRN_LAST_MODIFIED ((UInt16) 4128) +#define kPdiPRN_RECURRENCE_ID ((UInt16) 4162) +#define kPdiPRN_MAILER ((UInt16) 4216) +#define kPdiPRN_REQUEST_STATUS ((UInt16) 4236) +#define kPdiPRN_BEGIN_VJOURNAL ((UInt16) 4272) +#define kPdiPRN_SUMMARY ((UInt16) 4366) +#define kPdiPRN_BEGIN_VCALENDAR ((UInt16) 4388) +#define kPdiPRN_URL ((UInt16) 4426) +#define kPdiPRN_BEGIN_VFREEBUSY ((UInt16) 4440) +#define kPdiPRN_BEGIN_VTIMEZONE ((UInt16) 4478) +#define kPdiPRN_SEQUENCE ((UInt16) 4594) +#define kPdiPRN_DTEND ((UInt16) 4660) +#define kPdiPRN_DTSTART ((UInt16) 4678) +#define kPdiPRN_DUE ((UInt16) 4700) +#define kPdiPRN_TEL ((UInt16) 4714) +#define kPdiPRN_DTSTAMP ((UInt16) 4744) +#define kPdiPRN_NAME ((UInt16) 4800) +#define kPdiPRN_DURATION ((UInt16) 4954) +#define kPdiPRN_DESCRIPTION ((UInt16) 5270) + +/****************************************************************************** + * Parameters constants + *****************************************************************************/ + +#define kPdiPAN_DELEGATED_TO ((UInt16) 1012) +#define kPdiPAN_X ((UInt16) 1098) +#define kPdiPAN_DELEGATED_FROM ((UInt16) 1128) +#define kPdiPAN_MEMBER ((UInt16) 1164) +#define kPdiPAN_UTC_OFFSET ((UInt16) 1186) +#define kPdiPAN_DIR ((UInt16) 1350) +#define kPdiPAN_TYPE ((UInt16) 1428) +#define kPdiPAN_TIME ((UInt16) 1446) +#define kPdiPAN_PARTSTAT ((UInt16) 1738) +#define kPdiPAN_ROLE ((UInt16) 2056) +#define kPdiPAN_CN ((UInt16) 2208) +#define kPdiPAN_SOUND ((UInt16) 2312) +#define kPdiPAN_RANGE ((UInt16) 2330) +#define kPdiPAN_CONTEXT ((UInt16) 2508) +#define kPdiPAN_RSVP ((UInt16) 2816) +#define kPdiPAN_ENCODE ((UInt16) 3054) +#define kPdiPAN_ENCODING ((UInt16) 3166) +#define kPdiPAN_FMTTYPE ((UInt16) 3452) +#define kPdiPAN_RELATED ((UInt16) 3474) +#define kPdiPAN_RELTYPE ((UInt16) 3496) +#define kPdiPAN_LANGUAGE ((UInt16) 3618) +#define kPdiPAN_STATUS ((UInt16) 3870) +#define kPdiPAN_CUTYPE ((UInt16) 4308) +#define kPdiPAN_SENT_BY ((UInt16) 4556) +#define kPdiPAN_URI ((UInt16) 4580) +#define kPdiPAN_VALUE ((UInt16) 4852) +#define kPdiPAN_ALTREP ((UInt16) 5200) +#define kPdiPAN_FBTYPE ((UInt16) 5220) +#define kPdiPAN_CHARSET ((UInt16) 5300) + +/****************************************************************************** + * Parameter pairs constants + *****************************************************************************/ + +#define kPdiPAV_TYPE_HOME ((UInt16) 0) +#define kPdiPAV_VALUE_VCARD ((UInt16) 2) +#define kPdiPAV_TYPE_VCARD ((UInt16) 4) +#define kPdiPAV_VALUE_UTC_OFFSET ((UInt16) 6) +#define kPdiPAV_TYPE_POSTAL ((UInt16) 8) +#define kPdiPAV_RELTYPE_SIBLING ((UInt16) 10) +#define kPdiPAV_TYPE_INTL ((UInt16) 12) +#define kPdiPAV_CUTYPE_GROUP ((UInt16) 14) +#define kPdiPAV_ROLE_OPT_PARTICIPANT ((UInt16) 16) +#define kPdiPAV_VALUE_INTEGER ((UInt16) 18) +#define kPdiPAV_VALUE_TIME ((UInt16) 20) +#define kPdiPAV_TYPE_INTERNET ((UInt16) 22) +#define kPdiPAV_TYPE_PAGER ((UInt16) 24) +#define kPdiPAV_ROLE_ORGANIZER ((UInt16) 26) +#define kPdiPAV_ENCODING_Q ((UInt16) 28) +#define kPdiPAV_CUTYPE_INDIVIDUAL ((UInt16) 30) +#define kPdiPAV_PARTSTAT_IN_PROCESS ((UInt16) 32) +#define kPdiPAV_RELTYPE_PARENT ((UInt16) 34) +#define kPdiPAV_TYPE_PARCEL ((UInt16) 36) +#define kPdiPAV_TYPE_PREF ((UInt16) 38) +#define kPdiPAV_RANGE_THISANDPRIOR ((UInt16) 40) +#define kPdiPAV_ENCODING_8BIT ((UInt16) 42) +#define kPdiPAV_RANGE_THISANDFUTURE ((UInt16) 44) +#define kPdiPAV_TYPE_PCS ((UInt16) 46) +#define kPdiPAV_CUTYPE_ROOM ((UInt16) 48) +#define kPdiPAV_PARTSTAT_NEEDS_ACTION ((UInt16) 50) +#define kPdiPAV_STATUS_NEEDS_ACTION ((UInt16) 52) +#define kPdiPAV_ENCODING_B ((UInt16) 54) +#define kPdiPAV_VALUE_BOOLEAN ((UInt16) 56) +#define kPdiPAV_TYPE_X400 ((UInt16) 58) +#define kPdiPAV_TYPE_ISDN ((UInt16) 60) +#define kPdiPAV_ROLE_OWNER ((UInt16) 62) +#define kPdiPAV_TYPE_VIDEO ((UInt16) 64) +#define kPdiPAV_ENCODING_BASE64 ((UInt16) 66) +#define kPdiPAV_VALUE_PERIOD ((UInt16) 68) +#define kPdiPAV_TYPE_BBS ((UInt16) 70) +#define kPdiPAV_PARTSTAT_ACCEPTED ((UInt16) 72) +#define kPdiPAV_STATUS_ACCEPTED ((UInt16) 74) +#define kPdiPAV_PARTSTAT_COMPLETED ((UInt16) 76) +#define kPdiPAV_STATUS_COMPLETED ((UInt16) 78) +#define kPdiPAV_STATUS_CONFIRMED ((UInt16) 80) +#define kPdiPAV_TYPE_CAR ((UInt16) 82) +#define kPdiPAV_TYPE_DOM ((UInt16) 84) +#define kPdiPAV_ROLE_ATTENDEE ((UInt16) 86) +#define kPdiPAV_RELATED_END ((UInt16) 88) +#define kPdiPAV_VALUE_FLOAT ((UInt16) 90) +#define kPdiPAV_CUTYPE_UNKNOWN ((UInt16) 92) +#define kPdiPAV_VALUE_CAL_ADDRESS ((UInt16) 94) +#define kPdiPAV_FBTYPE_BUSY ((UInt16) 96) +#define kPdiPAV_VALUE_DATE ((UInt16) 98) +#define kPdiPAV_VALUE_RECUR ((UInt16) 100) +#define kPdiPAV_TYPE_MODEM ((UInt16) 102) +#define kPdiPAV_ENCODING_QUOTED_PRINTABLE ((UInt16) 104) +#define kPdiPAV_CUTYPE_RESOURCE ((UInt16) 106) +#define kPdiPAV_RSVP_TRUE ((UInt16) 108) +#define kPdiPAV_VALUE_PHONE_NUMBER ((UInt16) 110) +#define kPdiPAV_RELATED_START ((UInt16) 112) +#define kPdiPAV_VALUE_DATE_TIME ((UInt16) 114) +#define kPdiPAV_TYPE_CELL ((UInt16) 116) +#define kPdiPAV_STATUS_SENT ((UInt16) 118) +#define kPdiPAV_TYPE_VOICE ((UInt16) 120) +#define kPdiPAV_FBTYPE_BUSY_TENTATIVE ((UInt16) 122) +#define kPdiPAV_ROLE_REQ_PARTICIPANT ((UInt16) 124) +#define kPdiPAV_VALUE_URI ((UInt16) 126) +#define kPdiPAV_FBTYPE_BUSY_UNAVAILABLE ((UInt16) 128) +#define kPdiPAV_TYPE_FAX ((UInt16) 130) +#define kPdiPAV_TYPE_MSG ((UInt16) 132) +#define kPdiPAV_TYPE_WORK ((UInt16) 134) +#define kPdiPAV_VALUE_TEXT ((UInt16) 136) +#define kPdiPAV_CONTEXT_WORD ((UInt16) 138) +#define kPdiPAV_RSVP_FALSE ((UInt16) 140) +#define kPdiPAV_VALUE_BINARY ((UInt16) 142) +#define kPdiPAV_ROLE_NON_PARTICIPANT ((UInt16) 144) +#define kPdiPAV_VALUE_DURATION ((UInt16) 146) +#define kPdiPAV_X_X_PALM_N ((UInt16) 148) +#define kPdiPAV_X_X_IRMC_N ((UInt16) 150) +#define kPdiPAV_FBTYPE_FREE ((UInt16) 152) +#define kPdiPAV_PARTSTAT_DECLINED ((UInt16) 154) +#define kPdiPAV_STATUS_DECLINED ((UInt16) 156) +#define kPdiPAV_PARTSTAT_TENTATIVE ((UInt16) 158) +#define kPdiPAV_STATUS_TENTATIVE ((UInt16) 160) +#define kPdiPAV_PARTSTAT_DELEGATED ((UInt16) 162) +#define kPdiPAV_STATUS_DELEGATED ((UInt16) 164) +#define kPdiPAV_RELTYPE_CHILD ((UInt16) 166) +#define kPdiPAV_ROLE_CHAIR ((UInt16) 168) +#define kPdiPAV_X_X_PALM_ORG ((UInt16) 170) +#define kPdiPAV_X_X_IRMC_ORG ((UInt16) 172) +#define kPdiPAV_X_X_PALM_MAIN ((UInt16) 174) + +/****************************************************************************** + * Properties types constants + *****************************************************************************/ + +#define kPdiType_DATE_TIME kPdiPAV_VALUE_DATE_TIME +#define kPdiType_TEXT kPdiPAV_VALUE_TEXT +#define kPdiType_CAL_ADDRESS kPdiPAV_VALUE_CAL_ADDRESS +#define kPdiType_DURATION kPdiPAV_VALUE_DURATION +#define kPdiType_RECUR kPdiPAV_VALUE_RECUR +#define kPdiType_PERIOD kPdiPAV_VALUE_PERIOD +#define kPdiType_FLOAT kPdiPAV_VALUE_FLOAT +#define kPdiType_BINARY kPdiPAV_VALUE_BINARY +#define kPdiType_INTEGER kPdiPAV_VALUE_INTEGER +#define kPdiType_UTC_OFFSET kPdiPAV_VALUE_UTC_OFFSET +#define kPdiType_URI kPdiPAV_VALUE_URI +#define kPdiType_BOOLEAN kPdiPAV_VALUE_BOOLEAN +#define kPdiType_DATE kPdiPAV_VALUE_DATE +#define kPdiType_TIME kPdiPAV_VALUE_TIME +#define kPdiType_VCARD kPdiPAV_VALUE_VCARD +#define kPdiType_PHONE_NUMBER kPdiPAV_VALUE_PHONE_NUMBER + diff --git a/sdk-4/include/Libraries/Pdi/PdiLib.h b/sdk-4/include/Libraries/Pdi/PdiLib.h new file mode 100644 index 0000000..781e837 --- /dev/null +++ b/sdk-4/include/Libraries/Pdi/PdiLib.h @@ -0,0 +1,299 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __PDILIB_H__ +#define __PDILIB_H__ + +#ifndef BUILDING_PDI_LIB +# define PDI_LIB_TRAP(trapNum) SYS_TRAP(trapNum) +#else +# define PDI_LIB_TRAP(trapNum) +# define sysLibTrapCustom 0 +#endif + +#include +#include +#include + +/******************************************************************* + * Unified data access types and macros + *******************************************************************/ + +#include + +/******************************************************************* + * 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 + +#include + +/******************************************************************* + * Internal library name which can be passed to SysLibFind() + *******************************************************************/ + +#define kPdiLibName "Pdi.lib" + +/******************************************************************* + * Pdi Library function trap ID's + *******************************************************************/ + +#define PdiLibTrapReaderNew (sysLibTrapCustom) +#define PdiLibTrapReaderDelete (sysLibTrapCustom+1) +#define PdiLibTrapWriterNew (sysLibTrapCustom+2) +#define PdiLibTrapWriterDelete (sysLibTrapCustom+3) +#define PdiLibTrapReadProperty (sysLibTrapCustom+4) +#define PdiLibTrapReadPropertyField (sysLibTrapCustom+5) +#define PdiLibTrapReadPropertyName (sysLibTrapCustom+6) +#define PdiLibTrapReadParameter (sysLibTrapCustom+7) +#define PdiLibTrapDefineResizing (sysLibTrapCustom+8) +#define PdiLibTrapEnterObject (sysLibTrapCustom+9) +#define PdiLibTrapWriteBeginObject (sysLibTrapCustom+10) +#define PdiLibTrapWriteProperty (sysLibTrapCustom+11) +#define PdiLibTrapWriteParameter (sysLibTrapCustom+12) +#define PdiLibTrapWritePropertyValue (sysLibTrapCustom+13) +#define PdiLibTrapWritePropertyFields (sysLibTrapCustom+14) +#define PdiLibTrapWritePropertyBinaryValue (sysLibTrapCustom+15) +#define PdiLibTrapSetEncoding (sysLibTrapCustom+16) +#define PdiLibTrapSetCharset (sysLibTrapCustom+17) +#define PdiLibTrapWritePropertyStr (sysLibTrapCustom+18) +#define PdiLibTrapWriteParameterStr (sysLibTrapCustom+19) +#define PdiLibTrapDefineReaderDictionary (sysLibTrapCustom+20) +#define PdiLibTrapDefineWriterDictionary (sysLibTrapCustom+21) + +/******************************************************************* + * Pdi Library result codes + *******************************************************************/ + +#define pdiErrRead (pdiErrorClass | 1) +#define pdiErrWrite (pdiErrorClass | 2) +#define pdiErrNoPropertyName (pdiErrorClass | 3) +#define pdiErrNoPropertyValue (pdiErrorClass | 4) +#define pdiErrMoreChars (pdiErrorClass | 5) +#define pdiErrNoMoreFields (pdiErrorClass | 6) +#define pdiErrOpenFailed (pdiErrorClass | 7) +#define pdiErrCloseFailed (pdiErrorClass | 8) + +/******************************************************************* + * Pdi library constants + *******************************************************************/ + +#define kPdiASCIIEncoding 0 // consider ascii value +#define kPdiQPEncoding kPdiPAV_ENCODING_QUOTED_PRINTABLE // value must be QP encoded (write) or is QP encoded (read) +#define kPdiB64Encoding kPdiPAV_ENCODING_BASE64 // value must be B64 encoded (write) or is B64 encoded (read) +#define kPdiBEncoding kPdiPAV_ENCODING_B // same as above but ENCODING=B in place of ENCODING=BASE64 +#define kPdiEscapeEncoding ((UInt16) (0x8000)) // special encoding where newline are backslashed +#define kPdiNoEncoding ((UInt16) (0x8001)) // value must not be encoded (write) + +// Constants for structured property values +#define kPdiNoFields ((UInt16) 0) // Consider property value has just one field +#define kPdiCommaFields ((UInt16) 1) // Consider property value can have several fields comma separated +#define kPdiSemicolonFields ((UInt16) 2) // Consider property value can have several fields semicolon separated +#define kPdiDefaultFields ((UInt16) 4) // Accept default fields definition (dictionary information) +#define kPdiConvertComma ((UInt16) 8) // Consider property value has just one field, commas are converted to '\n' +#define kPdiConvertSemicolon ((UInt16) 16) // Consider property value has just one field, semicolons are converted to '\n' + +// Constants to manage parser/generator behavior + +// Generator behavior +#define kPdiEnableFolding ((UInt16) 1) +#define kPdiEnableQuotedPrintable ((UInt16) 2) +#define kPdiEscapeMultiFieldValues ((UInt16) 4) // Earlier PalmOS compatiblity +#define kPdiEnableB ((UInt16) 8) // New B encoding type (in place of base64) + +#define kPdiPalmCompatibility (kPdiEscapeMultiFieldValues | kPdiEnableQuotedPrintable) + +// Parser behavior, currently the open parser is OK +// Maybe future evolution will declare new constants +#define kPdiOpenParser ((UInt16) 16) // Generic parser + +// Constants to manage writting of values +#define kPdiWriteData ((UInt16) 0) // No charset computation (non text values) +#define kPdiWriteText ((UInt16) 8) // charset computation +#define kPdiWriteMultiline ((UInt16) 16) // if present: must encode else encoding is determinated by charset + +// Constant to manage growing buffers +#define kPdiResizableBuffer ((UInt16) 0xFFFF) // Special value to indicate a resizable buffer (handle based) +#define kPdiDefaultBufferMaxSize ((UInt16) 0x3FFF) // Maximum size of a resizable buffer non including terminal 0 +#define kPdiDefaultBufferDeltaSize ((UInt16) 0x0010) // Delta (& minimum) size of resizable buffer + +// event mask of automata +#define kPdiEOFEventMask ((UInt16) 1) +#define kPdiGroupNameEventMask ((UInt16) 2) // A group name is found +#define kPdiPropertyNameEventMask ((UInt16) 4) // A property name is found +#define kPdiParameterNameEventMask ((UInt16) 8) // A parameter name is found +#define kPdiParameterValueEventMask ((UInt16) 16) // A parameter value is found +#define kPdiPropertyDefinedEventMask ((UInt16) 32) // A property definition is found (the ':' separator is reached) +#define kPdiPropertyValueEventMask ((UInt16) 64) // An entire property value is found +#define kPdiPropertyValueFieldEventMask ((UInt16) 128) // A value field is found (';' separated) +#define kPdiPropertyValueItemEventMask ((UInt16) 256) // A value item is found (',' separated) +#define kPdiPropertyValueMoreCharsEventMask ((UInt16) 512) // The application didn't provide a large enought buffer: more chars must be read +#define kPdiBeginObjectEventMask ((UInt16) 1024) // BEGIN reached +#define kPdiEndObjectEventMask ((UInt16) 2048) // END reached +#define kPdiPropertyValueCRLFEventMask ((UInt16) 4096) // A value item is found (',' separated) + +/******************************************************************* + * Public Data structures. + *******************************************************************/ + +typedef UInt8 PdiDictionary; + +typedef struct PdiReaderTag { + Err error; // last error + UInt8 encoding; // Type of encoding of the property value + UInt8 fieldNum; + CharEncodingType charset; // Charset of property value + UInt16 written; // Current number of chars already written in buffer + UInt16 property; // ID of the current property + UInt16 propertyValueType; // type of property value + UInt16 parameter; // ID of the last parsed parameter name + UInt32 parameterPairs[8]; // set of bits of parsed parameter values + UInt16 customFieldNumber; // Value of X-PALM-CUSTOM (cutom fields) + void* appData; // General usage app dependent field + UInt16 pdiRefNum; // The refNum of the Pdi library + UInt16 events; // Mask of events (see kPdiXXXXEventMask constants) + Char* groupName; + Char* propertyName; + Char* parameterName; + Char* parameterValue; + Char* propertyValue; +} PdiReaderType; + +typedef struct _PdiWriter { + Err error; // last error + UInt16 encoding; // Type of encoding of the property value + CharEncodingType charset; // Charset of property value + void* appData; // General usage app dependent field + UInt16 pdiRefNum; // The refNum of the Pdi library +} PdiWriterType; + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************* + * Library Open & Close functions + *******************************************************************/ + +extern Err PdiLibOpen(UInt16 libRefnum) + PDI_LIB_TRAP(sysLibTrapOpen); + +extern Err PdiLibClose(UInt16 libRefnum) + PDI_LIB_TRAP(sysLibTrapClose); + +/******************************************************************* + * Reader / Writer initialization & finalization functions + *******************************************************************/ + +extern PdiReaderType* PdiReaderNew(UInt16 libRefnum, UDAReaderType *input, UInt16 version) + PDI_LIB_TRAP(PdiLibTrapReaderNew); + +extern void PdiReaderDelete(UInt16 libRefnum, PdiReaderType** ioReader) + PDI_LIB_TRAP(PdiLibTrapReaderDelete); + +extern PdiWriterType* PdiWriterNew(UInt16 libRefnum, UDAWriterType *output, UInt16 version) + PDI_LIB_TRAP(PdiLibTrapWriterNew); + +extern void PdiWriterDelete(UInt16 libRefnum, PdiWriterType** ioWriter) + PDI_LIB_TRAP(PdiLibTrapWriterDelete); + + +/******************************************************************* + * Read functions group. + *******************************************************************/ + +extern Err PdiReadProperty(UInt16 libRefnum, PdiReaderType* ioReader) + PDI_LIB_TRAP(PdiLibTrapReadProperty); + +extern Err PdiReadPropertyField(UInt16 libRefnum, PdiReaderType* ioReader, Char** bufferPP, UInt16 bufferSize, UInt16 readMode) + PDI_LIB_TRAP(PdiLibTrapReadPropertyField); + +extern Err PdiReadPropertyName(UInt16 libRefnum, PdiReaderType* ioReader) + PDI_LIB_TRAP(PdiLibTrapReadPropertyName); + +extern Err PdiReadParameter(UInt16 libRefnum, PdiReaderType* ioReader) + PDI_LIB_TRAP(PdiLibTrapReadParameter); + +extern Err PdiDefineResizing(UInt16 libRefnum, PdiReaderType* ioReader, UInt16 deltaSize, UInt16 maxSize) + PDI_LIB_TRAP(PdiLibTrapDefineResizing); + +#define PdiParameterPairTest(reader, pair) \ + ((reader->parameterPairs[(pair) & 7] & ((UInt32) (1) << ((UInt8) (pair) >> 3))) != 0) + +/******************************************************************* + * Recursive objects functions group. + *******************************************************************/ + +extern Err PdiEnterObject(UInt16 libRefnum, PdiReaderType* ioReader) + PDI_LIB_TRAP(PdiLibTrapEnterObject); + +/******************************************************************* + * Write functions group. + *******************************************************************/ + +extern Err PdiWriteBeginObject(UInt16 libRefnum, PdiWriterType* ioWriter, UInt16 objectNameID) + PDI_LIB_TRAP(PdiLibTrapWriteBeginObject); + +#define PdiWriteEndObject PdiWriteBeginObject + +extern Err PdiWriteProperty(UInt16 libRefnum, PdiWriterType* ioWriter, UInt16 propertyNameID) + PDI_LIB_TRAP(PdiLibTrapWriteProperty); + +extern Err PdiWriteParameter(UInt16 libRefnum, PdiWriterType* ioWriter, UInt16 parameter, Boolean parameterName) + PDI_LIB_TRAP(PdiLibTrapWriteParameter); + + +extern Err PdiWritePropertyValue(UInt16 libRefnum, PdiWriterType* ioWriter, Char* buffer, UInt16 options) + PDI_LIB_TRAP(PdiLibTrapWritePropertyValue); + +extern Err PdiWritePropertyFields(UInt16 libRefnum, PdiWriterType* ioWriter, Char* fields[], UInt16 fieldNumber, UInt16 options) + PDI_LIB_TRAP(PdiLibTrapWritePropertyFields); + +extern Err PdiWritePropertyBinaryValue(UInt16 libRefnum, PdiWriterType* ioWriter, const Char* buffer, UInt16 size, UInt16 options) + PDI_LIB_TRAP(PdiLibTrapWritePropertyBinaryValue); + +extern Err PdiSetEncoding(UInt16 libRefnum, PdiWriterType* ioWriter, UInt16 encoding) + PDI_LIB_TRAP(PdiLibTrapSetEncoding); + +extern Err PdiSetCharset(UInt16 libRefnum, PdiWriterType* ioWriter, CharEncodingType charset) + PDI_LIB_TRAP(PdiLibTrapSetCharset); + +extern Err PdiWritePropertyStr(UInt16 libRefnum, PdiWriterType* ioWriter, const Char* propertyName, UInt8 writeMode, UInt8 requiredFields) + PDI_LIB_TRAP(PdiLibTrapWritePropertyStr); + +extern Err PdiWriteParameterStr(UInt16 libRefnum, PdiWriterType* ioWriter , const Char* parameterName, const Char* parameterValue) + PDI_LIB_TRAP(PdiLibTrapWriteParameterStr); + +/******************************************************************* + * Customisation functions group + *******************************************************************/ + +extern PdiDictionary* PdiDefineReaderDictionary(UInt16 libRefnum, PdiReaderType* ioReader, PdiDictionary* dictionary, Boolean disableMainDictionary) + PDI_LIB_TRAP(PdiLibTrapDefineReaderDictionary); + +extern PdiDictionary* PdiDefineWriterDictionary(UInt16 libRefnum, PdiWriterType* ioWriter, PdiDictionary* dictionary, Boolean disableMainDictionary) + PDI_LIB_TRAP(PdiLibTrapDefineWriterDictionary); + +#ifdef __cplusplus +} +#endif + + +#endif // __PDILIB_H__ diff --git a/sdk-4/include/Libraries/Sms/SmsLib.h b/sdk-4/include/Libraries/Sms/SmsLib.h new file mode 100644 index 0000000..b894148 --- /dev/null +++ b/sdk-4/include/Libraries/Sms/SmsLib.h @@ -0,0 +1,319 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __SMSLIB_H__ +#define __SMSLIB_H__ + +#include +#include +#include +#include +#include + +// 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. + +#include + +/**************************************************************************** + * + * ExgLibControl opcodes + * + ****************************************************************************/ + +/* Those Op codes take SmsPrefType as parameter */ +#define exgLibSmsPrefGetOp (exgLibCtlSpecificOp | 1) +#define exgLibSmsPrefGetDefaultOp (exgLibCtlSpecificOp | 2) +#define exgLibSmsPrefSetOp (exgLibCtlSpecificOp | 3) + +/* This Op code takes a network type constant as parameter kSmsNetworkXxx */ +#define exgLibSmsPrefDisplayOp (exgLibCtlSpecificOp | 4) + +/* This Op code takes an UInt16 as parameter */ +#define exgLibSmsIncompleteGetCountOp (exgLibCtlSpecificOp | 5) + +/* This OpCode takes a SmsID (UInt16) as parameter */ +#define exgLibSmsIncompleteDeleteOp (exgLibCtlSpecificOp | 6) + +/**************************************************************************** + * + * Types and Constants + * + ****************************************************************************/ + +#define 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 +#define kSmsFtrNumVersion ((UInt16)0) + +// 0xMMmfsbbb, where MM is major version, m is minor version +// f is bug fix, s is stage: 3-release, 2-beta, 1-alpha, 0-development, +// bbb is build number for non-releases +// V1.12b3 would be: 0x01122003 +// V2.00a2 would be: 0x02001002 +// V1.01 would be: 0x01013000 + +#define kSmsMessageRegExtensionType "sms" +#define kSmsReportRegExtensionType "rps" +#define kSmsExtensionTypeLength 3 + +#define kSmsScheme "_sms" + +#define kSmsMaxPhoneSize (kTelMaxPhoneNumberLen + 1) // Max length for Phone number + +#define kSmsNBSConverter ((UInt8)0) // NBS header will be add to the data +#define kSmsNoConverter ((UInt8)1) // No header will be add to the data. + +#define kSmsRowDataEncoding ((UInt8)0) // 8 bit encoding scheme +#define kSmsTextEncoding ((UInt8)1) // 7 bit compressed encoding scheme. + +#define kSmsNetworkAuto ((UInt8)-1) +#define kSmsNetworkCDMA ((UInt8)kTelNwkCDMA) +#define kSmsNetworkGSM ((UInt8)kTelNwkGSM) +#define kSmsNetworkTDMA ((UInt8)kTelNwkTDMA) +#define kSmsNetworkPDC ((UInt8)kTelNwkPDC) + +#define kSmsMessageType ((UInt8)0) +#define kSmsIncompleteType ((UInt8)1) +#define kSmsReportType ((UInt8)2) + +/**************************************************************************** + * + * Sms Error + * + ****************************************************************************/ +#pragma mark Sms Error + +#define kSmsErrMaxSizeExceeded (smsErrorClass | 0x01) /* Message exceeds maximum size supported by network */ + +/**************************************************************************** + * + * Data Structures + * + ****************************************************************************/ + +#pragma mark Report Param +/**************************************************************************** + * Report parameters + ****************************************************************************/ + +/* Report Parameters Type + ---------------------- */ +typedef struct SmsReportParamsTag +{ + UInt32 timeStamp; // TimeStamp of the report (when delivered, or last attempt, ...) + UInt16 index; // SMS index on the phone storage + UInt8 reportType; // Delivery report type + UInt8 report; // Status report indicator + Char* originatingAddress; // Phone number to which belong the report (was sent) + +} SmsReportParamsType, *SmsReportParamsPtr; + + +#pragma mark Send Param +/**************************************************************************** + * Send parameters + ****************************************************************************/ + +/* Advanced Parameters Type for TDMA & CDMA network + ------------------------------------------------ */ +typedef struct SmsSendCDMAParamsTag +{ + UInt8 messageType; // Message Type + + TelSmsDateTimeType deferredDate; + + UInt8 priority; + UInt8 privacy; + + UInt8 alertOnDelivery:1; + UInt8 manualAckRequest:1; + UInt8 reserved:6; + + Char* callbackNumber; // Address to reply + +} SmsSendCDMAParamsType, *SmsSendCDMAParamsPtr; + +typedef SmsSendCDMAParamsType SmsSendTDMAParamsType, *SmsSendTDMAParamsPtr; + + +/* Advanced Parameters Type for GSM network + ---------------------------------------- */ + +typedef struct SmsSendGSMParamsTag +{ + UInt16 protocolId; // Reserved - not supported (Fax, paging, . . .) + Char* serviceCenterNumber; // SMS Center number - Optionel + + Boolean rejectDuplicated; // Network must reject msg if the same exists + Boolean replyPath; // Use reply specified path + +} SmsSendGSMParamsType, *SmsSendGSMParamsPtr; + + +/* SMS Send Parameters Type + ------------------------ */ + +typedef struct SmsSendParamsTag +{ + TelSmsDateTimeType validityPeriod; // SMS validity Period + Char* destinationAddress; // recipient number -> to send the sms to + + UInt8 networkDeliveryRequested:1; // Sms report wanted + UInt8 ignoreDefaultValue:1; // If false, the field validityPeriod, ackRequested, reportRequested, smsCenter are ignored. + UInt8 reserved:6; + + UInt16 partCount; // number of parts of the SMS (output) + UInt16 lastPart; // if error, the last part sent (output) + + UInt8 converter; // How the data are going to be typed (0 = NBS, 1 = None) + + union + { + SmsSendGSMParamsType gsm; + SmsSendCDMAParamsType cdma; + SmsSendTDMAParamsType tdma; + + } protocol; + +} SmsSendParamsType, *SmsSendParamsPtr; + + +#pragma mark Receive Param +/**************************************************************************** + * Receive parameters + ****************************************************************************/ + +/* Advanced Parameters Type for TDMA & CDMA network + ----------------------------------------------- */ +typedef struct SmsReceiveCDMAParamsTag +{ + UInt8 messageType; // Delivery Message Type + + TelSmsDateTimeType validityPeriod; + + UInt8 priority; + UInt8 privacy; + + Boolean alertOnDeliveryRequest; + Boolean manualAckRequest; + + UInt8 voiceMessageNumber; + UInt8 languageIndicator; + + Char* callbackNumberAddress; // Store callback address */ + +} SmsReceiveCDMAParamsType, *SmsReceiveCDMAParamsPtr; + +typedef SmsReceiveCDMAParamsType SmsReceiveTDMAParamsType, *SmsReceiveTDMAParamsPtr; + +/* Advanced Parameters Type for GSM network + ---------------------------------------- */ +typedef struct SmsReceiveGSMParamsTag +{ + UInt16 protocolId; // reserved - not supported + Char* serviceCenterNumber; + + Boolean replyPath; // Must use specified reply path + +} SmsReceiveGSMParamsType, *SmsReceiveGSMParamsPtr; + +/* SMS Receive Parameters Type + --------------------------- */ + +typedef struct SmsReceiveParamsTag +{ + UInt32 timeStamp; // Palm + Char* originatingAddress; // originating number -> to send the sms to + + UInt8 leaveOnPhone:1; // Received messages won't be deleted on the phone (Input) + UInt8 forceSlotMode:1; // Force parsing methode to Slot Mode (default is Block mode) (Input) + UInt8 reserved:6; + + UInt16 index; // Index of the storage in the mobile where the message is stored + + Boolean otherToReceive; + Boolean reportDeliveryIndicator; + + union + { + SmsReceiveGSMParamsType gsm; + SmsReceiveCDMAParamsType cdma; + SmsReceiveTDMAParamsType tdma; + + } protocol; + +} SmsReceiveParamsType, *SmsReceiveParamsPtr; + + +#pragma mark Sms Param +/**************************************************************************** + * Sms parameters + ****************************************************************************/ +/* SMS Parameters Type + ------------------- */ + +typedef struct SmsParamsTag +{ + UInt32 creator; // MUST ALWAYS BE SET TO sysFileCSmsLib + UInt16 smsID; // ID of the SMS (output) + + Char* extension; // Extension type of the data - Optionel (Output) + Char* mimeTypes; // Mime type of object - Optionel (Output) + UInt32 appCreator; // Application Creator of the target - Optionel (Output) + + UInt8 dataCodingScheme; // How SMS are going to convert the data (0 = 8 bit, 1 = 7 bit) + UInt8 networkType; // Indicates the type of advanced parameters (input - output) + UInt8 dataType; // Indicates the kind of message: Sms, incomplete Sms, Report (Output) + + UInt16 nbsDestPort; // NBS port to use to encode the data (input) - port used in received Sms (output) + UInt16 nbsSrcPort; // NBS port to use to encode the data (input) - port used in received Sms (output) + + union + { + SmsSendParamsType send; + SmsReceiveParamsType receive; + SmsReportParamsType report; + + } data; + +} SmsParamsType, *SmsParamsPtr; + + +/* Preferences Type + ------------------- */ + +typedef struct SmsPrefTag +{ + UInt32 validity; // Validity period of SMS (relatif) in seconds + UInt16 warnOver; // Display an alert if sending more Sms than this value. + Boolean leave; // Leave SMS on Phone + Boolean report; // Ask for a network delivery report + Boolean autoSMSC; // If set, don't use the value stored in smscNumber field + Char smscNumber[kSmsMaxPhoneSize]; // SMS Service Center. Could be null + +} SmsPrefType, *SmsPrefPtr; + + +/****************************************************************************/ + +#endif // SMS_LIB_H diff --git a/sdk-4/include/Libraries/Telephony/TelephonyMgr.h b/sdk-4/include/Libraries/Telephony/TelephonyMgr.h new file mode 100644 index 0000000..0ce545f --- /dev/null +++ b/sdk-4/include/Libraries/Telephony/TelephonyMgr.h @@ -0,0 +1,1178 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __TELEPHONYMGR_H__ +#define __TELEPHONYMGR_H__ + +#include +#include +#include +#include +#include +#include + +#include "TelephonyMgrTypes.h" + +/* sysMakeROMVersion(major, minor, fix, stage, buildNum) */ +#define kTelMgrVersionMajor 1 +#define kTelMgrVersionMinor 0 +#define kTelMgrVersionFix 3 +#define kTelMgrVersionBuild 0 + +/* telephony manager shared lib version */ +#define kTelMgrVersion sysMakeROMVersion(kTelMgrVersionMajor, kTelMgrVersionMinor, kTelMgrVersionFix, sysROMStageBeta, kTelMgrVersionBuild) + +/* TelMgr shared lib internal name */ +#define kTelMgrLibName "Telephony Library" + +/* TelMgr shared lib name and creator */ +#define kTelMgrDatabaseCreator sysFileCTelMgrLib +#define kTelMgrDatabaseType sysFileTLibrary + +#define kTelTelephonyNotification 'tmgr' /* telephony notification */ +#define kTelTelephonyEvent 0x1200 /* telephony event */ + +/* Telephony notification IDs */ +enum {kTelSmsLaunchCmdIncomingMessage, /* an incoming SMS */ + kTelSpcLaunchCmdIncomingCall, /* an incoming voice call */ + kTelSpcLaunchCmdCallerIDAvailable, /* the caller ID is available */ + kTelSpcLaunchCmdCallReleased, /* the call has been released */ + kTelSpcLaunchCmdCallBusy, /* the called equipment is busy */ + kTelSpcLaunchCmdCallConnect, /* the line is opened */ + kTelSpcLaunchCmdCallError, /* the call has encountered an error */ + kTelEmcLaunchCmdCallReleased, /* the call has been released */ + kTelEmcLaunchCmdCallBusy, /* the called equipment is busy */ + kTelEmcLaunchCmdCallConnect, /* the line is opened */ + kTelEmcLaunchCmdCallError, /* the call has encountered an error */ + kTelLastLaunchCode}; + +/* notification priorities */ +#define kTelCallNotificationPriority 0 /* higher priority */ +#define kTelSmsNotificationPriority 1 + +/* error codes */ +#define telErrMsgAllocation (telErrorClass | 0x01) /* couldn't allocate message */ +#define telErrUnknown (telErrorClass | 0x02) /* unknown Tel internal error */ +#define telErrMemAllocation (telErrorClass | 0x03) /* memory allocation error */ + +#define telErrResultTimeOut (telErrorClass | 0x04) /* time-out was reached */ +#define telErrResultUserCancel (telErrorClass | 0x05) /* user cancelled action */ +#define telErrResultBusyResource (telErrorClass | 0x06) /* resource is busy */ +#define telErrInvalidAppId (telErrorClass | 0x07) /* don't know that application */ +#define telErrTooManyApps (telErrorClass | 0x08) /* applications table is full */ +#define telErrSecurity (telErrorClass | 0x09) /* access to ME has not been granted */ +#define telErrBufferSize (telErrorClass | 0x0A) /* buffer used to retrieve data is too small */ +#define telErrFeatureNotSupported (telErrorClass | 0x0B) /* the feature is not supported by phone/network */ + +#define telErrPhoneComm (telErrorClass | 0x0C) /* the communication link with the phone is down */ +#define telErrPhoneReply (telErrorClass | 0x0D) /* the phone reply syntax is incorrect, check the phone driver! */ +#define telErrCommandFailed (telErrorClass | 0x0E) /* the phone couldn't achieve the associated command, check the phone driver! */ + +#define telErrSpcLineIsBusy (telErrorClass | 0x0F) /* spc call failure events, error field values */ + +#define telErrPhoneCodeRequired (telErrorClass | 0x10) /* phone code required */ +#define telErrNoSIMInserted (telErrorClass | 0x11) /* no SIM inserted */ +#define telErrPINRequired (telErrorClass | 0x12) /* PIN is required */ +#define telErrPUKRequired (telErrorClass | 0x13) /* PUK is required */ +#define telErrSIMFailure (telErrorClass | 0x14) /* the SIM is not working properly */ +#define telErrSIMBusy (telErrorClass | 0x15) /* the SIM couldn't reply */ +#define telErrSIMWrong (telErrorClass | 0x16) /* the SIM is not accepted by the phone */ +#define telErrPassword (telErrorClass | 0x17) /* incorrect password */ +#define telErrPIN2Required (telErrorClass | 0x18) /* PIN2 is required */ +#define telErrPUK2Required (telErrorClass | 0x19) /* PUK2 is required */ +#define telErrPhoneMemAllocation (telErrorClass | 0x1A) /* phone memory is full */ +#define telErrInvalidIndex (telErrorClass | 0x1B) /* invalid index when accessing a storage */ +#define telErrEntryNotFound (telErrorClass | 0x1C) /* entry not found */ +#define telErrPhoneMemFailure (telErrorClass | 0x1D) /* the phone encountered a memory error */ +#define telErrInvalidString (telErrorClass | 0x1E) /* bad character in text string */ +#define telErrInvalidDial (telErrorClass | 0x1F) /* bad character in dial string */ +#define telErrNoNetwork (telErrorClass | 0x20) /* no network available */ +#define telErrNetworkTimeOut (telErrorClass | 0x21) /* the network didn't reply within 'normal' time delay */ +#define telErrInvalidParameter (telErrorClass | 0x22) /* bad parameter passed to an API */ +#define telErrValidityPeriod (telErrorClass | 0x23) /* the specified short message validity period is invalid */ +#define telErrCodingScheme (telErrorClass | 0x24) /* the specified short message coding scheme is invalid */ +#define telErrPhoneNumber (telErrorClass | 0x25) /* the specified short message smsc or destination phone number is invalid */ +#define telErrValueStale (telErrorClass | 0x26) /* information couldn't be retrieved, a copy of last retrieved value was returned */ +#define telErrTTaskNotRunning (telErrorClass | 0x27) /* the Telephony Task is not running */ +#define telErrPhoneToSIMPINRequired (telErrorClass | 0x28) /* Phone 2 SIM PIN is required */ + +#define telErrSpecificDrvNotFound (telErrorClass | 0x29) /* the specified driver was not found */ +#define telErrGenericDrvNotFound (telErrorClass | 0x2A) /* the generic driver was not found */ +#define telErrNoSpecificDrv (telErrorClass | 0x2B) /* no specific driver was specified */ + +#define telErrSpcLineIsReleased (telErrorClass | 0x2C) /* the call has been released */ +#define telErrSpcCallError (telErrorClass | 0x2D) /* the call has encountered an error */ + +#define telErrNotInstalled (telErrorClass | 0x2E) /* the shared lib couldn't be installed */ +#define telErrVersion (telErrorClass | 0x2F) /* the shared lib version doesn't match the application one */ +#define telErrSettings (telErrorClass | 0x30) /* bad telephony settings: Phone Panel Prefs doesn't exist or Telephony Profile not (correctly) set */ + +#define telErrUnavailableValue (telErrorClass | 0x31) /* the asked value can't be retrieved at that time (i.e.: TelSpcGetCallerNumber and no active line) */ + +#define telErrLimitedCompatibility (telErrorClass | 0x32) /* the current driver is partially compatible with the connected phone */ + +#define telErrProfileConflict (telErrorClass | 0x33) /* the currently used profile conflicts with the requested profile */ + +#define telErrLibStillInUse (telErrorClass | 0x34) /* the shared lib is currently being used by another app, don't unload it! */ + +#define telErrTTaskNotFound (telErrorClass | 0x35) /* couldn't find the specified (by phone driver) telephony task */ + +/* constants */ +#define kTelInvalidAppId ((TelAppID)-1) /* this value can't be returned on TelMgr attachement */ + +#define kTelInfiniteDelay 0xFFFFFFFF /* infinite time-out delay */ + +#define kTelLocationSeparator ';' /* this symbol is used to separate location string tokens */ + +#define kTelNwkAutomaticSearch 0 /* network search mode */ +#define kTelNwkManualSearch 1 + +#define kTelNwkCDMA 0 /* network type */ +#define kTelNwkGSM 1 +#define kTelNwkTDMA 2 +#define kTelNwkPDC 3 + +#define kTelPowBatteryPowered 0 /* battery status */ +#define kTelPowBatteryNotPowered 1 +#define kTelPowNoBattery 2 +#define kTelPowBatteryFault 3 + +#define 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 */ +#define kTelSmsMessageTypeDelivered 0 +#define kTelSmsMessageTypeReport 1 +#define kTelSmsMessageTypeSubmitted 2 +#define kTelSmsMessageTypeManualAck 3 +#define kTelSmsMessageAllTypes 4 + +#define kTelSmsMultiPartExtensionTypeId 0x00 /* Multipart short messages */ +#define kTelSmsNbsExtensionTypeId 0x04 /* NBS message, with port number in short */ +#define kTelSmsNbs2ExtensionTypeId 0x05 /* NBS message, with port number in long */ + +#define kTelSmsDefaultProtocol 0 /* sms message transport protocol */ +#define kTelSmsFaxProtocol 1 +#define kTelSmsX400Protocol 2 +#define kTelSmsPagingProtocol 3 +#define kTelSmsEmailProtocol 4 +#define kTelSmsErmesProtocol 5 +#define kTelSmsVoiceProtocol 6 + +#define kTelSmsAPIVersion 0x0001 /* SMS api version */ + +#define kTelSmsStorageSIM 0 /* SMS storage IDs */ +#define kTelSmsStoragePhone 1 +#define kTelSmsStorageAdaptor 2 +#define kTelSmsStorageFirstOem 3 + +#define kTelSmsCMTMessageType 0 /* Cellular Messaging Teleservice message */ +#define kTelSmsCPTMessageType 1 /* Cellular Paging Teleservice message */ +#define kTelSmsVMNMessageType 2 /* Voice Mail Notification message */ + + +/* Delivery report Type (UInt8) - Only used in CDMA & TDMA advanced parameters */ +#define kTelSmsStatusReportDeliveryType 0 /* Status report or delivery acknowledge */ +#define kTelSmsManualAckDeliveryType 1 /* Manual acknowledge delivery */ + + +/* Data coding scheme (UInt8) */ +#define kTelSms8BitsEncoding 0 +#define kTelSmsBitsASCIIEncoding 1 /* ANSI X3.4 */ +#define kTelSmsIA5Encoding 2 /* CCITTT T.50 */ +#define kTelSmsIS91Encoding 3 /* TIA/EIA/IS-91 section 3.7.1 */ +#define kTelSmsUCS2Encoding 4 /* Only supported by GSM */ +#define kTelSmsDefaultGSMEncoding 5 /* Only supported by GSM */ + + +/* Message urgency / priority (UInt8) - Only used in CDMA & TDMA advanced parameters */ +#define kTelSmsUrgencyNormal 0 +#define kTelSmsUrgencyUrgent 1 +#define kTelSmsUrgencyEmergency 2 +/*Bulk (CDMA) & Interactive mode (TDMA) are not supported */ + + +/* Privacy message indicator (UInt8) - Only used in CDMA & TDMA advanced parameters */ +#define kTelSmsPrivacyNotRestricted 0 /* Privacy level 0 */ +#define kTelSmsPrivacyRestricted 1 /* Privacy level 1 */ +#define kTelSmsPrivacyConfidential 2 /* Privacy level 2 */ +#define kTelSmsPrivacySecret 3 /* Privacy level 3 */ + + +/* Delivery status report (UInt8) */ +#define kTelSmsDSRSuccess 0 +#define kTelSmsDSRMessageReplaced 1 +#define kTelSmsDSRMessageForwarded 2 /* unknown delivery result */ +#define kTelSmsDSRTempCongestion 3 +#define kTelSmsDSRTempSMEBusy 4 +#define kTelSmsDSRTempServiceRejected 5 +#define kTelSmsDSRTempServiceUnavailable 6 +#define kTelSmsDSRTempSMEError 7 +#define kTelSmsDSRTempOther 8 +#define kTelSmsDSRPermRPError 9 +#define kTelSmsDSRPermBadDestination 10 +#define kTelSmsDSRPermUnobtainable 11 +#define kTelSmsDSRPermServiceUnavailable 12 +#define kTelSmsDSRPermInternetworkError 13 +#define kTelSmsDSRPermValidityExpired 14 +#define kTelSmsDSRPermDeletedByOrigSME 15 +#define kTelSmsDSRPermDeleteByAdm 16 +#define kTelSmsDSRPermSMNotExist 17 +#define kTelSmsDSRPermOther 18 + +#define kTelSpeechCallClass 0 /* call classes */ +#define kTelDataCallClass 1 +#define kTelFaxCallClass 2 + +#define kTelPhbFixedPhonebook 0 /* phonebooks */ +#define kTelPhbSimPhonebook 1 +#define kTelPhbPhonePhonebook 2 +#define kTelPhbLastDialedPhonebook 3 +#define kTelPhbSimAndPhonePhonebook 4 +#define kTelPhbAdaptorPhonebook 5 +#define kTelPhbFirstOemPhonebook 6 + +#define kTelCallIdle 0 /* call states */ +#define kTelCallConnecting 1 +#define kTelCallConnected 2 +#define kTelCallRedial 3 +#define kTelCallIncoming 4 +#define kTelCallIncomingAck 5 +#define kTelCallDisconnecting 6 + +#define kTelCallTypeOutgoing 0 /* call type */ +#define kTelCallTypeIncoming 1 + +#define kTelCallServiceVoice 0 /* call service type */ +#define kTelCallServiceData 1 + +#define kTelStyReady 0 /* no more security code expected */ +#define kTelStyPin1CodeId 1 /* authentication code IDs */ +#define kTelStyPin2CodeId 2 +#define kTelStyPuk1CodeId 3 +#define kTelStyPuk2CodeId 4 +#define kTelStyPhoneToSimCodeId 5 +#define kTelStyFirstOemCodeId 6 + +#define kTelInfPhoneBrand 0 /* phone information type */ +#define kTelInfPhoneModel 1 +#define kTelInfPhoneRevision 2 + +/* TelMgr library call ID's */ +/* first entry points are reserved for internal use only */ +#define telLibTrapReserved1 (sysLibTrapCustom) +#define telLibTrapReserved2 (sysLibTrapCustom+1) +#define telLibTrapReserved3 (sysLibTrapCustom+2) +#define telLibTrapReserved4 (sysLibTrapCustom+3) +#define telLibTrapReserved5 (sysLibTrapCustom+4) +#define telLibTrapReserved6 (sysLibTrapCustom+5) +#define telLibTrapReserved7 (sysLibTrapCustom+6) +#define telLibTrapReserved8 (sysLibTrapCustom+7) +#define telLibTrapReserved9 (sysLibTrapCustom+8) +#define telLibTrapReserved10 (sysLibTrapCustom+9) + +#define telLibTrapGetEvent (sysLibTrapCustom+10) +#define telLibTrapGetTelephonyEvent (sysLibTrapCustom+11) + +#define telLibTrapOpenPhoneConnection (sysLibTrapCustom+12) +#define telLibTrapIsPhoneConnected (sysLibTrapCustom+13) +#define telLibTrapClosePhoneConnection (sysLibTrapCustom+14) + +#define telLibTrapIsServiceAvailable (sysLibTrapCustom+15) +#define telLibTrapIsFunctionSupported (sysLibTrapCustom+16) + +#define telLibTrapSendCommandString (sysLibTrapCustom+17) + +#define telLibTrapCancel (sysLibTrapCustom+18) + +#define telLibTrapMatchPhoneDriver (sysLibTrapCustom+19) + +#define telLibTrapGetCallState (sysLibTrapCustom+20) + +#define telLibTrapOemCall (sysLibTrapCustom+21) + +#define telLibTrapNwkGetNetworks (sysLibTrapCustom+22) +#define telLibTrapNwkGetNetworkName (sysLibTrapCustom+23) +#define telLibTrapNwkGetLocation (sysLibTrapCustom+24) +#define telLibTrapNwkSelectNetwork (sysLibTrapCustom+25) +#define telLibTrapNwkGetSelectedNetwork (sysLibTrapCustom+26) +#define telLibTrapNwkGetNetworkType (sysLibTrapCustom+27) +#define telLibTrapNwkGetSignalLevel (sysLibTrapCustom+28) +#define telLibTrapNwkGetSearchMode (sysLibTrapCustom+29) +#define telLibTrapNwkSetSearchMode (sysLibTrapCustom+30) + +#define telLibTrapStyChangeAuthenticationCode (sysLibTrapCustom+31) +#define telLibTrapStyGetAuthenticationState (sysLibTrapCustom+32) +#define telLibTrapStyEnterAuthenticationCode (sysLibTrapCustom+33) + +#define telLibTrapPowGetPowerLevel (sysLibTrapCustom+34) +#define telLibTrapPowGetBatteryStatus (sysLibTrapCustom+35) +#define telLibTrapPowSetPhonePower (sysLibTrapCustom+36) + +#define telLibTrapCfgSetSmsCenter (sysLibTrapCustom+37) +#define telLibTrapCfgGetSmsCenter (sysLibTrapCustom+38) +#define telLibTrapCfgGetPhoneNumber (sysLibTrapCustom+39) + +#define telLibTrapSmsGetUniquePartId (sysLibTrapCustom+40) +#define telLibTrapSmsGetDataMaxSize (sysLibTrapCustom+41) +#define telLibTrapSmsSendMessage (sysLibTrapCustom+42) +#define telLibTrapSmsSendManualAcknowledge (sysLibTrapCustom+43) +#define telLibTrapSmsReadMessage (sysLibTrapCustom+44) +#define telLibTrapSmsReadMessages (sysLibTrapCustom+45) +#define telLibTrapSmsReadReport (sysLibTrapCustom+46) +#define telLibTrapSmsReadReports (sysLibTrapCustom+47) +#define telLibTrapSmsReadSubmittedMessage (sysLibTrapCustom+48) +#define telLibTrapSmsReadSubmittedMessages (sysLibTrapCustom+49) +#define telLibTrapSmsGetMessageCount (sysLibTrapCustom+50) +#define telLibTrapSmsDeleteMessage (sysLibTrapCustom+51) +#define telLibTrapSmsGetAvailableStorage (sysLibTrapCustom+52) +#define telLibTrapSmsGetSelectedStorage (sysLibTrapCustom+53) +#define telLibTrapSmsSelectStorage (sysLibTrapCustom+54) + +#define telLibTrapEmcCall (sysLibTrapCustom+55) +#define telLibTrapEmcCloseLine (sysLibTrapCustom+56) +#define telLibTrapEmcGetNumberCount (sysLibTrapCustom+57) +#define telLibTrapEmcGetNumber (sysLibTrapCustom+58) +#define telLibTrapEmcSetNumber (sysLibTrapCustom+59) +#define telLibTrapEmcSelectNumber (sysLibTrapCustom+60) + +#define telLibTrapSpcCallNumber (sysLibTrapCustom+61) +#define telLibTrapSpcCloseLine (sysLibTrapCustom+62) +#define telLibTrapSpcHoldLine (sysLibTrapCustom+63) +#define telLibTrapSpcRetrieveHeldLine (sysLibTrapCustom+64) +#define telLibTrapSpcConference (sysLibTrapCustom+65) +#define telLibTrapSpcSelectLine (sysLibTrapCustom+66) +#define telLibTrapSpcAcceptCall (sysLibTrapCustom+67) +#define telLibTrapSpcRejectCall (sysLibTrapCustom+68) +#define telLibTrapSpcGetCallerNumber (sysLibTrapCustom+69) +#define telLibTrapSpcSendBurstDTMF (sysLibTrapCustom+70) +#define telLibTrapSpcStartContinuousDTMF (sysLibTrapCustom+71) +#define telLibTrapSpcStopContinuousDTMF (sysLibTrapCustom+72) +#define telLibTrapSpcPlayDTMF (sysLibTrapCustom+73) + +#define telLibTrapPhbGetEntryCount (sysLibTrapCustom+74) +#define telLibTrapPhbGetEntry (sysLibTrapCustom+75) +#define telLibTrapPhbGetEntries (sysLibTrapCustom+76) +#define telLibTrapPhbAddEntry (sysLibTrapCustom+77) +#define telLibTrapPhbDeleteEntry (sysLibTrapCustom+78) +#define telLibTrapPhbGetAvailablePhonebooks (sysLibTrapCustom+79) +#define telLibTrapPhbSelectPhonebook (sysLibTrapCustom+80) +#define telLibTrapPhbGetSelectedPhonebook (sysLibTrapCustom+81) +#define telLibTrapPhbGetEntryMaxSizes (sysLibTrapCustom+82) + +#define telLibTrapSndPlayKeyTone (sysLibTrapCustom+83) +#define telLibTrapSndStopKeyTone (sysLibTrapCustom+84) +#define telLibTrapSndMute (sysLibTrapCustom+85) + +#define telLibTrapInfGetInformation (sysLibTrapCustom+86) + +#define telLibTrapDtcCallNumber (sysLibTrapCustom+87) +#define telLibTrapDtcCloseLine (sysLibTrapCustom+88) +#define telLibTrapDtcSendData (sysLibTrapCustom+89) +#define telLibTrapDtcReceiveData (sysLibTrapCustom+90) + +#define telLibTrapUnblockNotifications (sysLibTrapCustom+91) + +#define telLibTrapOpenProfile (sysLibTrapCustom+92) + +#define telLibTrapLast (sysLibTrapCustom+93) + +#ifdef __cplusplus +extern "C" { +#endif + +/* function traps */ +Err TelOpen(UInt16 iRefnum, + UInt32 iVersnum, + TelAppID *oAppIdP) + SYS_TRAP(sysLibTrapOpen); + +Err TelClose(UInt16 iRefnum, + TelAppID iAppId) + SYS_TRAP(sysLibTrapClose); + +/* events management */ +void TelGetEvent(UInt16 iRefnum, + TelAppID iAppId, + EventPtr oEventP, + Int32 iTimeOut) + SYS_TRAP(telLibTrapGetEvent); + +void TelGetTelephonyEvent(UInt16 iRefnum, + TelAppID iAppId, + EventPtr oEventP, + Int32 iTimeOut) + SYS_TRAP(telLibTrapGetTelephonyEvent); + +/* phone connection management */ +Err TelOpenPhoneConnection(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapOpenPhoneConnection); + +Err TelIsPhoneConnected(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapIsPhoneConnected); + +Err TelClosePhoneConnection(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapClosePhoneConnection); + +/* service/function availability */ +Err TelIsServiceAvailable(UInt16 iRefnum, + TelAppID iAppId, + UInt16 serviceId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapIsServiceAvailable); + +Err TelIsFunctionSupported(UInt16 iRefnum, + TelAppID iAppId, + UInt16 functionId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapIsFunctionSupported); + +/* sending commands to the phone */ +Err TelSendCommandString(UInt16 iRefnum, + TelAppID iAppId, + TelSendCommandStringType* ioParamP , + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSendCommandString); + +/* cancelling asynchronous calls */ +Err TelCancel(UInt16 iRefnum, + TelAppID iAppId, + UInt16 iTransId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapCancel); + +/* checking whether phone and driver match */ +Err TelMatchPhoneDriver(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapMatchPhoneDriver); + +/* getting phone status */ +Err TelGetCallState(UInt16 iRefnum, + TelAppID iAppId, + TelGetCallStateType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapGetCallState); + +/* OEM support */ +Err TelOemCall(UInt16 iRefnum, + TelAppID iAppId, + TelOemCallType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapOemCall); + +/* network */ +Err TelNwkGetNetworks(UInt16 iRefnum, + TelAppID iAppId, + TelNwkGetNetworksType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapNwkGetNetworks); + +Err TelNwkGetNetworkName(UInt16 iRefnum, + TelAppID iAppId, + TelNwkGetNetworkNameType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapNwkGetNetworkName); + +Err TelNwkGetLocation(UInt16 iRefnum, + TelAppID iAppId, + TelNwkGetLocationType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapNwkGetLocation); + +Err TelNwkSelectNetwork(UInt16 iRefnum, + TelAppID iAppId, + UInt32 iNetworkId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapNwkSelectNetwork); + +Err TelNwkGetSelectedNetwork(UInt16 iRefnum, + TelAppID iAppId, + UInt32* oNetworkIdP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapNwkGetSelectedNetwork); + +Err TelNwkGetNetworkType(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oTypeP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapNwkGetNetworkType); + +Err TelNwkGetSignalLevel(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oSignalP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapNwkGetSignalLevel); + +Err TelNwkGetSearchMode(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oModeP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapNwkGetSearchMode); + +Err TelNwkSetSearchMode(UInt16 iRefnum, + TelAppID iAppId, + UInt8 iMode, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapNwkSetSearchMode); + +/* security */ +Err TelStyGetAuthenticationState(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oStateP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapStyGetAuthenticationState); + +Err TelStyEnterAuthenticationCode(UInt16 iRefnum, + TelAppID iAppId, + const Char* iCodeP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapStyEnterAuthenticationCode); + +Err TelStyChangeAuthenticationCode(UInt16 iRefnum, + TelAppID iAppId, + TelStyChangeAuthenticationType* iParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapStyChangeAuthenticationCode); + +/* power */ +Err TelPowGetPowerLevel(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oPowerP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPowGetPowerLevel); + +Err TelPowGetBatteryStatus(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oStatusP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPowGetBatteryStatus); + +Err TelPowSetPhonePower(UInt16 iRefnum, + TelAppID iAppId, + Boolean iPowerOn) + SYS_TRAP(telLibTrapPowSetPhonePower); + +/* configuration */ +Err TelCfgSetSmsCenter(UInt16 iRefnum, + TelAppID iAppId, + const Char* iDialNumberP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapCfgSetSmsCenter); + +Err TelCfgGetSmsCenter(UInt16 iRefnum, + TelAppID iAppId, + TelCfgGetSmsCenterType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapCfgGetSmsCenter); + +Err TelCfgGetPhoneNumber(UInt16 iRefnum, + TelAppID iAppId, + TelCfgGetPhoneNumberType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapCfgGetPhoneNumber); + +/* sms */ +Err TelSmsGetUniquePartId(UInt16 iRefnum, + TelAppID iAppId, + UInt16 *oUniqueIdP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsGetUniquePartId); + +Err TelSmsGetDataMaxSize(UInt16 iRefnum, + TelAppID iAppId, + UInt16* oSizeP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsGetDataMaxSize); + +Err TelSmsSendMessage(UInt16 iRefnum, + TelAppID iAppId, + TelSmsSendMessageType* ioMessageP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsSendMessage); + +Err TelSmsSendManualAcknowledge(UInt16 iRefnum, + TelAppID iAppId, + TelSmsManualAckType* ioAckP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsSendManualAcknowledge); + +Err TelSmsReadMessage(UInt16 iRefnum, + TelAppID iAppId, + TelSmsDeliveryMessageType* ioMessageP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsReadMessage); + +Err TelSmsReadMessages(UInt16 iRefnum, + TelAppID iAppId, + TelSmsReadMessagesType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsReadMessages); + +Err TelSmsReadReport(UInt16 iRefnum, + TelAppID iAppId, + TelSmsReportType* ioReportP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsReadReport); + +Err TelSmsReadReports(UInt16 iRefnum, + TelAppID iAppId, + TelSmsReadReportsType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsReadReports); + +Err TelSmsReadSubmittedMessage(UInt16 iRefnum, + TelAppID iAppId, + TelSmsSubmittedMessageType* ioMessageP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsReadSubmittedMessage); + +Err TelSmsReadSubmittedMessages(UInt16 iRefnum, + TelAppID iAppId, + TelSmsReadSubmittedMessagesType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsReadSubmittedMessages); + +Err TelSmsGetMessageCount(UInt16 iRefnum, + TelAppID iAppId, + TelSmsGetMessageCountType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsGetMessageCount); + +Err TelSmsDeleteMessage(UInt16 iRefnum, + TelAppID iAppId, + TelSmsDeleteMessageType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsDeleteMessage); + +Err TelSmsGetAvailableStorage(UInt16 iRefnum, + TelAppID iAppId, + TelSmsGetAvailableStorageType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsGetAvailableStorage); + +Err TelSmsGetSelectedStorage(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oStorageIdP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsGetSelectedStorage); + +Err TelSmsSelectStorage(UInt16 iRefnum, + TelAppID iAppId, + UInt8 iStorageId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSmsSelectStorage); + +/* emergency calls */ +Err TelEmcCall(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapEmcCall); + +Err TelEmcCloseLine(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapEmcCloseLine); + +Err TelEmcGetNumberCount(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oCountP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapEmcGetNumberCount); + +Err TelEmcGetNumber(UInt16 iRefnum, + TelAppID iAppId, + TelEmcGetNumberType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapEmcGetNumber); + +Err TelEmcSetNumber(UInt16 iRefnum, + TelAppID iAppId, + TelEmcSetNumberType* iParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapEmcSetNumber); + +Err TelEmcSelectNumber(UInt16 iRefnum, + TelAppID iAppId, + UInt8 iIndex, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapEmcSelectNumber); + +/* speech call */ +Err TelSpcCallNumber(UInt16 iRefnum, + TelAppID iAppId, + const Char* iDialNumberP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcCallNumber); + +Err TelSpcCloseLine(UInt16 iRefnum, + TelAppID iAppId, + UInt8 iLineId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcCloseLine); + +Err TelSpcHoldLine(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcHoldLine); + +Err TelSpcRetrieveHeldLine(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcRetrieveHeldLine); + +Err TelSpcConference(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oLineIdP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcConference); + +Err TelSpcSelectLine(UInt16 iRefnum, + TelAppID iAppId, + UInt8 iLineId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcSelectLine); + +Err TelSpcAcceptCall(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oLineIdP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcAcceptCall); + +Err TelSpcRejectCall(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcRejectCall); + +Err TelSpcGetCallerNumber(UInt16 iRefnum, + TelAppID iAppId, + TelSpcGetCallerNumberType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcGetCallerNumber); + +Err TelSpcSendBurstDTMF(UInt16 iRefnum, + TelAppID iAppId, + const Char* iDTMFStringP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcSendBurstDTMF); + +Err TelSpcStartContinuousDTMF(UInt16 iRefnum, + TelAppID iAppId, + UInt8 iKeyCode, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcStartContinuousDTMF); + +Err TelSpcStopContinuousDTMF(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcStopContinuousDTMF); + +Err TelSpcPlayDTMF(UInt16 iRefnum, + TelAppID iAppId, + TelSpcPlayDTMFType* iParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSpcPlayDTMF); + +/* phonebook */ +Err TelPhbGetEntryCount(UInt16 iRefnum, + TelAppID iAppId, + TelPhbGetEntryCountType* oParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPhbGetEntryCount); + +Err TelPhbGetEntry(UInt16 iRefnum, + TelAppID iAppId, + TelPhbEntryType* ioEntryP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPhbGetEntry); + +Err TelPhbGetEntries(UInt16 iRefnum, + TelAppID iAppId, + TelPhbGetEntriesType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPhbGetEntries); + +Err TelPhbAddEntry(UInt16 iRefnum, + TelAppID iAppId, + TelPhbEntryType* iEntryP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPhbAddEntry); + +Err TelPhbDeleteEntry(UInt16 iRefnum, + TelAppID iAppId, + UInt16 iEntryIndex, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPhbDeleteEntry); + +Err TelPhbGetAvailablePhonebooks(UInt16 iRefnum, + TelAppID iAppId, + TelPhbGetAvailablePhonebooksType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPhbGetAvailablePhonebooks); + +Err TelPhbSelectPhonebook(UInt16 iRefnum, + TelAppID iAppId, + UInt8 iPhbId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPhbSelectPhonebook); + +Err TelPhbGetSelectedPhonebook(UInt16 iRefnum, + TelAppID iAppId, + UInt8* oPhbIdP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPhbGetSelectedPhonebook); + +Err TelPhbGetEntryMaxSizes(UInt16 iRefnum, + TelAppID iAppId, + TelPhbGetEntryMaxSizesType* oParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapPhbGetEntryMaxSizes); + +/* sound */ +Err TelSndPlayKeyTone(UInt16 iRefnum, + TelAppID iAppId, + TelSndPlayKeyToneType* iParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSndPlayKeyTone); + +Err TelSndStopKeyTone(UInt16 iRefnum, + TelAppID iAppId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSndStopKeyTone); + +Err TelSndMute(UInt16 iRefnum, + TelAppID iAppId, + Boolean iMuteOn, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapSndMute); + +/* information */ +Err TelInfGetInformation(UInt16 iRefnum, + TelAppID iAppId, + TelInfGetInformationType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapInfGetInformation); + +/* data */ +Err TelDtcCallNumber(UInt16 iRefnum, + TelAppID iAppId, + TelDtcCallNumberType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapDtcCallNumber); + +Err TelDtcCloseLine(UInt16 iRefnum, + TelAppID iAppId, + UInt8 iLineId, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapDtcCloseLine); + +Err TelDtcSendData(UInt16 iRefnum, + TelAppID iAppId, + TelDtcSendDataType* iParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapDtcSendData); + +Err TelDtcReceiveData(UInt16 iRefnum, + TelAppID iAppId, + TelDtcReceiveDataType* ioParamP, + UInt16* ioTransIdP) + SYS_TRAP(telLibTrapDtcReceiveData); + +Err TelUnblockNotifications(UInt16 iRefnum) + SYS_TRAP(telLibTrapUnblockNotifications); + +/* open telephony using a particular connection profile */ +Err TelOpenProfile(UInt16 iRefnum, + UInt32 iVersnum, + UInt32 profileId, + TelAppID *oAppIdP) + SYS_TRAP(telLibTrapOpenProfile); + +#ifdef __cplusplus +} +#endif + +/* MACROS for checking service availability */ +#define TelIsNwkServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelNwkServiceId, transIdP) + +#define TelIsStyServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelStyServiceId, transIdP) + +#define TelIsPowServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelPowServiceId, transIdP) + +#define TelIsCfgServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelCfgServiceId, transIdP) + +#define TelIsSmsServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelSmsServiceId, transIdP) + +#define TelIsEmcServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelEmcServiceId, transIdP) + +#define TelIsSpcServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelSpcServiceId, transIdP) + +#define TelIsDtcServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelDtcServiceId, transIdP) + +#define TelIsPhbServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelPhbServiceId, transIdP) + +#define TelIsOemServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelOemServiceId, transIdP) + +#define TelIsSndServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelSndServiceId, transIdP) + +#define TelIsInfServiceAvailable(refnum, appId, transIdP) \ + TelIsServiceAvailable(refnum, appId, kTelInfServiceId, transIdP) + +/* MACROS to check function availability */ +#define TelIsSendCommandStringSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSendCommandStringMessage, transIdP) + +#define TelIsCancelSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelUrqCancelMessage, transIdP) + +#define TelIsMatchPhoneDriverSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelUrqMatchPhoneDriverMessage, transIdP) + +#define TelIsGetCallStateSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelGetCallStateMessage, transIdP) + +#define TelIsOemCallSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelOemCallMessage, transIdP) + +#define TelIsNwkGetNetworksSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelNwkGetNetworksMessage, transIdP) + +#define TelIsNwkGetNetworkNameSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelNwkGetNetworkNameMessage, transIdP) + +#define TelIsNwkGetLocationSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelNwkGetLocationMessage, transIdP) + +#define TelIsNwkSelectNetworkSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelNwkSelectNetworkMessage, transIdP) + +#define TelIsNwkGetSelectedNetworkSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelNwkGetSelectedNetworkMessage, transIdP) + +#define TelIsNwkGetNetworkTypeSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelNwkGetNetworkTypeMessage, transIdP) + +#define TelIsNwkGetSignalLevelSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelNwkGetSignalLevelMessage, transIdP) + +#define TelIsNwkGetSearchModeSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelNwkGetSearchModeMessage, transIdP) + +#define TelIsNwkSetSearchModeSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelNwkSetSearchModeMessage, transIdP) + +#define TelIsStyGetAuthenticationStateSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelStyGetAuthenticationStateMessage, transIdP) + +#define TelIsStyEnterAuthenticationCodeSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelStyEnterAuthenticationCodeMessage, transIdP) + +#define TelIsStyChangeAuthenticationCodeSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelStyChangeAuthenticationCodeMessage, transIdP) + +#define TelIsPowGetPowerLevelSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPowGetPowerLevelMessage, transIdP) + +#define TelIsPowGetBatteryStatusSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPowGetBatteryStatusMessage, transIdP) + +#define TelIsPowSetPhonePowerSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPowSetPhonePowerMessage, transIdP) + +#define TelIsCfgSetSmsCenterSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelCfgSetSmsCenterMessage, transIdP) + +#define TelIsCfgGetSmsCenterSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelCfgGetSmsCenterMessage, transIdP) + +#define TelIsCfgGetPhoneNumberSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelCfgGetPhoneNumberMessage, transIdP) + +#define TelIsSmsGetUniquePartIdSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelUrqSmsGetUniquePartIdMessage, transIdP) + +#define TelIsSmsGetDataMaxSizeSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsGetDataMaxSizeMessage, transIdP) + +#define TelIsSmsSendMessageSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsSendMessageMessage, transIdP) + +#define TelIsSmsSendManualAcknowledgeSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsSendManualAcknowledgeMessage, transIdP) + +#define TelIsSmsReadMessageSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsReadMessageMessage, transIdP) + +#define TelIsSmsReadMessagesSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsReadMessagesMessage, transIdP) + +#define TelIsSmsReadReportSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsReadReportMessage, transIdP) + +#define TelIsSmsReadReportsSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsReadReportsMessage, transIdP) + +#define TelIsSmsReadSubmittedMessageSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsReadSubmittedMessageMessage, transIdP) + +#define TelIsSmsReadSubmittedMessagesSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsReadSubmittedMessagesMessage, transIdP) + +#define TelIsSmsGetMessageCountSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsGetMessageCountMessage, transIdP) + +#define TelIsSmsDeleteMessageSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsDeleteMessageMessage, transIdP) + +#define TelIsSmsGetAvailableStorageSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsGetAvailableStorageMessage, transIdP) + +#define TelIsSmsGetSelectedStorageSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsGetSelectedStorageMessage, transIdP) + +#define TelIsSmsSelectStorageSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSmsSelectStorageMessage, transIdP) + +#define TelIsEmcCallSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelEmcCallMessage, transIdP) + +#define TelIsEmcCloseLineSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelEmcCloseLineMessage, transIdP) + +#define TelIsEmcGetNumberCountSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelEmcGetNumberCountMessage, transIdP) + +#define TelIsEmcGetNumberSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelEmcGetNumberMessage, transIdP) + +#define TelIsEmcSetNumberSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelEmcSetNumberMessage, transIdP) + +#define TelIsEmcSelectNumberSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelEmcSelectNumberMessage, transIdP) + +#define TelIsSpcCallNumberSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcCallNumberMessage, transIdP) + +#define TelIsSpcCloseLineSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcCloseLineMessage, transIdP) + +#define TelIsSpcHoldLineSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcHoldLineMessage, transIdP) + +#define TelIsSpcRetrieveHeldLineSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcRetrieveHeldLineMessage, transIdP) + +#define TelIsSpcConferenceSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcConferenceMessage, transIdP) + +#define TelIsSpcSelectLineSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcSelectLineMessage, transIdP) + +#define TelIsSpcAcceptCallSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcAcceptCallMessage, transIdP) + +#define TelIsSpcRejectCallSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcRejectCallMessage, transIdP) + +#define TelIsSpcGetCallerNumberSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcGetCallerNumberMessage, transIdP) + +#define TelIsSpcSendBurstDTMFSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcSendBurstDTMFMessage, transIdP) + +#define TelIsSpcStartContinuousDTMFSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcStartContinuousDTMFMessage, transIdP) + +#define TelIsSpcStopContinuousDTMFSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcStopContinuousDTMFMessage, transIdP) + +#define TelIsSpcPlayDTMFSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSpcPlayDTMFMessage, transIdP) + +#define TelIsPhbGetEntryCountSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPhbGetEntryCountMessage, transIdP) + +#define TelIsPhbGetEntrySupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPhbGetEntryMessage, transIdP) + +#define TelIsPhbGetEntriesSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPhbGetEntriesMessage, transIdP) + +#define TelIsPhbAddEntrySupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPhbAddEntryMessage, transIdP) + +#define TelIsPhbDeleteEntrySupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPhbDeleteEntryMessage, transIdP) + +#define TelIsPhbGetAvailablePhonebooksSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPhbGetAvailablePhonebooksMessage, transIdP) + +#define TelIsPhbSelectPhonebookSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPhbSelectPhonebookMessage, transIdP) + +#define TelIsPhbGetSelectedPhonebookSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPhbGetSelectedPhonebookMessage, transIdP) + +#define TelIsPhbGetEntryMaxSizesSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelPhbGetEntryMaxSizesMessage, transIdP) + +#define TelIsSndPlayKeyToneSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSndPlayKeyToneMessage, transIdP) + +#define TelIsSndStopKeyToneSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSndStopKeyToneMessage, transIdP) + +#define TelIsSndMuteSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelSndMuteMessage, transIdP) + +#define TelIsInfGetInformationSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelInfGetInformationMessage, transIdP) + +#define TelIsDtcCallNumberSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelDtcCallNumberMessage, transIdP) + +#define TelIsDtcCloseLineSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelDtcCloseLineMessage, transIdP) + +#define TelIsDtcSendDataSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelDtcSendDataMessage, transIdP) + +#define TelIsDtcReceiveDataSupported(refnum, appId, transIdP) \ + TelIsFunctionSupported(refnum, appId, kTelDtcReceiveDataMessage, transIdP) + +#endif diff --git a/sdk-4/include/Libraries/Telephony/TelephonyMgrTypes.h b/sdk-4/include/Libraries/Telephony/TelephonyMgrTypes.h new file mode 100644 index 0000000..735b73d --- /dev/null +++ b/sdk-4/include/Libraries/Telephony/TelephonyMgrTypes.h @@ -0,0 +1,628 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __TELEPHONYMGRTYPES_H__ +#define __TELEPHONYMGRTYPES_H__ + +#include +#include +#include + +#ifndef telErrorClass +# define telErrorClass (appErrorClass + 0x100) /* DOLATER: remove this constant */ +#endif + +#define kTelMaxPhoneNumberLen 30 + +/* managers id */ +enum TelServices {kTelNwkServiceId, + kTelStyServiceId, + kTelPowServiceId, + kTelCfgServiceId, + kTelSmsServiceId, + kTelEmcServiceId, + kTelSpcServiceId, + kTelDtcServiceId, + kTelPhbServiceId, + kTelOemServiceId, + kTelSndServiceId, + kTelInfServiceId}; + +/* messages */ +enum TelMessages {kTelGetCallStateMessage, + + kTelSendCommandStringMessage, + + kTelNwkGetNetworkNameMessage, + kTelNwkGetNetworkTypeMessage, + kTelNwkGetSignalLevelMessage, + kTelNwkGetSearchModeMessage, + kTelNwkSetSearchModeMessage, + kTelNwkGetNetworksMessage, + kTelNwkSelectNetworkMessage, + kTelNwkGetSelectedNetworkMessage, + kTelNwkGetLocationMessage, + + kTelStyGetAuthenticationStateMessage, + kTelStyEnterAuthenticationCodeMessage, + kTelStyChangeAuthenticationCodeMessage, + + kTelPowGetPowerLevelMessage, + kTelPowGetBatteryStatusMessage, + kTelPowSetPhonePowerMessage, + + kTelCfgSetSmsCenterMessage, + kTelCfgGetSmsCenterMessage, + kTelCfgGetPhoneNumberMessage, + + kTelSmsSendMessageMessage, + kTelSmsSendManualAcknowledgeMessage, + kTelSmsGetMessageCountMessage, + kTelSmsReadMessageMessage, + kTelSmsReadMessagesMessage, + kTelSmsReadSubmittedMessageMessage, + kTelSmsReadSubmittedMessagesMessage, + kTelSmsReadReportMessage, + kTelSmsReadReportsMessage, + kTelSmsDeleteMessageMessage, + kTelSmsGetAvailableStorageMessage, + kTelSmsSelectStorageMessage, + kTelSmsGetSelectedStorageMessage, + kTelSmsGetDataMaxSizeMessage, + + kTelEmcGetNumberCountMessage, + kTelEmcGetNumberMessage, + kTelEmcSetNumberMessage, + kTelEmcSelectNumberMessage, + kTelEmcCallMessage, + kTelEmcCloseLineMessage, + + kTelSpcAcceptCallMessage, + kTelSpcRejectCallMessage, + kTelSpcCallNumberMessage, + kTelSpcCloseLineMessage, + kTelSpcHoldLineMessage, + kTelSpcRetrieveHeldLineMessage, + kTelSpcGetCallerNumberMessage, + kTelSpcSendBurstDTMFMessage, + kTelSpcStartContinuousDTMFMessage, + kTelSpcStopContinuousDTMFMessage, + kTelSpcConferenceMessage, + kTelSpcSelectLineMessage, + kTelSpcPlayDTMFMessage, + + kTelDtcCallNumberMessage, + kTelDtcCloseLineMessage, + kTelDtcSendDataMessage, + kTelDtcReceiveDataMessage, + + kTelPhbGetEntryCountMessage, + kTelPhbGetEntryMessage, + kTelPhbGetEntriesMessage, + kTelPhbAddEntryMessage, + kTelPhbDeleteEntryMessage, + kTelPhbGetAvailablePhonebooksMessage, + kTelPhbSelectPhonebookMessage, + kTelPhbGetSelectedPhonebookMessage, + kTelPhbGetEntryMaxSizesMessage, + + kTelSndPlayKeyToneMessage, + kTelSndStopKeyToneMessage, + kTelSndMuteMessage, + + kTelUrqSmsGetUniquePartIdMessage, + + kTelUrqClosePhoneConnectionMessage, /* urgent query: ask TT to close connection with phone */ + kTelUrqOpenPhoneConnectionMessage, /* urgent query: ask TT to open connection with phone */ + kTelUrqIsPhoneConnectedMessage, /* urgent query: ask TT the connection state with phone */ + kTelUrqMatchPhoneDriverMessage, /* urgent query: ask TT to check whether the driver matches the phone */ + kTelUrqCancelMessage, /* urgent query: ask TT to cancel an asynchronous call */ + kTelUrqIsServiceAvailableMessage, /* urgent query: ask TT whether a service set is available */ + kTelUrqIsFunctionSupportedMessage, /* urgent query: ask TT whether a function is supported */ + + kTelUrqGetTTStatusMessage, /* urgent query: ask TT is status */ + kTelUrqSleepMessage, /* urgent query: warn TT the palm is going asleep */ + kTelUrqWakeMessage, /* urgent query: warn TT the palm is awaking */ + kTelUrqDetachMessage, /* urgent query: warn TT associated application is about to quit */ + kTelUrqStopTTMessage, /* urgent query: ask TT to stop */ + + kTelInfGetInformationMessage, + + kTelOemCallMessage, /* oem calls */ + + kTelLastMessage = kTelOemCallMessage +}; + +/* basic types */ +typedef UInt32 TelAppID; + +/* notification structure */ +typedef struct _TelNotificationType +{ + UInt32 notificationData; /* associated data if any */ + UInt32 notificationData2; /* associated data if any */ + UInt32 timeStamp; /* time stamp */ + UInt16 notificationId; /* what was the associated telephony event */ + UInt8 priority; /* notification priority 0 == max, 255 == min */ +} TelNotificationType; + +/* event structure */ +typedef struct _TelEventType +{ + eventsEnum eType; + Boolean penDown; + UInt8 tapCount; + Int16 screenX; + Int16 screenY; + + UInt16 functionId; /* ID of the message associated to the asynchronous function call */ + UInt16 transId; /* transId returned on asynchronous function call return */ + MemPtr *paramP; /* parameter passed at asynchronous function call */ + Err returnCode; /* function return code, errNone if ok, else an error */ +} TelEventType; + +/* command string */ +typedef struct _TelSendCommandStringType +{ + Char* commandString; /* command string to be sent */ + Char* resultString; /* result string */ + UInt16 resultSize; /* result string buffer size/max bytes retrieved on result */ + UInt32 timeOut; /* milliseconds time out for command processing (before phone starts replying) */ +} TelSendCommandStringType; + +/* call state */ +typedef struct _TelGetCallStateType +{ + UInt8 state; /* call state, see kTelCall constants in TelMgr.h */ + UInt8 callType; /* incoming or outgoing */ + UInt8 callServiceType; /* voice or data */ + + /* outgoing or incoming call number */ + UInt8 numberSize; /* size of number (in), length of number + 1 (out) */ + Char* number; /* called or calling number */ +} TelGetCallStateType; + +/* network support */ +typedef struct _TelNwkGetNetworkNameType +{ + UInt32 id; /* network ID */ + Char* value; /* name */ + UInt16 size; /* size of name (in), name len including '\0' (out) */ +} TelNwkGetNetworkNameType; + +typedef struct _TelNwkGetNetworksType +{ + UInt32* networkIdP; /* network IDs array */ + UInt8 size; /* size of networkIdP (in), number of network IDs (out) */ +} TelNwkGetNetworksType; + +/* phone location within network web */ +typedef struct _TelNwkGetLocationType +{ + Char* value; /* current location string */ + UInt16 size; /* size of value (in), location len including '\0' (out) */ +} TelNwkGetLocationType; + +/* change security code */ +typedef struct _TelStyChangeAuthenticationType +{ + UInt8 codeId; /* code to be changed */ + Char* oldCode; /* old code value */ + Char* newCode; /* new code value */ +} TelStyChangeAuthenticationType; + +/* SMS center */ +typedef struct _TelCfgGetSmsCenterType +{ + UInt8 size; /* size of value (in), SMS dial number len including '\0' (out) */ + Char* value; /* SMS center dial number */ +} TelCfgGetSmsCenterType; + +/* phone number */ +typedef struct _TelCfgGetPhoneNumberType +{ + UInt8 size; /* size of value (in), phone dial number len including '\0' (out) */ + Char* value; /* phone dial number */ +} TelCfgGetPhoneNumberType; + +/* SMS */ +/* SMS time */ +typedef struct _TelSmsDateTimeType +{ + Boolean absolute; + UInt32 dateTime; /* relative time from now, or Palm absolute time */ +} TelSmsDateTimeType; + +/* SMS extensions */ +typedef struct _TelSmsMultiPartExtensionType +{ + UInt16 bytesSent; + + UInt16 partCurrent, + partCount, + partId; +} TelSmsMultiPartExtensionType; + +typedef struct _TelSmsNbsExtensionType +{ + UInt16 destPort, /* destination NBS port */ + srcPort; /* source NBS port */ +} TelSmsNbsExtensionType; + +typedef struct _TelSmsUserExtensionType +{ + UInt8* extHeader; /* user defined extended header */ + UInt8 extHeaderSize; +} TelSmsUserExtensionType; + +typedef struct _TelSmsExtensionType +{ + UInt8 extensionTypeId; /* what does this extension describe? */ + + union + { + TelSmsMultiPartExtensionType mp; /* multi-part SMS extension */ + TelSmsNbsExtensionType nbs; /* NBS SMS extension */ + TelSmsUserExtensionType user; /* User Defined SMS extension */ + } extension; +} TelSmsExtensionType; + +/* Advanced parameters for GSM */ +typedef struct _TelSmsSubmitAdvancedGSMType +{ + UInt16 protocolId; /* Reserved - not supported (Fax, paging, . . .) GSM only */ + + Boolean rejectDuplicatedRequest; /* GSM - Network must reject msg if the same exists */ + Boolean replyPath; /* GSM - use reply specified path */ + + Char* serviceCenterNumber; /* SMS service center number */ + UInt8 serviceCenterNumberSize; /* Used for decoding only */ +} TelSmsSubmitAdvancedGSMType; + +/* Advanced parameters for CDMA */ +typedef struct _TelSmsSubmitAdvancedCDMAType +{ + Boolean manualAckRequest; + UInt8 messageType; /* Message Type */ + + TelSmsDateTimeType deferredDate; /* GSM & CDMA only Absolute or relative */ + + UInt8 priority; /* CDMA & TDMA only */ + UInt8 privacy; /* CDMA & TDMA only */ + + Boolean alertOnDeliveryRequest; /* CDMA & TDMA(?) */ + + Char* callbackNumber; /* CDMA & TDMA only - address to reply */ + UInt8 callbackNumberSize; +} TelSmsSubmitAdvancedCDMAType; + +/* Advanced parameters for TDMA - currently identical to CDMA */ +typedef TelSmsSubmitAdvancedCDMAType TelSmsSubmitAdvancedTDMAType; + +/* Submit message structure */ +typedef struct _TelSmsSubmitMessageType +{ + UInt16 version; /* SMS API version */ + + Boolean networkDeliveryRequest; /* All - Ask a network delivery report / status report */ + + Char* destinationAddress; /* length : GSM 12bytes, CDMA up to 2x64 bytes */ + UInt8 destinationAddressSize; /* Used for decoding only */ + + UInt16 dataSize; /* Length of data being sent */ + UInt8* data; /* All */ + UInt8 dataCodingScheme; + + TelSmsDateTimeType validityPeriod; /* All - Absolute or relative */ + + /* Advanced parameters */ + UInt8 standardType; /* Indicates the type of advanced parameters */ + union + { + TelSmsSubmitAdvancedGSMType advancedGSM; + TelSmsSubmitAdvancedCDMAType advancedCDMA; + TelSmsSubmitAdvancedTDMAType advancedTDMA; + } advancedParams; + + UInt8 extensionsCount; /* how many extensions in this message */ + TelSmsExtensionType* extensionsP; /* SMS extensions array: NBS, Multi-part, etc. */ +} TelSmsSubmitMessageType; + +/* Submit message structure parameter */ +typedef struct _TelSmsSendMessageType +{ + UInt32 messageId; /* Output parameter, filled by the telephony implementation */ + TelSmsSubmitMessageType message; +} TelSmsSendMessageType; + +/* Submitted message structure parameter */ +typedef struct _TelSmsSubmittedMessageType +{ + UInt16 index; /* Message's index on the phone */ + TelSmsSubmitMessageType message; +} TelSmsSubmittedMessageType; + +/* Manual acknowledge structure */ +typedef struct _TelSmsManualAckType +{ + UInt16 version; /* SMS API version */ + Char* destinationAddress; /* length : GSM 12bytes, CDMA up to 2x64 bytes */ + UInt32 messagesId; /* Message Id of message to be acknowledged */ + + UInt16 dataSize; /* Length of data being sent */ + UInt8* data; /* All */ + UInt8 dataCodingScheme; + + UInt8 responseCode; /* Value is network dependant */ +} TelSmsManualAckType; + +typedef struct _TelSmsDeliveryAdvancedGSMType +{ + UInt16 protocolId; /* reserved - not supported - GSM only */ + + Boolean replyPath; /* GSM - must use specified reply path */ + Char* serviceCenterNumber; + UInt8 serviceCenterNumberSize; +} TelSmsDeliveryAdvancedGSMType; + +typedef struct _TelSmsDeliveryAdvancedCDMAType +{ + UInt8 messageType; /* Delivery Message Type */ + + TelSmsDateTimeType validityPeriod; /* CDMA & TDMA only */ + + UInt8 priority; /* CDMA & TDMA only */ + UInt8 privacy; /* CDMA & TDMA only */ + + Boolean alertOnDeliveryRequest; /* CDMA & TDMA only */ + Boolean manualAckRequest; /* CDMA */ + + UInt8 voiceMessageNumber; /* CDMA, TDMA, GSM */ + + UInt8 callbackNumberSize; + Char* callbackNumberAddress; /* Store callback address */ + + UInt8 languageIndicator; /* reserved - not supported - CDMA only */ +} TelSmsDeliveryAdvancedCDMAType; + +typedef struct _TelSmsDeliveryAdvancedTDMAType +{ + UInt8 messageType; /* Delivery Message Type */ + + TelSmsDateTimeType validityPeriod; /* CDMA & TDMA only */ + + UInt8 priority; /* CDMA & TDMA only */ + UInt8 privacy; /* CDMA & TDMA only */ + + Boolean manualAckRequest; /* CDMA */ + + Boolean alertOnDeliveryRequest; /* CDMA & TDMA only */ + UInt8 voiceMessageNumber; /* CDMA, TDMA, GSM */ + + UInt8 callbackNumberSize; + Char* callbackNumberAddress; /* Store callback address */ +} TelSmsDeliveryAdvancedTDMAType; + +/* Delivery message structure */ +typedef struct _TelSmsDeliveryMessageType +{ + UInt16 version; /* SMS API version */ + UInt16 index; /* SMS index on the phone storage */ + + UInt32 messageIdentifier; + + TelSmsDateTimeType timeStamp; + + UInt16 dataSize; /* Length of data being sent */ + UInt8* data; + UInt8 dataCodingScheme; /* enum All */ + + UInt8 originatingAddressSize; + Char* originatingAddress; /* Store originating address (delivery message) */ + + Boolean otherToReceive; /* GSM & CDMA & TDMA(?) */ + + Boolean reportDeliveryIndicator; /* All */ + + /* Advanced parameters */ + UInt8 standardType; + union + { + TelSmsDeliveryAdvancedGSMType advancedGSM; + TelSmsDeliveryAdvancedCDMAType advancedCDMA; + TelSmsDeliveryAdvancedTDMAType advancedTDMA; + } advancedParams; + + UInt8 extensionsCount; /* how many extensions in this message */ + TelSmsExtensionType* extensionsP; /* SMS extensions array: NBS, Multi-part, etc. */ +} TelSmsDeliveryMessageType; + +/* Report message structure */ +typedef struct _TelSmsReportType +{ + UInt16 version; + UInt16 index; /* SMS index on the phone storage */ + UInt8 reportType; /* Delivery report type */ + UInt32 messageId; + + UInt16 dataSize; /* Length of data being sent */ + UInt8* data; + UInt8 dataCodingScheme; + + Char* originatingAddress; /* Store originating address */ + UInt8 originatingAddressSize; + + UInt8 report; + + TelSmsDateTimeType timeStamp; /* Time when SC received the corresponding sent message */ +} TelSmsReportType; + +/* multiple messages read */ +typedef struct _TelSmsReadMessagesType +{ + UInt16 first; /* first message physical index, zero based */ + UInt16 count; /* number of messages to read */ + TelSmsDeliveryMessageType *messagesP; /* messages array */ +} TelSmsReadMessagesType; + +/* multiple reports read */ +typedef struct _TelSmsReadReportsType +{ + UInt16 first; /* first report physical index, zero based */ + UInt16 count; /* number of reports to read */ + TelSmsReportType *reportsP; /* reports array */ +} TelSmsReadReportsType; + +/* multiple submitted messages read */ +typedef struct _TelSmsReadSubmittedMessagesType +{ + UInt16 first; /* first sent message physical index, zero based */ + UInt16 count; /* number of sent messages to read */ + TelSmsSubmittedMessageType *submittedsP; /* sent messages array */ +} TelSmsReadSubmittedMessagesType; + +/* get messages number/slots in selected storage */ +typedef struct _TelSmsGetMessageCountType +{ + UInt8 messageType; /* report, submitted, etc. */ + UInt16 slots; /* number of entries in the selected storage */ + UInt16 count; /* number of messages present in the selected storage */ +} TelSmsGetMessageCountType; + +/* delete message selected storage */ +typedef struct _TelSmsDeleteMessageType +{ + UInt8 messageType; /* report, submitted, etc. */ + UInt16 index; /* physical index in storage, zero based */ +} TelSmsDeleteMessageType; + +/* available storage list */ +typedef struct _TelSmsGetAvailableStorageType +{ + UInt16 count; /* storage IDs array size (in), retrieved IDs number (out) */ + UInt8 *storagesP; /* storage IDs array */ +} TelSmsGetAvailableStorageType; + +/* emergency call support */ +typedef struct _TelEmcGetNumberType +{ + UInt8 index; /* EMC number index, zero based */ + UInt8 size; /* EMC dial number len including '\0' (out), value size (in) */ + Char* value; /* EMC dial number */ +} TelEmcGetNumberType; + +typedef struct _TelEmcSetNumberType +{ + UInt8 index; /* EMC number index, zero based */ + Char* value; /* EMC dial number */ +} TelEmcSetNumberType; + +/* speech call support */ +typedef struct _TelSpcGetCallerNumberType +{ + UInt8 size; /* dial number len including '\0' (out), value size (in) */ + Char* value; /* dial number */ +} TelSpcGetCallerNumberType; + +typedef struct _TelSpcPlayDTMFType +{ + UInt8 keyTone; /* keytone to be played */ + UInt32 duration; /* play duration in 10 ms multiple */ +} TelSpcPlayDTMFType; + +/* phonebook support */ +typedef struct _TelPhbEntryType +{ + UInt16 phoneIndex; /* entry's index in the phonebook, zero based */ + Char* fullName; + UInt8 fullNameSize; /* name len including '\0' (out), name size (in) */ + Char* dialNumber; + UInt8 dialNumberSize; /* dial number len including '\0' (out), dialNumber size (in) */ +} TelPhbEntryType; + +typedef struct _TelPhbGetEntryCountType +{ + UInt16 slots; /* number of entries in the selected phonebook */ + UInt16 count; /* number of name/addresse pairs present in the selected phonebook */ +} TelPhbGetEntryCountType; + +typedef struct _TelPhbGetEntriesType +{ + UInt16 first; /* first entry physical index, zero based */ + UInt16 count; /* number of name/addresse pairs */ + TelPhbEntryType* entriesP; /* name/addresse pairs array */ +} TelPhbGetEntriesType; + +typedef struct _TelPhbGetAvailablePhonebooksType +{ + UInt16 count; /* size of array (in), number of IDs (out) */ + UInt8* phonebooksP; /* phonebook IDs array */ +} TelPhbGetAvailablePhonebooksType; + +typedef struct _TelPhbGetEntryMaxSizesType +{ + UInt8 fullNameMaxSize; /* name len including '\0' */ + UInt8 dialNumberMaxSize; /* dial number len including '\0' */ +} TelPhbGetEntryMaxSizesType; + +/* sound support */ +typedef struct _TelSndPlayKeyToneType +{ + UInt8 keycode; /* what key */ + UInt8 type; /* what tone type */ +} TelSndPlayKeyToneType; + +/* information support */ +typedef struct _TelInfGetInformationType +{ + UInt8 infoType; /* expected information, can be up to 2Kb (!) */ + UInt16 size; /* value len including '\0' (out), value size (in) */ + Char* value; /* returned information string */ +} TelInfGetInformationType; + +/* data call support */ +typedef struct _TelDtcCallNumberType +{ + Char* dialNumberP; /* number to dial */ + UInt8 lineId; /* resulting line id, sent back in event */ +} TelDtcCallNumberType; + +typedef struct _TelDtcSendDataType +{ + UInt8* data; /* data to be sent */ + UInt32 size; /* data size (in), data sent (out)*/ +} TelDtcSendDataType; + +typedef struct _TelDtcReceiveDataType +{ + UInt8* data; /* buffer to receive data */ + UInt32 size; /* size of buffer (in), data size (out)*/ + UInt32 timeOut; /* milliseconds to wait before exiting */ +} TelDtcReceiveDataType; + +/* OEM support */ +typedef struct _TelOemCallType +{ + UInt32 OemId; /* unique ID of OEM function set */ + UInt8 funcId; /* function ID */ + void* paramP; /* parameters block */ +} TelOemCallType; + +#endif diff --git a/sdk-4/include/Libraries/Telephony/UI/TelephonyMgrUI.h b/sdk-4/include/Libraries/Telephony/UI/TelephonyMgrUI.h new file mode 100644 index 0000000..0afbe42 --- /dev/null +++ b/sdk-4/include/Libraries/Telephony/UI/TelephonyMgrUI.h @@ -0,0 +1,49 @@ +/****************************************************************************** + * + * 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 + * + *****************************************************************************/ + +#ifndef __TELEPHONYMGRUI_H__ +#define __TELEPHONYMGRUI_H__ + +#include + +/*********************************************************************** + * Structure definition - to move to a public header file + ***********************************************************************/ + +#define kTelNotifyErrorDetailsVersion 1 + +#define telNotifyErrorEvent 'terr' +#define telNotifyEnterCodeEvent 'tpin' + +#define kTelTryAgainBit 0x00000001 +#define kTelNoSetUpButtonBit 0x00000002 +#define kTelAutoTryAgainBit 0x00000004 +#define kTelAutoSetUpButtonBit 0x00000008 + +typedef struct TelNotifyErrorDetailsTag +{ + UInt16 version; + Err error; + UInt32 ioFlags; + Char* messageP; +} TelNotifyErrorDetailsType, *TelNotifyErrorDetailsPtr; + + +#endif // __TELEPHONYMGRUI_H__ diff --git a/sdk-4/include/PalmCompatibility.h b/sdk-4/include/PalmCompatibility.h new file mode 100644 index 0000000..cad7b09 --- /dev/null +++ b/sdk-4/include/PalmCompatibility.h @@ -0,0 +1,312 @@ +/****************************************************************************** + * + * 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. + * + *****************************************************************************/ + +#ifndef __PALMCOMPATIBILITY_H__ +#define __PALMCOMPATIBILITY_H__ + +#include + +// 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. + +typedef Int8 SByte; +#if __DEFINE_TYPES_ +typedef UInt8 Byte; +#endif + +typedef Int16 SWord; +typedef UInt16 Word; + +typedef Int32 SDWord; +typedef UInt32 DWord; + + +// Logical data types +typedef Int8 SChar; +typedef UInt8 UChar; + +typedef Int16 Short; +typedef UInt16 UShort; + +typedef Int16 Int; +typedef UInt16 UInt; + +typedef Int32 Long; +typedef UInt32 ULong; + + +// Pointer Types +typedef MemPtr VoidPtr; +typedef MemHandle VoidHand; + +#if __DEFINE_TYPES_ +typedef MemPtr Ptr; +typedef MemHandle Handle; +#endif + + +// 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 *"!) + +typedef SByte* SBytePtr; +#if __DEFINE_TYPES_ +typedef Byte* BytePtr; +#endif + +typedef SWord* SWordPtr; +typedef Word* WordPtr; +typedef UInt16* UInt16Ptr; + +typedef SDWord* SDWordPtr; +typedef DWord* DWordPtr; + +// Logical data types +typedef Boolean* BooleanPtr; + +typedef Char* CharPtr; +typedef SChar* SCharPtr; +typedef UChar* UCharPtr; + +typedef WChar* WCharPtr; + +typedef Short* ShortPtr; +typedef UShort* UShortPtr; + +typedef Int* IntPtr; +typedef UInt* UIntPtr; + +typedef Long* LongPtr; +typedef ULong* ULongPtr; + +// Instead of indexing through countries and languages, developers should call +// the Locale Manager to index through known locales: +#define languageFirst lEnglish // From Preferences.h +#define languageLast lDutch // From Preferences.h +#define languageCount (languageLast - languageFirst + 1) // From Preferences.h +#define countryFirst cAustralia // From Preferences.h +#define countryLast cTaiwan // From Preferences.h +#define countryCount (countryLast - countryFirst + 1) // From Preferences.h + +// Incorporated into the Locale Manager: +#define countryNameLength (kMaxCountryNameLen+1) // From Preferences.h +#define currencyNameLength (kMaxCurrencyNameLen+1) // From Preferences.h +#define currencySymbolLength (kMaxCurrencySymbolLen+1) // From Preferences.h + +/******************************************************************** + * + * Deprecated screen stuff + * + ********************************************************************/ + +#define scrCopy winPaint +#define scrAND winErase +#define scrANDNOT winMask +#define scrXOR winInvert +#define scrOR winOverlay +#define scrCopyNOT winPaintInverse + +#define scrDisplayModeGetDefaults winScreenModeGetDefaults +#define scrDisplayModeGet winScreenModeGet +#define scrDisplayModeSetToDefaults winScreenModeSetToDefaults +#define scrDisplayModeSet winScreenModeSet +#define scrDisplayModeGetSupportedDepths winScreenModeGetSupportedDepths +#define scrDisplayModeGetSupportsColor winScreenModeGetSupportsColor + +#define ScrOperation WinDrawOperation + +#define ScrDisplayMode(op, widthP, heightP, depthP, enableColorP) \ + WinScreenMode(op, widthP, heightP, depthP, enableColorP) + +#define 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. +#define daysOfWeekStrID 10000 +#define dayFullNamesStrID 10001 +#define monthNamesStrID 10002 +#define 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. +#define daysOfWeekShortStrListID 10200 +#define daysOfWeekStdStrListID 10201 +#define daysOfWeekLongStrListID 10202 +#define monthNamesShortStrListID 10203 +#define monthNamesStdStrListID 10204 +#define 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. +#define sysResTCountries 'cnty' +#define sysResIDCountries 10000 + +/******************************************************************** + * + * Deprecated SYS_TRAP macro machinery + * + ********************************************************************/ + +// This nWORD_INLINE stuff was never really portable to GCC. See the +// new SYS_TRAP framework in PalmTypes.h for most uses of these macros. +// Generally if you just want to use CodeWarrior, you can use these +// macros or just use the = { x, y, z} notation directly. To be +// portable between CodeWarrior and m68k-palmos-gcc, you should use +// the ={x,y,z} notation on the CW side and __attribute__((callseq)) +// on the GCC side (see the Palm OS-specific manual). + +#if USE_TRAPS == 0 +// Disable Palm OS System and Library trap inline code +// Header files become function prototypes for direct-linking +#define ONEWORD_INLINE(trapNum) +#define TWOWORD_INLINE(w1, w2) +#define THREEWORD_INLINE(w1, w2, w3) +#define FOURWORD_INLINE(w1, w2, w3, w4) +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) + +#else +// Enable Palm OS System and Library trap inline code +// Header files contain inline glue (opcodes) to be inserted in calling code +#define ONEWORD_INLINE(trapNum) \ + = trapNum +#define TWOWORD_INLINE(w1, w2) \ + = {w1,w2} +#define THREEWORD_INLINE(w1, w2, w3) \ + = {w1,w2,w3} +#define FOURWORD_INLINE(w1, w2, w3, w4) \ + = {w1,w2,w3,w4} +#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) \ + = {w1,w2,w3,w4,w5} +#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) \ + = {w1,w2,w3,w4,w5,w6} +#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) \ + = {w1,w2,w3,w4,w5,w6,w7} +#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) \ + = {w1,w2,w3,w4,w5,w6,w7,w8} +#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9} +#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10} +#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11} +#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \ + = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12} + +#endif + +/******************************************************************** + * + * Deprecated Expansion Manager names + * + ********************************************************************/ + +// Expansion Manager +#define invalidSlotRefNum expInvalidSlotRefNum +#define expErrInvalidSlotRefNumber expErrInvalidSlotRefNum +#define ExpMediaType_Any expMediaType_Any +#define ExpMediaType_MemoryStick expMediaType_MemoryStick +#define ExpMediaType_CompactFlash expMediaType_CompactFlash +#define ExpMediaType_SecureDigital expMediaType_SecureDigital +#define ExpMediaType_MultiMediaCard expMediaType_MultiMediaCard +#define ExpMediaType_SmartMedia expMediaType_SmartMedia +#define ExpMediaType_RAMDisk expMediaType_RAMDisk +#define ExpMediaType_PoserHost expMediaType_PoserHost +#define ExpMediaType_MacSim expMediaType_MacSim + +// VFS Manager: +#define VFSMountClass_SlotDriver vfsMountClass_SlotDriver +#define VFSMountClass_Simulator vfsMountClass_Simulator +#define fsOriginBeginning vfsOriginBeginning +#define fsOriginCurrent vfsOriginCurrent +#define fsOriginEnd vfsOriginEnd +#define fsFilesystemType_VFAT vfsFilesystemType_VFAT +#define fsFilesystemType_FAT vfsFilesystemType_FAT +#define fsFilesystemType_NTFS vfsFilesystemType_NTFS +#define fsFilesystemType_HFSPlus vfsFilesystemType_HFSPlus +#define fsFilesystemType_HFS vfsFilesystemType_HFS +#define fsFilesystemType_MFS vfsFilesystemType_MFS +#define fsFilesystemType_EXT2 vfsFilesystemType_EXT2 +#define fsFilesystemType_FFS vfsFilesystemType_FFS +#define fsFilesystemType_NFS vfsFilesystemType_NFS +#define fsFilesystemType_AFS vfsFilesystemType_AFS +#define fsFilesystemType_Novell vfsFilesystemType_Novell +#define fsFilesystemType_HPFS vfsFilesystemType_HPFS +#define VFSFileAttributesGet VFSFileGetAttributes +#define VFSFileAttributesSet VFSFileSetAttributes +#define VFSFileDateGet VFSFileGetDate +#define VFSFileDateSet VFSFileSetDate +#define VFSVolumeLabelGet VFSVolumeGetLabel +#define VFSVolumeLabelSet VFSVolumeSetLabel + +// FSLib: +#define FS_LIB_APIVersion fsLibAPIVersion +#define FSFileAttributesGet FSFileGetAttributes +#define FSFileAttributesSet FSFileSetAttributes +#define FSFileDateGet FSFileGetDate +#define FSFileDateSet FSFileSetDate +#define FSVolumeLabelGet FSVolumeGetLabel +#define FSVolumeLabelSet FSVolumeSetLabel + +// SlotDrvrLib: +#define SlotDrvr_LIB_APIVersion slotDrvrAPIVersion +#define Slot_SECTOR_SIZE slotSectorSize + + +#endif diff --git a/sdk-4/include/PalmOS.h b/sdk-4/include/PalmOS.h new file mode 100644 index 0000000..abbb130 --- /dev/null +++ b/sdk-4/include/PalmOS.h @@ -0,0 +1,30 @@ +/****************************************************************************** + * + * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOS.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Public includes for the whole core OS, generally apps/panels/libraries + * only need to include this. + * + * History: + * 6/ 6/95 RM - Created by Ron Marianetti + * 2/24/97 RF - Changed to handle c++ versions. + * 4/24/97 SL - Changes for PalmOS 2.0 SDK + * 5/19/97 SL - Now includes only in MWERKS environments + * 7/14/99 bob - Created from Pilot.h + * + *****************************************************************************/ + +#ifndef __PALMOS_H__ +#define __PALMOS_H__ + +#include +#include +#include + +#endif // __PALMOS_H__ diff --git a/sdk-4/include/PalmOS.pch b/sdk-4/include/PalmOS.pch new file mode 100644 index 0000000..5cdec7e --- /dev/null +++ b/sdk-4/include/PalmOS.pch @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOS.pch + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Precompiled header file for PalmOS.h. + * + * To use precompiled headers, add this file to your application project, + * and add the output filename ("PalmOS_Headers" for device builds, or + * "PalmOS_Sim_Headers" for simulator builds) to the "Prefix File" field + * of the "C/C++ Language" project settings panel. + * + * To use a custom prefix file in your project, #include "StarterPrefix.h" and + * in "StarterPrefix.h" add: #include "PalmOS_Headers" (or PalmOS_Sim_Headers) + * as the FIRST #include line. + * + * To override values (such as the ERROR_CHECK_LEVEL define), see comments below + * regarding modifying this file or creating your own version. + * + * History: + * 12/ 3/99 SCL - Created by Steve Lemke + * + *****************************************************************************/ + +#ifndef __PALMOS_PCH__ +#define __PALMOS_PCH__ + +// To override certain build options, modify this file or create your own copy of it, +// and do something like the following to customize the #define options... +// +//#include +//#define ERROR_CHECK_LEVEL ERROR_CHECK_PARTIAL + +// Include the Palm OS public header files +#include + +#if EMULATION_LEVEL == EMULATION_NONE + #pragma precompile_target ":Obj:PalmOS_Headers" +#else + #pragma precompile_target ":Obj:PalmOS_Headers_Sim" +#endif + +#endif // __PALMOS_PCH__ diff --git a/sdk-4/include/PalmOS.win.pch b/sdk-4/include/PalmOS.win.pch new file mode 100644 index 0000000..efb064f --- /dev/null +++ b/sdk-4/include/PalmOS.win.pch @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmOS.win.pch + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Precompiled header file for PalmOS.h. + * + * To use precompiled headers, add this file to your application project, + * and add the output filename ("PalmOS_Headers" for device builds, or + * "PalmOS_Sim_Headers" for simulator builds) to the "Prefix File" field + * of the "C/C++ Language" project settings panel. + * + * To use a custom prefix file in your project, #include "StarterPrefix.h" and + * in "StarterPrefix.h" add: #include "PalmOS_Headers" (or PalmOS_Sim_Headers) + * as the FIRST #include line. + * + * To override values (such as the ERROR_CHECK_LEVEL define), see comments below + * regarding modifying this file or creating your own version. + * + * History: + * 12/ 3/99 SCL - Created by Steve Lemke + * + *****************************************************************************/ + +#ifndef __PALMOS_PCH__ +#define __PALMOS_PCH__ + +// To override certain build options, modify this file or create your own copy of it, +// and do something like the following to customize the #define options... +// +//#include +//#define ERROR_CHECK_LEVEL ERROR_CHECK_PARTIAL + +// Include the Palm OS public header files +#include + +#if EMULATION_LEVEL == EMULATION_NONE + #pragma precompile_target "PalmOS_Headers" +#else + #pragma precompile_target "PalmOS_Headers_Sim" +#endif + +#endif // __PALMOS_PCH__ diff --git a/sdk-4/include/PalmTypes.h b/sdk-4/include/PalmTypes.h new file mode 100644 index 0000000..ee5f46b --- /dev/null +++ b/sdk-4/include/PalmTypes.h @@ -0,0 +1,303 @@ +/****************************************************************************** + * + * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmTypes.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * Common header file for all Palm OS components. + * Contains elementary data types + * + * History: + * 10/19/94 Created by Ron Marianetti + * 04/24/97 SCL Changes for PalmOS 2.0 SDK + * 08/21/98 SCL Merged WChar & WCharPtr typedefs from Sumo. + * 07/13/99 bob Created from Common.h, lots of cleanup of types + * + *****************************************************************************/ + +#ifndef __PALMTYPES_H__ +#define __PALMTYPES_H__ + + +/************************************************************ + * Environment configuration + *************************************************************/ +// must be included here, rather than in +// because they must be included for ALL builds. +// Not every build includes . + +// To override build options in a local component, include +// first, then define switches as need, and THEN include . +// This new mechanism supercedes the old "AppBuildRules.h" approach. +// More details available in . +#include + + +/************************************************************ + * Useful Macros + *************************************************************/ +#if defined(__GNUC__) && defined(__UNIX__) // used to be in + // Ensure that structure elements are 16-bit aligned + // Other [host] development platforms may need this as well... + #pragma pack(2) +#endif + + +/******************************************************************** + * Elementary data types + ********************************************************************/ +// Determine if we need to define our basic types or not +#ifndef __TYPES__ // (Already defined in CW11) +#ifndef __MACTYPES__ // (Already defined in CWPro3) +#define __DEFINE_TYPES_ 1 +#endif +#endif + + +// Fixed size data types +typedef signed char Int8; +typedef signed short Int16; +typedef signed long Int32; + +#if __DEFINE_TYPES_ +typedef unsigned char UInt8; +typedef unsigned short UInt16; +typedef unsigned long UInt32; +#endif + + +// Logical data types +#if __DEFINE_TYPES_ +typedef unsigned char Boolean; +#endif + +typedef char Char; +typedef UInt16 WChar; // 'wide' int'l character type. + +typedef UInt16 Err; + +typedef UInt32 LocalID; // local (card relative) chunk ID + +typedef Int16 Coord; // screen/window coordinate + + +typedef void * MemPtr; // global pointer +typedef struct _opaque *MemHandle; // global handle + + +#if __DEFINE_TYPES_ +typedef Int32 (*ProcPtr)(); +#endif + + +/************************************************************ + * Useful Macros + *************************************************************/ + +// The min() and max() macros which used to be defined here have been removed +// because they conflicted with facilities in C++. If you need them, you +// should define them yourself, or see PalmUtils.h -- but please read the +// comments in that file before using it in your own projects. + + +#define OffsetOf(type, member) ((UInt32) &(((type *) 0)->member)) + + + + +/************************************************************ + * Common constants + *************************************************************/ +#ifndef NULL +#define NULL 0 +#endif // NULL + +#ifndef bitsInByte +#define bitsInByte 8 +#endif // bitsInByte + + +// Include the following typedefs if types.h wasn't read. +#if __DEFINE_TYPES_ + #ifdef __MWERKS__ + #if !__option(bool) + #ifndef true + #define true 1 + #endif + #ifndef false + #define false 0 + #endif + #endif + #else + #ifndef __cplusplus + #ifndef true + enum {false, true}; + #endif + #endif + #endif +#endif /* __TYPES__ */ + + + + +/************************************************************ + * Misc + *************************************************************/ + +// Standardized infinite loop notation +// Use in place of while(1), while(true), while(!0), ... +#define loop_forever for (;;) + + +// Include M68KHwr.h: +#if EMULATION_LEVEL == EMULATION_NONE +#if CPU_TYPE == CPU_68K +#include +//#pragma warn_no_side_effect on +#endif +#endif + +/************************************************************ + * Metrowerks will substitute strlen and strcpy with inline + * 68K assembly code. Prevent this. + *************************************************************/ + +#ifdef __MC68K__ +#define _NO_FAST_STRING_INLINES_ 0 +#endif + + +/************************************************************ + * Define whether or not we are direct linking, or going through + * traps. + * + * When eumulating we use directy linking. + * When running under native mode, we use traps EXCEPT for the + * modules that actually install the routines into the trap table. + * These modules will set the DIRECT_LINK define to 1 + *************************************************************/ +#ifndef EMULATION_LEVEL +#error "This should not happen!" +#endif + +#ifndef USE_TRAPS + #if EMULATION_LEVEL == EMULATION_NONE + #define USE_TRAPS 1 // use Pilot traps + #else + #define USE_TRAPS 0 // direct link (Simulator) + #endif +#endif + + +/******************************************************************** + * Palm OS System and Library trap macro definitions: + ********************************************************************/ + +#define _DIRECT_CALL(table, vector) +#define _DIRECT_CALL_WITH_SELECTOR(table, vector, selector) +#define _DIRECT_CALL_WITH_16BIT_SELECTOR(table, vector, selector) + +#ifndef _STRUCTURE_PICTURES + +#define _SYSTEM_TABLE 15 +#define _HAL_TABLE 15 + +#ifdef __GNUC__ + + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) + + #ifndef _Str + #define _Str(X) #X + #endif + + #define _OS_CALL(table, vector) \ + __attribute__ ((__callseq__ ( \ + "trap #" _Str(table) "; dc.w " _Str(vector)))) + + #define _OS_CALL_WITH_SELECTOR(table, vector, selector) \ + __attribute__ ((__callseq__ ( \ + "moveq #" _Str(selector) ",%%d2; " \ + "trap #" _Str(table) "; dc.w " _Str(vector)))) + + #define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) \ + __attribute__ ((__callseq__ ( \ + "move.w #" _Str(selector) ",-(%%sp); " \ + "trap #" _Str(table) "; dc.w " _Str(vector) "; " \ + "addq.w #2,%%sp"))) + + #else + + #define _OS_CALL(table, vector) __attribute__ ((systrap (vector))) + #define _OS_CALL_WITH_SELECTOR(table, vector, selector) + #define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) + + #endif + +#elif defined (__MWERKS__) /* The equivalent in CodeWarrior syntax */ + + #define _OS_CALL(table, vector) \ + = { 0x4E40 + table, vector } + + #define _OS_CALL_WITH_SELECTOR(table, vector, selector) \ + = { 0x7400 + selector, 0x4E40 + table, vector } + + #define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) \ + = { 0x3F3C, selector, 0x4E40 + table, vector, 0x544F } + +#endif + +#else + +#define _SYSTEM_TABLE "systrap" +#define _HAL_TABLE "hal" + +#define _OS_CALL(table, vector) \ + __SPIC__("simple", table, vector, 0) + +#define _OS_CALL_WITH_SELECTOR(table, vector, selector) \ + __SPIC__("selector", table, vector, selector) + +#define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) \ + __SPIC__("16bit_selector", table, vector, selector) + +#endif + + +#if EMULATION_LEVEL != EMULATION_NONE + +#define _HAL_API(kind) _DIRECT##kind +#define _SYSTEM_API(kind) _DIRECT##kind + +#elif USE_TRAPS == 0 + +#define _HAL_API(kind) _OS##kind +#define _SYSTEM_API(kind) _DIRECT##kind + +#else + +#define _HAL_API(kind) _OS##kind +#define _SYSTEM_API(kind) _OS##kind + +#endif + + +/************************************************************ + * Palm specific TRAP instruction numbers + *************************************************************/ +#define sysDbgBreakpointTrapNum 0 // For soft breakpoints +#define sysDbgTrapNum 8 // For compiled breakpoints +#define sysDispatchTrapNum 15 // Trap dispatcher + + +#define SYS_TRAP(trapNum) _SYSTEM_API(_CALL)(_SYSTEM_TABLE, trapNum) + +#define ASM_SYS_TRAP(trapNum) \ + DC.W m68kTrapInstr+sysDispatchTrapNum; \ + DC.W trapNum + + +#endif //__PALMTYPES_H__ diff --git a/sdk-4/include/PalmUtils.h b/sdk-4/include/PalmUtils.h new file mode 100644 index 0000000..d590514 --- /dev/null +++ b/sdk-4/include/PalmUtils.h @@ -0,0 +1,80 @@ +/****************************************************************************** + * + * Copyright (c) 2000 Palm, Inc. or its subsidiaries. + * All rights reserved. + * + * File: PalmUtils.h + * + * Release: Palm OS SDK 4.0 (63220) + * + * Description: + * The utilities in this file are not a supported part of the Palm OS + * API and hence are not documented in the Palm OS Reference. They are + * here to provide a common vocabulary for various trivial operations in + * the SDK Source Code Examples. These examples are part of the SDK, so + * this file is part of the SDK too -- but not of the supported API. + * + * These macros are all trivial -- the value of this file is not in the + * definitions, but in the common vocabulary provided. You can use this + * header in your applications if you wish, but it will be just as easy + * to add relevant macros to your project itself. Since this header is + * unsupported and subject to change in future SDKs, there is some risk + * in using it directly in your projects. + * + * Since this header is not part of the Palm OS API, it is not included + * from PalmOS.h or any other API headers. (In particular, in C++ there + * are better alternatives to the facilities defined here, and parts of + * this header (the min/max macros) actively conflict with their C++ + * alternatives. Hence this header should not be forced on unsuspecting + * C++ users.) + * + * History: + * 2000-12-05 jwm Created. + * + *****************************************************************************/ + +#ifndef PALMUTILS_H +#define PALMUTILS_H + +// Macros for documenting that a function parameter is unused and +// suppressing warnings if the compiler supports a notation for that. + +#if defined __MWERKS__ + #define UNUSED_PARAM_ID(id) + #define UNUSED_PARAM_ATTR +#elif defined __GNUC__ + #define UNUSED_PARAM_ID(id) id + #define UNUSED_PARAM_ATTR __attribute__ ((__unused__)) +#else + #define UNUSED_PARAM_ID(id) id + #define UNUSED_PARAM_ATTR +#endif + +#define UNUSED_PARAM(id) UNUSED_PARAM_ID(id) UNUSED_PARAM_ATTR + +// In most cases, for simple parameters like "int x", the UNUSED_PARAM macro +// can be used, as in foo() below. Put only the parameter identifier as +// the argument to UNUSED_PARAM. +// +// Occasionally there might be an unused parameter with a complicated type +// which has some notation trailing after the parameter identifier, as in +// foo()'s "int array[]" parameter below. In this case you need to use +// the pair of macros as below: UNUSED_PARAM_ID has the function parameter +// identify as an argument, and UNUSED_PARAM_ATTR goes after the end of the +// parameter's type notation. +// +// void foo (int UNUSED_PARAM(x), +// int UNUSED_PARAM_ID(array)[] UNUSED_PARAM_ATTR) { } + + +// Note that these macros will interfere with the function templates of +// the same names in the C++ standard header . If you want to +// use this header file with C++ and (which is unlikely), you +// should #undef min and max after #including this header. + +#undef min +#undef max +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define max(a, b) (((a) > (b)) ? (a) : (b)) + +#endif diff --git a/sdk-4/include/header.gcc b/sdk-4/include/header.gcc new file mode 100644 index 0000000..aa793c8 --- /dev/null +++ b/sdk-4/include/header.gcc @@ -0,0 +1,34 @@ +ImcUtils.h Core/System/IMCUtils.h +PalmOptErrorCheckLevel.h Dynamic/PalmOptErrorCheckLevel.h +PalmOptTraceLevel.h Dynamic/PalmOptTraceLevel.h +ExpansionMgr.h Extensions/ExpansionMgr/ExpansionMgr.h +FSLib.h Extensions/ExpansionMgr/FSLib.h +SlotDrvrLib.h Extensions/ExpansionMgr/SlotDrvrLib.h +VFSMgr.h Extensions/ExpansionMgr/VFSMgr.h +ExgLocalLib.h Libraries/ExgLocal/ExgLocalLib.h +INetMgr.h Libraries/INet/INetMgr.h +LibTraps.h Libraries/LibTraps.h +Lz77Mgr.h Libraries/Lz77/Lz77Mgr.h +BmpGlue.h Libraries/PalmOSGlue/BmpGlue.h +CtlGlue.h Libraries/PalmOSGlue/CtlGlue.h +DateGlue.h Libraries/PalmOSGlue/DateGlue.h +FldGlue.h Libraries/PalmOSGlue/FldGlue.h +FntGlue.h Libraries/PalmOSGlue/FntGlue.h +FrmGlue.h Libraries/PalmOSGlue/FrmGlue.h +IntlGlue.h Libraries/PalmOSGlue/IntlGlue.h +LmGlue.h Libraries/PalmOSGlue/LmGlue.h +LstGlue.h Libraries/PalmOSGlue/LstGlue.h +OmGlue.h Libraries/PalmOSGlue/OmGlue.h +PalmOSGlue.h Libraries/PalmOSGlue/PalmOSGlue.h +ResGlue.h Libraries/PalmOSGlue/ResGlue.h +SysGlue.h Libraries/PalmOSGlue/SysGlue.h +TblGlue.h Libraries/PalmOSGlue/TblGlue.h +TsmGlue.h Libraries/PalmOSGlue/TsmGlue.h +TxtGlue.h Libraries/PalmOSGlue/TxtGlue.h +WinGlue.h Libraries/PalmOSGlue/WinGlue.h +PdiConst.h Libraries/Pdi/PdiConst.h +PdiLib.h Libraries/Pdi/PdiLib.h +SmsLib.h Libraries/Sms/SmsLib.h +TelephonyMgr.h Libraries/Telephony/TelephonyMgr.h +TelephonyMgrTypes.h Libraries/Telephony/TelephonyMgrTypes.h +TelephonyMgrUI.h Libraries/Telephony/UI/TelephonyMgrUI.h diff --git a/sdk-4/lib/m68k-palmos-coff/libNetSocket.a b/sdk-4/lib/m68k-palmos-coff/libNetSocket.a new file mode 100644 index 0000000..0c4fe43 Binary files /dev/null and b/sdk-4/lib/m68k-palmos-coff/libNetSocket.a differ diff --git a/sdk-4/lib/m68k-palmos-coff/libPalmOSGlue-debug.a b/sdk-4/lib/m68k-palmos-coff/libPalmOSGlue-debug.a new file mode 100644 index 0000000..f027eb1 Binary files /dev/null and b/sdk-4/lib/m68k-palmos-coff/libPalmOSGlue-debug.a differ diff --git a/sdk-4/lib/m68k-palmos-coff/libPalmOSGlue.a b/sdk-4/lib/m68k-palmos-coff/libPalmOSGlue.a new file mode 100644 index 0000000..d08982d Binary files /dev/null and b/sdk-4/lib/m68k-palmos-coff/libPalmOSGlue.a differ