4
(******************************************************************************
6
* Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
11
* Release: Palm OS SDK 4.0 (63220)
14
* Public header for routines that support overlays.
17
* 06/24/99 kwk Created by Ken Krugler.
18
* 07/06/99 CS Added omSpecAttrForBase
19
* (and renumbered omSpecAttrStripped).
20
* 07/29/99 CS Added omOverlayKindBase for the entries in the base
21
* DBs 'ovly' resource (they had been set to
22
* omOverlayKindReplace before).
23
* 07/29/99 CS Bumped version to 3, since now we're supposed to
24
* support omOverlayKindAdd.
25
* 09/29/99 kwk Bumped version to 4, since we added the baseChecksum
26
* field to OmOverlaySpecType, as a way of speeding up
28
* 09/29/99 CS Actually bumped version to 4, which Ken forgot.
29
* 10/08/99 kwk Added OmGetRoutineAddress selector/declaration.
30
* Moved OmDispatch, OmInit, and OmOpenOverlayDatabase
32
* ===== Palm OS 3.5 Released =====
33
* 03/12/00 kwk Fixed comment for omOverlayKindHide.
34
* 05/18/00 kwk Added omFtrDefaultLocale feature selector.
35
* Added OmGetNextSystemLocale routine. Changed OmLocaleType
36
* to LmLocaleType. Deleted omOverlayDBType (use sysFileTOverlay).
37
* Moved more private stuff into OverlayPrv.h.
38
* 07/29/00 kwk Added note about using OmGetNextSystemLocale vs OmGetIndexedLocale.
39
* 09/14/00 kwk Added didNoOverlaySystem & foundSystem to OmSearchStateType,
40
* plus 6 more reserved bytes for future expansion.
41
* 09/18/00 kwk Added omErrNoNextSystemLocale.
43
*****************************************************************************)
49
uses palmos, coretraps, errorbase, datamgr, localemgr;
51
(***********************************************************************
52
* Overlay Manager constants
53
**********************************************************************)
56
omOverlayRscType_ = Rsc('ovly'); // Overlay desc resource type
57
omOverlayRscID = 1000; // Overlay desc resource ID
59
omFtrCreator = Rsc('ovly'); // For get/set of Overlay features.
60
omFtrShowErrorsFlag = 0; // Boolean - True => display overlay errors.
61
omFtrDefaultLocale = 1; // LmLocaleType record => default locale to
62
// try with stripped bases & no valid overlay.
64
// OmFindOverlayDatabase called with stripped base, and no appropriate overlay was found.
65
omErrBaseRequiresOverlay = omErrorClass or 1;
67
// OmOverlayDBNameToLocale or OmLocaleToOverlayDBName were passed an unknown locale.
68
mErrUnknownLocale = omErrorClass or 2;
70
// OmOverlayDBNameToLocale was passed a poorly formed string.
71
mErrBadOverlayDBName = omErrorClass or 3;
73
// OmGetIndexedLocale was passed an invalid index.
74
mErrInvalidLocaleIndex = omErrorClass or 4;
76
// OmSetSystemLocale was passed an invalid locale (doesn't correspond to available
79
mErrInvalidLocale = omErrorClass or 5;
81
// OmSetSystemLocale was passed a locale that referenced an invalid system overlay
82
// (missing one or more required resources)
84
mErrInvalidSystemOverlay = omErrorClass or 6;
86
// OmGetNextSystemLocale was called, but there were no more valid system
88
omErrNoNextSystemLocale = omErrorClass or 7;
90
(***********************************************************************
91
* Selectors & macros used for calling Overlay Manager routines
92
**********************************************************************)
94
// Selectors used for getting to the right Overlay Manager routine via
95
// the OmDispatch trap.
98
OmSelector = WordEnum;
102
omOpenOverlayDatabase = Succ(omInit);
103
omLocaleToOverlayDBName_ = Succ(omOpenOverlayDatabase);
104
omOverlayDBNameToLocale_ = Succ(omLocaleToOverlayDBName_);
105
omGetCurrentLocale_ = Succ(omOverlayDBNameToLocale_);
106
omGetIndexedLocale_ = Succ(omGetCurrentLocale_);
107
omGetSystemLocale_ = Succ(omGetIndexedLocale_);
108
omSetSystemLocale_ = Succ(omGetSystemLocale_);
109
omGetRoutineAddress_ = Succ(omSetSystemLocale_);
110
omGetNextSystemLocale_ = Succ(omGetRoutineAddress_);
112
omMaxSelector = omGetNextSystemLocale_;
114
(***********************************************************************
115
* Overlay Manager types
116
**********************************************************************)
118
// DOLATER kwk - decide how to deprecate this.
120
OmLocaleType = LmLocaleType;
122
// Structure passed to OmGetNextSystemLocale.
124
OmSearchStateType = record
125
searchState: DmSearchStateType;
126
systemDBRef: DmOpenRef;
127
systemDBCard: UInt16;
128
systemDBName: array [0..dmDBNameLength-1] of Char;
129
systemDBNameLen: Int16;
130
curLocale: LmLocaleType;
131
didNoOverlaySystem: Boolean;
132
foundSystem: Boolean;
133
reserved: array [0..5] of UInt8;
136
(***********************************************************************
137
* Overlay Manager routines
138
**********************************************************************)
140
// Return in <overlayDBName> an overlay database name that's appropriate
141
// for the base name <baseDBName> and the locale <targetLocale>. If the
142
// <targetLocale> param in NULL, use the current locale. The <overlayDBName>
143
// buffer must be at least dmDBNameLength bytes.
145
function OmLocaleToOverlayDBName(const baseDBName: PChar; {const} var targetLocale: LmLocaleType;
146
overlayDBName: PChar): Err;
148
// Given the name of an overlay database in <overlayDBName>, return back
149
// the overlay in overlayLocale. If the name isn't an overlay name,
150
// return omErrBadOverlayDBName.
152
function OmOverlayDBNameToLocale(const overlayDBName: PChar; var overlayLocale: LmLocaleType): Err;
154
// Return the current locale in <currentLocale>. This may not be the same as
155
// the system locale, which will take effect after the next reset.
157
procedure OmGetCurrentLocale(var currentLocale: LmLocaleType);
159
// Return the nth valid system locale in <theLocale>. Indexes are zero-based,
160
// and omErrInvalidLocaleIndex will be returned if <localeIndex> is out of
161
// bounds. Note that OmGetNextSystemLocale should be used on Palm OS 4.0 or
162
// later, since OmGetIndexedLocale can be slow on ROMs with more than few
163
// valid system locales.
165
function OmGetIndexedLocale(localeIndex: UInt16; var theLocale: LmLocaleType): Err;
167
// Return the system locale in <systemLocale>. This may not be the same as
168
// the current locale. WARNING!!! This routine should only be used in very
169
// special situations; typically OmGetCurrentLocale should be used to determine
170
// the "active" locale.
172
procedure OmGetSystemLocale(var systemLocale: LmLocaleType);
174
// Set the post-reset system locale to be <systemLocale>. Return omErrInvalidLocale if
175
// the passed locale doesnմ correspond to a valid System.prc overlay.
177
function OmSetSystemLocale({const} var systemLocale: LmLocaleType): Err;
179
// Return back the address of the routine indicated by <inSelector>. If
180
// <inSelector> isn't a valid routine selector, return back NULL.
182
function OmGetRoutineAddress(inSelector: OmSelector): Pointer;
184
// NEW in 4.0. Return back the next valid system locale in <oLocaleP>. The first
185
// time the routine is called, <iNewSearch> must be true. When there are no more
186
// valid system locales, omErrInvalidLocaleIndex will be returned. This routine
187
// should be used in place of OmGetIndexedLocale on Palm OS 4.0 or later, since
190
function OmGetNextSystemLocale(iNewSearch: Boolean; var ioStateInfoP: OmSearchStateType; var oLocaleP: LmLocaleType): Err;
194
function __OmLocaleToOverlayDBName(const baseDBName: PChar; {const} var targetLocale: LmLocaleType;
195
overlayDBName: PChar): Err; syscall sysTrapOmDispatch;
196
function __OmOverlayDBNameToLocale(const overlayDBName: PChar; var overlayLocale: LmLocaleType): Err; syscall sysTrapOmDispatch;
197
procedure __OmGetCurrentLocale(var currentLocale: LmLocaleType); syscall sysTrapOmDispatch;
198
function __OmGetIndexedLocale(localeIndex: UInt16; var theLocale: LmLocaleType): Err; syscall sysTrapOmDispatch;
199
procedure __OmGetSystemLocale(var systemLocale: LmLocaleType); syscall sysTrapOmDispatch;
200
function __OmSetSystemLocale({const} var systemLocale: LmLocaleType): Err; syscall sysTrapOmDispatch;
201
function __OmGetRoutineAddress(inSelector: OmSelector): Pointer; syscall sysTrapOmDispatch;
202
function __OmGetNextSystemLocale(iNewSearch: Boolean; var ioStateInfoP: OmSearchStateType; var oLocaleP: LmLocaleType): Err; syscall sysTrapOmDispatch;
204
function OmLocaleToOverlayDBName(const baseDBName: PChar; var targetLocale: LmLocaleType;
205
overlayDBName: PChar): Err;
208
move.l #$omLocaleToOverlayDBName_,D2;
210
OmLocaleToOverlayDBName := __OmLocaleToOverlayDBName(baseDBName, targetLocale, overlayDBName);
213
function OmOverlayDBNameToLocale(const overlayDBName: PChar; var overlayLocale: LmLocaleType): Err;
216
move.l #$omOverlayDBNameToLocale_,D2;
218
OmOverlayDBNameToLocale := __OmOverlayDBNameToLocale(overlayDBName, overlayLocale);
221
procedure OmGetCurrentLocale(var currentLocale: LmLocaleType);
224
move.l #$omGetCurrentLocale_,D2;
226
__OmGetCurrentLocale(currentLocale);
229
function OmGetIndexedLocale(localeIndex: UInt16; var theLocale: LmLocaleType): Err;
232
move.l #$omGetIndexedLocale_,D2;
234
OmGetIndexedLocale := __OmGetIndexedLocale(localeIndex, theLocale);
237
procedure OmGetSystemLocale(var systemLocale: LmLocaleType);
240
move.l #$omGetSystemLocale_,D2;
242
__OmGetSystemLocale(systemLocale);
245
function OmSetSystemLocale(var systemLocale: LmLocaleType): Err;
248
move.l #$omSetSystemLocale_,D2;
250
OmSetSystemLocale := __OmSetSystemLocale(systemLocale);
253
function OmGetRoutineAddress(inSelector: OmSelector): Pointer;
256
move.l #$omGetRoutineAddress_,D2;
258
OmGetRoutineAddress := __OmGetRoutineAddress(inSelector);
261
function OmGetNextSystemLocale(iNewSearch: Boolean; var ioStateInfoP: OmSearchStateType; var oLocaleP: LmLocaleType): Err;
264
move.l #$omGetNextSystemLocale_,D2;
266
OmGetNextSystemLocale := __OmGetNextSystemLocale(iNewSearch, ioStateInfoP, oLocaleP);
b'\\ No newline at end of file'