tabs->spaces
[AROS.git] / compiler / arossupport / include / bigendianio.h
blob8fe169851efd5db0f355c4193454fef9cd7e3685
1 #ifndef AROS_STRUCTDESC_H
2 #define AROS_STRUCTDESC_H
4 /*
5 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Read and write big endian structures from and to a file
9 Lang: english
12 #ifndef EXEC_TYPES_H
13 # include <exec/types.h>
14 #endif
15 #ifndef DOS_DOS_H
16 # include <dos/dos.h>
17 #endif
18 #ifndef UTILITY_HOOKS_H
19 # include <utility/hooks.h>
20 #endif
21 #include <stddef.h>
23 /* Big endian streamhook mathods */
24 struct BEIOM_Read
26 STACKULONG MethodID; /* BEIO_READ */
29 struct BEIOM_Write
31 STACKULONG MethodID; /* BEIO_WRITE */
32 STACKULONG Data; /* One byte to emit (0..255) */
35 struct BEIOM_Ignore
37 STACKULONG MethodID; /* BEIO_IGNORE */
38 STACKULONG Count; /* How many bytes */
41 /* Big endian streamhook access modes */
42 #define BEIO_READ 0 /* Read a byte */
43 #define BEIO_WRITE 1 /* Write a byte */
44 #define BEIO_IGNORE 2 /* Skip some bytes (read only) */
46 #define SDT_END 0 /* Read one 8bit byte */
47 #define SDT_UBYTE 1 /* Read one 8bit byte */
48 #define SDT_UWORD 2 /* Read one 16bit word */
49 #define SDT_ULONG 3 /* Read one 32bit long */
50 #define SDT_FLOAT 4 /* Read one 32bit IEEE */
51 #define SDT_DOUBLE 5 /* Read one 64bit IEEE */
52 #define SDT_STRING 6 /* Read a string */
53 #define SDT_STRUCT 7 /* Read a structure */
54 #define SDT_PTR 8 /* Follow a pointer */
55 #define SDT_IGNORE 9 /* Ignore x bytes */
56 #define SDT_FILL_BYTE 10 /* Fill x bytes */
57 #define SDT_FILL_LONG 11 /* Fill x longs */
58 #define SDT_IFILL_BYTE 12 /* Ignore and fill x bytes */
59 #define SDT_IFILL_LONG 13 /* Ignore and fill x longs */
60 #define SDT_SPECIAL 14 /* Call user routine */
61 #define SDT_COPY 15 /* Copy the specified number of bytes */
63 struct SDData
65 APTR sdd_Dest;
66 WORD sdd_Mode;
67 void * sdd_Stream;
70 #define SDV_SPECIALMODE_READ 0 /* Function was called to read from file */
71 #define SDV_SPECIALMODE_WRITE 1 /* Function was called to write to file */
72 #define SDV_SPECIALMODE_FREE 2 /* Function was called to free memory */
74 #define SDM_END SDT_END
75 #define SDM_UBYTE(offset) SDT_UBYTE, offset
76 #define SDM_UWORD(offset) SDT_UWORD, offset
77 #define SDM_ULONG(offset) SDT_ULONG, offset
78 #define SDM_FLOAT(offset) SDT_FLOAT, offset
79 #define SDM_DOUBLE(offset) SDT_DOUBLE, offset
80 #define SDM_COPY(offset,n) SDT_COPY, offset, n
81 #define SDM_STRING(offset) SDT_STRING, offset
82 #define SDM_STRUCT(offset,sd) SDT_STRUCT, offset, ((IPTR)sd)
83 #define SDM_PTR(offset,sd) SDT_PTR, offset, ((IPTR)sd)
84 #define SDM_IGNORE(n) SDT_IGNORE, n
85 #define SDM_FILL_BYTE(offset,v,n) SDT_FILL_BYTE, offset, v, n
86 #define SDM_FILL_LONG(offset,v,n) SDT_FILL_LONG, offset, v, n
87 #define SDM_IFILL_BYTE(offset,v,n) SDT_FILL_BYTE, offset, v, n
88 #define SDM_IFILL_LONG(offset,v,n) SDT_FILL_LONG, offset, v, n
89 #define SDM_SPECIAL(offset,sdhook) SDT_SPECIAL, offset, ((IPTR)sdhook)
91 #define SDM_BYTE SDM_UBYTE
92 #define SDM_WORD SDM_UWORD
93 #define SDM_LONG SDM_ULONG
95 #endif /* AROS_STRUCTDESC_H */