~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to packages/extra/palmunits/overlaymgr.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{$MACRO ON}
2
 
 
3
 
{$define Rsc := }
4
 
(******************************************************************************
5
 
 *
6
 
 * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
7
 
 * All rights reserved.
8
 
 *
9
 
 * File: OverlayMgr.h
10
 
 *
11
 
 * Release: Palm OS SDK 4.0 (63220)
12
 
 *
13
 
 * Description:
14
 
 *    Public header for routines that support overlays.
15
 
 *
16
 
 * History:
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
27
 
 *                   overlay validation.
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
31
 
 *                   into OverlayPrv.h
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.
42
 
 *
43
 
 *****************************************************************************)
44
 
 
45
 
unit overlaymgr;
46
 
 
47
 
interface
48
 
 
49
 
uses palmos, coretraps, errorbase, datamgr, localemgr;
50
 
 
51
 
(***********************************************************************
52
 
 * Overlay Manager constants
53
 
 **********************************************************************)
54
 
 
55
 
const
56
 
  omOverlayRscType_        = Rsc('ovly'); // Overlay desc resource type
57
 
  omOverlayRscID           = 1000;  // Overlay desc resource ID
58
 
 
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.
63
 
 
64
 
// OmFindOverlayDatabase called with stripped base, and no appropriate overlay was found.
65
 
  omErrBaseRequiresOverlay = omErrorClass or 1;
66
 
 
67
 
// OmOverlayDBNameToLocale or OmLocaleToOverlayDBName were passed an unknown locale.
68
 
  mErrUnknownLocale        = omErrorClass or 2;
69
 
 
70
 
// OmOverlayDBNameToLocale was passed a poorly formed string.
71
 
  mErrBadOverlayDBName     = omErrorClass or 3;
72
 
 
73
 
// OmGetIndexedLocale was passed an invalid index.
74
 
  mErrInvalidLocaleIndex   = omErrorClass or 4;
75
 
 
76
 
// OmSetSystemLocale was passed an invalid locale (doesn't correspond to available
77
 
// system overlay).
78
 
 
79
 
  mErrInvalidLocale        = omErrorClass or 5;
80
 
 
81
 
// OmSetSystemLocale was passed a locale that referenced an invalid system overlay
82
 
// (missing one or more required resources)
83
 
 
84
 
  mErrInvalidSystemOverlay = omErrorClass or 6;
85
 
 
86
 
// OmGetNextSystemLocale was called, but there were no more valid system
87
 
// locales to return.
88
 
  omErrNoNextSystemLocale  = omErrorClass or 7;
89
 
 
90
 
(***********************************************************************
91
 
 * Selectors & macros used for calling Overlay Manager routines
92
 
 **********************************************************************)
93
 
 
94
 
// Selectors used for getting to the right Overlay Manager routine via
95
 
// the OmDispatch trap.
96
 
 
97
 
type
98
 
  OmSelector = WordEnum;
99
 
 
100
 
const
101
 
  omInit = 0;
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_);
111
 
 
112
 
  omMaxSelector = omGetNextSystemLocale_;
113
 
 
114
 
(***********************************************************************
115
 
 * Overlay Manager types
116
 
 **********************************************************************)
117
 
 
118
 
// DOLATER kwk - decide how to deprecate this.
119
 
type
120
 
  OmLocaleType = LmLocaleType;
121
 
 
122
 
// Structure passed to OmGetNextSystemLocale.
123
 
type
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;
134
 
  end;
135
 
 
136
 
(***********************************************************************
137
 
 * Overlay Manager routines
138
 
 **********************************************************************)
139
 
 
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.
144
 
 
145
 
function OmLocaleToOverlayDBName(const baseDBName: PChar; {const} var targetLocale: LmLocaleType;
146
 
                                 overlayDBName: PChar): Err;
147
 
 
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.
151
 
 
152
 
function OmOverlayDBNameToLocale(const overlayDBName: PChar; var overlayLocale: LmLocaleType): Err;
153
 
 
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.
156
 
 
157
 
procedure OmGetCurrentLocale(var currentLocale: LmLocaleType);
158
 
 
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.
164
 
 
165
 
