OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [MW_0_8_9PRE7/] [mw/] [src/] [demos/] [nxscribble/] [hre_internal.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 673 markom
/*
2
 *  hre_internal.h:   Internal Interface for Recognizer.
3
 *  Author:           James Kempf
4
 *  Created On:       Thu Nov  5 10:54:18 1992
5
 *  Last Modified By: James Kempf
6
 *  Last Modified On: Fri Sep 23 13:51:15 1994
7
 *  Update Count:     99
8
 *  Copyright (c) 1994 by Sun Microsystems Computer Company
9
 *  All rights reserved.
10
 *
11
 *  Use and copying of this software and preparation of
12
 *  derivative works based upon this software are permitted.
13
 *  Any distribution of this software or derivative works
14
 *  must comply with all applicable United States export control
15
 *  laws.
16
 *
17
 *  This software is made available as is, and Sun Microsystems
18
 *  Computer Company makes no warranty about the software, its
19
 *  performance, or its conformity to any specification
20
 */
21
 
22
#ifndef _HRE_INTERNAL_H_
23
 
24
#define _HRE_INTERNAL_H_
25
 
26
/*Avoids forward reference problem.*/
27
 
28
#define wordset void*
29
 
30
#include <hre.h>
31
 
32
#undef wordset
33
 
34
#define recognizer void*
35
 
36
/*
37
 * Internal view of wordset. The recognition engine uses this view to
38
 * maintain information about which recognizer object this wordset
39
 * belongs to, which file (in case it needs to be saved), and internal
40
 * data structures.
41
*/
42
 
43
typedef struct _wordset {
44
        char* ws_pathname;              /*Path name to word set file.*/
45
        recognizer ws_recognizer;       /*To whom it belongs.*/
46
        void* ws_internal;              /*Internal data structures.*/
47
} *wordset;
48
 
49
#undef recognizer
50
 
51
/*
52
 * Internal view of the recognizer struct. This view is only available
53
 * to OEM clients who implement a recognizer shared library. Clients
54
 * of the recognizer itself see it as an opaque data type. The struct
55
 * contains a function pointer for each function in the client API.
56
*/
57
 
58
struct _Recognizer {
59
        u_int recognizer_magic;
60
/* ari */
61
/*      const char* recognizer_version;  */
62
        char* recognizer_version;
63
 
64
        rec_info* recognizer_info;
65
        void* recognizer_specific;
66
        int
67
                (*recognizer_load_state)(
68
                        struct _Recognizer*,
69
                        char*, char*);
70
/*                      char* dir,
71
                        char* name);
72
*/
73
        int
74
                (*recognizer_save_state)(
75
                        struct _Recognizer*,
76
                        char*, char*);
77
/*                      char* dir,
78
                        char* name);
79
*/
80
        char*
81
                (*recognizer_error)(
82
                        struct _Recognizer*);
83
        wordset
84
                (*recognizer_load_dictionary)(
85
/*                      struct _Recognizer* rec,
86
                        char* directory,
87
                        char* name);
88
*/
89
                        struct _Recognizer*,
90
                        char*, char*);
91
        int
92
                (*recognizer_save_dictionary)(
93
/*                      struct _Recognizer* rec,
94
                        char* directory,
95
                        char* name,
96
                        wordset dict);
97
*/
98
                        struct _Recognizer*,
99
                        char*, char*, wordset);
100
 
101
        int
102
                (*recognizer_free_dictionary)(
103
/*                      struct _Recognizer* rec,
104
                        wordset dict);
105
*/
106
                        struct _Recognizer*,
107
                        wordset);
108
        int
109
                (*recognizer_add_to_dictionary)(
110
/*                      struct _Recognizer* rec,
111
                        letterset* word,
112
                        wordset dict);
113
*/
114
                        struct _Recognizer*,
115
                        letterset*, wordset);
116
        int
117
                (*recognizer_delete_from_dictionary)(
118
/*                      struct _Recognizer* rec,
119
                        letterset* word,
120
                        wordset dict);
121
*/
122
                        struct _Recognizer*,
123
                        letterset*, wordset);
124
        int
125
         (*recognizer_set_context)(
126
/*              struct _Recognizer* rec,
127
                rc* rec_xt);
128
*/
129
                        struct _Recognizer*,rc*);
130
        rc*
131
         (*recognizer_get_context)(
132
/*              struct _Recognizer* rec);
133
*/
134
                        struct _Recognizer*);
135
 
136
        int
137
         (*recognizer_clear)(
138
/*              struct _Recognizer* rec,
139
                bool delete_ponts_p);
140
*/
141
                        struct _Recognizer*, bool);
142
        int
143
         (*recognizer_get_buffer)(
144
/*              struct _Recognizer* rec,
145
                u_int* nstrokes,
146
                pen_stroke** strokes);
147
*/
148
                        struct _Recognizer*, u_int*, pen_stroke**);
149
 
150
        int
151
         (*recognizer_set_buffer)(
152
/*              struct _Recognizer* rec,
153
                u_int nstrokes,
154
                pen_stroke* strokes);
155
*/
156
                        struct _Recognizer*, u_int, pen_stroke*);
157
        int
158
         (*recognizer_translate)(
159
/*              struct _Recognizer* rec,
160
                u_int nstrokes,
161
                pen_stroke* strokes,
162
                bool correlate_p,
163
                int* nret,
164
                rec_alternative** ret);
165
*/
166
                        struct _Recognizer*, u_int, pen_stroke*,
167
                        bool, int*, rec_alternative**);
168
        rec_fn*
169
         (*recognizer_get_extension_functions)(
170
                struct _Recognizer*);
171
        char**
172
                (*recognizer_get_gesture_names)(
173
                        struct _Recognizer*);
174
        xgesture
175
                (*recognizer_set_gesture_action)(
176
                        struct _Recognizer*,
177
/*                      char* name,
178
                        xgesture fn,
179
                        void* wsinfo);
180
*/
181
                        char*, xgesture, void*);
182
        u_int recognizer_end_magic;
183
};
184
 
185
typedef struct _Recognizer* recognizer;
186
 
187
/*
188
 * recognizer_internal_initialize - Allocate and initialize the recognizer
189
 * object. The recognition shared library has the responsibility for filling
190
 * in all the function pointers for the recognition functions. This
191
 * function must be defined as a global function within the shared
192
 * library, so it can be accessed using dlsym() when the recognizer
193
 * shared library is loaded. It returns NULL if an error occured and
194
 * sets errno to indicate what.
195
*/
196
 
197
typedef recognizer (*recognizer_internal_initialize)(rec_info* ri);
198
 
199
/*Function header definition for recognizer internal initializer.*/
200
 
201
/* ari -- This is used in cmu_recognizer.c. */
202
 
203
#define RECOGNIZER_INITIALIZE(_a) \
204
        recognizer __recognizer_internal_initialize(rec_info* _a)
205
 
206
/*
207
 * recognizer_internal_finalize - Deallocate and deinitialize the recognizer
208
 * object. If the recognizer has allocated any additional storage, it should
209
 * be deallocated as well. Returns 0 if successful, -1 if the argument
210
 * wasn't a recognizer or wasn't a recognizer handled by this library.
211
*/
212
 
213
typedef int (*recognizer_internal_finalize)(recognizer r);
214
 
215
#define RECOGNIZER_FINALIZE(_a) \
216
       int __recognizer_internal_finalize(recognizer _a)
217
 
218
 
219
/*
220
 * The following are for creating HRE structures.
221
 */
222
 
223
recognizer
224
make_recognizer(rec_info* ri);
225
void
226
delete_recognizer(recognizer rec);
227
 
228
rec_alternative*
229
make_rec_alternative_array(u_int size);
230
rec_correlation*
231
make_rec_correlation(char type,
232
                     u_int size,
233
                     void* trans,
234
                     rec_confidence conf,
235
                     u_int ps_size);
236
 
237
rec_fn*
238
make_rec_fn_array(u_int size);
239
void
240
delete_rec_fn_array(rec_fn* rf);
241
 
242
gesture*
243
initialize_gesture(gesture* g,
244
                   char* name,
245
                   u_int nhs,
246
                   pen_point* hspots,
247
                   pen_rect bbox,
248
                   xgesture cback,
249
                   void* wsinfo);
250
gesture*
251
make_gesture_array(u_int size);
252
void
253
delete_gesture_array(u_int size,gesture* ga,bool delete_points_p);
254
 
255
pen_stroke*
256
concatenate_pen_strokes(int nstrokes1,
257
                        pen_stroke* strokes1,
258
                        int nstrokes2,
259
                        pen_stroke* strokes2,
260
                        int* nstrokes3,
261
                        pen_stroke** strokes3);
262
 
263
rec_alternative*
264
initialize_rec_alternative(rec_alternative* ra,u_int nelem);
265
rec_element*
266
initialize_rec_element(rec_element* re,
267
                       char type,
268
                       u_int size,
269
                       void* trans,
270
                       rec_confidence conf);
271
/*
272
 * Pathnames, etc.
273
*/
274
 
275
/* these going to be handled in the makefile, for portability */
276
/* #define REC_DEFAULT_HOME_DIR   "/udir/rapkin/vb/hre.ultrix/lib/recognizers" */
277
/* #define REC_DEFAULT_USER_DIR ".recognizers" */
278
 
279
#define REC_DEFAULT_LOCALE      "C"
280
#define RECHOME                 "RECHOME"
281
#define LANG                    "LANG"
282
 
283
#include <hre_api_internal.h>
284
 
285
#endif
286
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.