palmos.inc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2017 by Free Pascal development team
  4. PalmOS specific structures and definitions to be used by the RTL
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$PACKRECORDS 2}
  12. type
  13. MemPtr = Pointer;
  14. MemHandle = Pointer;
  15. Err = Word;
  16. DmOpenRef = Pointer;
  17. type
  18. DmResType = UInt32;
  19. DmResID = UInt16;
  20. type
  21. SysAppInfoTag = record
  22. cmd: Int16; // command code for app
  23. cmdPBP: MemPtr; // cmd ParamBlock
  24. launchFlags: UInt16; // launch flags
  25. taskID: UInt32; // AMX task ID of task that app runs in
  26. codeH: MemHandle; // code MemHandle of the main code segment
  27. dbP: DmOpenRef; // Application database access MemPtr of App
  28. stackP: ^UInt8; // stack chunk for the App
  29. globalsChunkP: ^UInt8; // globals chunk for the App
  30. memOwnerID: UInt16; // owner ID for Memory Manager chunks
  31. dmAccessP: MemPtr; // pointer to linked list of opened DB's
  32. dmLastErr: Err; // Last error from Data Manager
  33. errExceptionP: MemPtr; // ErrTry,Catch exception list
  34. // PalmOS v3.0 fields begin here
  35. a5Ptr: ^UInt8; // A5 MemPtr for this app
  36. stackEndP: ^UInt8; // stack chunk end for the App (last byte)
  37. globalEndP: ^UInt8; // global chunk end for the App (last byte)
  38. rootP: ^SysAppInfoType;// Points to the SysAppInfoType first
  39. // allocated for this thread.
  40. extraP: MemPtr; // unused MemPtr for the App.
  41. end;
  42. SysAppInfoType = SysAppInfoTag;
  43. SysAppInfoPtr = ^SysAppInfoType;
  44. const
  45. sysAppLaunchCmdNormalLaunch = 0;
  46. const
  47. sysAppLaunchFlagNewThread = $01; // create a new thread for application
  48. // - implies sysAppLaunchFlagNewStack
  49. sysAppLaunchFlagNewStack = $02; // create separate stack for application
  50. sysAppLaunchFlagNewGlobals = $04; // create new globals world for application
  51. // - implies new owner ID for Memory chunks
  52. sysAppLaunchFlagUIApp = $08; // notifies launch routine that this is a UI app being
  53. // launched.
  54. const
  55. sysTrapSysAppStartup = $A08F;
  56. sysTrapSysAppExit = $A090;
  57. function SysAppStartup(var appInfoPP: SysAppInfoPtr; var prevGlobalsP, globalsPtrP: MemPtr): UInt16; syscall sysTrapSysAppStartup;
  58. function SysAppExit(appInfoP: SysAppInfoPtr; prevGlobalsP, globalsP: MemPtr): UInt16; syscall sysTrapSysAppExit;
  59. const
  60. sysTrapSndPlaySystemSound = $A234;
  61. sndError = 3;
  62. procedure SndPlaySystemSound(beepID: Word); syscall sysTrapSndPlaySystemSound;
  63. const
  64. sysTrapMemChunkFree = $A012;
  65. sysTrapMemPtrNew = $A013;
  66. sysTrapMemHandleLock = $A021;
  67. sysTrapMemHandleUnlock = $A022;
  68. function MemPtrNew(size: UInt32): MemPtr; syscall sysTrapMemPtrNew;
  69. function MemPtrFree(chunkDataP: MemPtr): Err; syscall sysTrapMemChunkFree;
  70. function MemHandleLock(h: MemHandle): MemPtr; syscall sysTrapMemHandleLock;
  71. function MemHandleUnlock(h: MemHandle): Err; syscall sysTrapMemHandleUnlock;
  72. const
  73. sysTrapDmGet1Resource = $A060;
  74. sysTrapDmReleaseResource = $A061;
  75. function DmGet1Resource(type_: DmResType; resID: DmResID): MemHandle; syscall sysTrapDmGet1Resource;
  76. function DmReleaseResource(resourceH: MemHandle): Err; syscall sysTrapDmReleaseResource;
  77. const
  78. sysTrapWinDrawChars = $A220;
  79. procedure WinDrawChars(const chars: PChar; len: SmallInt; x, y: SmallInt); syscall sysTrapWinDrawChars;
  80. {$PACKRECORDS DEFAULT}