2 * hre_internal.h: Internal Interface for Recognizer.
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
8 * Copyright (c) 1994 by Sun Microsystems Computer Company
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
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
22 /*Avoids forward reference problem.*/
25 * Internal view of wordset. The recognition engine uses this view to
26 * maintain information about which recognizer object this wordset
27 * belongs to, which file (in case it needs to be saved), and internal
32 char* ws_pathname; /*Path name to word set file.*/
33 recognizer ws_recognizer; /*To whom it belongs.*/
34 void* ws_internal; /*Internal data structures.*/
38 * Internal view of the recognizer struct. This view is only available
39 * to OEM clients who implement a recognizer shared library. Clients
40 * of the recognizer itself see it as an opaque data type. The struct
41 * contains a function pointer for each function in the client API.
45 uint recognizer_magic;
46 char *recognizer_version;
48 rec_info *recognizer_info;
49 void *recognizer_specific;
50 int (*recognizer_load_state)(struct _Recognizer*, char*, char*);
51 int (*recognizer_save_state)(struct _Recognizer*, char*, char*);
52 char* (*recognizer_error)(struct _Recognizer*);
53 wordset (*recognizer_load_dictionary)(struct _Recognizer*, char*, char*);
54 int (*recognizer_save_dictionary)(struct _Recognizer*, char*, char*, wordset);
56 int (*recognizer_free_dictionary)(struct _Recognizer*, wordset);
57 int (*recognizer_add_to_dictionary)(struct _Recognizer*, letterset*, wordset);
58 int (*recognizer_delete_from_dictionary)(struct _Recognizer*, letterset*, wordset);
59 int (*recognizer_set_context)(struct _Recognizer*,rc*);
60 rc* (*recognizer_get_context)(struct _Recognizer*);
62 int (*recognizer_clear)(struct _Recognizer*, bool);
63 int (*recognizer_get_buffer)(struct _Recognizer*, uint*, Stroke**);
65 int (*recognizer_set_buffer)(struct _Recognizer*, uint, Stroke*);
66 int (*recognizer_translate)(struct _Recognizer*, uint, Stroke*, bool, int*, rec_alternative**);
67 rec_fn* (*recognizer_get_extension_functions)(struct _Recognizer*);
68 char** (*recognizer_get_gesture_names)(struct _Recognizer*);
69 xgesture (*recognizer_set_gesture_action)(struct _Recognizer*, char*, xgesture, void*);
70 uint recognizer_end_magic;
74 * recognizer_internal_initialize - Allocate and initialize the recognizer
75 * object. The recognition shared library has the responsibility for filling
76 * in all the function pointers for the recognition functions. This
77 * function must be defined as a global function within the shared
78 * library, so it can be accessed using dlsym() when the recognizer
79 * shared library is loaded. It returns NULL if an error occured and
80 * sets errno to indicate what.
83 typedef recognizer (*recognizer_internal_initialize)(rec_info* ri);
85 /*Function header definition for recognizer internal initializer.*/
87 #define RECOGNIZER_INITIALIZE(_a) \
88 recognizer __recognizer_internal_initialize(rec_info* _a)
91 * recognizer_internal_finalize - Deallocate and deinitialize the recognizer
92 * object. If the recognizer has allocated any additional storage, it should
93 * be deallocated as well. Returns 0 if successful, -1 if the argument
94 * wasn't a recognizer or wasn't a recognizer handled by this library.
97 typedef int (*recognizer_internal_finalize)(recognizer r);
99 #define RECOGNIZER_FINALIZE(_a) \
100 int __recognizer_internal_finalize(recognizer _a)
103 * The following are for creating HRE structures.
106 recognizer make_recognizer(rec_info* ri);
107 void delete_recognizer(recognizer rec);
109 RECOGNIZER_FINALIZE(_a);
110 rec_alternative* make_rec_alternative_array(uint size);
111 rec_correlation* make_rec_correlation(char type, uint size, void* trans, rec_confidence conf, uint ps_size);
114 make_rec_fn_array(uint size);
116 delete_rec_fn_array(rec_fn* rf);
119 initialize_gesture(gesture* g,
127 make_gesture_array(uint size);
129 delete_gesture_array(uint size,gesture* ga,bool delete_points_p);
132 concatenate_Strokes(int nstrokes1,
139 rec_alternative* initialize_rec_alternative(rec_alternative* ra, uint);
141 rec_element* initialize_rec_element(rec_element*, char, uint, void*, rec_confidence);
147 #define REC_DEFAULT_LOCALE "C"
148 #define RECHOME "RECHOME"