Line -... |
Line 1... |
- |
|
1 |
/*
|
- |
|
2 |
* Copyright (c) 2002-2006 The TenDRA Project <http://www.tendra.org/>.
|
- |
|
3 |
* All rights reserved.
|
- |
|
4 |
*
|
- |
|
5 |
* Redistribution and use in source and binary forms, with or without
|
- |
|
6 |
* modification, are permitted provided that the following conditions are met:
|
- |
|
7 |
*
|
- |
|
8 |
* 1. Redistributions of source code must retain the above copyright notice,
|
- |
|
9 |
* this list of conditions and the following disclaimer.
|
- |
|
10 |
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
- |
|
11 |
* this list of conditions and the following disclaimer in the documentation
|
- |
|
12 |
* and/or other materials provided with the distribution.
|
- |
|
13 |
* 3. Neither the name of The TenDRA Project nor the names of its contributors
|
- |
|
14 |
* may be used to endorse or promote products derived from this software
|
- |
|
15 |
* without specific, prior written permission.
|
- |
|
16 |
*
|
- |
|
17 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
- |
|
18 |
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
- |
|
19 |
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
- |
|
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
- |
|
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
- |
|
22 |
* EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
- |
|
23 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
- |
|
24 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
- |
|
25 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
- |
|
26 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
- |
|
27 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
- |
|
28 |
*
|
- |
|
29 |
* $Id$
|
- |
|
30 |
*/
|
1 |
/*
|
31 |
/*
|
2 |
Crown Copyright (c) 1997
|
32 |
Crown Copyright (c) 1997
|
3 |
|
33 |
|
4 |
This TenDRA(r) Computer Program is subject to Copyright
|
34 |
This TenDRA(r) Computer Program is subject to Copyright
|
5 |
owned by the United Kingdom Secretary of State for Defence
|
35 |
owned by the United Kingdom Secretary of State for Defence
|
6 |
acting through the Defence Evaluation and Research Agency
|
36 |
acting through the Defence Evaluation and Research Agency
|
7 |
(DERA). It is made available to Recipients with a
|
37 |
(DERA). It is made available to Recipients with a
|
8 |
royalty-free licence for its use, reproduction, transfer
|
38 |
royalty-free licence for its use, reproduction, transfer
|
9 |
to other parties and amendment for any purpose not excluding
|
39 |
to other parties and amendment for any purpose not excluding
|
10 |
product development provided that any such use et cetera
|
40 |
product development provided that any such use et cetera
|
11 |
shall be deemed to be acceptance of the following conditions:-
|
41 |
shall be deemed to be acceptance of the following conditions:-
|
12 |
|
42 |
|
13 |
(1) Its Recipients shall ensure that this Notice is
|
43 |
(1) Its Recipients shall ensure that this Notice is
|
14 |
reproduced upon any copies or amended versions of it;
|
44 |
reproduced upon any copies or amended versions of it;
|
15 |
|
45 |
|
16 |
(2) Any amended version of it shall be clearly marked to
|
46 |
(2) Any amended version of it shall be clearly marked to
|
17 |
show both the nature of and the organisation responsible
|
47 |
show both the nature of and the organisation responsible
|
18 |
for the relevant amendment or amendments;
|
48 |
for the relevant amendment or amendments;
|
19 |
|
49 |
|
20 |
(3) Its onward transfer from a recipient to another
|
50 |
(3) Its onward transfer from a recipient to another
|
21 |
party shall be deemed to be that party's acceptance of
|
51 |
party shall be deemed to be that party's acceptance of
|
22 |
these conditions;
|
52 |
these conditions;
|
23 |
|
53 |
|
24 |
(4) DERA gives no warranty or assurance as to its
|
54 |
(4) DERA gives no warranty or assurance as to its
|
25 |
quality or suitability for any purpose and DERA accepts
|
55 |
quality or suitability for any purpose and DERA accepts
|
26 |
no liability whatsoever in relation to any use to which
|
56 |
no liability whatsoever in relation to any use to which
|
27 |
it may be put.
|
57 |
it may be put.
|
28 |
*/
|
58 |
*/
|
Line 46... |
Line 76... |
46 |
*
|
76 |
*
|
47 |
* This is the input stream type.
|
77 |
* This is the input stream type.
|
48 |
*
|
78 |
*
|
49 |
***=== FUNCTIONS ============================================================
|
79 |
***=== FUNCTIONS ============================================================
|
50 |
*
|
80 |
*
|
51 |
** Function: void bistream_init
|
81 |
** Function: void bistream_init(BIStreamP bistream)
|
52 |
* PROTO_S ((BIStreamP bistream))
|
- |
|
53 |
** Exceptions:
|
82 |
** Exceptions:
|
54 |
*
|
83 |
*
|
55 |
* This function initialises the specified bistream not to read from any file.
|
84 |
* This function initialises the specified bistream not to read from any file.
|
56 |
*
|
85 |
*
|
57 |
** Function: BoolT bistream_open
|
- |
|
58 |
* PROTO_S ((BIStreamP bistream, CStringP name))
|
86 |
** Function: BoolT bistream_open(BIStreamP bistream, CStringP name)
|
59 |
** Exceptions:
|
87 |
** Exceptions:
|
60 |
*
|
88 |
*
|
61 |
* This function initialises the specified bistream to read from the file with
|
89 |
* This function initialises the specified bistream to read from the file with
|
62 |
* the specified name. The name should not be modified or deallocated until
|
90 |
* the specified name. The name should not be modified or deallocated until
|
63 |
* the bistream has been closed. If the file cannot be opened, the function
|
91 |
* the bistream has been closed. If the file cannot be opened, the function
|
64 |
* returns false. If the file is opened successfully, the function returns
|
92 |
* returns false. If the file is opened successfully, the function returns
|
65 |
* true.
|
93 |
* true.
|
66 |
*
|
94 |
*
|
67 |
** Function: void bistream_assign
|
- |
|
68 |
* PROTO_S ((BIStreamP to, BIStreamP from))
|
95 |
** Function: void bistream_assign(BIStreamP to, BIStreamP from)
|
69 |
** Exceptions:
|
96 |
** Exceptions:
|
70 |
*
|
97 |
*
|
71 |
* This function assigns the from bistream to the to bistream. The from
|
98 |
* This function assigns the from bistream to the to bistream. The from
|
72 |
* bistream should not be used again.
|
99 |
* bistream should not be used again.
|
73 |
*
|
100 |
*
|
74 |
** Function: BoolT bistream_is_open
|
101 |
** Function: BoolT bistream_is_open(BIStreamP bistream)
|
75 |
* PROTO_S ((BIStreamP bistream))
|
- |
|
76 |
*
|
102 |
*
|
77 |
* This function returns true if the specified bistream is reading from a file,
|
103 |
* This function returns true if the specified bistream is reading from a file,
|
78 |
* and false otherwise.
|
104 |
* and false otherwise.
|
79 |
*
|
105 |
*
|
80 |
** Function: unsigned bistream_read_chars
|
106 |
** Function: unsigned bistream_read_chars(BIStreamP bistream,
|
81 |
* PROTO_S ((BIStreamP bistream, unsigned length,
|
- |
|
82 |
* CStringP chars))
|
107 |
* unsigned length, CStringP chars)
|
83 |
** Exceptions: XX_bistream_read_error
|
108 |
** Exceptions: XX_bistream_read_error
|
84 |
*
|
109 |
*
|
85 |
* This function reads the next length characters from the specified bistream.
|
110 |
* This function reads the next length characters from the specified bistream.
|
86 |
* The characters read are placed in the chars vector, which should be long
|
111 |
* The characters read are placed in the chars vector, which should be long
|
87 |
* enough to hold at least length characters. The function returns the number
|
112 |
* enough to hold at least length characters. The function returns the number
|
88 |
* of characters actually read.
|
113 |
* of characters actually read.
|
89 |
*
|
114 |
*
|
90 |
** Function: unsigned bistream_read_bytes
|
115 |
** Function: unsigned bistream_read_bytes(BIStreamP bistream,
|
91 |
* PROTO_S ((BIStreamP bistream, unsigned length,
|
- |
|
92 |
* ByteP bytes))
|
116 |
* unsigned length, ByteP bytes)
|
93 |
** Exceptions: XX_bistream_read_error
|
117 |
** Exceptions: XX_bistream_read_error
|
94 |
*
|
118 |
*
|
95 |
* This function reads the next length bytes from the specified bistream. The
|
119 |
* This function reads the next length bytes from the specified bistream. The
|
96 |
* bytes read are placed in the bytes vector, which should be long enough to
|
120 |
* bytes read are placed in the bytes vector, which should be long enough to
|
97 |
* hold at least length bytes. The function returns the number of bytes
|
121 |
* hold at least length bytes. The function returns the number of bytes
|
98 |
* actually read.
|
122 |
* actually read.
|
99 |
*
|
123 |
*
|
100 |
** Function: BoolT bistream_read_byte
|
- |
|
101 |
* PROTO_S ((BIStreamP bistream, ByteT *byte_ref))
|
124 |
** Function: BoolT bistream_read_byte(BIStreamP bistream, ByteT *byte_ref)
|
102 |
** Exceptions: XX_bistream_read_error
|
125 |
** Exceptions: XX_bistream_read_error
|
103 |
*
|
126 |
*
|
104 |
* This function reads the next character from the specified bistream. If a
|
127 |
* This function reads the next character from the specified bistream. If a
|
105 |
* byte is read then the byte is assigned to the reference argument, and the
|
128 |
* byte is read then the byte is assigned to the reference argument, and the
|
106 |
* function returns true. If the end of file is reached, the function returns
|
129 |
* function returns true. If the end of file is reached, the function returns
|
107 |
* false.
|
130 |
* false.
|
108 |
*
|
131 |
*
|
109 |
** Function: unsigned bistream_byte
|
132 |
** Function: unsigned bistream_byte(BIStreamP bistream)
|
110 |
* PROTO_S ((BIStreamP bistream))
|
- |
|
111 |
** Exceptions:
|
133 |
** Exceptions:
|
112 |
*
|
134 |
*
|
113 |
* This function returns the number of bytes that have been read from the
|
135 |
* This function returns the number of bytes that have been read from the
|
114 |
* specified bistream.
|
136 |
* specified bistream.
|
115 |
*
|
137 |
*
|
116 |
** Function: CStringP bistream_name
|
138 |
** Function: CStringP bistream_name(BIStreamP bistream)
|
117 |
* PROTO_S ((BIStreamP bistream))
|
- |
|
118 |
** Exceptions:
|
139 |
** Exceptions:
|
119 |
*
|
140 |
*
|
120 |
* This function returns the name of the file from which the specified
|
141 |
* This function returns the name of the file from which the specified
|
121 |
* bistream is reading. The return value should not be modified or
|
142 |
* bistream is reading. The return value should not be modified or
|
122 |
* deallocated.
|
143 |
* deallocated.
|
123 |
*
|
144 |
*
|
124 |
** Function: void bistream_rewind
|
145 |
** Function: void bistream_rewind(BIStreamP bistream)
|
125 |
* PROTO_S ((BIStreamP bistream))
|
- |
|
126 |
** Exceptions:
|
146 |
** Exceptions:
|
127 |
*
|
147 |
*
|
128 |
* This function rewinds the specified bistream.
|
148 |
* This function rewinds the specified bistream.
|
129 |
*
|
149 |
*
|
130 |
** Function: void bistream_close
|
150 |
** Function: void bistream_close(BIStreamP bistream)
|
131 |
* PROTO_S ((BIStreamP bistream))
|
- |
|
132 |
** Exceptions:
|
151 |
** Exceptions:
|
133 |
*
|
152 |
*
|
134 |
* This function closes the specified bistream.
|
153 |
* This function closes the specified bistream.
|
135 |
*
|
154 |
*
|
136 |
***=== EXCEPTIONS ===========================================================
|
155 |
***=== EXCEPTIONS ===========================================================
|
Line 176... |
Line 195... |
176 |
extern ExceptionP XX_bistream_read_error;
|
195 |
extern ExceptionP XX_bistream_read_error;
|
177 |
|
196 |
|
178 |
/*--------------------------------------------------------------------------*/
|
197 |
/*--------------------------------------------------------------------------*/
|
179 |
|
198 |
|
180 |
extern void bistream_init
|
199 |
extern void bistream_init
|
181 |
PROTO_S ((BIStreamP));
|
200 |
(BIStreamP);
|
182 |
extern BoolT bistream_open
|
201 |
extern BoolT bistream_open
|
183 |
PROTO_S ((BIStreamP, CStringP));
|
202 |
(BIStreamP, CStringP);
|
184 |
extern void bistream_assign
|
203 |
extern void bistream_assign
|
185 |
PROTO_S ((BIStreamP, BIStreamP));
|
204 |
(BIStreamP, BIStreamP);
|
186 |
extern BoolT bistream_is_open
|
205 |
extern BoolT bistream_is_open
|
187 |
PROTO_S ((BIStreamP));
|
206 |
(BIStreamP);
|
188 |
extern unsigned bistream_read_chars
|
207 |
extern unsigned bistream_read_chars
|
189 |
PROTO_S ((BIStreamP, unsigned, CStringP));
|
208 |
(BIStreamP, unsigned, CStringP);
|
190 |
extern unsigned bistream_read_bytes
|
209 |
extern unsigned bistream_read_bytes
|
191 |
PROTO_S ((BIStreamP, unsigned, ByteP));
|
210 |
(BIStreamP, unsigned, ByteP);
|
192 |
extern BoolT bistream_read_byte
|
211 |
extern BoolT bistream_read_byte
|
193 |
PROTO_S ((BIStreamP, ByteT *));
|
212 |
(BIStreamP, ByteT *);
|
194 |
extern unsigned bistream_byte
|
213 |
extern unsigned bistream_byte
|
195 |
PROTO_S ((BIStreamP));
|
214 |
(BIStreamP);
|
196 |
extern CStringP bistream_name
|
215 |
extern CStringP bistream_name
|
197 |
PROTO_S ((BIStreamP));
|
216 |
(BIStreamP);
|
198 |
extern void bistream_rewind
|
217 |
extern void bistream_rewind
|
199 |
PROTO_S ((BIStreamP));
|
218 |
(BIStreamP);
|
200 |
extern void bistream_close
|
219 |
extern void bistream_close
|
201 |
PROTO_S ((BIStreamP));
|
220 |
(BIStreamP);
|
202 |
|
221 |
|
203 |
#endif /* !defined (H_BISTREAM) */
|
222 |
#endif /* !defined (H_BISTREAM) */
|