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 #define YY_NO_INPUT
00063
00064 typedef struct jsgf_rhs_s jsgf_rhs_t;
00065 typedef struct jsgf_atom_s jsgf_atom_t;
00066 typedef struct jsgf_link_s jsgf_link_t;
00067
00068 struct jsgf_s {
00069 char *version;
00070 char *charset;
00071 char *locale;
00072 char *name;
00074 hash_table_t *rules;
00075 hash_table_t *imports;
00076 jsgf_t *parent;
00077 glist_t searchpath;
00079
00080 int nstate;
00081 glist_t links;
00082 glist_t rulestack;
00083 };
00084
00085 struct jsgf_rule_s {
00086 int refcnt;
00087 char *name;
00088 int public;
00089 jsgf_rhs_t *rhs;
00091 int entry;
00092 int exit;
00093 };
00094
00095 struct jsgf_rhs_s {
00096 glist_t atoms;
00097 jsgf_rhs_t *alt;
00098 };
00099
00100 struct jsgf_atom_s {
00101 char *name;
00102 glist_t tags;
00103 float weight;
00104 };
00105
00106 struct jsgf_link_s {
00107 jsgf_atom_t *atom;
00108 int from;
00109 int to;
00110 };
00111
00112 #define jsgf_atom_is_rule(atom) ((atom)->name[0] == '<')
00113
00114 void jsgf_add_link(jsgf_t *grammar, jsgf_atom_t *atom, int from, int to);
00115 jsgf_atom_t *jsgf_atom_new(char *name, float weight);
00116 jsgf_atom_t *jsgf_kleene_new(jsgf_t *jsgf, jsgf_atom_t *atom, int plus);
00117 jsgf_rule_t *jsgf_optional_new(jsgf_t *jsgf, jsgf_rhs_t *exp);
00118 jsgf_rule_t *jsgf_define_rule(jsgf_t *jsgf, char *name, jsgf_rhs_t *rhs, int public);
00119 jsgf_rule_t *jsgf_import_rule(jsgf_t *jsgf, char *name);
00120
00121 int jsgf_atom_free(jsgf_atom_t *atom);
00122 int jsgf_rule_free(jsgf_rule_t *rule);
00123 jsgf_rule_t *jsgf_rule_retain(jsgf_rule_t *rule);
00124
00125 #ifdef __cplusplus
00126 }
00127 #endif
00128
00129
00130 #endif