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