graffiti.pp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. {$MACRO ON}
  2. (******************************************************************************
  3. *
  4. * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
  5. * All rights reserved.
  6. *
  7. * File: Graffiti.h
  8. *
  9. * Release: Palm OS SDK 4.0 (63220)
  10. *
  11. * Description:
  12. * Header for the Graffiti interface
  13. *
  14. * History:
  15. * 6/30 RM - Created by Ron Marianetti
  16. *
  17. *****************************************************************************)
  18. {$IFNDEF FPC_DOTTEDUNITS}
  19. unit graffiti;
  20. {$ENDIF FPC_DOTTEDUNITS}
  21. interface
  22. {$IFDEF FPC_DOTTEDUNITS}
  23. uses PalmApi.Palmos, PalmApi.Coretraps, PalmApi.Rect, PalmApi.Errorbase;
  24. {$ELSE FPC_DOTTEDUNITS}
  25. uses palmos, coretraps, rect, errorbase;
  26. {$ENDIF FPC_DOTTEDUNITS}
  27. (*------------------------------------------------------------------------------
  28. * Match info structure. Returned by GrfMatch and GrfMatchGlyph
  29. *-----------------------------------------------------------------------------*)
  30. type
  31. GrfMatchType = record
  32. glyphID: UInt8; // glyph ID of this match
  33. unCertainty: UInt8; // unCertainty of this match (0 most certain)
  34. end;
  35. const
  36. grfMaxMatches = 4;
  37. type
  38. GrfMatchInfoType = record
  39. numMatches: UInt16; // number of matches returned in this structure
  40. match: array [0..grfMaxMatches-1] of GrfMatchType;
  41. end;
  42. GrfMatchInfoPtr = ^GrfMatchInfoType;
  43. //----------------------------------------------------------------------------
  44. // Escape codes preceding special sequences in the dictionary or macros
  45. //----------------------------------------------------------------------------
  46. // In dictionary or macros preceding virtual key event sequences. These are always
  47. // 13 byte sequences that have ASCII encoded values for the ascii code, keyCode,
  48. // and modifiers:
  49. // grfVirtualSequence, ascii, keyCode, modifiers.
  50. // 1 byte 4 bytes 4 bytes 4 bytes
  51. const
  52. grfVirtualSequence = $01;
  53. // In dictionary to tell us about temp shift state changes.
  54. grfShiftSequence = $02;
  55. // In dictionary/macros to hide special features
  56. grfSpecialSequence = $03;
  57. // Determine if a string has a sequence
  58. {
  59. HasVirtualSequence(s) (s[0] == grfVirtualSequence)
  60. HasSpecialSequence(s) (s[0] == grfSpecialSequence)
  61. }
  62. (*------------------------------------------------------------------------------
  63. * Temp shift states, returned by GrfGetState
  64. *-----------------------------------------------------------------------------*)
  65. grfTempShiftPunctuation = 1;
  66. grfTempShiftExtended = 2;
  67. grfTempShiftUpper = 3;
  68. grfTempShiftLower = 4;
  69. (*------------------------------------------------------------------------------
  70. * Macro (aka Shortcut) related constants/macros
  71. * Use the definitions in ShortcutLib.h instead!
  72. *-----------------------------------------------------------------------------*)
  73. // AnsiChar indicating a seqeunce of characters to expand.
  74. grfExpansionSequence = '@';
  75. // Chars indicating what to expand into
  76. expandDateChar = 'D';
  77. expandTimeChar = 'T';
  78. expandStampChar = 'S'; // This follows 'D' or 'T' for the sake
  79. // of the mnemonic name.
  80. // max shortcut name length
  81. grfNameLength = 8; // eight letters possible (don't forget CR)
  82. // index which is not a shortcut
  83. grfNoShortCut = $ffff;
  84. (************************************************************
  85. * Graffiti result codes
  86. *************************************************************)
  87. grfErrBadParam = grfErrorClass or 1;
  88. grfErrPointBufferFull = grfErrorClass or 2;
  89. grfErrNoGlyphTable = grfErrorClass or 3;
  90. grfErrNoDictionary = grfErrorClass or 4;
  91. grfErrNoMapping = grfErrorClass or 5;
  92. grfErrMacroNotFound = grfErrorClass or 6;
  93. grfErrDepthTooDeep = grfErrorClass or 7;
  94. grfErrMacroPtrTooSmall = grfErrorClass or 8;
  95. grfErrNoMacros = grfErrorClass or 9;
  96. grfErrMacroIncomplete = grfErrorClass or 129; // (grfWarningOffset+1)
  97. grfErrBranchNotFound = grfErrorClass or 130; // (grfWarningOffset+2)
  98. grfErrGenericHWRErrBase = grfErrorClass or 16;
  99. grfErrNoHWRInstalled = grfErrGenericHWRErrBase;
  100. (************************************************************
  101. * Graffiti interface procedures
  102. *************************************************************)
  103. //-----------------------------------------------------------------
  104. // High Level Calls
  105. //------------------------------------------------------------------
  106. function GrfInit: Err; syscall sysTrapGrfInit;
  107. function GrfFree: Err; syscall sysTrapGrfFree;
  108. function GrfProcessStroke(var startPtP, endPtP: PointType; upShift: Boolean): Err; syscall sysTrapGrfProcessStroke;
  109. function GrfFieldChange(resetState: Boolean; var characterToDelete: UInt16): Err; syscall sysTrapGrfFieldChange;
  110. function GrfGetState(var capsLockP, numLockP: Boolean; var tempShiftP: UInt16; var autoShiftedP: Boolean): Err; syscall sysTrapGrfGetState;
  111. function GrfSetState(capsLock, numLock, upperShift: Boolean): Err; syscall sysTrapGrfSetState;
  112. //-----------------------------------------------------------------
  113. // Mid Level Calls
  114. //------------------------------------------------------------------
  115. function GrfFlushPoints: Err; syscall sysTrapGrfFlushPoints;
  116. function GrfAddPoint(var pt: PointType): Err; syscall sysTrapGrfAddPoint;
  117. function GrfInitState: Err; syscall sysTrapGrfInitState;
  118. function GrfCleanState: Err; syscall sysTrapGrfCleanState;
  119. function GrfMatch(var flagsP: UInt16; dataPtrP: Pointer; var dataLenP, uncertainLenP: UInt16;
  120. matchInfoP: GrfMatchInfoPtr): Err; syscall sysTrapGrfMatch;
  121. function GrfGetMacro(nameP: PAnsiChar; var macroDataP: UInt8; var dataLenP: UInt16): Err; syscall sysTrapGrfGetMacro;
  122. function GrfGetAndExpandMacro(nameP: PAnsiChar; var macroDataP: UInt8; var dataLenP: UInt16): Err; syscall sysTrapGrfGetAndExpandMacro;
  123. //-----------------------------------------------------------------
  124. // Low Level Calls
  125. //------------------------------------------------------------------
  126. function GrfFilterPoints: Err; syscall sysTrapGrfFilterPoints;
  127. function GrfGetNumPoints(var numPtsP: UInt16): Err; syscall sysTrapGrfGetNumPoints;
  128. function GrfGetPoint(index: UInt16; var pointP: PointType): Err; syscall sysTrapGrfGetPoint;
  129. function GrfFindBranch(flags: UInt16): Err; syscall sysTrapGrfFindBranch;
  130. function GrfMatchGlyph(matchInfoP: GrfMatchInfoPtr; maxUnCertainty: Int16; maxMatches: UInt16): Err; syscall sysTrapGrfMatchGlyph;
  131. function GrfGetGlyphMapping(glyphID: UInt16; var flagsP: UInt16; dataPtrP: Pointer;
  132. var dataLenP, uncertainLenP: UInt16): Err; syscall sysTrapGrfGetGlyphMapping;
  133. function GrfGetMacroName(index: UInt16; nameP: PAnsiChar): Err; syscall sysTrapGrfGetMacroName;
  134. function GrfDeleteMacro(index: UInt16): Err; syscall sysTrapGrfDeleteMacro;
  135. function GrfAddMacro(const nameP: PAnsiChar; var macroDataP: UInt8; dataLen: UInt16): Err; syscall sysTrapGrfAddMacro;
  136. implementation
  137. end.