Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SDL_rwops.h « SDL2 « include « sdlew « extern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6129ffb4825d065ac7b64b0cac434c8121832523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162

#ifndef _SDL_rwops_h
#define _SDL_rwops_h

#include "SDL_stdinc.h"
#include "SDL_error.h"

#include "begin_code.h"

#ifdef __cplusplus
extern "C" {
#endif

#define SDL_RWOPS_UNKNOWN   0
#define SDL_RWOPS_WINFILE   1
#define SDL_RWOPS_STDFILE   2
#define SDL_RWOPS_JNIFILE   3
#define SDL_RWOPS_MEMORY    4
#define SDL_RWOPS_MEMORY_RO 5

typedef struct SDL_RWops
{

    Sint64 (SDLCALL * size) (struct SDL_RWops * context);

    Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
                             int whence);

    size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr,
                             size_t size, size_t maxnum);

    size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
                              size_t size, size_t num);

    int (SDLCALL * close) (struct SDL_RWops * context);

    Uint32 type;
    union
    {
#if defined(ANDROID)
        struct
        {
            void *fileNameRef;
            void *inputStreamRef;
            void *readableByteChannelRef;
            void *readMethod;
            void *assetFileDescriptorRef;
            long position;
            long size;
            long offset;
            int fd;
        } androidio;
#elif defined(__WIN32__)
        struct
        {
            SDL_bool append;
            void *h;
            struct
            {
                void *data;
                size_t size;
                size_t left;
            } buffer;
        } windowsio;
#endif

#ifdef HAVE_STDIO_H
        struct
        {
            SDL_bool autoclose;
            FILE *fp;
        } stdio;
#endif
        struct
        {
            Uint8 *base;
            Uint8 *here;
            Uint8 *stop;
        } mem;
        struct
        {
            void *data1;
            void *data2;
        } unknown;
    } hidden;

} SDL_RWops;

typedef SDL_RWops * SDLCALL tSDL_RWFromFile(const char *file,
                                                  const char *mode);

#ifdef HAVE_STDIO_H
typedef SDL_RWops * SDLCALL tSDL_RWFromFP(FILE * fp,
                                                SDL_bool autoclose);
#else
typedef SDL_RWops * SDLCALL tSDL_RWFromFP(void * fp,
                                                SDL_bool autoclose);
#endif

typedef SDL_RWops * SDLCALL tSDL_RWFromMem(void *mem, int size);
typedef SDL_RWops * SDLCALL tSDL_RWFromConstMem(const void *mem,
                                                      int size);

typedef SDL_RWops * SDLCALL tSDL_AllocRW(void);
typedef void SDLCALL tSDL_FreeRW(SDL_RWops * area);

#define RW_SEEK_SET 0
#define RW_SEEK_CUR 1
#define RW_SEEK_END 2

#define SDL_RWsize(ctx)         (ctx)->size(ctx)
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
#define SDL_RWtell(ctx)         (ctx)->seek(ctx, 0, RW_SEEK_CUR)
#define SDL_RWread(ctx, ptr, size, n)   (ctx)->read(ctx, ptr, size, n)
#define SDL_RWwrite(ctx, ptr, size, n)  (ctx)->write(ctx, ptr, size, n)
#define SDL_RWclose(ctx)        (ctx)->close(ctx)

typedef Uint8 SDLCALL tSDL_ReadU8(SDL_RWops * src);
typedef Uint16 SDLCALL tSDL_ReadLE16(SDL_RWops * src);
typedef Uint16 SDLCALL tSDL_ReadBE16(SDL_RWops * src);
typedef Uint32 SDLCALL tSDL_ReadLE32(SDL_RWops * src);
typedef Uint32 SDLCALL tSDL_ReadBE32(SDL_RWops * src);
typedef Uint64 SDLCALL tSDL_ReadLE64(SDL_RWops * src);
typedef Uint64 SDLCALL tSDL_ReadBE64(SDL_RWops * src);

typedef size_t SDLCALL tSDL_WriteU8(SDL_RWops * dst, Uint8 value);
typedef size_t SDLCALL tSDL_WriteLE16(SDL_RWops * dst, Uint16 value);
typedef size_t SDLCALL tSDL_WriteBE16(SDL_RWops * dst, Uint16 value);
typedef size_t SDLCALL tSDL_WriteLE32(SDL_RWops * dst, Uint32 value);
typedef size_t SDLCALL tSDL_WriteBE32(SDL_RWops * dst, Uint32 value);
typedef size_t SDLCALL tSDL_WriteLE64(SDL_RWops * dst, Uint64 value);
typedef size_t SDLCALL tSDL_WriteBE64(SDL_RWops * dst, Uint64 value);

extern tSDL_RWFromFile *SDL_RWFromFile;
extern tSDL_RWFromFP *SDL_RWFromFP;
extern tSDL_RWFromFP *SDL_RWFromFP;
extern tSDL_RWFromMem *SDL_RWFromMem;
extern tSDL_RWFromConstMem *SDL_RWFromConstMem;
extern tSDL_AllocRW *SDL_AllocRW;
extern tSDL_FreeRW *SDL_FreeRW;
extern tSDL_ReadU8 *SDL_ReadU8;
extern tSDL_ReadLE16 *SDL_ReadLE16;
extern tSDL_ReadBE16 *SDL_ReadBE16;
extern tSDL_ReadLE32 *SDL_ReadLE32;
extern tSDL_ReadBE32 *SDL_ReadBE32;
extern tSDL_ReadLE64 *SDL_ReadLE64;
extern tSDL_ReadBE64 *SDL_ReadBE64;
extern tSDL_WriteU8 *SDL_WriteU8;
extern tSDL_WriteLE16 *SDL_WriteLE16;
extern tSDL_WriteBE16 *SDL_WriteBE16;
extern tSDL_WriteLE32 *SDL_WriteLE32;
extern tSDL_WriteBE32 *SDL_WriteBE32;
extern tSDL_WriteLE64 *SDL_WriteLE64;
extern tSDL_WriteBE64 *SDL_WriteBE64;

#ifdef __cplusplus
}
#endif
#include "close_code.h"

#endif