/*
|
/*
|
* hre_internal.h: Internal Interface for Recognizer.
|
* hre_internal.h: Internal Interface for Recognizer.
|
* Author: James Kempf
|
* Author: James Kempf
|
* Created On: Thu Nov 5 10:54:18 1992
|
* Created On: Thu Nov 5 10:54:18 1992
|
* Last Modified By: James Kempf
|
* Last Modified By: James Kempf
|
* Last Modified On: Fri Sep 23 13:51:15 1994
|
* Last Modified On: Fri Sep 23 13:51:15 1994
|
* Update Count: 99
|
* Update Count: 99
|
* Copyright (c) 1994 by Sun Microsystems Computer Company
|
* Copyright (c) 1994 by Sun Microsystems Computer Company
|
* All rights reserved.
|
* All rights reserved.
|
*
|
*
|
* Use and copying of this software and preparation of
|
* Use and copying of this software and preparation of
|
* derivative works based upon this software are permitted.
|
* derivative works based upon this software are permitted.
|
* Any distribution of this software or derivative works
|
* Any distribution of this software or derivative works
|
* must comply with all applicable United States export control
|
* must comply with all applicable United States export control
|
* laws.
|
* laws.
|
*
|
*
|
* This software is made available as is, and Sun Microsystems
|
* This software is made available as is, and Sun Microsystems
|
* Computer Company makes no warranty about the software, its
|
* Computer Company makes no warranty about the software, its
|
* performance, or its conformity to any specification
|
* performance, or its conformity to any specification
|
*/
|
*/
|
|
|
#ifndef _HRE_INTERNAL_H_
|
#ifndef _HRE_INTERNAL_H_
|
|
|
#define _HRE_INTERNAL_H_
|
#define _HRE_INTERNAL_H_
|
|
|
/*Avoids forward reference problem.*/
|
/*Avoids forward reference problem.*/
|
|
|
#define wordset void*
|
#define wordset void*
|
|
|
#include <hre.h>
|
#include <hre.h>
|
|
|
#undef wordset
|
#undef wordset
|
|
|
#define recognizer void*
|
#define recognizer void*
|
|
|
/*
|
/*
|
* Internal view of wordset. The recognition engine uses this view to
|
* Internal view of wordset. The recognition engine uses this view to
|
* maintain information about which recognizer object this wordset
|
* maintain information about which recognizer object this wordset
|
* belongs to, which file (in case it needs to be saved), and internal
|
* belongs to, which file (in case it needs to be saved), and internal
|
* data structures.
|
* data structures.
|
*/
|
*/
|
|
|
typedef struct _wordset {
|
typedef struct _wordset {
|
char* ws_pathname; /*Path name to word set file.*/
|
char* ws_pathname; /*Path name to word set file.*/
|
recognizer ws_recognizer; /*To whom it belongs.*/
|
recognizer ws_recognizer; /*To whom it belongs.*/
|
void* ws_internal; /*Internal data structures.*/
|
void* ws_internal; /*Internal data structures.*/
|
} *wordset;
|
} *wordset;
|
|
|
#undef recognizer
|
#undef recognizer
|
|
|
/*
|
/*
|
* Internal view of the recognizer struct. This view is only available
|
* Internal view of the recognizer struct. This view is only available
|
* to OEM clients who implement a recognizer shared library. Clients
|
* to OEM clients who implement a recognizer shared library. Clients
|
* of the recognizer itself see it as an opaque data type. The struct
|
* of the recognizer itself see it as an opaque data type. The struct
|
* contains a function pointer for each function in the client API.
|
* contains a function pointer for each function in the client API.
|
*/
|
*/
|
|
|
struct _Recognizer {
|
struct _Recognizer {
|
u_int recognizer_magic;
|
u_int recognizer_magic;
|
/* ari */
|
/* ari */
|
/* const char* recognizer_version; */
|
/* const char* recognizer_version; */
|
char* recognizer_version;
|
char* recognizer_version;
|
|
|
rec_info* recognizer_info;
|
rec_info* recognizer_info;
|
void* recognizer_specific;
|
void* recognizer_specific;
|
int
|
int
|
(*recognizer_load_state)(
|
(*recognizer_load_state)(
|
struct _Recognizer*,
|
struct _Recognizer*,
|
char*, char*);
|
char*, char*);
|
/* char* dir,
|
/* char* dir,
|
char* name);
|
char* name);
|
*/
|
*/
|
int
|
int
|
(*recognizer_save_state)(
|
(*recognizer_save_state)(
|
struct _Recognizer*,
|
struct _Recognizer*,
|
char*, char*);
|
char*, char*);
|
/* char* dir,
|
/* char* dir,
|
char* name);
|
char* name);
|
*/
|
*/
|
char*
|
char*
|
(*recognizer_error)(
|
(*recognizer_error)(
|
struct _Recognizer*);
|
struct _Recognizer*);
|
wordset
|
wordset
|
(*recognizer_load_dictionary)(
|
(*recognizer_load_dictionary)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
char* directory,
|
char* directory,
|
char* name);
|
char* name);
|
*/
|
*/
|
struct _Recognizer*,
|
struct _Recognizer*,
|
char*, char*);
|
char*, char*);
|
int
|
int
|
(*recognizer_save_dictionary)(
|
(*recognizer_save_dictionary)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
char* directory,
|
char* directory,
|
char* name,
|
char* name,
|
wordset dict);
|
wordset dict);
|
*/
|
*/
|
struct _Recognizer*,
|
struct _Recognizer*,
|
char*, char*, wordset);
|
char*, char*, wordset);
|
|
|
int
|
int
|
(*recognizer_free_dictionary)(
|
(*recognizer_free_dictionary)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
wordset dict);
|
wordset dict);
|
*/
|
*/
|
struct _Recognizer*,
|
struct _Recognizer*,
|
wordset);
|
wordset);
|
int
|
int
|
(*recognizer_add_to_dictionary)(
|
(*recognizer_add_to_dictionary)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
letterset* word,
|
letterset* word,
|
wordset dict);
|
wordset dict);
|
*/
|
*/
|
struct _Recognizer*,
|
struct _Recognizer*,
|
letterset*, wordset);
|
letterset*, wordset);
|
int
|
int
|
(*recognizer_delete_from_dictionary)(
|
(*recognizer_delete_from_dictionary)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
letterset* word,
|
letterset* word,
|
wordset dict);
|
wordset dict);
|
*/
|
*/
|
struct _Recognizer*,
|
struct _Recognizer*,
|
letterset*, wordset);
|
letterset*, wordset);
|
int
|
int
|
(*recognizer_set_context)(
|
(*recognizer_set_context)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
rc* rec_xt);
|
rc* rec_xt);
|
*/
|
*/
|
struct _Recognizer*,rc*);
|
struct _Recognizer*,rc*);
|
rc*
|
rc*
|
(*recognizer_get_context)(
|
(*recognizer_get_context)(
|
/* struct _Recognizer* rec);
|
/* struct _Recognizer* rec);
|
*/
|
*/
|
struct _Recognizer*);
|
struct _Recognizer*);
|
|
|
int
|
int
|
(*recognizer_clear)(
|
(*recognizer_clear)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
bool delete_ponts_p);
|
bool delete_ponts_p);
|
*/
|
*/
|
struct _Recognizer*, bool);
|
struct _Recognizer*, bool);
|
int
|
int
|
(*recognizer_get_buffer)(
|
(*recognizer_get_buffer)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
u_int* nstrokes,
|
u_int* nstrokes,
|
pen_stroke** strokes);
|
pen_stroke** strokes);
|
*/
|
*/
|
struct _Recognizer*, u_int*, pen_stroke**);
|
struct _Recognizer*, u_int*, pen_stroke**);
|
|
|
int
|
int
|
(*recognizer_set_buffer)(
|
(*recognizer_set_buffer)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
u_int nstrokes,
|
u_int nstrokes,
|
pen_stroke* strokes);
|
pen_stroke* strokes);
|
*/
|
*/
|
struct _Recognizer*, u_int, pen_stroke*);
|
struct _Recognizer*, u_int, pen_stroke*);
|
int
|
int
|
(*recognizer_translate)(
|
(*recognizer_translate)(
|
/* struct _Recognizer* rec,
|
/* struct _Recognizer* rec,
|
u_int nstrokes,
|
u_int nstrokes,
|
pen_stroke* strokes,
|
pen_stroke* strokes,
|
bool correlate_p,
|
bool correlate_p,
|
int* nret,
|
int* nret,
|
rec_alternative** ret);
|
rec_alternative** ret);
|
*/
|
*/
|
struct _Recognizer*, u_int, pen_stroke*,
|
struct _Recognizer*, u_int, pen_stroke*,
|
bool, int*, rec_alternative**);
|
bool, int*, rec_alternative**);
|
rec_fn*
|
rec_fn*
|
(*recognizer_get_extension_functions)(
|
(*recognizer_get_extension_functions)(
|
struct _Recognizer*);
|
struct _Recognizer*);
|
char**
|
char**
|
(*recognizer_get_gesture_names)(
|
(*recognizer_get_gesture_names)(
|
struct _Recognizer*);
|
struct _Recognizer*);
|
xgesture
|
xgesture
|
(*recognizer_set_gesture_action)(
|
(*recognizer_set_gesture_action)(
|
struct _Recognizer*,
|
struct _Recognizer*,
|
/* char* name,
|
/* char* name,
|
xgesture fn,
|
xgesture fn,
|
void* wsinfo);
|
void* wsinfo);
|
*/
|
*/
|
char*, xgesture, void*);
|
char*, xgesture, void*);
|
u_int recognizer_end_magic;
|
u_int recognizer_end_magic;
|
};
|
};
|
|
|
typedef struct _Recognizer* recognizer;
|
typedef struct _Recognizer* recognizer;
|
|
|
/*
|
/*
|
* recognizer_internal_initialize - Allocate and initialize the recognizer
|
* recognizer_internal_initialize - Allocate and initialize the recognizer
|
* object. The recognition shared library has the responsibility for filling
|
* object. The recognition shared library has the responsibility for filling
|
* in all the function pointers for the recognition functions. This
|
* in all the function pointers for the recognition functions. This
|
* function must be defined as a global function within the shared
|
* function must be defined as a global function within the shared
|
* library, so it can be accessed using dlsym() when the recognizer
|
* library, so it can be accessed using dlsym() when the recognizer
|
* shared library is loaded. It returns NULL if an error occured and
|
* shared library is loaded. It returns NULL if an error occured and
|
* sets errno to indicate what.
|
* sets errno to indicate what.
|
*/
|
*/
|
|
|
typedef recognizer (*recognizer_internal_initialize)(rec_info* ri);
|
typedef recognizer (*recognizer_internal_initialize)(rec_info* ri);
|
|
|
/*Function header definition for recognizer internal initializer.*/
|
/*Function header definition for recognizer internal initializer.*/
|
|
|
/* ari -- This is used in cmu_recognizer.c. */
|
/* ari -- This is used in cmu_recognizer.c. */
|
|
|
#define RECOGNIZER_INITIALIZE(_a) \
|
#define RECOGNIZER_INITIALIZE(_a) \
|
recognizer __recognizer_internal_initialize(rec_info* _a)
|
recognizer __recognizer_internal_initialize(rec_info* _a)
|
|
|
/*
|
/*
|
* recognizer_internal_finalize - Deallocate and deinitialize the recognizer
|
* recognizer_internal_finalize - Deallocate and deinitialize the recognizer
|
* object. If the recognizer has allocated any additional storage, it should
|
* object. If the recognizer has allocated any additional storage, it should
|
* be deallocated as well. Returns 0 if successful, -1 if the argument
|
* be deallocated as well. Returns 0 if successful, -1 if the argument
|
* wasn't a recognizer or wasn't a recognizer handled by this library.
|
* wasn't a recognizer or wasn't a recognizer handled by this library.
|
*/
|
*/
|
|
|
typedef int (*recognizer_internal_finalize)(recognizer r);
|
typedef int (*recognizer_internal_finalize)(recognizer r);
|
|
|
#define RECOGNIZER_FINALIZE(_a) \
|
#define RECOGNIZER_FINALIZE(_a) \
|
int __recognizer_internal_finalize(recognizer _a)
|
int __recognizer_internal_finalize(recognizer _a)
|
|
|
|
|
/*
|
/*
|
* The following are for creating HRE structures.
|
* The following are for creating HRE structures.
|
*/
|
*/
|
|
|
recognizer
|
recognizer
|
make_recognizer(rec_info* ri);
|
make_recognizer(rec_info* ri);
|
void
|
void
|
delete_recognizer(recognizer rec);
|
delete_recognizer(recognizer rec);
|
|
|
rec_alternative*
|
rec_alternative*
|
make_rec_alternative_array(u_int size);
|
make_rec_alternative_array(u_int size);
|
rec_correlation*
|
rec_correlation*
|
make_rec_correlation(char type,
|
make_rec_correlation(char type,
|
u_int size,
|
u_int size,
|
void* trans,
|
void* trans,
|
rec_confidence conf,
|
rec_confidence conf,
|
u_int ps_size);
|
u_int ps_size);
|
|
|
rec_fn*
|
rec_fn*
|
make_rec_fn_array(u_int size);
|
make_rec_fn_array(u_int size);
|
void
|
void
|
delete_rec_fn_array(rec_fn* rf);
|
delete_rec_fn_array(rec_fn* rf);
|
|
|
gesture*
|
gesture*
|
initialize_gesture(gesture* g,
|
initialize_gesture(gesture* g,
|
char* name,
|
char* name,
|
u_int nhs,
|
u_int nhs,
|
pen_point* hspots,
|
pen_point* hspots,
|
pen_rect bbox,
|
pen_rect bbox,
|
xgesture cback,
|
xgesture cback,
|
void* wsinfo);
|
void* wsinfo);
|
gesture*
|
gesture*
|
make_gesture_array(u_int size);
|
make_gesture_array(u_int size);
|
void
|
void
|
delete_gesture_array(u_int size,gesture* ga,bool delete_points_p);
|
delete_gesture_array(u_int size,gesture* ga,bool delete_points_p);
|
|
|
pen_stroke*
|
pen_stroke*
|
concatenate_pen_strokes(int nstrokes1,
|
concatenate_pen_strokes(int nstrokes1,
|
pen_stroke* strokes1,
|
pen_stroke* strokes1,
|
int nstrokes2,
|
int nstrokes2,
|
pen_stroke* strokes2,
|
pen_stroke* strokes2,
|
int* nstrokes3,
|
int* nstrokes3,
|
pen_stroke** strokes3);
|
pen_stroke** strokes3);
|
|
|
rec_alternative*
|
rec_alternative*
|
initialize_rec_alternative(rec_alternative* ra,u_int nelem);
|
initialize_rec_alternative(rec_alternative* ra,u_int nelem);
|
rec_element*
|
rec_element*
|
initialize_rec_element(rec_element* re,
|
initialize_rec_element(rec_element* re,
|
char type,
|
char type,
|
u_int size,
|
u_int size,
|
void* trans,
|
void* trans,
|
rec_confidence conf);
|
rec_confidence conf);
|
/*
|
/*
|
* Pathnames, etc.
|
* Pathnames, etc.
|
*/
|
*/
|
|
|
/* these going to be handled in the makefile, for portability */
|
/* these going to be handled in the makefile, for portability */
|
/* #define REC_DEFAULT_HOME_DIR "/udir/rapkin/vb/hre.ultrix/lib/recognizers" */
|
/* #define REC_DEFAULT_HOME_DIR "/udir/rapkin/vb/hre.ultrix/lib/recognizers" */
|
/* #define REC_DEFAULT_USER_DIR ".recognizers" */
|
/* #define REC_DEFAULT_USER_DIR ".recognizers" */
|
|
|
#define REC_DEFAULT_LOCALE "C"
|
#define REC_DEFAULT_LOCALE "C"
|
#define RECHOME "RECHOME"
|
#define RECHOME "RECHOME"
|
#define LANG "LANG"
|
#define LANG "LANG"
|
|
|
#include <hre_api_internal.h>
|
#include <hre_api_internal.h>
|
|
|
#endif
|
#endif
|
|
|
|
|