SphinxBase 5prealpha
glist.h
Go to the documentation of this file.
1/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/* ====================================================================
3 * Copyright (c) 1999-2004 Carnegie Mellon University. All rights
4 * reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 *
18 * This work was supported in part by funding from the Defense Advanced
19 * Research Projects Agency and the National Science Foundation of the
20 * United States of America, and the CMU Sphinx Speech Consortium.
21 *
22 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * ====================================================================
35 *
36 */
37/*
38 * glist.h -- Module for maintaining a generic, linear linked-list structure.
39 *
40 * **********************************************
41 * CMU ARPA Speech Project
42 *
43 * Copyright (c) 1999 Carnegie Mellon University.
44 * ALL RIGHTS RESERVED.
45 * **********************************************
46 *
47 * HISTORY
48 * $Log: glist.h,v $
49 * Revision 1.9 2005/06/22 03:02:51 arthchan2003
50 * 1, Fixed doxygen documentation, 2, add keyword.
51 *
52 * Revision 1.4 2005/05/03 04:09:11 archan
53 * Implemented the heart of word copy search. For every ci-phone, every word end, a tree will be allocated to preserve its pathscore. This is different from 3.5 or below, only the best score for a particular ci-phone, regardless of the word-ends will be preserved at every frame. The graph propagation will not collect unused word tree at this point. srch_WST_propagate_wd_lv2 is also as the most stupid in the century. But well, after all, everything needs a start. I will then really get the results from the search and see how it looks.
54 *
55 * Revision 1.3 2005/03/30 01:22:48 archan
56 * Fixed mistakes in last updates. Add
57 *
58 *
59 * 09-Mar-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
60 * Added glist_chkdup_*().
61 *
62 * 13-Feb-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
63 * Created from earlier version.
64 */
65
66
82#ifndef _LIBUTIL_GLIST_H_
83#define _LIBUTIL_GLIST_H_
84
85#include <stdlib.h>
86/* Win32/WinCE DLL gunk */
87#include <sphinxbase/sphinxbase_export.h>
89
90#ifdef __cplusplus
91extern "C" {
92#endif
93#if 0
94/* Fool Emacs. */
95}
96#endif
97
100typedef struct gnode_s {
101 anytype_t data;
102 struct gnode_s *next;
104typedef gnode_t *glist_t;
109#define gnode_ptr(g) ((g)->data.ptr)
110#define gnode_int32(g) ((g)->data.i)
111#define gnode_uint32(g) ((g)->data.ui)
112#define gnode_float32(g) ((float32)(g)->data.fl)
113#define gnode_float64(g) ((g)->data.fl)
114#define gnode_next(g) ((g)->next)
115
116
122SPHINXBASE_EXPORT
124 void *ptr
125 );
126
130SPHINXBASE_EXPORT
132 int32 val
133 );
137SPHINXBASE_EXPORT
139 uint32 val
140 );
144SPHINXBASE_EXPORT
146 float32 val
147 );
151SPHINXBASE_EXPORT
153 float64 val
154 );
155
156
157
163SPHINXBASE_EXPORT
165 void *ptr
166 );
170SPHINXBASE_EXPORT
172 int32 val
173 );
177SPHINXBASE_EXPORT
179 uint32 val
180 );
184SPHINXBASE_EXPORT
186 float32 val
187 );
191SPHINXBASE_EXPORT
193 float64 val
194 );
195
202SPHINXBASE_EXPORT
204 );
205
206
211SPHINXBASE_EXPORT
212int32 glist_count (glist_t g
213 );
214
219SPHINXBASE_EXPORT
220void glist_free (glist_t g);
221
222
227SPHINXBASE_EXPORT
229 gnode_t *pred
230 );
231
235SPHINXBASE_EXPORT
237
238#ifdef __cplusplus
239}
240#endif
241
242#endif
struct gnode_s gnode_t
A node in a generic list.
SPHINXBASE_EXPORT gnode_t * glist_insert_uint32(gnode_t *gn, uint32 val)
Create and insert a new list node containing an unsigned integer.
Definition glist.c:215
SPHINXBASE_EXPORT glist_t glist_add_int32(glist_t g, int32 val)
Create and prepend a new list node containing an integer.
Definition glist.c:86
SPHINXBASE_EXPORT gnode_t * glist_insert_ptr(gnode_t *gn, void *ptr)
Create and insert a new list node, with the given user-defined data, after the given generic node gn.
Definition glist.c:187
SPHINXBASE_EXPORT gnode_t * glist_insert_float32(gnode_t *gn, float32 val)
Create and insert a new list node containing a single-precision float.
Definition glist.c:230
SPHINXBASE_EXPORT glist_t glist_reverse(glist_t g)
Reverse the order of the given glist.
Definition glist.c:169
SPHINXBASE_EXPORT void glist_free(glist_t g)
Free the given generic list; user-defined data contained within is not automatically freed.
Definition glist.c:133
SPHINXBASE_EXPORT gnode_t * glist_insert_float64(gnode_t *gn, float64 val)
Create and insert a new list node containing a double-precision float.
Definition glist.c:244
SPHINXBASE_EXPORT glist_t glist_add_float32(glist_t g, float32 val)
Create and prepend a new list node containing a single-precision float.
Definition glist.c:110
SPHINXBASE_EXPORT glist_t glist_add_float64(glist_t g, float64 val)
Create and prepend a new list node containing a double-precision float.
Definition glist.c:122
SPHINXBASE_EXPORT glist_t glist_add_ptr(glist_t g, void *ptr)
Create and prepend a new list node, with the given user-defined data, at the HEAD of the given generi...
Definition glist.c:74
SPHINXBASE_EXPORT gnode_t * gnode_free(gnode_t *gn, gnode_t *pred)
Free the given node, gn, of a glist, pred being its predecessor in the list.
Definition glist.c:257
SPHINXBASE_EXPORT gnode_t * glist_tail(glist_t g)
Return the last node in the given list.
Definition glist.c:156
SPHINXBASE_EXPORT gnode_t * glist_insert_int32(gnode_t *gn, int32 val)
Create and insert a new list node containing an integer.
Definition glist.c:201
SPHINXBASE_EXPORT int32 glist_count(glist_t g)
Count the number of element in a given link list.
Definition glist.c:145
SPHINXBASE_EXPORT glist_t glist_add_uint32(glist_t g, uint32 val)
Create and prepend a new list node containing an unsigned integer.
Definition glist.c:98
Basic type definitions used in Sphinx.
A node in a generic list.
Definition glist.h:100
struct gnode_s * next
See prim_type.h.
Definition glist.h:102
Union of basic types.
Definition prim_type.h:107