Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* 
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
/*Avoids forward reference problem.*/
23
 
24
/*
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
28
 * data structures.
29
*/
30
 
31
struct _wordset {
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.*/
35
};
36
 
37
/*
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.
42
*/
43
 
44
struct _Recognizer {
45
	uint		recognizer_magic;
46
	char		*recognizer_version; 
47
 
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);
55
 
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*);
61
 
62
	int		(*recognizer_clear)(struct _Recognizer*, bool);
63
	int		(*recognizer_get_buffer)(struct _Recognizer*, uint*, Stroke**);
64
 
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; 
71
};
72
 
73
/*
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.
81
*/
82
 
83
typedef recognizer (*recognizer_internal_initialize)(rec_info* ri);
84
 
85
/*Function header definition for recognizer internal initializer.*/
86
 
87
#define RECOGNIZER_INITIALIZE(_a) \
88
        recognizer __recognizer_internal_initialize(rec_info* _a)
89
 
90
/*
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.
95
*/
96
 
97
typedef int (*recognizer_internal_finalize)(recognizer r);
98
 
99
#define RECOGNIZER_FINALIZE(_a) \
100
       int __recognizer_internal_finalize(recognizer _a)
101
 
102
/*
103
 * The following are for creating HRE structures.
104
 */
105
 
106
recognizer			make_recognizer(rec_info* ri);
107
void 				delete_recognizer(recognizer rec);
108
 
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);
112
 
113
rec_fn* 
114
make_rec_fn_array(uint size);
115
void 
116
delete_rec_fn_array(rec_fn* rf);
117
 
118
gesture* 
119
initialize_gesture(gesture* g,
120
		   char* name,
121
		   uint nhs,
122
		   pen_point* hspots,
123
		   pen_rect bbox,
124
		   xgesture cback,
125
		   void* wsinfo);
126
gesture* 
127
make_gesture_array(uint size);
128
void 
129
delete_gesture_array(uint size,gesture* ga,bool delete_points_p);
130
 
131
Stroke*
132
concatenate_Strokes(int nstrokes1,
133
			Stroke* strokes1,
134
			int nstrokes2,
135
			Stroke* strokes2,
136
			int* nstrokes3,
137
			Stroke** strokes3);
138
 
139
rec_alternative* initialize_rec_alternative(rec_alternative* ra, uint);
140
 
141
rec_element* initialize_rec_element(rec_element*, char, uint, void*, rec_confidence);
142
 
143
/*
144
 * Pathnames, etc.
145
*/
146
 
147
#define REC_DEFAULT_LOCALE  	"C"
148
#define RECHOME			"RECHOME"
149
#define LANG			"LANG"