Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/**** bostream.h --- Binary output stream handling.
32
 *
33
 ** Author: Steve Folkes <smf@hermes.mod.uk>
34
 *
35
 **** Commentary:
36
 *
37
 ***=== INTRODUCTION =========================================================
38
 *
39
 * This file specifies the interface to the binary output stream facility.
40
 *
41
 ***=== TYPES ================================================================
42
 *
43
 ** Type:	BOStreamT
44
 ** Type:	BOStreamP
45
 ** Repr:	<private>
46
 *
47
 * This is the output stream type.
48
 *
49
 ***=== FUNCTIONS ============================================================
50
 *
51
 ** Function:	void			bostream_init
52
 *			PROTO_S ((BOStreamP bostream))
53
 ** Exceptions:
54
 *
55
 * This function initialises the specified bostream not to write to any file.
56
 *
57
 ** Function:	BoolT			bostream_open
58
 *			PROTO_S ((BOStreamP bostream, CStringP name))
59
 ** Exceptions:
60
 *
61
 * This function initialises the specified bostream to write to the file with
62
 * the specified name.  The name should not be modified or deallocated until
63
 * the bostream has been closed.  If the file cannot be opened, the function
64
 * returns false. If the file is opened successfully, the function returns
65
 * true.
66
 *
67
 ** Function:	void			bostream_assign
68
 *			PROTO_S ((BOStreamP to, BOStreamP from))
69
 ** Exceptions:
70
 *
71
 * This function assigns the from bostream to the to bostream.  The from
72
 * bostream should not be used again.
73
 *
74
 ** Function:	BoolT			bostream_is_open
75
 *			PROTO_S ((BOStreamP bostream))
76
 *
77
 * This function returns true if the specified bostream is writing to a file,
78
 * and false otherwise.
79
 *
80
 ** Function:	void			bostream_write_chars
81
 *			PROTO_S ((BOStreamP bostream, unsigned length,
82
 *				  CStringP chars))
83
 ** Exceptions:	XX_bostream_write_error
84
 *
85
 * This function writes the length characters in the chars vector to the
86
 * specified bostream.
87
 *
88
 ** Function:	void			bostream_write_bytes
89
 *			PROTO_S ((BOStreamP bostream, unsigned length,
90
 *				  ByteP bytes))
91
 ** Exceptions:	XX_bostream_write_error
92
 *
93
 * This function writes the length bytes in the bytes vector to the specified
94
 * bostream.
95
 *
96
 ** Function:	void			bostream_write_byte
97
 *			PROTO_S ((BOStreamP bostream, ByteT byte))
98
 ** Exceptions:	XX_bostream_write_error
99
 *
100
 * This function writes the byte to the specified bostream.
101
 *
102
 ** Function:	CStringP		bostream_name
103
 *			PROTO_S ((BOStreamP bostream))
104
 ** Exceptions:
105
 *
106
 * This function returns the name of the file to which the specified
107
 * bostream is writing. The return value should not be modified or
108
 * deallocated.
109
 *
110
 ** Function:	void			bostream_close
111
 *			PROTO_S ((BOStreamP bostream))
112
 ** Exceptions:
113
 *
114
 * This function closes the specified bostream.
115
 *
116
 ***=== EXCEPTIONS ===========================================================
117
 *
118
 ** Exception:	XX_bostream_write_error (CStringP name)
119
 *
120
 * This exception is raised if a write attempt fails.  The data thrown is a
121
 * copy of the name of the file that the write error occured on.  The copy
122
 * should be deallocated when finished with.
123
 *
124
 **** Change Log:
125
 * $Log: bostream.h,v $
126
 * Revision 1.1.1.1  1998/01/17  15:57:17  release
127
 * First version to be checked into rolling release.
128
 *
129
 * Revision 1.2  1994/12/12  11:45:23  smf
130
 * Performing changes for 'CR94_178.sid+tld-update' - bringing in line with
131
 * OSSG C Coding Standards.
132
 *
133
 * Revision 1.1.1.1  1994/07/25  16:06:14  smf
134
 * Initial import of os-interface shared files.
135
 *
136
**/
137
 
138
/****************************************************************************/
139
 
140
#ifndef H_BOSTREAM
141
#define H_BOSTREAM
142
 
143
#include "os-interface.h"
144
#include "exception.h"
145
 
146
/*--------------------------------------------------------------------------*/
147
 
148
typedef struct BOStreamT {
149
    FILE		       *file;
150
    CStringP			name;
151
} BOStreamT, *BOStreamP;
152
 
153
/*--------------------------------------------------------------------------*/
154
 
155
extern ExceptionP		XX_bostream_write_error;
156
 
157
/*--------------------------------------------------------------------------*/
158
 
159
extern void			bostream_init
160
	PROTO_S ((BOStreamP));
161
extern BoolT			bostream_open
162
	PROTO_S ((BOStreamP, CStringP));
163
extern void			bostream_assign
164
	PROTO_S ((BOStreamP, BOStreamP));
165
extern BoolT			bostream_is_open
166
	PROTO_S ((BOStreamP));
167
extern void			bostream_write_chars
168
	PROTO_S ((BOStreamP, unsigned, CStringP));
169
extern void			bostream_write_bytes
170
	PROTO_S ((BOStreamP, unsigned, ByteP));
171
extern void			bostream_write_byte
172
	PROTO_S ((BOStreamP, ByteT));
173
extern CStringP			bostream_name
174
	PROTO_S ((BOStreamP));
175
extern void			bostream_close
176
	PROTO_S ((BOStreamP));
177
 
178
#endif /* !defined (H_BOSTREAM) */