CORSIKA add-on package IACT/ATMO:  Version 1.63 (November 2020)
io_basic.h
Go to the documentation of this file.
1 /* ============================================================================
2 
3  Copyright (C) 1991, 2001, 2007, 2009, 2010, 2014 Konrad Bernloehr
4 
5  This file is part of the eventio/hessio library.
6 
7  The eventio/hessio library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with this library. If not, see <http://www.gnu.org/licenses/>.
19 
20 ============================================================================ */
21 
38 #ifndef IO_BASIC_H__LOADED
39 
40 #define IO_BASIC_H__LOADED 1
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 #ifndef INITIAL_H__LOADED
47 #include "initial.h"
48 #endif
49 
50 /* #ifndef __cplusplus */
51 #ifndef WARNING_H__LOADED
52 #include "warning.h"
53 #endif
54 /* #endif */
55 
56 #define MAX_IO_ITEM_LEVEL 20
57 
58 #define HAVE_EVENTIO_USER_FLAG 1
59 #define HAVE_EVENTIO_EXTENDED_LENGTH 1
60 #define HAVE_EVENTIO_HEADER_LENGTH 1
61 
62 /* Flag bits to be used with put_item_begin_with_flag(): */
63 #define EVENTIO_USER_FLAG 1
64 #define EVENTIO_EXTENSION_FLAG 2
65 
66 typedef unsigned char BYTE;
67 
72 {
73  unsigned long type;
74  unsigned version;
75  int can_search;
76  int level;
77  long ident;
78  int user_flag;
80  size_t length;
81 };
83 
87 {
88  unsigned char *buffer;
89  long buflen;
90  long r_remaining, w_remaining;
91  BYTE *data;
102  long item_length[MAX_IO_ITEM_LEVEL];
103  long sub_item_length[MAX_IO_ITEM_LEVEL];
104  long item_start_offset[MAX_IO_ITEM_LEVEL];
105  int item_extension[MAX_IO_ITEM_LEVEL];
108  FILE *input_file;
109  FILE *output_file;
110  int (*user_function) (unsigned char *, long, int);
114  long min_length;
115  long max_length;
116  int aux_count;
117  int regular;
118  int extended;
121  int msg_ext;
122 };
123 typedef struct _struct_IO_BUFFER IO_BUFFER;
124 typedef int (*IO_USER_FUNCTION) (unsigned char *, long, int);
125 
126 /* ------------------ Buffer size parameters ------------------ */
127 
128 #ifdef OS_MSDOS
129 # define IO_BUFFER_INITIAL_LENGTH 8192L
130 # define IO_BUFFER_LENGTH_INCREMENT 8192L
131 # define IO_BUFFER_MAXIMUM_LENGTH 65500L
132 #else
133 # define IO_BUFFER_INITIAL_LENGTH 32768L
134 # define IO_BUFFER_LENGTH_INCREMENT 65536L
135 # ifdef OS_OS9
136 # define IO_BUFFER_MAXIMUM_LENGTH 1000000L
137 # else
138 # define IO_BUFFER_MAXIMUM_LENGTH 3000000L
139 # endif
140 #endif
141 
142 /* ------------------- Macro definitions ---------------------- */
143 
144 /* ------------------------ COPY_BYTES ------------------------- */
145 
146 /* Copy byte without or with switching byte orders. */
147 /* Using the order of arguments as with memcpy: (to,from,nbytes) */
148 #define COPY_BYTES(_target,_source,_num) memcpy(_target,_source,_num)
149 /* For reverting byte orders every two bytes, use swab() but */
150 /* beware that the order of arguments differs from memcpy. */
151 #define COPY_BYTES_SWAB(_target,_source,_num) swab(_source,_target,_num)
152 
153 /* -------------------------- put_byte ------------------------- */
154 /*
155 @@ put_byte(): Write a byte to the output buffer.
156  */
157 
158 #define put_byte(_c,_p) (--(_p)->w_remaining>=0 ? \
159  (*(_p)->data++ = (BYTE)(_c)) : \
160  (BYTE)extend_io_buffer(_p,(unsigned)(_c), \
161  (IO_BUFFER_LENGTH_INCREMENT)))
162 
163 /* -------------------------- get_byte ------------------------- */
164 /*
165 @@ get_byte(): Read a byte from the input buffer.
166  */
167 
168 #define get_byte(p) (--(p)->r_remaining>=0? *(p)->data++ : -1)
169 #define get_bytes(p,k) (((p)->r_remaining -= k) >=0 ? (*(p)->data+=k)-k : -1)
170 
171 
172 /* ------------------ Function prototypes --------------------- */
173 
174 /* I/O buffer allocation: */
176 int extend_io_buffer (IO_BUFFER *iobuf, unsigned next_byte,
177  long increment);
178 void free_io_buffer (IO_BUFFER *iobuf);
179 
180 /* Atomic data type handling: */
181 /* ... 8 bits integer data types ... */
182 void put_vector_of_byte (const BYTE *vec, int num, IO_BUFFER *iobuf);
183 void get_vector_of_byte (BYTE *vec, int num, IO_BUFFER *iobuf);
184 #define put_vector_of_uint8 put_vector_of_byte
185 #define get_vector_of_uint8 get_vector_of_byte
186 
187 /* Unsigned integers (counts) of unspecified length */
188 void put_count (uintmax_t num, IO_BUFFER *iobuf);
189 void put_count32 (uint32_t num, IO_BUFFER *iobuf);
190 void put_count16 (uint16_t num, IO_BUFFER *iobuf);
191 uintmax_t get_count (IO_BUFFER *iobuf);
192 uint32_t get_count32 (IO_BUFFER *iobuf);
193 uint16_t get_count16 (IO_BUFFER *iobuf);
194 /* Signed integers (counts) of unspecified length */
195 void put_scount (intmax_t num, IO_BUFFER *iobuf);
196 void put_scount32 (int32_t num, IO_BUFFER *iobuf);
197 void put_scount16 (int16_t num, IO_BUFFER *iobuf);
198 intmax_t get_scount (IO_BUFFER *iobuf);
199 int32_t get_scount32 (IO_BUFFER *iobuf);
200 int16_t get_scount16 (IO_BUFFER *iobuf);
201 void put_vector_of_int_scount (const int *vec, int num, IO_BUFFER *iobuf);
202 void get_vector_of_int_scount (int *vec, int num, IO_BUFFER *iobuf);
203 void put_vector_of_uint16_scount_differential (uint16_t *vec, int num, IO_BUFFER *iobuf);
204 void get_vector_of_uint16_scount_differential (uint16_t *vec, int num, IO_BUFFER *iobuf);
205 void put_vector_of_uint32_scount_differential (uint32_t *vec, int num, IO_BUFFER *iobuf);
206 void get_vector_of_uint32_scount_differential (uint32_t *vec, int num, IO_BUFFER *iobuf);
207 
208 /* ... 16 bits integer data types ... */
209 /* ... (native) ... */
210 void put_vector_of_short (const short *vec, int num, IO_BUFFER *iobuf);
211 void get_vector_of_short (short *vec, int num, IO_BUFFER *iobuf);
212 #define put_vector_of_int16 put_vector_of_short
213 #define get_vector_of_int16 get_vector_of_short
214 void put_vector_of_uint16 (const uint16_t *uval, int num, IO_BUFFER *iobuf);
215 void get_vector_of_uint16 (uint16_t *uval, int num, IO_BUFFER *iobuf);
216 uint16_t get_uint16(IO_BUFFER *iobuf);
217 /* ... (with conversion) ... */
218 void put_short (int num, IO_BUFFER *iobuf);
219 int get_short (IO_BUFFER *iobuf);
220 void put_vector_of_int (const int *vec, int num, IO_BUFFER *iobuf);
221 void get_vector_of_int (int *vec, int num, IO_BUFFER *iobuf);
222 
223 /* ... 32 bits integer data types ... */
224 /* ... (native) ... */
225 void put_int32 (int32_t num, IO_BUFFER *iobuf);
226 int32_t get_int32 (IO_BUFFER *iobuf);
227 void put_uint32 (uint32_t num, IO_BUFFER *iobuf);
228 uint32_t get_uint32 (IO_BUFFER *iobuf);
229 void put_vector_of_int32 (const int32_t *vec, int num, IO_BUFFER *iobuf);
230 void get_vector_of_int32 (int32_t *vec, int num, IO_BUFFER *iobuf);
231 void put_vector_of_uint32 (const uint32_t *vec, int num, IO_BUFFER *iobuf);
232 void get_vector_of_uint32 (uint32_t *vec, int num, IO_BUFFER *iobuf);
233 /* ... (with conversion) ... */
234 void put_long (long num, IO_BUFFER *iobuf);
235 long get_long (IO_BUFFER *iobuf);
236 void put_vector_of_long (const long *vec, int num, IO_BUFFER *iobuf);
237 void get_vector_of_long (long *vec, int num, IO_BUFFER *iobuf);
238 
239 #ifdef HAVE_64BIT_INT
240 /* ... 64 bits integer data types (data may be non-portable!) ... */
241 void put_vector_of_int64 (const int64_t *vec, int num, IO_BUFFER *iobuf);
242 void get_vector_of_int64 (int64_t *vec, int num, IO_BUFFER *iobuf);
243 void put_vector_of_uint64 (const uint64_t *vec, int num, IO_BUFFER *iobuf);
244 void get_vector_of_uint64 (uint64_t *vec, int num, IO_BUFFER *iobuf);
245 #endif
246 
247 /* ... run-length encoded character string ... */
248 int put_string (const char *s, IO_BUFFER *iobuf);
249 int get_string (char *s, int nmax, IO_BUFFER *iobuf);
250 int put_long_string (const char *s, IO_BUFFER *iobuf);
251 int get_long_string (char *s, int nmax, IO_BUFFER *iobuf);
252 int put_var_string (const char *s, IO_BUFFER *iobuf);
253 int get_var_string (char *s, int nmax, IO_BUFFER *iobuf);
254 
255 /* ... 32 bits floating point ... */
256 /* ... (native) ... */
257 void put_vector_of_float (const float *vec, int num, IO_BUFFER *iobuf);
258 void get_vector_of_float (float *vec, int num, IO_BUFFER *iobuf);
259 /* ... (with conversion) ... */
260 void put_real (double d, IO_BUFFER *iobuf);
261 double get_real (IO_BUFFER *iobuf);
262 void put_vector_of_real (const double *vec, int num, IO_BUFFER *iobuf);
263 void get_vector_of_real (double *vec, int num, IO_BUFFER *iobuf);
264 
265 /* ... 64 bits floating point ... */
266 void put_double (double d, IO_BUFFER *iobuf);
267 double get_double (IO_BUFFER *iobuf);
268 void put_vector_of_double (const double *vec, int num, IO_BUFFER *iobuf);
269 void get_vector_of_double (double *vec, int num, IO_BUFFER *iobuf);
270 
271 /* ... 16 bits floating point ... */
272 void dbl_to_sfloat (double dnum, uint16_t *snum);
273 void fltp_to_sfloat (const float *fnum, uint16_t *snum);
274 void put_sfloat (double dnum, IO_BUFFER *iobuf);
275 double dbl_from_sfloat(const uint16_t *snum);
276 double get_sfloat (IO_BUFFER *iobuf);
277 
278 /* General item management: */
279 int put_item_begin (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
281  IO_ITEM_HEADER *item_header, int user_flag, int extended);
282 int put_item_end (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
283 int unput_item (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
284 int get_item_begin (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
285 int get_item_end (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
286 int unget_item (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
287 int next_subitem_type (IO_BUFFER *iobuf);
288 long next_subitem_length (IO_BUFFER *iobuf);
289 long next_subitem_ident (IO_BUFFER *iobuf);
290 int skip_subitem (IO_BUFFER *iobuf);
291 int search_sub_item (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header,
292  IO_ITEM_HEADER *sub_item_header);
293 int rewind_item (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
294 int remove_item (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
295 int list_sub_items (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header,
296  int maxlevel, int verbosity);
297 
298 /* File I/O: */
299 int reset_io_block (IO_BUFFER *iobuf);
300 int write_io_block (IO_BUFFER *iobuf);
301 int find_io_block (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
302 int read_io_block (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
303 int skip_io_block (IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header);
304 int list_io_blocks (IO_BUFFER *iobuf, int verbosity);
305 
306 int copy_item_to_io_block (IO_BUFFER *iobuf2, IO_BUFFER *iobuf,
307  const IO_ITEM_HEADER *item_header);
309  IO_ITEM_HEADER *item_header, BYTE *_buffer, long length);
310 
311 /* Registry hook: */
312 
314 {
315  unsigned long type;
316  char *name;
317  char *description;
318 };
319 
321 struct ev_reg_entry *find_ev_reg(unsigned long t);
322 
323 typedef struct ev_reg_entry *(*EVREGSEARCH)(unsigned long t);
324 
326 void set_eventio_registry_hook(EVREGSEARCH fptr);
327 
330 const char *eventio_registered_typename(unsigned long type);
331 const char *eventio_registered_description(unsigned long type);
332 
333 
334 #ifdef __cplusplus
335 }
336 #endif
337 
338 #endif
const char * eventio_registered_description(unsigned long type)
Extract the optional description for a given type number, if available.
Definition: eventio.c:5441
void get_vector_of_int(int *vec, int num, IO_BUFFER *iobuf)
Get a vector of (small) integers from I/O buffer.
Definition: eventio.c:1884
int32_t get_int32(IO_BUFFER *iobuf)
Read a four byte integer from an I/O buffer.
Definition: eventio.c:1976
int get_item_end(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
End reading an item.
Definition: eventio.c:3924
int sync_err_count
Count of synchronization errors.
Definition: io_basic.h:119
int put_var_string(const char *s, IO_BUFFER *iobuf)
Put a string of ASCII characters into an I/O buffer.
Definition: eventio.c:2809
int16_t get_scount16(IO_BUFFER *iobuf)
Shortened version of get_scount for up to 16 bits of data.
Definition: eventio.c:1103
long item_start_offset[MAX_IO_ITEM_LEVEL]
Where the item starts in buffer.
Definition: io_basic.h:104
int item_level
Current level of nesting of items.
Definition: io_basic.h:101
int read_io_block(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
Read the data of an I/O block from the input.
Definition: eventio.c:4893
uint32_t get_uint32(IO_BUFFER *iobuf)
Get a four-byte unsigned integer from an I/O buffer.
Definition: eventio.c:2145
size_t length
Length of data field, for information only.
Definition: io_basic.h:80
void put_vector_of_float(const float *vec, int num, IO_BUFFER *iobuf)
Put a vector of floats as IEEE 'float' numbers into an I/O buffer.
Definition: eventio.c:2982
int get_string(char *s, int nmax, IO_BUFFER *iobuf)
Get a string of ASCII characters from an I/O buffer.
Definition: eventio.c:2695
void put_count32(uint32_t num, IO_BUFFER *iobuf)
Shortened version of put_count for up to 32 bits of data.
Definition: eventio.c:710
int item_extension[MAX_IO_ITEM_LEVEL]
Where the extension field was used.
Definition: io_basic.h:105
int aux_count
May be used for dedicated buffers.
Definition: io_basic.h:116
char * description
Optional longer description of the data block.
Definition: io_basic.h:317
void get_vector_of_uint32_scount_differential(uint32_t *vec, int num, IO_BUFFER *iobuf)
Get an array of uint32_t as differential scount data from an I/O buffer.
Definition: eventio.c:1461
void get_vector_of_uint16(uint16_t *uval, int num, IO_BUFFER *iobuf)
Get a vector of unsigned shorts from an I/O buffer.
Definition: eventio.c:1718
void get_vector_of_real(double *vec, int num, IO_BUFFER *iobuf)
Get a vector of floating point numbers as 'doubles' from an I/O buffer.
Definition: eventio.c:3092
double get_sfloat(IO_BUFFER *iobuf)
Get a 16-bit float from an I/O buffer and expand it to a double.
Definition: eventio.c:3458
uint16_t get_uint16(IO_BUFFER *iobuf)
Get one unsigned short from an I/O buffer.
Definition: eventio.c:1783
int unget_item(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
Go back to the beginning of an item being read.
Definition: eventio.c:3991
int(* user_function)(unsigned char *, long, int)
For use of special type of I/O.
Definition: io_basic.h:110
int reset_io_block(IO_BUFFER *iobuf)
Reset an I/O block to its empty status.
Definition: eventio.c:4507
void dbl_to_sfloat(double dnum, uint16_t *snum)
Convert a double to the internal representation of a 16 bit floating point number as specified in the...
Definition: eventio.c:3306
unsigned version
The version number used for the block.
Definition: io_basic.h:74
int msg_ext
1 if buffer extension should be reported, 0 if not
Definition: io_basic.h:121
void put_vector_of_int32(const int32_t *vec, int num, IO_BUFFER *iobuf)
Put a vector of 32 bit integers into I/O buffer.
Definition: eventio.c:1952
long buflen
Usable length of data space.
Definition: io_basic.h:89
void put_int32(int32_t num, IO_BUFFER *iobuf)
Write a four-byte integer to an I/O buffer.
Definition: eventio.c:1911
void put_vector_of_short(const short *vec, int num, IO_BUFFER *iobuf)
Put a vector of 2-byte integers on an I/O buffer.
Definition: eventio.c:1618
int use_extension
Non-zero if the extension header field should be used.
Definition: io_basic.h:79
int output_fileno
For use of write() function for output.
Definition: io_basic.h:107
unsigned long type
The type number telling the type of I/O block.
Definition: io_basic.h:73
void get_vector_of_long(long *vec, int num, IO_BUFFER *iobuf)
Get a vector of 4-byte integers as long int from I/O buffer.
Definition: eventio.c:2358
IO_BUFFER * allocate_io_buffer(size_t buflen)
Dynamic allocation of an I/O buffer.
Definition: eventio.c:261
void put_vector_of_uint32(const uint32_t *vec, int num, IO_BUFFER *iobuf)
Put a vector of 32 bit integers into I/O buffer.
Definition: eventio.c:2120
void put_long(long num, IO_BUFFER *iobuf)
Put a four-byte integer taken from a 'long' into an I/O buffer.
Definition: eventio.c:2248
long get_long(IO_BUFFER *iobuf)
Get 4-byte integer from I/O buffer and return as a long int.
Definition: eventio.c:2313
void get_vector_of_short(short *vec, int num, IO_BUFFER *iobuf)
Get a vector of short integers from I/O buffer.
Definition: eventio.c:1843
int sync_err_max
Maximum accepted number of synchronisation errors.
Definition: io_basic.h:120
An IO_ITEM_HEADER is to access header info for an I/O block and as a handle to the I/O buffer.
Definition: io_basic.h:71
int data_pending
Set to 1 when header is read but not the data.
Definition: io_basic.h:113
int skip_io_block(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
Skip the data of an I/O block from the input.
Definition: eventio.c:5013
long w_remaining
Byte available for reading/writing.
Definition: io_basic.h:90
int next_subitem_type(IO_BUFFER *iobuf)
Reads the header of a sub-item and return the type of it.
Definition: eventio.c:4025
void put_scount(intmax_t num, IO_BUFFER *iobuf)
Put a signed integer of unspecified length to an I/O buffer.
Definition: eventio.c:1024
void get_vector_of_uint32(uint32_t *vec, int num, IO_BUFFER *iobuf)
Get a vector of 32 bit integers from I/O buffer.
Definition: eventio.c:2189
int extended
Set to 1 if you want to use the extension field always.
Definition: io_basic.h:118
FILE * output_file
For use of stream I/O for output.
Definition: io_basic.h:109
int get_short(IO_BUFFER *iobuf)
Get a two-byte integer from an I/O buffer.
Definition: eventio.c:1798
void put_vector_of_int_scount(const int *vec, int num, IO_BUFFER *iobuf)
Put an array of ints as scount32 data into an I/O buffer.
Definition: eventio.c:1271
int can_search
Set to 1 if I/O block consist of sub-blocks only.
Definition: io_basic.h:75
void get_vector_of_byte(BYTE *vec, int num, IO_BUFFER *iobuf)
Get a vector of bytes from an I/O buffer.
Definition: eventio.c:564
int skip_subitem(IO_BUFFER *iobuf)
When the next sub-item is of no interest, it can be skipped.
Definition: eventio.c:4165
int is_allocated
Indicates if buffer is allocated by eventio.
Definition: io_basic.h:100
Indentification of the system and including some basic include file.
int put_string(const char *s, IO_BUFFER *iobuf)
Put a string of ASCII characters into an I/O buffer.
Definition: eventio.c:2665
uint32_t get_count32(IO_BUFFER *iobuf)
Get an unsigned 32 bit integer of unspecified length from an I/O buffer.
Definition: eventio.c:850
void set_eventio_registry_hook(EVREGSEARCH fptr)
This function should be used to set the find_ev_reg_ptr function pointer.
int input_fileno
For use of read() function for input.
Definition: io_basic.h:106
int regular
1 if a regular file, 0 not known, -1 not regular
Definition: io_basic.h:117
int level
Tells how many levels deep we are nested now.
Definition: io_basic.h:76
intmax_t get_scount(IO_BUFFER *iobuf)
Get a signed integer of unspecified length from an I/O buffer.
Definition: eventio.c:1086
void get_vector_of_int32(int32_t *vec, int num, IO_BUFFER *iobuf)
Get a vector of 32 bit integers from I/O buffer.
Definition: eventio.c:2020
long max_length
The maximum length for extending the buffer.
Definition: io_basic.h:115
int get_var_string(char *s, int nmax, IO_BUFFER *iobuf)
Get a string of ASCII characters from an I/O buffer.
Definition: eventio.c:2837
long next_subitem_length(IO_BUFFER *iobuf)
Reads the header of a sub-item and return the length of it.
Definition: eventio.c:4080
int get_long_string(char *s, int nmax, IO_BUFFER *iobuf)
Get a long string of ASCII characters from an I/O buffer.
Definition: eventio.c:2768
double get_double(IO_BUFFER *iobuf)
Get a double from the I/O buffer.
Definition: eventio.c:3226
Definition: io_basic.h:313
int32_t get_scount32(IO_BUFFER *iobuf)
Shortened version of get_scount for up to 32 bits of data.
Definition: eventio.c:1175
int copy_item_to_io_block(IO_BUFFER *iobuf2, IO_BUFFER *iobuf, const IO_ITEM_HEADER *item_header)
Copy a sub-item to another I/O buffer as top-level item.
Definition: eventio.c:5235
long next_subitem_ident(IO_BUFFER *iobuf)
Reads the header of a sub-item and return the identifier of it.
Definition: eventio.c:4122
FILE * input_file
For use of stream I/O for input.
Definition: io_basic.h:108
void put_short(int num, IO_BUFFER *iobuf)
Put a two-byte integer on an I/O buffer.
Definition: eventio.c:1583
void get_vector_of_uint16_scount_differential(uint16_t *vec, int num, IO_BUFFER *iobuf)
Get an array of uint16_t as differential scount data from an I/O buffer.
Definition: eventio.c:1342
int remove_item(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
Remove an item from an I/O buffer.
Definition: eventio.c:4294
struct ev_reg_entry * find_ev_reg(unsigned long t)
This optionally available function is implemented externally.
Definition: eventio.c:5419
BYTE * data
Position for next get.../put...
Definition: io_basic.h:91
void get_vector_of_double(double *vec, int num, IO_BUFFER *iobuf)
Get a vector of floating point numbers as 'doubles' from an I/O buffer.
Definition: eventio.c:3270
long min_length
The initial and minimum length of the buffer.
Definition: io_basic.h:114
void put_double(double d, IO_BUFFER *iobuf)
Put a 'double' as such into an I/O buffer.
Definition: eventio.c:3152
int rewind_item(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
Go back to the beginning of an item.
Definition: eventio.c:4261
void put_sfloat(double dnum, IO_BUFFER *iobuf)
Put a 16-bit float to an I/O buffer.
Definition: eventio.c:3410
int find_io_block(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
Find the beginning of the next I/O data block in the input.
Definition: eventio.c:4639
void free_io_buffer(IO_BUFFER *iobuf)
Free an I/O buffer that has been allocated at run-time.
Definition: eventio.c:506
void put_vector_of_uint16_scount_differential(uint16_t *vec, int num, IO_BUFFER *iobuf)
Put an array of uint16_t as differential scount data into an I/O buffer.
Definition: eventio.c:1297
void put_scount32(int32_t num, IO_BUFFER *iobuf)
Shorter version of put_scount for up to 32 bytes of data.
Definition: eventio.c:1044
long sub_item_length[MAX_IO_ITEM_LEVEL]
Length of its sub-items.
Definition: io_basic.h:103
void put_vector_of_real(const double *vec, int num, IO_BUFFER *iobuf)
Put a vector of doubles as IEEE 'float' numbers into an I/O buffer.
Definition: eventio.c:2962
void get_vector_of_float(float *vec, int num, IO_BUFFER *iobuf)
Get a vector of floating point numbers as 'floats' from an I/O buffer.
Definition: eventio.c:3115
double get_real(IO_BUFFER *iobuf)
Get a floating point number (as written by put_real) from the I/O buffer.
Definition: eventio.c:3007
int put_long_string(const char *s, IO_BUFFER *iobuf)
Put a long string of ASCII characters into an I/O buffer.
Definition: eventio.c:2736
void put_vector_of_long(const long *vec, int num, IO_BUFFER *iobuf)
Put a vector of long int as 4-byte integers into an I/O buffer.
Definition: eventio.c:2289
void get_vector_of_int_scount(int *vec, int num, IO_BUFFER *iobuf)
Get an array of ints as scount32 data from an I/O buffer.
Definition: eventio.c:1284
int put_item_begin(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
Begin putting another (sub-) item into the output buffer.
Definition: eventio.c:3480
double dbl_from_sfloat(const uint16_t *snum)
Convert from the internal representation of an OpenGL 16-bit floating point number back to normal flo...
Definition: eventio.c:3423
int search_sub_item(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header, IO_ITEM_HEADER *sub_item_header)
Search for an item of a specified type.
Definition: eventio.c:4198
int user_flag
One more bit in the header available for user data.
Definition: io_basic.h:78
void fltp_to_sfloat(const float *fnum, uint16_t *snum)
Convert a float to the internal representation of a 16 bit floating point number as specified in the ...
Definition: eventio.c:3326
uintmax_t get_count(IO_BUFFER *iobuf)
Get an unsigned integer of unspecified length from an I/O buffer.
Definition: eventio.c:801
uint16_t get_count16(IO_BUFFER *iobuf)
Get an unsigned 16 bit integer of unspecified length from an I/O buffer.
Definition: eventio.c:957
long item_length[MAX_IO_ITEM_LEVEL]
Length of each level of items.
Definition: io_basic.h:102
int write_io_block(IO_BUFFER *iobuf)
Write an I/O block to the block's output.
Definition: eventio.c:4551
int put_item_end(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
End of putting an item into the output buffer.
Definition: eventio.c:3606
Pass warning messages to the screen or a usr function as set up.
void put_count16(uint16_t num, IO_BUFFER *iobuf)
Shortened version of put_count for up to 16 bits of data.
Definition: eventio.c:761
void put_vector_of_uint32_scount_differential(uint32_t *vec, int num, IO_BUFFER *iobuf)
Put an array of uint16_t as differential scount data into an I/O buffer.
Definition: eventio.c:1431
void put_vector_of_double(const double *vec, int num, IO_BUFFER *iobuf)
Put a vector of doubles into an I/O buffer.
Definition: eventio.c:3196
long ident
Identity number.
Definition: io_basic.h:77
void put_uint32(uint32_t num, IO_BUFFER *iobuf)
Put a four-byte integer into an I/O buffer.
Definition: eventio.c:2079
char * name
The data block name (short)
Definition: io_basic.h:316
void put_count(uintmax_t num, IO_BUFFER *iobuf)
Put an unsigned integer of unspecified length to an I/O buffer.
Definition: eventio.c:601
int list_sub_items(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header, int maxlevel, int verbosity)
Display the contents of sub-items on standard output.
Definition: eventio.c:4395
int put_item_begin_with_flags(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header, int user_flag, int extended)
Begin putting another (sub-) item into the output buffer.
Definition: eventio.c:3503
void put_scount16(int16_t num, IO_BUFFER *iobuf)
Shorter version of put_scount for up to 16 bytes of data.
Definition: eventio.c:1064
unsigned long type
The data block type number.
Definition: io_basic.h:315
void put_vector_of_int(const int *vec, int num, IO_BUFFER *iobuf)
Put a vector of integers (range -32768 to 32767) into I/O buffer.
Definition: eventio.c:1642
int byte_order
Set if block is not in internal byte order.
Definition: io_basic.h:112
The IO_BUFFER structure contains all data needed the manage the stuff.
Definition: io_basic.h:86
int unput_item(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
Undo writing at the present level.
Definition: eventio.c:3710
void put_vector_of_uint16(const uint16_t *uval, int num, IO_BUFFER *iobuf)
Put a vector of unsigned shorts into an I/O buffer.
Definition: eventio.c:1672
void put_real(double d, IO_BUFFER *iobuf)
Put a 4-byte floating point number into an I/O buffer.
Definition: eventio.c:2885
int list_io_blocks(IO_BUFFER *iobuf, int verbosity)
Show the top-level item of an I/O block on standard output.
Definition: eventio.c:5162
const char * eventio_registered_typename(unsigned long type)
This functions using the stored function pointer are now in the core eventio code.
Definition: eventio.c:5429
int get_item_begin(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header)
Begin reading an item.
Definition: eventio.c:3755
unsigned char * buffer
Pointer to allocated data space.
Definition: io_basic.h:88
void put_vector_of_byte(const BYTE *vec, int num, IO_BUFFER *iobuf)
Put a vector of bytes into an I/O buffer.
Definition: eventio.c:527
int append_io_block_as_item(IO_BUFFER *iobuf, IO_ITEM_HEADER *item_header, BYTE *_buffer, long length)
Append data from one I/O block into another one.
Definition: eventio.c:5320
int extend_io_buffer(IO_BUFFER *iobuf, unsigned next_byte, long increment)
Extend the dynamically allocated I/O buffer.
Definition: eventio.c:391