graffiti.pp 6.6 KB

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