Fixed build problem with SDL_string.c
authorSam Lantinga <slouken@libsdl.org>
Thu, 09 Feb 2006 09:38:05 +0000
changeset 135422f39393668a
parent 1353 7ba544e2888d
child 1355 4d0f2b2147cf
Fixed build problem with SDL_string.c
Officially deprecated SDL_byteorder.h, SDL_getenv.h and SDL_types.h
Moved endian-related SDL_rwops code into SDL_rwops.c
configure.in
include/Makefile.am
include/SDL_byteorder.h
include/SDL_config.h
include/SDL_config.h.in
include/SDL_endian.h
include/SDL_getenv.h
include/SDL_rwops.h
include/SDL_types.h
src/Makefile.am
src/endian/Makefile.am
src/endian/Makefile.wat
src/endian/SDL_endian.c
src/file/SDL_rwops.c
src/stdlib/SDL_getenv.c
src/stdlib/SDL_malloc.c
src/stdlib/SDL_qsort.c
src/stdlib/SDL_stdlib.c
src/stdlib/SDL_string.c
     1.1 --- a/configure.in	Thu Feb 09 09:07:13 2006 +0000
     1.2 +++ b/configure.in	Thu Feb 09 09:38:05 2006 +0000
     1.3 @@ -41,6 +41,12 @@
     1.4  
     1.5  dnl Detect the canonical host and target build environment
     1.6  AC_CANONICAL_SYSTEM
     1.7 +AC_C_BIGENDIAN
     1.8 +if test x$ac_cv_c_bigendian = xyes; then
     1.9 +    AC_DEFINE(SDL_BYTEORDER, 4321)
    1.10 +else
    1.11 +    AC_DEFINE(SDL_BYTEORDER, 1234)
    1.12 +fi
    1.13  
    1.14  dnl Setup for automake
    1.15  AM_INIT_AUTOMAKE(SDL, $SDL_VERSION)
    1.16 @@ -118,7 +124,7 @@
    1.17  dnl See whether we are allowed to use the system C library
    1.18  AC_ARG_ENABLE(libc,
    1.19  [  --enable-libc           Use the system C library [default=yes]],
    1.20 -              , AC_DEFINE([HAVE_LIBC]))
    1.21 +              , AC_DEFINE(HAVE_LIBC))
    1.22  
    1.23  dnl Check for compiler characteristics
    1.24  AC_C_CONST
    1.25 @@ -286,15 +292,6 @@
    1.26  else
    1.27      CFLAGS="$CFLAGS -DDISABLE_TIMERS"
    1.28  fi
    1.29 -AC_ARG_ENABLE(endian,
    1.30 -[  --enable-endian         Enable the endian subsystem [default=yes]],
    1.31 -              , enable_endian=yes)
    1.32 -if test x$enable_endian = xyes; then
    1.33 -    SDL_EXTRADIRS="$SDL_EXTRADIRS endian"
    1.34 -    SDL_EXTRALIBS="$SDL_EXTRALIBS endian/libendian.la"
    1.35 -else
    1.36 -    CFLAGS="$CFLAGS -DDISABLE_ENDIAN"
    1.37 -fi
    1.38  AC_ARG_ENABLE(file,
    1.39  [  --enable-file           Enable the file subsystem [default=yes]],
    1.40                , enable_file=yes)
    1.41 @@ -3051,7 +3048,6 @@
    1.42  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
    1.43  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread"
    1.44  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer"
    1.45 -CFLAGS="$CFLAGS -I\$(top_srcdir)/src/endian"
    1.46  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
    1.47  CFLAGS="$CFLAGS -I\$(top_builddir)/src/thread"
    1.48  CXXFLAGS="$CFLAGS"
    1.49 @@ -3180,7 +3176,6 @@
    1.50  src/cdrom/win32/Makefile
    1.51  src/thread/Makefile
    1.52  src/timer/Makefile
    1.53 -src/endian/Makefile
    1.54  src/file/Makefile
    1.55  src/cpuinfo/Makefile
    1.56  src/hermes/Makefile
     2.1 --- a/include/Makefile.am	Thu Feb 09 09:07:13 2006 +0000
     2.2 +++ b/include/Makefile.am	Thu Feb 09 09:38:05 2006 +0000
     2.3 @@ -13,7 +13,6 @@
     2.4  	SDL_config.h		\
     2.5  	SDL_copying.h		\
     2.6  	SDL_cpuinfo.h		\
     2.7 -	SDL_ctype.h		\
     2.8  	SDL_endian.h		\
     2.9  	SDL_error.h		\
    2.10  	SDL_events.h		\
    2.11 @@ -29,7 +28,7 @@
    2.12  	SDL_opengl.h		\
    2.13  	SDL_quit.h		\
    2.14  	SDL_rwops.h		\
    2.15 -	SDL_stdarg.h		\
    2.16 +	SDL_stdinc.h		\
    2.17  	SDL_stdlib.h		\
    2.18  	SDL_string.h		\
    2.19  	SDL_syswm.h		\
     3.1 --- a/include/SDL_byteorder.h	Thu Feb 09 09:07:13 2006 +0000
     3.2 +++ b/include/SDL_byteorder.h	Thu Feb 09 09:38:05 2006 +0000
     3.3 @@ -20,29 +20,5 @@
     3.4      slouken@libsdl.org
     3.5  */
     3.6  
     3.7 -/* Macros for determining the byte-order of this platform */
     3.8 -
     3.9 -#ifndef _SDL_byteorder_h
    3.10 -#define _SDL_byteorder_h
    3.11 -
    3.12 -#include "SDL_config.h"
    3.13 -
    3.14 -/* The two types of endianness */
    3.15 -#define SDL_LIL_ENDIAN	1234
    3.16 -#define SDL_BIG_ENDIAN	4321
    3.17 -
    3.18 -#ifndef SDL_BYTEORDER	/* Not defined in SDL_config.h? */
    3.19 -#if (defined(__i386__) || defined(__i386)) || \
    3.20 -     defined(__ia64__) || defined(__x86_64__) || \
    3.21 -    (defined(__alpha__) || defined(__alpha)) || \
    3.22 -    (defined(__arm__) || defined(__thumb__)) || \
    3.23 -    (defined(__sh__) || defined(__sh64__)) || \
    3.24 -    (defined(__mips__) && defined(__MIPSEL__)) || \
    3.25 -     defined(__SYMBIAN32__) || defined(__OS2__)
    3.26 -#define SDL_BYTEORDER	SDL_LIL_ENDIAN
    3.27 -#else
    3.28 -#define SDL_BYTEORDER	SDL_BIG_ENDIAN
    3.29 -#endif
    3.30 -#endif /* !SDL_BYTEORDER */
    3.31 -
    3.32 -#endif /* _SDL_byteorder_h */
    3.33 +/* DEPRECATED */
    3.34 +#include "SDL_endian.h"
     4.1 --- a/include/SDL_config.h	Thu Feb 09 09:07:13 2006 +0000
     4.2 +++ b/include/SDL_config.h	Thu Feb 09 09:38:05 2006 +0000
     4.3 @@ -1,3 +1,4 @@
     4.4 +/* include/SDL_config.h.  Generated by configure.  */
     4.5  /*
     4.6      SDL - Simple DirectMedia Layer
     4.7      Copyright (C) 1997-2006 Sam Lantinga
     4.8 @@ -23,17 +24,111 @@
     4.9  #ifndef _SDL_config_h
    4.10  #define _SDL_config_h
    4.11  
    4.12 -/* This is the minimal configuration that can be used to build SDL */
    4.13 +/* This is a set of defines to configure the SDL features */
    4.14  
    4.15 -#include <stdarg.h>
    4.16 +/* C language features */
    4.17 +/* #undef const */
    4.18 +/* #undef inline */
    4.19 +/* #undef volatile */
    4.20  
    4.21 -typedef signed char int8_t;
    4.22 -typedef unsigned char uint8_t;
    4.23 -typedef signed short int16_t;
    4.24 -typedef unsigned short uint16_t;
    4.25 -typedef signed int int32_t;
    4.26 -typedef unsigned int uint32_t;
    4.27 -typedef unsigned int size_t;
    4.28 -typedef unsigned long uintptr_t;
    4.29 +/* C datatypes */
    4.30 +/* #undef size_t */
    4.31 +/* #undef int8_t */
    4.32 +/* #undef uint8_t */
    4.33 +/* #undef int16_t */
    4.34 +/* #undef uint16_t */
    4.35 +/* #undef int32_t */
    4.36 +/* #undef uint32_t */
    4.37 +#define SDL_HAS_64BIT_TYPE 1
    4.38 +/* #undef int64_t */
    4.39 +/* #undef uint64_t */
    4.40 +/* #undef uintptr_t */
    4.41 +
    4.42 +/* Endianness */
    4.43 +#define SDL_BYTEORDER 1234
    4.44 +
    4.45 +/* Comment this if you want to build without any C library requirements */
    4.46 +#define HAVE_LIBC 1
    4.47 +#ifdef HAVE_LIBC
    4.48 +
    4.49 +/* Useful headers */
    4.50 +#define HAVE_SYS_TYPES_H 1
    4.51 +#define HAVE_STDIO_H 1
    4.52 +#define STDC_HEADERS 1
    4.53 +#define HAVE_STDLIB_H 1
    4.54 +#define HAVE_STDARG_H 1
    4.55 +#define HAVE_MALLOC_H 1
    4.56 +#define HAVE_MEMORY_H 1
    4.57 +#define HAVE_STRING_H 1
    4.58 +#define HAVE_STRINGS_H 1
    4.59 +#define HAVE_INTTYPES_H 1
    4.60 +#define HAVE_STDINT_H 1
    4.61 +#define HAVE_CTYPE_H 1
    4.62 +#define HAVE_SIGNAL_H 1
    4.63 +
    4.64 +/* C library functions */
    4.65 +#define HAVE_MALLOC 1
    4.66 +#define HAVE_CALLOC 1
    4.67 +#define HAVE_REALLOC 1
    4.68 +#define HAVE_FREE 1
    4.69 +#define HAVE_ALLOCA 1
    4.70 +#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
    4.71 +#define HAVE_GETENV 1
    4.72 +#define HAVE_PUTENV 1
    4.73 +#define HAVE_UNSETENV 1
    4.74 +#endif
    4.75 +#define HAVE_QSORT 1
    4.76 +#define HAVE_ABS 1
    4.77 +#define HAVE_BCOPY 1
    4.78 +#define HAVE_MEMSET 1
    4.79 +#define HAVE_MEMCPY 1
    4.80 +#define HAVE_MEMMOVE 1
    4.81 +#define HAVE_MEMCMP 1
    4.82 +#define HAVE_STRLEN 1
    4.83 +#define HAVE_STRCPY 1
    4.84 +#define HAVE_STRNCPY 1
    4.85 +#define HAVE_STRCAT 1
    4.86 +#define HAVE_STRNCAT 1
    4.87 +#define HAVE_STRDUP 1
    4.88 +/* #undef HAVE__STRREV */
    4.89 +/* #undef HAVE__STRUPR */
    4.90 +/* #undef HAVE__STRLWR */
    4.91 +/* #undef HAVE_INDEX */
    4.92 +/* #undef HAVE_RINDEX */
    4.93 +#define HAVE_STRCHR 1
    4.94 +#define HAVE_STRRCHR 1
    4.95 +#define HAVE_STRSTR 1
    4.96 +/* #undef HAVE_ITOA */
    4.97 +/* #undef HAVE__LTOA */
    4.98 +/* #undef HAVE__UITOA */
    4.99 +/* #undef HAVE__ULTOA */
   4.100 +#define HAVE_STRTOL 1
   4.101 +/* #undef HAVE__I64TOA */
   4.102 +/* #undef HAVE__UI64TOA */
   4.103 +#define HAVE_STRTOLL 1
   4.104 +#define HAVE_STRTOD 1
   4.105 +#define HAVE_ATOI 1
   4.106 +#define HAVE_ATOF 1
   4.107 +#define HAVE_STRCMP 1
   4.108 +#define HAVE_STRNCMP 1
   4.109 +/* #undef HAVE_STRICMP */
   4.110 +#define HAVE_STRCASECMP 1
   4.111 +#define HAVE_SSCANF 1
   4.112 +#define HAVE_SNPRINTF 1
   4.113 +/* #undef HAVE_VSNPRINTF */
   4.114 +
   4.115 +#endif /* HAVE_LIBC */
   4.116 +
   4.117 +
   4.118 +/* Allow disabling of core subsystems */
   4.119 +/* #undef DISABLE_AUDIO */
   4.120 +/* #undef DISABLE_VIDEO */
   4.121 +/* #undef DISABLE_EVENTS */
   4.122 +/* #undef DISABLE_JOYSTICK */
   4.123 +/* #undef DISABLE_CDROM */
   4.124 +/* #undef DISABLE_THREADS */
   4.125 +/* #undef DISABLE_TIMERS */
   4.126 +/* #undef DISABLE_FILE */
   4.127 +/* #undef DISABLE_CPUINFO */
   4.128  
   4.129  #endif /* _SDL_config_h */
     5.1 --- a/include/SDL_config.h.in	Thu Feb 09 09:07:13 2006 +0000
     5.2 +++ b/include/SDL_config.h.in	Thu Feb 09 09:38:05 2006 +0000
     5.3 @@ -43,6 +43,9 @@
     5.4  #undef uint64_t
     5.5  #undef uintptr_t
     5.6  
     5.7 +/* Endianness */
     5.8 +#undef SDL_BYTEORDER
     5.9 +
    5.10  /* Comment this if you want to build without any C library requirements */
    5.11  #undef HAVE_LIBC
    5.12  #ifdef HAVE_LIBC
    5.13 @@ -124,7 +127,6 @@
    5.14  #undef DISABLE_CDROM
    5.15  #undef DISABLE_THREADS
    5.16  #undef DISABLE_TIMERS
    5.17 -#undef DISABLE_ENDIAN
    5.18  #undef DISABLE_FILE
    5.19  #undef DISABLE_CPUINFO
    5.20  
     6.1 --- a/include/SDL_endian.h	Thu Feb 09 09:07:13 2006 +0000
     6.2 +++ b/include/SDL_endian.h	Thu Feb 09 09:38:05 2006 +0000
     6.3 @@ -25,22 +25,26 @@
     6.4  #ifndef _SDL_endian_h
     6.5  #define _SDL_endian_h
     6.6  
     6.7 -/* These functions read and write data of the specified endianness, 
     6.8 -   dynamically translating to the host machine endianness.
     6.9 +#include "SDL_stdinc.h"
    6.10  
    6.11 -   e.g.: If you want to read a 16 bit value on big-endian machine from
    6.12 -         an open file containing little endian values, you would use:
    6.13 -		value = SDL_ReadLE16(rp);
    6.14 -         Note that the read/write functions use SDL_RWops pointers
    6.15 -         instead of FILE pointers.  This allows you to read and write
    6.16 -         endian values from large chunks of memory as well as files 
    6.17 -         and other data sources.
    6.18 -*/
    6.19 +/* The two types of endianness */
    6.20 +#define SDL_LIL_ENDIAN	1234
    6.21 +#define SDL_BIG_ENDIAN	4321
    6.22  
    6.23 -#include "SDL_types.h"
    6.24 -//#warning FIXME: move rwops into rwops and swapping into byteorder.h
    6.25 -#include "SDL_rwops.h"
    6.26 -#include "SDL_byteorder.h"
    6.27 +#ifndef SDL_BYTEORDER	/* Not defined in SDL_config.h? */
    6.28 +#if (defined(__i386__) || defined(__i386)) || \
    6.29 +     defined(__ia64__) || defined(__x86_64__) || \
    6.30 +    (defined(__alpha__) || defined(__alpha)) || \
    6.31 +    (defined(__arm__) || defined(__thumb__)) || \
    6.32 +    (defined(__sh__) || defined(__sh64__)) || \
    6.33 +    (defined(__mips__) && defined(__MIPSEL__)) || \
    6.34 +     defined(__SYMBIAN32__) || defined(__OS2__)
    6.35 +#define SDL_BYTEORDER	SDL_LIL_ENDIAN
    6.36 +#else
    6.37 +#define SDL_BYTEORDER	SDL_BIG_ENDIAN
    6.38 +#endif
    6.39 +#endif /* !SDL_BYTEORDER */
    6.40 +
    6.41  
    6.42  #include "begin_code.h"
    6.43  /* Set up for C function definitions, even when using C++ */
    6.44 @@ -180,23 +184,6 @@
    6.45  #define SDL_SwapBE64(X)	(X)
    6.46  #endif
    6.47  
    6.48 -/* Read an item of the specified endianness and return in native format */
    6.49 -extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
    6.50 -extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
    6.51 -extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
    6.52 -extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
    6.53 -extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
    6.54 -extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
    6.55 -
    6.56 -/* Write an item of native format to the specified endianness */
    6.57 -extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
    6.58 -extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
    6.59 -extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
    6.60 -extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
    6.61 -extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
    6.62 -extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
    6.63 -
    6.64 -
    6.65  /* Ends C function definitions when using C++ */
    6.66  #ifdef __cplusplus
    6.67  }
     7.1 --- a/include/SDL_getenv.h	Thu Feb 09 09:07:13 2006 +0000
     7.2 +++ b/include/SDL_getenv.h	Thu Feb 09 09:38:05 2006 +0000
     7.3 @@ -20,4 +20,5 @@
     7.4      slouken@libsdl.org
     7.5  */
     7.6  
     7.7 +/* DEPRECATED */
     7.8  #include "SDL_stdinc.h"
     8.1 --- a/include/SDL_rwops.h	Thu Feb 09 09:07:13 2006 +0000
     8.2 +++ b/include/SDL_rwops.h	Thu Feb 09 09:38:05 2006 +0000
     8.3 @@ -27,14 +27,9 @@
     8.4  #ifndef _SDL_RWops_h
     8.5  #define _SDL_RWops_h
     8.6  
     8.7 -#include "SDL_config.h"
     8.8 +#include "SDL_stdinc.h"
     8.9  
    8.10 -#ifdef HAVE_STDIO_H
    8.11 -#include <stdio.h>
    8.12 -#endif
    8.13 -
    8.14 -#include "SDL_types.h"
    8.15 -
    8.16 +#ifndef DISABLE_FILE
    8.17  #include "begin_code.h"
    8.18  /* Set up for C function definitions, even when using C++ */
    8.19  #ifdef __cplusplus
    8.20 @@ -112,10 +107,28 @@
    8.21  #define SDL_RWclose(ctx)		(ctx)->close(ctx)
    8.22  
    8.23  
    8.24 +/* Read an item of the specified endianness and return in native format */
    8.25 +extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
    8.26 +extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
    8.27 +extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
    8.28 +extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
    8.29 +extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
    8.30 +extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
    8.31 +
    8.32 +/* Write an item of native format to the specified endianness */
    8.33 +extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
    8.34 +extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
    8.35 +extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
    8.36 +extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
    8.37 +extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
    8.38 +extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
    8.39 +
    8.40 +
    8.41  /* Ends C function definitions when using C++ */
    8.42  #ifdef __cplusplus
    8.43  }
    8.44  #endif
    8.45  #include "close_code.h"
    8.46 +#endif /* !DISABLE_FILE */
    8.47  
    8.48  #endif /* _SDL_RWops_h */
     9.1 --- a/include/SDL_types.h	Thu Feb 09 09:07:13 2006 +0000
     9.2 +++ b/include/SDL_types.h	Thu Feb 09 09:38:05 2006 +0000
     9.3 @@ -20,4 +20,5 @@
     9.4      slouken@libsdl.org
     9.5  */
     9.6  
     9.7 +/* DEPRECATED */
     9.8  #include "SDL_stdinc.h"
    10.1 --- a/src/Makefile.am	Thu Feb 09 09:07:13 2006 +0000
    10.2 +++ b/src/Makefile.am	Thu Feb 09 09:38:05 2006 +0000
    10.3 @@ -7,7 +7,7 @@
    10.4  
    10.5  # These are the subdirectories which may be built
    10.6  EXTRA_SUBDIRS =			\
    10.7 -	 audio video events joystick cdrom thread timer endian file cpuinfo hermes
    10.8 +	 audio video events joystick cdrom thread timer file cpuinfo hermes
    10.9  
   10.10  # These are the subdirectories which will be built now
   10.11  SUBDIRS = $(CORE_SUBDIRS) @SDL_EXTRADIRS@
    11.1 --- a/src/endian/Makefile.am	Thu Feb 09 09:07:13 2006 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,11 +0,0 @@
    11.4 -
    11.5 -## Makefile.am for the SDL endian library
    11.6 -
    11.7 -noinst_LTLIBRARIES = libendian.la
    11.8 -
    11.9 -# Include the architecture-independent sources
   11.10 -COMMON_SRCS =			\
   11.11 -	SDL_endian.c
   11.12 -
   11.13 -libendian_la_SOURCES = $(COMMON_SRCS)
   11.14 -
    12.1 --- a/src/endian/Makefile.wat	Thu Feb 09 09:07:13 2006 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,24 +0,0 @@
    12.4 -#=============================================================================
    12.5 -#          This is a Watcom makefile to build SDL.DLL for OS/2
    12.6 -#
    12.7 -# Makefile for endianness
    12.8 -#=============================================================================
    12.9 -
   12.10 -object_files=SDL_endian.obj
   12.11 -ExtraCFlags=
   12.12 -
   12.13 -#
   12.14 -#==============================================================================
   12.15 -#
   12.16 -!include ..\..\Watcom.mif
   12.17 -
   12.18 -.before
   12.19 -    set include=$(%os2tk)\h;$(%include);../../include
   12.20 -
   12.21 -all : $(object_files)
   12.22 -
   12.23 -clean : .SYMBOLIC
   12.24 -        @if exist *.obj del *.obj
   12.25 -        @if exist *.map del *.map
   12.26 -        @if exist *.res del *.res
   12.27 -        @if exist *.lst del *.lst
    13.1 --- a/src/endian/SDL_endian.c	Thu Feb 09 09:07:13 2006 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,99 +0,0 @@
    13.4 -/*
    13.5 -    SDL - Simple DirectMedia Layer
    13.6 -    Copyright (C) 1997-2006 Sam Lantinga
    13.7 -
    13.8 -    This library is free software; you can redistribute it and/or
    13.9 -    modify it under the terms of the GNU Lesser General Public
   13.10 -    License as published by the Free Software Foundation; either
   13.11 -    version 2.1 of the License, or (at your option) any later version.
   13.12 -
   13.13 -    This library is distributed in the hope that it will be useful,
   13.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.16 -    Lesser General Public License for more details.
   13.17 -
   13.18 -    You should have received a copy of the GNU Lesser General Public
   13.19 -    License along with this library; if not, write to the Free Software
   13.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   13.21 -
   13.22 -    Sam Lantinga
   13.23 -    slouken@libsdl.org
   13.24 -*/
   13.25 -
   13.26 -/* Functions for dynamically reading and writing endian-specific values */
   13.27 -
   13.28 -#include "SDL_endian.h"
   13.29 -
   13.30 -Uint16 SDL_ReadLE16 (SDL_RWops *src)
   13.31 -{
   13.32 -	Uint16 value;
   13.33 -
   13.34 -	SDL_RWread(src, &value, (sizeof value), 1);
   13.35 -	return(SDL_SwapLE16(value));
   13.36 -}
   13.37 -Uint16 SDL_ReadBE16 (SDL_RWops *src)
   13.38 -{
   13.39 -	Uint16 value;
   13.40 -
   13.41 -	SDL_RWread(src, &value, (sizeof value), 1);
   13.42 -	return(SDL_SwapBE16(value));
   13.43 -}
   13.44 -Uint32 SDL_ReadLE32 (SDL_RWops *src)
   13.45 -{
   13.46 -	Uint32 value;
   13.47 -
   13.48 -	SDL_RWread(src, &value, (sizeof value), 1);
   13.49 -	return(SDL_SwapLE32(value));
   13.50 -}
   13.51 -Uint32 SDL_ReadBE32 (SDL_RWops *src)
   13.52 -{
   13.53 -	Uint32 value;
   13.54 -
   13.55 -	SDL_RWread(src, &value, (sizeof value), 1);
   13.56 -	return(SDL_SwapBE32(value));
   13.57 -}
   13.58 -Uint64 SDL_ReadLE64 (SDL_RWops *src)
   13.59 -{
   13.60 -	Uint64 value;
   13.61 -
   13.62 -	SDL_RWread(src, &value, (sizeof value), 1);
   13.63 -	return(SDL_SwapLE64(value));
   13.64 -}
   13.65 -Uint64 SDL_ReadBE64 (SDL_RWops *src)
   13.66 -{
   13.67 -	Uint64 value;
   13.68 -
   13.69 -	SDL_RWread(src, &value, (sizeof value), 1);
   13.70 -	return(SDL_SwapBE64(value));
   13.71 -}
   13.72 -
   13.73 -int SDL_WriteLE16 (SDL_RWops *dst, Uint16 value)
   13.74 -{
   13.75 -	value = SDL_SwapLE16(value);
   13.76 -	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   13.77 -}
   13.78 -int SDL_WriteBE16 (SDL_RWops *dst, Uint16 value)
   13.79 -{
   13.80 -	value = SDL_SwapBE16(value);
   13.81 -	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   13.82 -}
   13.83 -int SDL_WriteLE32 (SDL_RWops *dst, Uint32 value)
   13.84 -{
   13.85 -	value = SDL_SwapLE32(value);
   13.86 -	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   13.87 -}
   13.88 -int SDL_WriteBE32 (SDL_RWops *dst, Uint32 value)
   13.89 -{
   13.90 -	value = SDL_SwapBE32(value);
   13.91 -	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   13.92 -}
   13.93 -int SDL_WriteLE64 (SDL_RWops *dst, Uint64 value)
   13.94 -{
   13.95 -	value = SDL_SwapLE64(value);
   13.96 -	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   13.97 -}
   13.98 -int SDL_WriteBE64 (SDL_RWops *dst, Uint64 value)
   13.99 -{
  13.100 -	value = SDL_SwapBE64(value);
  13.101 -	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
  13.102 -}
    14.1 --- a/src/file/SDL_rwops.c	Thu Feb 09 09:07:13 2006 +0000
    14.2 +++ b/src/file/SDL_rwops.c	Thu Feb 09 09:38:05 2006 +0000
    14.3 @@ -24,11 +24,11 @@
    14.4     data sources.  It can easily be extended to files, memory, etc.
    14.5  */
    14.6  
    14.7 -#include "SDL_stdlib.h"
    14.8 -#include "SDL_string.h"
    14.9  #include "SDL_error.h"
   14.10 +#include "SDL_endian.h"
   14.11  #include "SDL_rwops.h"
   14.12  
   14.13 +
   14.14  #ifdef HAVE_STDIO_H
   14.15  
   14.16  /* Functions to read/write stdio file pointers */
   14.17 @@ -303,3 +303,79 @@
   14.18  {
   14.19  	SDL_free(area);
   14.20  }
   14.21 +
   14.22 +/* Functions for dynamically reading and writing endian-specific values */
   14.23 +
   14.24 +Uint16 SDL_ReadLE16 (SDL_RWops *src)
   14.25 +{
   14.26 +	Uint16 value;
   14.27 +
   14.28 +	SDL_RWread(src, &value, (sizeof value), 1);
   14.29 +	return(SDL_SwapLE16(value));
   14.30 +}
   14.31 +Uint16 SDL_ReadBE16 (SDL_RWops *src)
   14.32 +{
   14.33 +	Uint16 value;
   14.34 +
   14.35 +	SDL_RWread(src, &value, (sizeof value), 1);
   14.36 +	return(SDL_SwapBE16(value));
   14.37 +}
   14.38 +Uint32 SDL_ReadLE32 (SDL_RWops *src)
   14.39 +{
   14.40 +	Uint32 value;
   14.41 +
   14.42 +	SDL_RWread(src, &value, (sizeof value), 1);
   14.43 +	return(SDL_SwapLE32(value));
   14.44 +}
   14.45 +Uint32 SDL_ReadBE32 (SDL_RWops *src)
   14.46 +{
   14.47 +	Uint32 value;
   14.48 +
   14.49 +	SDL_RWread(src, &value, (sizeof value), 1);
   14.50 +	return(SDL_SwapBE32(value));
   14.51 +}
   14.52 +Uint64 SDL_ReadLE64 (SDL_RWops *src)
   14.53 +{
   14.54 +	Uint64 value;
   14.55 +
   14.56 +	SDL_RWread(src, &value, (sizeof value), 1);
   14.57 +	return(SDL_SwapLE64(value));
   14.58 +}
   14.59 +Uint64 SDL_ReadBE64 (SDL_RWops *src)
   14.60 +{
   14.61 +	Uint64 value;
   14.62 +
   14.63 +	SDL_RWread(src, &value, (sizeof value), 1);
   14.64 +	return(SDL_SwapBE64(value));
   14.65 +}
   14.66 +
   14.67 +int SDL_WriteLE16 (SDL_RWops *dst, Uint16 value)
   14.68 +{
   14.69 +	value = SDL_SwapLE16(value);
   14.70 +	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   14.71 +}
   14.72 +int SDL_WriteBE16 (SDL_RWops *dst, Uint16 value)
   14.73 +{
   14.74 +	value = SDL_SwapBE16(value);
   14.75 +	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   14.76 +}
   14.77 +int SDL_WriteLE32 (SDL_RWops *dst, Uint32 value)
   14.78 +{
   14.79 +	value = SDL_SwapLE32(value);
   14.80 +	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   14.81 +}
   14.82 +int SDL_WriteBE32 (SDL_RWops *dst, Uint32 value)
   14.83 +{
   14.84 +	value = SDL_SwapBE32(value);
   14.85 +	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   14.86 +}
   14.87 +int SDL_WriteLE64 (SDL_RWops *dst, Uint64 value)
   14.88 +{
   14.89 +	value = SDL_SwapLE64(value);
   14.90 +	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   14.91 +}
   14.92 +int SDL_WriteBE64 (SDL_RWops *dst, Uint64 value)
   14.93 +{
   14.94 +	value = SDL_SwapBE64(value);
   14.95 +	return(SDL_RWwrite(dst, &value, (sizeof value), 1));
   14.96 +}
    15.1 --- a/src/stdlib/SDL_getenv.c	Thu Feb 09 09:07:13 2006 +0000
    15.2 +++ b/src/stdlib/SDL_getenv.c	Thu Feb 09 09:38:05 2006 +0000
    15.3 @@ -20,8 +20,7 @@
    15.4      slouken@libsdl.org
    15.5  */
    15.6  
    15.7 -#include "SDL_stdlib.h"
    15.8 -#include "SDL_string.h"
    15.9 +#include "SDL_stdinc.h"
   15.10  
   15.11  #ifndef HAVE_GETENV
   15.12  
    16.1 --- a/src/stdlib/SDL_malloc.c	Thu Feb 09 09:07:13 2006 +0000
    16.2 +++ b/src/stdlib/SDL_malloc.c	Thu Feb 09 09:38:05 2006 +0000
    16.3 @@ -23,8 +23,7 @@
    16.4  
    16.5  /* This file contains portable memory management functions for SDL */
    16.6  
    16.7 -#include "SDL_stdlib.h"
    16.8 -#include "SDL_string.h"
    16.9 +#include "SDL_stdinc.h"
   16.10  
   16.11  #ifndef HAVE_MALLOC
   16.12  
    17.1 --- a/src/stdlib/SDL_qsort.c	Thu Feb 09 09:07:13 2006 +0000
    17.2 +++ b/src/stdlib/SDL_qsort.c	Thu Feb 09 09:38:05 2006 +0000
    17.3 @@ -47,8 +47,7 @@
    17.4  #include <stdlib.h>
    17.5  #include <string.h>
    17.6  */
    17.7 -#include "SDL_stdlib.h"
    17.8 -#include "SDL_string.h"
    17.9 +#include "SDL_stdinc.h"
   17.10  
   17.11  #define assert(X)
   17.12  #define malloc	SDL_malloc
    18.1 --- a/src/stdlib/SDL_stdlib.c	Thu Feb 09 09:07:13 2006 +0000
    18.2 +++ b/src/stdlib/SDL_stdlib.c	Thu Feb 09 09:38:05 2006 +0000
    18.3 @@ -23,7 +23,7 @@
    18.4  
    18.5  /* This file contains portable stdlib functions for SDL */
    18.6  
    18.7 -#include "SDL_stdlib.h"
    18.8 +#include "SDL_stdinc.h"
    18.9  
   18.10  #ifndef HAVE_LIBC
   18.11  /* These are some C runtime intrinsics that need to be defined */
    19.1 --- a/src/stdlib/SDL_string.c	Thu Feb 09 09:07:13 2006 +0000
    19.2 +++ b/src/stdlib/SDL_string.c	Thu Feb 09 09:38:05 2006 +0000
    19.3 @@ -23,14 +23,11 @@
    19.4  
    19.5  /* This file contains portable string manipulation functions for SDL */
    19.6  
    19.7 -#include "SDL_types.h"
    19.8 -#include "SDL_ctype.h"
    19.9 -#include "SDL_stdlib.h"
   19.10 -#include "SDL_string.h"
   19.11 +#include "SDL_stdinc.h"
   19.12  
   19.13  
   19.14 -#define isupperhex(X)   (((X) >= 'A') && ((X) <= 'F'))
   19.15 -#define islowerhex(X)   (((X) >= 'a') && ((X) <= 'f'))
   19.16 +#define SDL_isupperhex(X)   (((X) >= 'A') && ((X) <= 'F'))
   19.17 +#define SDL_islowerhex(X)   (((X) >= 'a') && ((X) <= 'f'))
   19.18  
   19.19  #if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOL)
   19.20  static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
   19.21 @@ -48,11 +45,11 @@
   19.22      }
   19.23      for ( ; ; ) {
   19.24          int v;
   19.25 -        if ( isdigit(*text) ) {
   19.26 +        if ( SDL_isdigit(*text) ) {
   19.27              v = *text - '0';
   19.28 -        } else if ( radix == 16 && isupperhex(*text) ) {
   19.29 +        } else if ( radix == 16 && SDL_isupperhex(*text) ) {
   19.30              v = 10 + (*text - 'A');
   19.31 -        } else if ( radix == 16 && islowerhex(*text) ) {
   19.32 +        } else if ( radix == 16 && SDL_islowerhex(*text) ) {
   19.33              v = 10 + (*text - 'a');
   19.34          } else {
   19.35              break;
   19.36 @@ -83,11 +80,11 @@
   19.37      }
   19.38      for ( ; ; ) {
   19.39          int v;
   19.40 -        if ( isdigit(*text) ) {
   19.41 +        if ( SDL_isdigit(*text) ) {
   19.42              v = *text - '0';
   19.43 -        } else if ( radix == 16 && isupperhex(*text) ) {
   19.44 +        } else if ( radix == 16 && SDL_isupperhex(*text) ) {
   19.45              v = 10 + (*text - 'A');
   19.46 -        } else if ( radix == 16 && islowerhex(*text) ) {
   19.47 +        } else if ( radix == 16 && SDL_islowerhex(*text) ) {
   19.48              v = 10 + (*text - 'a');
   19.49          } else {
   19.50              break;
   19.51 @@ -120,11 +117,11 @@
   19.52      }
   19.53      for ( ; ; ) {
   19.54          int v;
   19.55 -        if ( isdigit(*text) ) {
   19.56 +        if ( SDL_isdigit(*text) ) {
   19.57              v = *text - '0';
   19.58 -        } else if ( radix == 16 && isupperhex(*text) ) {
   19.59 +        } else if ( radix == 16 && SDL_isupperhex(*text) ) {
   19.60              v = 10 + (*text - 'A');
   19.61 -        } else if ( radix == 16 && islowerhex(*text) ) {
   19.62 +        } else if ( radix == 16 && SDL_islowerhex(*text) ) {
   19.63              v = 10 + (*text - 'a');
   19.64          } else {
   19.65              break;
   19.66 @@ -155,11 +152,11 @@
   19.67      }
   19.68      for ( ; ; ) {
   19.69          int v;
   19.70 -        if ( isdigit(*text) ) {
   19.71 +        if ( SDL_isdigit(*text) ) {
   19.72              v = *text - '0';
   19.73 -        } else if ( radix == 16 && isupperhex(*text) ) {
   19.74 +        } else if ( radix == 16 && SDL_isupperhex(*text) ) {
   19.75              v = 10 + (*text - 'A');
   19.76 -        } else if ( radix == 16 && islowerhex(*text) ) {
   19.77 +        } else if ( radix == 16 && SDL_islowerhex(*text) ) {
   19.78              v = 10 + (*text - 'a');
   19.79          } else {
   19.80              break;
   19.81 @@ -193,7 +190,7 @@
   19.82      if ( *text == '.' ) {
   19.83          int mult = 10;
   19.84          ++text;
   19.85 -        while ( isdigit(*text) ) {
   19.86 +        while ( SDL_isdigit(*text) ) {
   19.87              lvalue = *text - '0';
   19.88              value += (double)lvalue / mult;
   19.89              mult *= 10;
   19.90 @@ -632,7 +629,7 @@
   19.91      va_start(ap, fmt);
   19.92      while ( *fmt ) {
   19.93          if ( *fmt == ' ' ) {
   19.94 -            while ( isspace(*text) ) {
   19.95 +            while ( SDL_isspace(*text) ) {
   19.96                  ++text;
   19.97              }
   19.98              ++fmt;
   19.99 @@ -683,7 +680,7 @@
  19.100                  continue;
  19.101              }
  19.102  
  19.103 -            while ( isspace(*text) ) {
  19.104 +            while ( SDL_isspace(*text) ) {
  19.105                  ++text;
  19.106              }
  19.107  
  19.108 @@ -845,7 +842,7 @@
  19.109                          break;
  19.110                      case 's':
  19.111                          if ( suppress ) {
  19.112 -                            while ( !isspace(*text) ) {
  19.113 +                            while ( !SDL_isspace(*text) ) {
  19.114                                  ++text;
  19.115                                  if ( count ) {
  19.116                                      if ( --count == 0 ) {
  19.117 @@ -855,7 +852,7 @@
  19.118                              }
  19.119                          } else {
  19.120                              char *valuep = va_arg(ap, char*);
  19.121 -                            while ( !isspace(*text) ) {
  19.122 +                            while ( !SDL_isspace(*text) ) {
  19.123                                  *valuep++ = *text++;
  19.124                                  if ( count ) {
  19.125                                      if ( --count == 0 ) {