| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
#ifndef _CST_ITEM_H__ |
| 41 |
#define _CST_ITEM_H__ |
| 42 |
|
| 43 |
#include "cst_file.h" |
| 44 |
#include "cst_features.h" |
| 45 |
|
| 46 |
|
| 47 |
typedef struct cst_relation_struct cst_relation; |
| 48 |
typedef struct cst_utterance_struct cst_utterance; |
| 49 |
typedef struct cst_item_struct cst_item; |
| 50 |
|
| 51 |
|
| 52 |
CST_VAL_USER_TYPE_DCLS(relation,cst_relation) |
| 53 |
CST_VAL_USER_TYPE_DCLS(item,cst_item) |
| 54 |
CST_VAL_USER_TYPE_DCLS(utterance,cst_utterance) |
| 55 |
|
| 56 |
typedef struct cst_item_contents_struct { |
| 57 |
cst_features *features; |
| 58 |
cst_features *relations; |
| 59 |
} cst_item_contents; |
| 60 |
|
| 61 |
struct cst_item_struct { |
| 62 |
cst_item_contents *contents; |
| 63 |
cst_relation *relation; |
| 64 |
cst_item *n; |
| 65 |
cst_item *p; |
| 66 |
cst_item *u; |
| 67 |
cst_item *d; |
| 68 |
}; |
| 69 |
|
| 70 |
|
| 71 |
cst_item *new_item_relation(cst_relation *r,cst_item *i); |
| 72 |
cst_item_contents *new_item_contents(cst_item *i); |
| 73 |
|
| 74 |
|
| 75 |
void delete_item(cst_item *item); |
| 76 |
|
| 77 |
void item_contents_set(cst_item *current, cst_item *i); |
| 78 |
void item_unref_contents(cst_item *i); |
| 79 |
|
| 80 |
cst_item *item_as(const cst_item *i,const char *rname); |
| 81 |
|
| 82 |
cst_utterance *item_utt(const cst_item *i); |
| 83 |
|
| 84 |
|
| 85 |
cst_item *item_next(const cst_item *i); |
| 86 |
cst_item *item_prev(const cst_item *i); |
| 87 |
|
| 88 |
cst_item *item_append(cst_item *i,cst_item *new_item); |
| 89 |
cst_item *item_prepend(cst_item *i,cst_item *new_item); |
| 90 |
|
| 91 |
|
| 92 |
cst_item *item_parent(const cst_item *i); |
| 93 |
cst_item *item_nth_daughter(const cst_item *i,int n); |
| 94 |
cst_item *item_daughter(const cst_item *i); |
| 95 |
cst_item *item_last_daughter(const cst_item *i); |
| 96 |
|
| 97 |
cst_item *item_add_daughter(cst_item *i,cst_item *new_item); |
| 98 |
cst_item *item_append_sibling(cst_item *i,cst_item *new_item); |
| 99 |
cst_item *item_prepend_sibling(cst_item *i,cst_item *new_item); |
| 100 |
|
| 101 |
|
| 102 |
int item_feat_present(const cst_item *i,const char *name); |
| 103 |
int item_feat_remove(const cst_item *i,const char *name); |
| 104 |
cst_features *item_feats(const cst_item *i); |
| 105 |
const cst_val *item_feat(const cst_item *i,const char *name); |
| 106 |
int item_feat_int(const cst_item *i,const char *name); |
| 107 |
float item_feat_float(const cst_item *i,const char *name); |
| 108 |
const char *item_feat_string(const cst_item *i,const char *name); |
| 109 |
void item_set(const cst_item *i,const char *name,const cst_val *val); |
| 110 |
void item_set_int(const cst_item *i,const char *name,int val); |
| 111 |
void item_set_float(const cst_item *i,const char *name,float val); |
| 112 |
void item_set_string(const cst_item *i,const char *name,const char *val); |
| 113 |
|
| 114 |
#define item_name(I) item_feat_string(I,"name") |
| 115 |
|
| 116 |
int item_equal(const cst_item *a, const cst_item *b); |
| 117 |
|
| 118 |
const char *ffeature_string(const cst_item *item,const char *featpath); |
| 119 |
int ffeature_int(const cst_item *item,const char *featpath); |
| 120 |
float ffeature_float(const cst_item *item,const char *featpath); |
| 121 |
const cst_val *ffeature(const cst_item *item,const char *featpath); |
| 122 |
cst_item* path_to_item(const cst_item *item,const char *featpath); |
| 123 |
|
| 124 |
|
| 125 |
typedef const cst_val *(*cst_ffunction)(const cst_item *i); |
| 126 |
CST_VAL_USER_FUNCPTR_DCLS(ffunc,cst_ffunction) |
| 127 |
void ff_register(cst_features *ffeatures, const char *name, |
| 128 |
cst_ffunction f); |
| 129 |
void ff_unregister(cst_features *ffeatures, const char *name); |
| 130 |
|
| 131 |
|
| 132 |
typedef cst_val *(*cst_itemfunc)(cst_item *i); |
| 133 |
CST_VAL_USER_FUNCPTR_DCLS(itemfunc,cst_itemfunc) |
| 134 |
|
| 135 |
#endif |