s2types.h
1/* ====================================================================
2 * Copyright (c) 1999-2004 Carnegie Mellon University. All rights
3 * reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 *
18 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
19 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
22 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * ====================================================================
31 *
32 */
33
34/*
35 * prim_type.h -- Primitive types; more machine-independent.
36 *
37 * **********************************************
38 * CMU ARPA Speech Project
39 *
40 * Copyright (c) 1999 Carnegie Mellon University.
41 * ALL RIGHTS RESERVED.
42 * **********************************************
43 *
44 * HISTORY
45 *
46 * $Log$
47 * Revision 1.2 2008/03/03 21:46:04 gerkey
48 * inserted new s2types.h, following user experience
49 *
50 * Revision 1.1 2006/04/20 01:05:29 gerkey
51 * changed sphinx2 configure check, added s2types.h
52 *
53 * Revision 1.7 2005/10/04 23:56:30 dhdfu
54 * Explicitly define int8 as signed, otherwise it will be unsigned on ARM
55 * and PowerPC, and Sphinx3 model definition files won't work.
56 *
57 * Revision 1.6 2004/12/10 16:48:56 rkm
58 * Added continuous density acoustic model handling
59 *
60 *
61 * 12-Mar-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon
62 * Added some useful constant definitions.
63 *
64 * Revision 1.5 2004/07/16 00:57:10 egouvea
65 * Added Ravi's implementation of FSG support.
66 *
67 * Revision 1.2 2004/05/27 14:22:57 rkm
68 * FSG cross-word triphones completed (but for single-phone words)
69 *
70 * Revision 1.1.1.1 2004/03/01 14:30:20 rkm
71 *
72 *
73 * Revision 1.3 2004/02/09 21:19:35 rkm
74 * Added bool
75 *
76 * Revision 1.2 2004/01/23 19:20:03 rkm
77 * *** empty log message ***
78 *
79 *
80 * 02-Aug-1999 Kevin A. Lenzo (lenzo@cs.cmu.edu) at Carnegie Mellon
81 * Copied from s3 and cut out everything but the typedefs.
82 *
83 * 12-Mar-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon
84 * Added arraysize_t, point_t, fpoint_t.
85 *
86 * 01-Feb-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon
87 * Added anytype_t.
88 *
89 * 08-31-95 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon
90 * Created.
91 */
92
93
94#ifndef __S2TYPES_H__
95#define __S2TYPES_H__
96
97
98typedef int int32;
99typedef short int16;
100typedef signed char int8;
101typedef unsigned int uint32;
102typedef unsigned short uint16;
103typedef unsigned char uint8;
104typedef float float32;
105typedef double float64;
106typedef unsigned char boolean;
107
108#ifndef TRUE
109#define TRUE 1
110#endif
111#ifndef FALSE
112#define FALSE 0
113#endif
114
115#ifndef NULL
116#define NULL (void *)0
117#endif
118
119
120/* Useful constants */
121#define MAX_INT32 ((int32) 0x7fffffff)
122#define MAX_INT16 ((int16) 0x00007fff)
123#define MAX_INT8 ((int8) 0x0000007f)
124
125#define MAX_NEG_INT32 ((int32) 0x80000000)
126#define MAX_NEG_INT16 ((int16) 0xffff8000)
127#define MAX_NEG_INT8 ((int8) 0xffffff80)
128
129#define MAX_UINT64 ((uint64) 0xffffffffffffffff)
130#define MAX_UINT32 ((uint32) 0xffffffff)
131#define MAX_UINT16 ((uint16) 0x0000ffff)
132#define MAX_UINT8 ((uint8) 0x000000ff)
133
134/* The following are approximate; IEEE floating point standards might quibble! */
135#define MAX_POS_FLOAT32 3.4e+38f
136#define MIN_POS_FLOAT32 1.2e-38f /* But not 0 */
137#define MAX_POS_FLOAT64 1.8e+307
138#define MIN_POS_FLOAT64 2.2e-308
139
140/* Will the following really work?? */
141#define MAX_NEG_FLOAT32 ((float32) (-MAX_POS_FLOAT32))
142#define MIN_NEG_FLOAT32 ((float32) (-MIN_POS_FLOAT32))
143#define MAX_NEG_FLOAT64 ((float64) (-MAX_POS_FLOAT64))
144#define MIN_NEG_FLOAT64 ((float64) (-MIN_POS_FLOAT64))
145
146/*
147typedef union anytype_s {
148 boolean boolean;
149 int8 int8;
150 uint8 uint8;
151 int16 int16;
152 uint16 uint16;
153 int32 int32;
154 uint32 uint32;
155 float32 float32;
156 float64 float64;
157 void *ptr;
158} anytype_t;
159*/
160
161#endif