include/SDL_rwops.h
changeset 1330 450721ad5436
parent 1312 c9b51268668f
child 1354 22f39393668a
     1.1 --- a/include/SDL_rwops.h	Sat Feb 04 22:01:44 2006 +0000
     1.2 +++ b/include/SDL_rwops.h	Mon Feb 06 08:28:51 2006 +0000
     1.3 @@ -27,7 +27,11 @@
     1.4  #ifndef _SDL_RWops_h
     1.5  #define _SDL_RWops_h
     1.6  
     1.7 +#include "SDL_config.h"
     1.8 +
     1.9 +#ifdef HAVE_STDIO_H
    1.10  #include <stdio.h>
    1.11 +#endif
    1.12  
    1.13  #include "SDL_types.h"
    1.14  
    1.15 @@ -63,10 +67,12 @@
    1.16  
    1.17  	Uint32 type;
    1.18  	union {
    1.19 +#ifdef HAVE_STDIO_H
    1.20  	    struct {
    1.21  		int autoclose;
    1.22  	 	FILE *fp;
    1.23  	    } stdio;
    1.24 +#endif
    1.25  	    struct {
    1.26  		Uint8 *base;
    1.27  	 	Uint8 *here;
    1.28 @@ -84,7 +90,9 @@
    1.29  
    1.30  extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
    1.31  
    1.32 +#ifdef HAVE_STDIO_H
    1.33  extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
    1.34 +#endif
    1.35  
    1.36  extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
    1.37  extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
    1.38 @@ -92,9 +100,13 @@
    1.39  extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
    1.40  extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
    1.41  
    1.42 +#define RW_SEEK_SET	0	/* Seek from the beginning of data */
    1.43 +#define RW_SEEK_CUR	1	/* Seek relative to current read point */
    1.44 +#define RW_SEEK_END	2	/* Seek relative to the end of data */
    1.45 +
    1.46  /* Macros to easily read and write from an SDL_RWops structure */
    1.47  #define SDL_RWseek(ctx, offset, whence)	(ctx)->seek(ctx, offset, whence)
    1.48 -#define SDL_RWtell(ctx)			(ctx)->seek(ctx, 0, SEEK_CUR)
    1.49 +#define SDL_RWtell(ctx)			(ctx)->seek(ctx, 0, RW_SEEK_CUR)
    1.50  #define SDL_RWread(ctx, ptr, size, n)	(ctx)->read(ctx, ptr, size, n)
    1.51  #define SDL_RWwrite(ctx, ptr, size, n)	(ctx)->write(ctx, ptr, size, n)
    1.52  #define SDL_RWclose(ctx)		(ctx)->close(ctx)