Subversion Repositories eduke32

Rev

Rev 6158 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6158 hendricks2 1
#ifndef XMP_HIO_H
2
#define XMP_HIO_H
3
 
7138 hendricks2 4
#ifdef EDUKE32_DISABLED
6158 hendricks2 5
#include <sys/types.h>
6
#include <sys/stat.h>
7138 hendricks2 7
#endif
6158 hendricks2 8
#include <stddef.h>
9
#include "memio.h"
10
 
11
#define HIO_HANDLE_TYPE(x) ((x)->type)
12
 
13
typedef struct {
7138 hendricks2 14
#ifdef EDUKE32_DISABLED
6158 hendricks2 15
#define HIO_HANDLE_TYPE_FILE    0
7138 hendricks2 16
#endif
6158 hendricks2 17
#define HIO_HANDLE_TYPE_MEMORY  1
18
        int type;
19
        long size;
20
        union {
7138 hendricks2 21
#ifdef EDUKE32_DISABLED
6158 hendricks2 22
                FILE *file;
7138 hendricks2 23
#endif
6158 hendricks2 24
                MFILE *mem;
25
        } handle;
26
        int error;
27
} HIO_HANDLE;
28
 
29
int8    hio_read8s      (HIO_HANDLE *);
30
uint8   hio_read8       (HIO_HANDLE *);
31
uint16  hio_read16l     (HIO_HANDLE *);
32
uint16  hio_read16b     (HIO_HANDLE *);
33
uint32  hio_read24l     (HIO_HANDLE *);
34
uint32  hio_read24b     (HIO_HANDLE *);
35
uint32  hio_read32l     (HIO_HANDLE *);
36
uint32  hio_read32b     (HIO_HANDLE *);
37
size_t  hio_read        (void *, size_t, size_t, HIO_HANDLE *);
38
int     hio_seek        (HIO_HANDLE *, long, int);
39
long    hio_tell        (HIO_HANDLE *);
40
int     hio_eof         (HIO_HANDLE *);
41
int     hio_error       (HIO_HANDLE *);
7138 hendricks2 42
#ifdef EDUKE32_DISABLED
6158 hendricks2 43
HIO_HANDLE *hio_open    (const void *, const char *);
7138 hendricks2 44
#endif
6158 hendricks2 45
HIO_HANDLE *hio_open_mem  (const void *, long);
7138 hendricks2 46
#ifdef EDUKE32_DISABLED
6158 hendricks2 47
HIO_HANDLE *hio_open_file (FILE *);
7138 hendricks2 48
#endif
6158 hendricks2 49
int     hio_close       (HIO_HANDLE *);
50
long    hio_size        (HIO_HANDLE *);
51
 
52
#endif