Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef __JSGF_INTERNAL_H__
00039 #define __JSGF_INTERNAL_H__
00040
00045 #define YY_NO_UNISTD_H 1
00046 #include <hash_table.h>
00047 #include <glist.h>
00048 #include <stdio.h>
00049 #include <fsg_model.h>
00050 #include <logmath.h>
00051 #include <strfuncs.h>
00052 #include <jsgf.h>
00053
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif
00057 #if 0
00058
00059 }
00060 #endif
00061
00062 typedef struct jsgf_rhs_s jsgf_rhs_t;
00063 typedef struct jsgf_atom_s jsgf_atom_t;
00064 typedef struct jsgf_link_s jsgf_link_t;
00065
00066 struct jsgf_s {
00067 char *version;
00068 char *charset;
00069 char *locale;
00070 char *name;
00072 hash_table_t *rules;
00073 hash_table_t *imports;
00074 jsgf_t *parent;
00075 glist_t searchpath;
00077
00078 int nstate;
00079 glist_t links;
00080 glist_t rulestack;
00081 };
00082
00083 struct jsgf_rule_s {
00084 int refcnt;
00085 char *name;
00086 int public;
00087 jsgf_rhs_t *rhs;
00089 int entry;
00090 int exit;
00091 };
00092
00093 struct jsgf_rhs_s {
00094 glist_t atoms;
00095 jsgf_rhs_t *alt;
00096 };
00097
00098 struct jsgf_atom_s {
00099 char *name;
00100 glist_t tags;
00101 float weight;
00102 };
00103
00104 struct jsgf_link_s {
00105 jsgf_atom_t *atom;
00106 int from;
00107 int to;
00108 };
00109
00110 #define jsgf_atom_is_rule(atom) ((atom)->name[0] == '<')
00111
00112 void jsgf_add_link(jsgf_t *grammar, jsgf_atom_t *atom, int from, int to);
00113 jsgf_atom_t *jsgf_atom_new(char *name, float weight);
00114 jsgf_atom_t *jsgf_kleene_new(jsgf_t *jsgf, jsgf_atom_t *atom, int plus);
00115 jsgf_rule_t *jsgf_optional_new(jsgf_t *jsgf, jsgf_rhs_t *exp);
00116 jsgf_rule_t *jsgf_define_rule(jsgf_t *jsgf, char *name, jsgf_rhs_t *rhs, int public);
00117 jsgf_rule_t *jsgf_import_rule(jsgf_t *jsgf, char *name);
00118
00119 int jsgf_atom_free(jsgf_atom_t *atom);
00120 int jsgf_rule_free(jsgf_rule_t *rule);
00121 jsgf_rule_t *jsgf_rule_retain(jsgf_rule_t *rule);
00122
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126
00127
00128 #endif