Mercurial > sdl-ios-xcode
comparison include/SDL_rwops.h @ 1330:450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
using Visual C++ 2005
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 06 Feb 2006 08:28:51 +0000 |
parents | c9b51268668f |
children | 22f39393668a |
comparison
equal
deleted
inserted
replaced
1329:bc67bbf87818 | 1330:450721ad5436 |
---|---|
25 */ | 25 */ |
26 | 26 |
27 #ifndef _SDL_RWops_h | 27 #ifndef _SDL_RWops_h |
28 #define _SDL_RWops_h | 28 #define _SDL_RWops_h |
29 | 29 |
30 #include "SDL_config.h" | |
31 | |
32 #ifdef HAVE_STDIO_H | |
30 #include <stdio.h> | 33 #include <stdio.h> |
34 #endif | |
31 | 35 |
32 #include "SDL_types.h" | 36 #include "SDL_types.h" |
33 | 37 |
34 #include "begin_code.h" | 38 #include "begin_code.h" |
35 /* Set up for C function definitions, even when using C++ */ | 39 /* Set up for C function definitions, even when using C++ */ |
61 /* Close and free an allocated SDL_FSops structure */ | 65 /* Close and free an allocated SDL_FSops structure */ |
62 int (SDLCALL *close)(struct SDL_RWops *context); | 66 int (SDLCALL *close)(struct SDL_RWops *context); |
63 | 67 |
64 Uint32 type; | 68 Uint32 type; |
65 union { | 69 union { |
70 #ifdef HAVE_STDIO_H | |
66 struct { | 71 struct { |
67 int autoclose; | 72 int autoclose; |
68 FILE *fp; | 73 FILE *fp; |
69 } stdio; | 74 } stdio; |
75 #endif | |
70 struct { | 76 struct { |
71 Uint8 *base; | 77 Uint8 *base; |
72 Uint8 *here; | 78 Uint8 *here; |
73 Uint8 *stop; | 79 Uint8 *stop; |
74 } mem; | 80 } mem; |
82 | 88 |
83 /* Functions to create SDL_RWops structures from various data sources */ | 89 /* Functions to create SDL_RWops structures from various data sources */ |
84 | 90 |
85 extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode); | 91 extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode); |
86 | 92 |
93 #ifdef HAVE_STDIO_H | |
87 extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose); | 94 extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose); |
95 #endif | |
88 | 96 |
89 extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size); | 97 extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size); |
90 extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size); | 98 extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size); |
91 | 99 |
92 extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void); | 100 extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void); |
93 extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area); | 101 extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area); |
94 | 102 |
103 #define RW_SEEK_SET 0 /* Seek from the beginning of data */ | |
104 #define RW_SEEK_CUR 1 /* Seek relative to current read point */ | |
105 #define RW_SEEK_END 2 /* Seek relative to the end of data */ | |
106 | |
95 /* Macros to easily read and write from an SDL_RWops structure */ | 107 /* Macros to easily read and write from an SDL_RWops structure */ |
96 #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) | 108 #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) |
97 #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, SEEK_CUR) | 109 #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) |
98 #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) | 110 #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) |
99 #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) | 111 #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) |
100 #define SDL_RWclose(ctx) (ctx)->close(ctx) | 112 #define SDL_RWclose(ctx) (ctx)->close(ctx) |
101 | 113 |
102 | 114 |