123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- #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
- typedef struct SDL_RWops {
-
- int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence);
-
- int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
-
- int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
-
- int (SDLCALL *close)(struct SDL_RWops *context);
- Uint32 type;
- union {
- #if defined(__WIN32__) && !defined(__SYMBIAN32__)
- struct {
- int append;
- void *h;
- struct {
- void *data;
- int size;
- int left;
- } buffer;
- } win32io;
- #endif
- #ifdef HAVE_STDIO_H
- struct {
- int autoclose;
- FILE *fp;
- } stdio;
- #endif
- struct {
- Uint8 *base;
- Uint8 *here;
- Uint8 *stop;
- } mem;
- struct {
- void *data1;
- } unknown;
- } hidden;
- } SDL_RWops;
- extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
- #ifdef HAVE_STDIO_H
- extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
- #endif
- extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
- extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
- extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
- extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
- #define RW_SEEK_SET 0
- #define RW_SEEK_CUR 1
- #define RW_SEEK_END 2
- #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)
- extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
- extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
- extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
- extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
- extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
- extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
- extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
- extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
- extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
- extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
- extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
- extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
- #ifdef __cplusplus
- }
- #endif
- #include "close_code.h"
- #endif
|