1 #ifndef AROS_STRUCTDESC_H
2 #define AROS_STRUCTDESC_H
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 Desc: Read and write big endian structures from and to a file
13 # include <exec/types.h>
18 #ifndef UTILITY_HOOKS_H
19 # include <utility/hooks.h>
23 /* Big endian streamhook mathods */
26 ULONG MethodID
; /* BEIO_READ */
31 ULONG MethodID
; /* BEIO_WRITE */
32 ULONG Data
; /* One byte to emit (0..255) */
37 ULONG MethodID
; /* BEIO_IGNORE */
38 ULONG 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 */
69 #define SDV_SPECIALMODE_READ 0 /* Function was called to read from file */
70 #define SDV_SPECIALMODE_WRITE 1 /* Function was called to write to file */
71 #define SDV_SPECIALMODE_FREE 2 /* Function was called to free memory */
73 #define SDM_END SDT_END
74 #define SDM_UBYTE(offset) SDT_UBYTE, offset
75 #define SDM_UWORD(offset) SDT_UWORD, offset
76 #define SDM_ULONG(offset) SDT_ULONG, offset
77 #define SDM_FLOAT(offset) SDT_FLOAT, offset
78 #define SDM_DOUBLE(offset) SDT_DOUBLE, offset
79 #define SDM_STRING(offset) SDT_STRING, offset
80 #define SDM_STRUCT(offset,sd) SDT_STRUCT, offset, ((IPTR)sd)
81 #define SDM_PTR(offset,sd) SDT_PTR, offset, ((IPTR)sd)
82 #define SDM_IGNORE(n) SDT_IGNORE, n
83 #define SDM_FILL_BYTE(offset,v,n) SDT_FILL_BYTE, offset, v, n
84 #define SDM_FILL_LONG(offset,v,n) SDT_FILL_LONG, offset, v, n
85 #define SDM_IFILL_BYTE(offset,v,n) SDT_FILL_BYTE, offset, v, n
86 #define SDM_IFILL_LONG(offset,v,n) SDT_FILL_LONG, offset, v, n
87 #define SDM_SPECIAL(offset,sdhook) SDT_SPECIAL, offset, ((IPTR)sdhook)
89 #define SDM_BYTE SDM_UBYTE
90 #define SDM_WORD SDM_UWORD
91 #define SDM_LONG SDM_ULONG
93 #endif /* AROS_STRUCTDESC_H */