CORSIKA add-on package IACT/ATMO:  Version 1.63 (November 2020)
Data Structures | Typedefs | Functions | Variables
The testio program

Data Structures

struct  test_struct
 

Typedefs

typedef struct test_struct TEST_DATA
 

Functions

int datacmp (TEST_DATA *data1, TEST_DATA *data2)
 Compare elements of test data structures. More...
 
int main (int argc, char **argv)
 Main function for I/O test program. More...
 
int read_test1 (TEST_DATA *data, IO_BUFFER *iobuf)
 Read test data with single-element functions. More...
 
int read_test2 (TEST_DATA *data, IO_BUFFER *iobuf)
 Read test data with vector functions as far as possible. More...
 
int read_test3 (TEST_DATA *data, IO_BUFFER *iobuf)
 Read test data as a nested tree. More...
 
int read_test_lrg (IO_BUFFER *iobuf)
 Read large data block. More...
 
void syntax (const char *prg)
 Replacement for function missing on OS-9.
 
int write_test1 (TEST_DATA *data, IO_BUFFER *iobuf)
 Write test data with single-element functions. More...
 
int write_test2 (TEST_DATA *data, IO_BUFFER *iobuf)
 Write test data with vector functions as far as possible. More...
 
int write_test3 (TEST_DATA *data, IO_BUFFER *iobuf)
 Write test data in nested items. More...
 
int write_test_lrg (IO_BUFFER *iobuf)
 Write large data block. More...
 

Variables

static int care_int
 
static int care_long
 
static int care_short
 

Detailed Description

Function Documentation

◆ datacmp()

int datacmp ( TEST_DATA data1,
TEST_DATA data2 
)

Compare elements of test data structures with the accuracy relevant to the I/O package.

Parameters
data1first data structure
data2second data structure
Returns
0 (something did not match), 1 (O.K.)

◆ main()

int main ( int  argc,
char **  argv 
)

First writes a test data structure with the vector functions, then the same data structure with the single-element functions. The output file is then closed and reopened for reading. The first structure is then read with the single-element functions and the second with the vector functions (i.e. the other way as done for writing). The data from the file is compared with the original data, taking the relevant accuracy into account. Note that if an 'int' variable is written via 'put_short()' and then read again via 'get_short()' not only the upper two bytes (on a 32-bit machine) are lost but also the sign bit is propagated from bit 15 to the upper 16 bits. Similarly, if a 'long' variable is written via 'put_long()' and later read via 'get_long()' on a 64-bit-machine, not only the upper 4 bytes are lost but also the sign in bit 31 is propagated to the upper 32 bits.

◆ read_test1()

int read_test1 ( TEST_DATA data,
IO_BUFFER iobuf 
)
Parameters
dataPointer to test data structure
iobufPointer to I/O buffer
Returns
0 (ok), <0 (error as for get_item_end())

◆ read_test2()

int read_test2 ( TEST_DATA data,
IO_BUFFER iobuf 
)
Parameters
dataPointer to test data structure
iobufPointer to I/O buffer
Returns
0 (ok), <0 (error as for get_item_end())

◆ read_test3()

int read_test3 ( TEST_DATA data,
IO_BUFFER iobuf 
)
Parameters
dataPointer to test data structure
iobufPointer to I/O buffer
Returns
0 (ok), <0 (error as for get_item_end())

◆ read_test_lrg()

int read_test_lrg ( IO_BUFFER iobuf)
Parameters
iobufPointer to I/O buffer
Returns
0 (ok), <0 (error as for put_item_end())

◆ write_test1()

int write_test1 ( TEST_DATA data,
IO_BUFFER iobuf 
)
Parameters
dataPointer to test data structure
iobufPointer to I/O buffer
Returns
0 (O.K.), <0 (error as for put_item_end())

◆ write_test2()

int write_test2 ( TEST_DATA data,
IO_BUFFER iobuf 
)
Parameters
dataPointer to test data structure
iobufPointer to I/O buffer
Returns
0 (ok), <0 (error as for put_item_end())

◆ write_test3()

int write_test3 ( TEST_DATA data,
IO_BUFFER iobuf 
)
Parameters
dataPointer to test data structure
iobufPointer to I/O buffer
Returns
0 (ok), <0 (error as for put_item_end())

◆ write_test_lrg()

int write_test_lrg ( IO_BUFFER iobuf)
Parameters
dataPointer to test data structure
iobufPointer to I/O buffer
Returns
0 (ok), <0 (error as for put_item_end())