Edinburgh Speech Tools  2.1-release
EST_rw_status.h
Go to the documentation of this file.
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1994,1995,1996 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /*************************************************************************/
33 /* Author : Paul Taylor */
34 /* Date : April 1994 */
35 /*-----------------------------------------------------------------------*/
36 /* Utility Function header file for C and C++ */
37 /* */
38 /*=======================================================================*/
39 
40 #ifndef __RW_STATUS_H__
41 #define __RW_STATUS_H__
42 
43 #ifdef __cplusplus
44 #include <cstdio>
45 #include <cerrno>
46 #else
47 #include <stdio.h>
48 #include <errno.h>
49 
50 #endif
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 
57  /*
58  * make_status_int builds the status as an integer
59  * make_X_status casts it to the required type.
60  */
61 
62 #define make_status_int(STATE, REASON, ERRNO) \
63  ( ((((unsigned int)(STATE)) & 0xff) <<24) \
64  | ((((unsigned int)(REASON)) & 0xff) <<16) \
65  | ((((unsigned int)(ERRNO)) & 0xffff) <<00) \
66  )
67 
68 #define make_read_status(STATE, REASON, ERRNO)\
69  ((EST_read_status)(make_status_int(STATE, REASON, ERRNO)))
70 
71 #define make_write_status(STATE, REASON, ERRNO) \
72  ((EST_write_status)(make_status_int(REASON, STATE, ERRNO)))
73 
74  /*
75  * Extract the bits.
76  */
77 
78 #define get_rw_state(STATUS) \
79  ((EST_rw_state)((((unsigned int)(STATUS)) >> 24) & 0xff))
80 #define get_rw_reason(STATUS) \
81  ((EST_rw_reason)((((unsigned int)(STATUS)) >> 16) & 0xff))
82 #define get_rw_errno(STATUS) \
83  ((int)((((unsigned int)(STATUS)) >> 0) & 0xff))
84 
85 
86  /*
87  * Why we failed.
88  */
89 
97 };
98 
99 /** State of rw */
101  /// ok
103  /// partial
105  /// failed
107 };
108 
109 
110 /** Possible outcomes of a file reading operation. More stuff*/
112  /// The file was read in successfully
114  /// The file exists but is not in the format specified
116  /// The file does not exist.
118  /// An error occurred while reading
120 };
121 
122 
123 /** Possible outcomes of a file writing operation */
125  /// The file was written successfully
127  /// The file was not written successfully
129  /// The file was not written successfully
131  /// A valid file was created, but only some of the requested data is in there
133 };
134 
135 /** Possible outcomes of a network connection operation */
137  /// Connection made.
139  /// Connection failed.
141  /// Connection failed.
143  /// System failure of some kind
145  /// The file was not written successfully
147 };
148 
149 
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 
155 /*
156  * Temporary redefinitions of the old values.
157  */
158 
159 #define format_ok read_ok
160 #define wrong_format read_format_error
161 #define misc_read_error read_error
162 #define misc_write_error write_error
163 
164 #endif /*__RW_STATUS_H__ */
The file does not exist.
EST_write_status
The file was read in successfully.
Connection failed.
An error occurred while reading.
The file was not written successfully.
Connection made.
The file was written successfully.
The file was not written successfully.
A valid file was created, but only some of the requested data is in there.
The file exists but is not in the format specified.
#define make_status_int(STATE, REASON, ERRNO)
Definition: EST_rw_status.h:62
System failure of some kind.
EST_rw_reason
Definition: EST_rw_status.h:90
The file was not written successfully.
EST_read_status
EST_connect_status
partial
Connection failed.
EST_rw_state