overlaymgr.pp 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. {$MACRO ON}
  2. {$define Rsc := }
  3. (******************************************************************************
  4. *
  5. * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
  6. * All rights reserved.
  7. *
  8. * File: OverlayMgr.h
  9. *
  10. * Release: Palm OS SDK 4.0 (63220)
  11. *
  12. * Description:
  13. * Public header for routines that support overlays.
  14. *
  15. * History:
  16. * 06/24/99 kwk Created by Ken Krugler.
  17. * 07/06/99 CS Added omSpecAttrForBase
  18. * (and renumbered omSpecAttrStripped).
  19. * 07/29/99 CS Added omOverlayKindBase for the entries in the base
  20. * DBs 'ovly' resource (they had been set to
  21. * omOverlayKindReplace before).
  22. * 07/29/99 CS Bumped version to 3, since now we're supposed to
  23. * support omOverlayKindAdd.
  24. * 09/29/99 kwk Bumped version to 4, since we added the baseChecksum
  25. * field to OmOverlaySpecType, as a way of speeding up
  26. * overlay validation.
  27. * 09/29/99 CS Actually bumped version to 4, which Ken forgot.
  28. * 10/08/99 kwk Added OmGetRoutineAddress selector/declaration.
  29. * Moved OmDispatch, OmInit, and OmOpenOverlayDatabase
  30. * into OverlayPrv.h
  31. * ===== Palm OS 3.5 Released =====
  32. * 03/12/00 kwk Fixed comment for omOverlayKindHide.
  33. * 05/18/00 kwk Added omFtrDefaultLocale feature selector.
  34. * Added OmGetNextSystemLocale routine. Changed OmLocaleType
  35. * to LmLocaleType. Deleted omOverlayDBType (use sysFileTOverlay).
  36. * Moved more private stuff into OverlayPrv.h.
  37. * 07/29/00 kwk Added note about using OmGetNextSystemLocale vs OmGetIndexedLocale.
  38. * 09/14/00 kwk Added didNoOverlaySystem & foundSystem to OmSearchStateType,
  39. * plus 6 more reserved bytes for future expansion.
  40. * 09/18/00 kwk Added omErrNoNextSystemLocale.
  41. *
  42. *****************************************************************************)
  43. {$IFNDEF FPC_DOTTEDUNITS}
  44. unit overlaymgr;
  45. {$ENDIF FPC_DOTTEDUNITS}
  46. interface
  47. {$IFDEF FPC_DOTTEDUNITS}
  48. uses PalmApi.Palmos, PalmApi.Coretraps, PalmApi.Errorbase, PalmApi.Datamgr, PalmApi.Localemgr;
  49. {$ELSE FPC_DOTTEDUNITS}
  50. uses palmos, coretraps, errorbase, datamgr, localemgr;
  51. {$ENDIF FPC_DOTTEDUNITS}
  52. (***********************************************************************
  53. * Overlay Manager constants
  54. **********************************************************************)
  55. const
  56. omOverlayRscType_ = Rsc('ovly'); // Overlay desc resource type
  57. omOverlayRscID = 1000; // Overlay desc resource ID
  58. omFtrCreator = Rsc('ovly'); // For get/set of Overlay features.
  59. omFtrShowErrorsFlag = 0; // Boolean - True => display overlay errors.
  60. omFtrDefaultLocale = 1; // LmLocaleType record => default locale to
  61. // try with stripped bases & no valid overlay.
  62. // OmFindOverlayDatabase called with stripped base, and no appropriate overlay was found.
  63. omErrBaseRequiresOverlay = omErrorClass or 1;
  64. // OmOverlayDBNameToLocale or OmLocaleToOverlayDBName were passed an unknown locale.
  65. mErrUnknownLocale = omErrorClass or 2;
  66. // OmOverlayDBNameToLocale was passed a poorly formed string.
  67. mErrBadOverlayDBName = omErrorClass or 3;
  68. // OmGetIndexedLocale was passed an invalid index.
  69. mErrInvalidLocaleIndex = omErrorClass or 4;
  70. // OmSetSystemLocale was passed an invalid locale (doesn't correspond to available
  71. // system overlay).
  72. mErrInvalidLocale = omErrorClass or 5;
  73. // OmSetSystemLocale was passed a locale that referenced an invalid system overlay
  74. // (missing one or more required resources)
  75. mErrInvalidSystemOverlay = omErrorClass or 6;
  76. // OmGetNextSystemLocale was called, but there were no more valid system
  77. // locales to return.
  78. omErrNoNextSystemLocale = omErrorClass or 7;
  79. (***********************************************************************
  80. * Selectors & macros used for calling Overlay Manager routines
  81. **********************************************************************)
  82. // Selectors used for getting to the right Overlay Manager routine via
  83. // the OmDispatch trap.
  84. type
  85. OmSelector = WordEnum;
  86. const
  87. omInit = 0;
  88. omOpenOverlayDatabase = Succ(omInit);
  89. omLocaleToOverlayDBName_ = Succ(omOpenOverlayDatabase);
  90. omOverlayDBNameToLocale_ = Succ(omLocaleToOverlayDBName_);
  91. omGetCurrentLocale_ = Succ(omOverlayDBNameToLocale_);
  92. omGetIndexedLocale_ = Succ(omGetCurrentLocale_);
  93. omGetSystemLocale_ = Succ(omGetIndexedLocale_);
  94. omSetSystemLocale_ = Succ(omGetSystemLocale_);
  95. omGetRoutineAddress_ = Succ(omSetSystemLocale_);
  96. omGetNextSystemLocale_ = Succ(omGetRoutineAddress_);
  97. omMaxSelector = omGetNextSystemLocale_;
  98. (***********************************************************************
  99. * Overlay Manager types
  100. **********************************************************************)
  101. // DOLATER kwk - decide how to deprecate this.
  102. type
  103. OmLocaleType = LmLocaleType;
  104. // Structure passed to OmGetNextSystemLocale.
  105. type
  106. OmSearchStateType = record
  107. searchState: DmSearchStateType;
  108. systemDBRef: DmOpenRef;
  109. systemDBCard: UInt16;
  110. systemDBName: array [0..dmDBNameLength-1] of AnsiChar;
  111. systemDBNameLen: Int16;
  112. curLocale: LmLocaleType;
  113. didNoOverlaySystem: Boolean;
  114. foundSystem: Boolean;
  115. reserved: array [0..5] of UInt8;
  116. end;
  117. (***********************************************************************
  118. * Overlay Manager routines
  119. **********************************************************************)
  120. // Return in <overlayDBName> an overlay database name that's appropriate
  121. // for the base name <baseDBName> and the locale <targetLocale>. If the
  122. // <targetLocale> param in NULL, use the current locale. The <overlayDBName>
  123. // buffer must be at least dmDBNameLength bytes.
  124. function OmLocaleToOverlayDBName(const baseDBName: PAnsiChar; {const} var targetLocale: LmLocaleType;
  125. overlayDBName: PAnsiChar): Err; syscall sysTrapOmDispatch, omLocaleToOverlayDBName_;
  126. // Given the name of an overlay database in <overlayDBName>, return back
  127. // the overlay in overlayLocale. If the name isn't an overlay name,
  128. // return omErrBadOverlayDBName.
  129. function OmOverlayDBNameToLocale(const overlayDBName: PAnsiChar; var overlayLocale: LmLocaleType): Err; syscall sysTrapOmDispatch, omOverlayDBNameToLocale_;
  130. // Return the current locale in <currentLocale>. This may not be the same as
  131. // the system locale, which will take effect after the next reset.
  132. procedure OmGetCurrentLocale(var currentLocale: LmLocaleType); syscall sysTrapOmDispatch, omGetCurrentLocale_;
  133. // Return the nth valid system locale in <theLocale>. Indexes are zero-based,
  134. // and omErrInvalidLocaleIndex will be returned if <localeIndex> is out of
  135. // bounds. Note that OmGetNextSystemLocale should be used on Palm OS 4.0 or
  136. // later, since OmGetIndexedLocale can be slow on ROMs with more than few
  137. // valid system locales.
  138. function OmGetIndexedLocale(localeIndex: UInt16; var theLocale: LmLocaleType): Err; syscall sysTrapOmDispatch, omGetIndexedLocale_;
  139. // Return the system locale in <systemLocale>. This may not be the same as
  140. // the current locale. WARNING!!! This routine should only be used in very
  141. // special situations; typically OmGetCurrentLocale should be used to determine
  142. // the "active" locale.
  143. procedure OmGetSystemLocale(var systemLocale: LmLocaleType); syscall sysTrapOmDispatch, omGetSystemLocale_;
  144. // Set the post-reset system locale to be <systemLocale>. Return omErrInvalidLocale if
  145. // the passed locale doesnմ correspond to a valid System.prc overlay.
  146. function OmSetSystemLocale({const} var systemLocale: LmLocaleType): Err; syscall sysTrapOmDispatch, omSetSystemLocale_;
  147. // Return back the address of the routine indicated by <inSelector>. If
  148. // <inSelector> isn't a valid routine selector, return back NULL.
  149. function OmGetRoutineAddress(inSelector: OmSelector): Pointer; syscall sysTrapOmDispatch, omGetRoutineAddress_;
  150. // NEW in 4.0. Return back the next valid system locale in <oLocaleP>. The first
  151. // time the routine is called, <iNewSearch> must be true. When there are no more
  152. // valid system locales, omErrInvalidLocaleIndex will be returned. This routine
  153. // should be used in place of OmGetIndexedLocale on Palm OS 4.0 or later, since
  154. // it's much faster.
  155. function OmGetNextSystemLocale(iNewSearch: Boolean; var ioStateInfoP: OmSearchStateType; var oLocaleP: LmLocaleType): Err; syscall sysTrapOmDispatch, omGetNextSystemLocale_;
  156. implementation
  157. end.