function OmGetIndexedLocale(localeIndex: UInt16; var theLocale: LmLocaleType): Err;
166
 
 
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.
171
 
 
172
 
procedure OmGetSystemLocale(var systemLocale: LmLocaleType);
173
 
 
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.
176
 
 
177
 
function OmSetSystemLocale({const} var systemLocale: LmLocaleType): Err;
178
 
 
179
 
// Return back the address of the routine indicated by <inSelector>. If
180
 
// <inSelector> isn't a valid routine selector, return back NULL.
181
 
 
182
 
function OmGetRoutineAddress(inSelector: OmSelector): Pointer;
183
 
 
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
188
 
// it's much faster.
189
 
 
190
 
function OmGetNextSystemLocale(iNewSearch: Boolean; var ioStateInfoP: OmSearchStateType; var oLocaleP: LmLocaleType): Err;
191
 
 
192
 
implementation
193
 
 
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;
203
 
 
204
 
function OmLocaleToOverlayDBName(const baseDBName: PChar; var targetLocale: LmLocaleType;
205
 
                                 overlayDBName: PChar): Err;
206
 
begin
207
 
 asm
208
 
  move.l #$omLocaleToOverlayDBName_,D2;
209
 
 end;
210
 
 OmLocaleToOverlayDBName := __OmLocaleToOverlayDBName(baseDBName, targetLocale, overlayDBName);
211
 
end;
212
 
 
213
 
function OmOverlayDBNameToLocale(const overlayDBName: PChar; var overlayLocale: LmLocaleType): Err;
214
 
begin
215
 
 asm
216
 
  move.l #$omOverlayDBNameToLocale_,D2;
217
 
 end;
218
 
 OmOverlayDBNameToLocale := __OmOverlayDBNameToLocale(overlayDBName, overlayLocale);
219
 
end;
220
 
 
221
 
procedure OmGetCurrentLocale(var currentLocale: LmLocaleType);
222
 
begin
223
 
 asm
224
 
  move.l #$omGetCurrentLocale_,D2;
225
 
 end;
226
 
 __OmGetCurrentLocale(currentLocale);
227
 
end;
228
 
 
229
 
function OmGetIndexedLocale(localeIndex: UInt16; var theLocale: LmLocaleType): Err;
230
 
begin
231
 
 asm
232
 
  move.l #$omGetIndexedLocale_,D2;
233
 
 end;
234
 
 OmGetIndexedLocale := __OmGetIndexedLocale(localeIndex, theLocale);
235
 
end;
236
 
 
237
 
procedure OmGetSystemLocale(var systemLocale: LmLocaleType);
238
 
begin
239
 
 asm
240
 
  move.l #$omGetSystemLocale_,D2;
241
 
 end;
242
 
 __OmGetSystemLocale(systemLocale);
243
 
end;
244
 
 
245
 
function OmSetSystemLocale(var systemLocale: LmLocaleType): Err;
246
 
begin
247
 
 asm
248
 
  move.l #$omSetSystemLocale_,D2;
249
 
 end;
250
 
 OmSetSystemLocale := __OmSetSystemLocale(systemLocale);
251
 
end;
252
 
 
253
 
function OmGetRoutineAddress(inSelector: OmSelector): Pointer;
254
 
begin
255
 
 asm
256
 
  move.l #$omGetRoutineAddress_,D2;
257
 
 end;
258
 
 OmGetRoutineAddress := __OmGetRoutineAddress(inSelector);
259
 
end;
260
 
 
261
 
function OmGetNextSystemLocale(iNewSearch: Boolean; var ioStateInfoP: OmSearchStateType; var oLocaleP: LmLocaleType): Err;
262
 
begin
263
 
 asm
264
 
  move.l #$omGetNextSystemLocale_,D2;
265
 
 end;
266
 
 OmGetNextSystemLocale := __OmGetNextSystemLocale(iNewSearch, ioStateInfoP, oLocaleP);
267
 
end;
268
 
 
269
 
 
270
 
end.
 
 
b'\\ No newline at end of file'