Mercurial > sdl-ios-xcode
changeset 1353:7ba544e2888d
Started the process of improving configure support, and merging C types
and library support into a single header.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 09 Feb 2006 09:07:13 +0000 |
parents | c643342f3f33 |
children | 22f39393668a |
files | configure.in include/SDL.h include/SDL_active.h include/SDL_audio.h include/SDL_byteorder.h include/SDL_cdrom.h include/SDL_config.h include/SDL_config.h.in include/SDL_config.h.minimal include/SDL_cpuinfo.h include/SDL_ctype.h include/SDL_endian.h include/SDL_getenv.h include/SDL_stdlib.h include/SDL_string.h include/SDL_types.h |
diffstat | 16 files changed, 155 insertions(+), 643 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Thu Feb 09 05:46:55 2006 +0000 +++ b/configure.in Thu Feb 09 09:07:13 2006 +0000 @@ -1,6 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(README) AC_CONFIG_HEADER(include/SDL_config.h) +AC_GNU_SOURCE dnl Set various version strings - taken gratefully from the GTk sources # @@ -53,11 +54,8 @@ AM_PROG_LIBTOOL AC_PROG_MAKE_SET AC_PROG_CC -AC_C_INLINE -AC_C_CONST AC_PROG_CXX AC_PROG_INSTALL -AC_FUNC_ALLOCA ASFLAGS="" AC_SUBST(ASFLAGS) CCAS="$CC" @@ -122,34 +120,76 @@ [ --enable-libc Use the system C library [default=yes]], , AC_DEFINE([HAVE_LIBC])) -dnl Checks for header files. -AC_CHECK_HEADERS(alloca.h stdint.h stdlib.h stdarg.h malloc.h) -AC_CHECK_HEADERS(ctype.h) -AC_CHECK_HEADERS(string.h) -AC_CHECK_HEADERS(stdio.h) -AC_CHECK_HEADERS(signal.h) - -dnl Checks for typedefs, structures, and compiler characteristics. +dnl Check for compiler characteristics AC_C_CONST AC_C_INLINE +AC_C_VOLATILE + +dnl Check for header files +AC_HEADER_STDC +AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h signal.h) + +dnl Check for typedefs, structures, etc. AC_TYPE_SIZE_T -AC_CHECK_SIZEOF(char, 1) -AC_CHECK_SIZEOF(short, 2) -AC_CHECK_SIZEOF(int, 4) -AC_CHECK_SIZEOF(long, 4) -AC_CHECK_SIZEOF(long long, 8) +if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then + AC_CHECK_TYPE(int64_t) + if test x$ac_cv_type_int64_t = xyes; then + AC_DEFINE(SDL_HAS_64BIT_TYPE) + fi +else + AC_CHECK_SIZEOF(char, 1) + AC_CHECK_SIZEOF(short, 2) + AC_CHECK_SIZEOF(int, 4) + AC_CHECK_SIZEOF(long, 4) + AC_CHECK_SIZEOF(long long, 8) + if test x$ac_cv_sizeof_char = x1; then + AC_DEFINE(int8_t, signed char) + AC_DEFINE(uint8_t, unsigned char) + fi + if test x$ac_cv_sizeof_short = x2; then + AC_DEFINE(int16_t, signed short) + AC_DEFINE(uint16_t, unsigned short) + else + if test x$ac_cv_sizeof_int = x2; then + AC_DEFINE(int16_t, signed int) + AC_DEFINE(uint16_t, unsigned int) + fi + fi + if test x$ac_cv_sizeof_int = x4; then + AC_DEFINE(int32_t, signed int) + AC_DEFINE(uint32_t, unsigned int) + else + if test x$ac_cv_sizeof_long = x4; then + AC_DEFINE(int32_t, signed long) + AC_DEFINE(uint32_t, unsigned long) + fi + fi + if test x$ac_cv_sizeof_long = x8; then + AC_DEFINE(int64_t, signed long) + AC_DEFINE(uint64_t, unsigned long) + AC_DEFINE(SDL_HAS_64BIT_TYPE) + else + if test x$ac_cv_sizeof_long_long = x8; then + AC_DEFINE(int64_t, signed long long) + AC_DEFINE(uint64_t, unsigned long long) + AC_DEFINE(SDL_HAS_64BIT_TYPE) + fi + fi + AC_CHECK_TYPE(uintptr_t, unsigned long) +fi dnl Checks for library functions. AC_FUNC_ALLOCA -AC_CHECK_FUNCS(malloc calloc realloc free) -AC_CHECK_FUNCS(getenv putenv unsetenv qsort abs) -AC_CHECK_FUNCS(memset memcpy memmove memcmp) -AC_CHECK_FUNCS(strlen strcpy strncpy strcat strncat strdup) -AC_CHECK_FUNCS(_strrev _strupr _strlwr) -AC_CHECK_FUNCS(strchr strrchr strstr) -AC_CHECK_FUNCS(itoa _ltoa _uitoa _ultoa strtol _i64toa _ui64toa strtoll strtod atoi atof) -AC_CHECK_FUNCS(strcmp strncmp stricmp strcasecmp) -AC_CHECK_FUNCS(sscanf snprintf vsnprintf) +AC_FUNC_MEMCMP +if test x$ac_cv_func_memcmp_working = xyes; then + AC_DEFINE(HAVE_MEMCMP) +fi +AC_FUNC_STRTOD +if test x$ac_cv_func_strtod = xyes; then + AC_DEFINE(HAVE_STRTOD) +fi +AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strcpy strncpy strcat strncat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol _i64toa _ui64toa strtoll atoi atof strcmp strncmp stricmp strcasecmp sscanf snprintf vsnprint) + dnl Initialize the compiler and linker flags for SDL applications
--- a/include/SDL.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL.h Thu Feb 09 09:07:13 2006 +0000 @@ -25,10 +25,8 @@ #ifndef _SDL_H #define _SDL_H -#include "SDL_config.h" +#include "SDL_stdinc.h" #include "SDL_main.h" -#include "SDL_types.h" -#include "SDL_getenv.h" #include "SDL_error.h" #include "SDL_rwops.h" #include "SDL_timer.h" @@ -37,9 +35,9 @@ #include "SDL_joystick.h" #include "SDL_events.h" #include "SDL_video.h" +#include "SDL_loadso.h" #include "SDL_byteorder.h" #include "SDL_version.h" -#include "SDL_loadso.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */
--- a/include/SDL_active.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_active.h Thu Feb 09 09:07:13 2006 +0000 @@ -25,6 +25,9 @@ #ifndef _SDL_active_h #define _SDL_active_h +#include "SDL_stdinc.h" + +#ifndef DISABLE_EVENTS #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -51,5 +54,6 @@ } #endif #include "close_code.h" +#endif /* !DISABLE_EVENTS */ #endif /* _SDL_active_h */
--- a/include/SDL_audio.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_audio.h Thu Feb 09 09:07:13 2006 +0000 @@ -25,12 +25,13 @@ #ifndef _SDL_audio_h #define _SDL_audio_h +#include "SDL_stdinc.h" #include "SDL_main.h" -#include "SDL_types.h" #include "SDL_error.h" #include "SDL_rwops.h" #include "SDL_byteorder.h" +#ifndef DISABLE_AUDIO #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -248,5 +249,6 @@ } #endif #include "close_code.h" +#endif /* !DISABLE_AUDIO */ #endif /* _SDL_audio_h */
--- a/include/SDL_byteorder.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_byteorder.h Thu Feb 09 09:07:13 2006 +0000 @@ -25,38 +25,24 @@ #ifndef _SDL_byteorder_h #define _SDL_byteorder_h +#include "SDL_config.h" + /* The two types of endianness */ #define SDL_LIL_ENDIAN 1234 #define SDL_BIG_ENDIAN 4321 -#ifdef __linux__ -# include <endian.h> -# if BYTE_ORDER == LITTLE_ENDIAN -# define SDL_BYTEORDER SDL_LIL_ENDIAN -# else -# define SDL_BYTEORDER SDL_BIG_ENDIAN -# endif - -#else - -/* Pardon the mess, I'm trying to determine the endianness of this host. - I'm doing it by preprocessor defines rather than some sort of configure - script so that application code can use this too. The "right" way would - be to dynamically generate this file on install, but that's a lot of work. - */ +#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ #if (defined(__i386__) || defined(__i386)) || \ - defined(__ia64__) || defined(WIN32) || \ + defined(__ia64__) || defined(__x86_64__) || \ (defined(__alpha__) || defined(__alpha)) || \ (defined(__arm__) || defined(__thumb__)) || \ (defined(__sh__) || defined(__sh64__)) || \ (defined(__mips__) && defined(__MIPSEL__)) || \ - defined(__SYMBIAN32__) || defined(__x86_64__) || \ - defined(__OS2__) || defined(__LITTLE_ENDIAN__) + defined(__SYMBIAN32__) || defined(__OS2__) #define SDL_BYTEORDER SDL_LIL_ENDIAN #else #define SDL_BYTEORDER SDL_BIG_ENDIAN #endif - -#endif /* __linux__ */ +#endif /* !SDL_BYTEORDER */ #endif /* _SDL_byteorder_h */
--- a/include/SDL_cdrom.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_cdrom.h Thu Feb 09 09:07:13 2006 +0000 @@ -25,8 +25,9 @@ #ifndef _SDL_cdrom_h #define _SDL_cdrom_h -#include "SDL_types.h" +#include "SDL_stdinc.h" +#ifndef DISABLE_CDROM #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -166,5 +167,6 @@ } #endif #include "close_code.h" +#endif /* !DISABLE_CDROM */ #endif /* _SDL_video_h */
--- a/include/SDL_config.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_config.h Thu Feb 09 09:07:13 2006 +0000 @@ -25,6 +25,15 @@ /* This is the minimal configuration that can be used to build SDL */ -#define HAVE_STDARG_H 1 +#include <stdarg.h> + +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef unsigned int size_t; +typedef unsigned long uintptr_t; #endif /* _SDL_config_h */
--- a/include/SDL_config.h.in Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_config.h.in Thu Feb 09 09:07:13 2006 +0000 @@ -25,23 +25,44 @@ /* This is a set of defines to configure the SDL features */ -#undef HAVE_STDARG_H +/* C language features */ +#undef const +#undef inline +#undef volatile -/* Comment this if you want to build without any libc requirements */ +/* C datatypes */ +#undef size_t +#undef int8_t +#undef uint8_t +#undef int16_t +#undef uint16_t +#undef int32_t +#undef uint32_t +#undef SDL_HAS_64BIT_TYPE +#undef int64_t +#undef uint64_t +#undef uintptr_t + +/* Comment this if you want to build without any C library requirements */ #undef HAVE_LIBC #ifdef HAVE_LIBC -/* Various C library headers */ +/* Useful headers */ +#undef HAVE_SYS_TYPES_H #undef HAVE_STDIO_H +#undef STDC_HEADERS #undef HAVE_STDLIB_H +#undef HAVE_STDARG_H #undef HAVE_MALLOC_H +#undef HAVE_MEMORY_H #undef HAVE_STRING_H +#undef HAVE_STRINGS_H +#undef HAVE_INTTYPES_H +#undef HAVE_STDINT_H #undef HAVE_CTYPE_H -#ifndef _WIN32_WCE #undef HAVE_SIGNAL_H -#endif /* !_WIN32_WCE */ -/* Features provided by SDL_stdlib.h */ +/* C library functions */ #undef HAVE_MALLOC #undef HAVE_CALLOC #undef HAVE_REALLOC @@ -54,8 +75,7 @@ #endif #undef HAVE_QSORT #undef HAVE_ABS - -/* Features provided by SDL_string.h */ +#undef HAVE_BCOPY #undef HAVE_MEMSET #undef HAVE_MEMCPY #undef HAVE_MEMMOVE @@ -69,6 +89,8 @@ #undef HAVE__STRREV #undef HAVE__STRUPR #undef HAVE__STRLWR +#undef HAVE_INDEX +#undef HAVE_RINDEX #undef HAVE_STRCHR #undef HAVE_STRRCHR #undef HAVE_STRSTR @@ -93,4 +115,17 @@ #endif /* HAVE_LIBC */ + +/* Allow disabling of core subsystems */ +#undef DISABLE_AUDIO +#undef DISABLE_VIDEO +#undef DISABLE_EVENTS +#undef DISABLE_JOYSTICK +#undef DISABLE_CDROM +#undef DISABLE_THREADS +#undef DISABLE_TIMERS +#undef DISABLE_ENDIAN +#undef DISABLE_FILE +#undef DISABLE_CPUINFO + #endif /* _SDL_config_h */
--- a/include/SDL_config.h.minimal Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_config.h.minimal Thu Feb 09 09:07:13 2006 +0000 @@ -25,6 +25,15 @@ /* This is the minimal configuration that can be used to build SDL */ -#define HAVE_STDARG_H 1 +#include <stdarg.h> + +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef unsigned int size_t; +typedef unsigned long uintptr_t; #endif /* _SDL_config_h */
--- a/include/SDL_cpuinfo.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_cpuinfo.h Thu Feb 09 09:07:13 2006 +0000 @@ -23,9 +23,12 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* CPU feature detection for SDL */ +#include "SDL_stdinc.h" + #ifndef _SDL_cpuinfo_h #define _SDL_cpuinfo_h +#ifndef DISABLE_CPUINFO #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -69,5 +72,6 @@ } #endif #include "close_code.h" +#endif /* !DISABLE_CPUINFO */ #endif /* _SDL_cpuinfo_h */
--- a/include/SDL_ctype.h Thu Feb 09 05:46:55 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2006 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -/* This file contains portable character manipulation functions for SDL */ - -#ifndef _SDL_CTYPE_H_ -#define _SDL_CTYPE_H_ - -#include "SDL_config.h" - -#ifdef HAVE_CTYPE_H -#include <ctype.h> -#else -#define isdigit(X) (((X) >= '0') && ((X) <= '9')) -#define isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n')) -#define toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X)) -#define tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X)) -#endif - -#endif /* _SDL_CTYPE_H_ */
--- a/include/SDL_endian.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_endian.h Thu Feb 09 09:07:13 2006 +0000 @@ -38,6 +38,7 @@ */ #include "SDL_types.h" +//#warning FIXME: move rwops into rwops and swapping into byteorder.h #include "SDL_rwops.h" #include "SDL_byteorder.h"
--- a/include/SDL_getenv.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_getenv.h Thu Feb 09 09:07:13 2006 +0000 @@ -20,4 +20,4 @@ slouken@libsdl.org */ -#include "SDL_stdlib.h" +#include "SDL_stdinc.h"
--- a/include/SDL_stdlib.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_stdlib.h Thu Feb 09 09:07:13 2006 +0000 @@ -20,103 +20,4 @@ slouken@libsdl.org */ -#ifndef _SDL_stdlib_h -#define _SDL_stdlib_h - -#include "SDL_config.h" - -/* AIX requires this to be the first thing in the file. */ -#ifndef __GNUC__ -# if HAVE_ALLOCA_H -# include <alloca.h> -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -#endif - -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif - -#include "SDL_types.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_MALLOC -#define SDL_malloc malloc -#else -extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); -#endif - -#ifdef HAVE_CALLOC -#define SDL_calloc calloc -#else -extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size); -#endif - -#ifdef HAVE_REALLOC -#define SDL_realloc realloc -#else -extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); -#endif - -#ifdef HAVE_FREE -#define SDL_free free -#else -extern DECLSPEC void SDLCALL SDL_free(void *mem); -#endif - -#ifdef HAVE_ALLOCA -#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) -#define SDL_stack_free(data) -#else -#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*count) -#define SDL_stack_free(data) SDL_free(data) -#endif - -#ifdef HAVE_GETENV -#define SDL_getenv getenv -#else -extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); -#endif - -#ifdef HAVE_PUTENV -#define SDL_putenv putenv -#else -extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); -#endif - -#ifdef HAVE_QSORT -#define SDL_qsort qsort -#else -extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, - int (*compare)(const void *, const void *)); -#endif - -#ifdef HAVE_ABS -#define SDL_abs abs -#else -#define SDL_abs(X) ((X) < 0 ? -(X) : (X)) -#endif - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_stdlib_h */ +#include "SDL_stdinc.h"
--- a/include/SDL_string.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_string.h Thu Feb 09 09:07:13 2006 +0000 @@ -20,343 +20,4 @@ slouken@libsdl.org */ -/* This file contains portable string manipulation functions for SDL */ - -#ifndef _SDL_string_h -#define _SDL_string_h - -#include "SDL_config.h" - -#ifdef HAVE_STDIO_H -#include <stdio.h> /* For snprintf() and friends */ -#endif - -#ifdef HAVE_STRING_H -#include <string.h> -#endif - -#include "SDL_types.h" -#include "SDL_stdarg.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_MEMSET -#define SDL_memset memset -#else -extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); -#endif - -#if defined(__GNUC__) && defined(i386) -#define SDL_memset4(dst, val, len) \ -do { \ - int u0, u1, u2; \ - __asm__ __volatile__ ( \ - "cld\n\t" \ - "rep ; stosl\n\t" \ - : "=&D" (u0), "=&a" (u1), "=&c" (u2) \ - : "0" (dst), "1" (val), "2" ((Uint32)(len)) \ - : "memory" ); \ -} while(0) -#endif -#ifndef SDL_memset4 -#define SDL_memset4(dst, val, len) \ -do { \ - unsigned _count = (len); \ - unsigned _n = (_count + 3) / 4; \ - Uint32 *_p = (Uint32 *)(dst); \ - Uint32 _val = (val); \ - switch (_count % 4) { \ - case 0: do { *_p++ = _val; \ - case 3: *_p++ = _val; \ - case 2: *_p++ = _val; \ - case 1: *_p++ = _val; \ - } while ( --_n ); \ - } \ -} while(0) -#endif - -#if defined(__GNUC__) && defined(i386) -#define SDL_memcpy(dst, src, len) \ -do { \ - int u0, u1, u2; \ - __asm__ __volatile__ ( \ - "cld\n\t" \ - "rep ; movsl\n\t" \ - "testb $2,%b4\n\t" \ - "je 1f\n\t" \ - "movsw\n" \ - "1:\ttestb $1,%b4\n\t" \ - "je 2f\n\t" \ - "movsb\n" \ - "2:" \ - : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ - : "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \ - : "memory" ); \ -} while(0) -#endif -#ifndef SDL_memcpy -#ifdef HAVE_MEMCPY -#define SDL_memcpy memcpy -#else -extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); -#endif -#endif - -#if defined(__GNUC__) && defined(i386) -#define SDL_memcpy4(dst, src, len) \ -do { \ - int ecx, edi, esi; \ - __asm__ __volatile__ ( \ - "cld\n\t" \ - "rep ; movsl" \ - : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \ - : "0" ((unsigned)(len)), "1" (dst), "2" (src) \ - : "memory" ); \ -} while(0) -#endif -#ifndef SDL_memcpy4 -#define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2) -#endif - -#if defined(__GNUC__) && defined(i386) -#define SDL_revcpy(dst, src, len) \ -do { \ - int u0, u1, u2; \ - char *dstp = (char *)(dst); \ - char *srcp = (char *)(src); \ - int n = (len); \ - if ( n >= 4 ) { \ - __asm__ __volatile__ ( \ - "std\n\t" \ - "rep ; movsl\n\t" \ - : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ - : "0" (n >> 2), \ - "1" (dstp+(n-4)), "2" (srcp+(n-4)) \ - : "memory" ); \ - } \ - switch (n & 3) { \ - case 3: dstp[2] = srcp[2]; \ - case 2: dstp[1] = srcp[1]; \ - case 1: dstp[0] = srcp[0]; \ - break; \ - default: \ - break; \ - } \ -} while(0) -#endif -#ifndef SDL_revcpy -extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len); -#endif - -#ifdef HAVE_MEMMOVE -#define SDL_memmove memmove -#else -#define SDL_memmove(dst, src, len) \ -do { \ - if ( dst < src ) { \ - SDL_memcpy(dst, src, len); \ - } else { \ - SDL_revcpy(dst, src, len); \ - } \ -} while(0) -#endif - -#ifdef HAVE_MEMCMP -#define SDL_memcmp memcmp -#else -extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); -#endif - -#ifdef HAVE_STRLEN -#define SDL_strlen strlen -#else -extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); -#endif - -#ifdef HAVE_STRCPY -#define SDL_strcpy strcpy -#else -extern DECLSPEC char * SDLCALL SDL_strcpy(char *dst, const char *src); -#endif - -#ifdef HAVE_STRNCPY -#define SDL_strncpy strncpy -#else -extern DECLSPEC char * SDLCALL SDL_strncpy(char *dst, const char *src, size_t maxlen); -#endif - -#ifdef HAVE_STRCAT -#define SDL_strcat strcat -#else -#define SDL_strcat(dst, src) (SDL_strcpy(dst+SDL_strlen(dst), src), dst) -#endif - -#ifdef HAVE_STRNCAT -#define SDL_strncat strncat -#else -#define SDL_strncat(dst, src, n) (SDL_strncpy(dst+SDL_strlen(dst), src, n), dst) -#endif - -#ifdef HAVE_STRDUP -#define SDL_strdup strdup -#else -extern DECLSPEC char * SDLCALL SDL_strdup(const char *string); -#endif - -#ifdef HAVE__STRREV -#define SDL_strrev _strrev -#else -extern DECLSPEC char * SDLCALL SDL_strrev(char *string); -#endif - -#ifdef HAVE__STRUPR -#define SDL_strupr _strupr -#else -extern DECLSPEC char * SDLCALL SDL_strupr(char *string); -#endif - -#ifdef HAVE__STRLWR -#define SDL_strlwr _strlwr -#else -extern DECLSPEC char * SDLCALL SDL_strlwr(char *string); -#endif - -#ifdef HAVE_STRCHR -#define SDL_strchr strchr -#else -extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c); -#endif - -#ifdef HAVE_STRRCHR -#define SDL_strrchr strrchr -#else -extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c); -#endif - -#ifdef HAVE_STRSTR -#define SDL_strstr strstr -#else -extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); -#endif - -#ifdef HAVE_ITOA -#define SDL_itoa itoa -#else -#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix) -#endif - -#ifdef HAVE__LTOA -#define SDL_ltoa _ltoa -#else -extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix); -#endif - -#ifdef HAVE__UITOA -#define SDL_uitoa _uitoa -#else -#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix) -#endif - -#ifdef HAVE__ULTOA -#define SDL_ultoa _ultoa -#else -extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix); -#endif - -#ifdef HAVE_STRTOL -#define SDL_strtol strtol -#else -extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); -#endif - -#ifdef SDL_HAS_64BIT_TYPE - -#ifdef HAVE__I64TOA -#define SDL_lltoa _i64toa -#else -extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix); -#endif - -#ifdef HAVE__UI64TOA -#define SDL_ulltoa _ui64toa -#else -extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); -#endif - -#ifdef HAVE_STRTOLL -#define SDL_strtoll strtoll -#else -extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); -#endif - -#endif /* SDL_HAS_64BIT_TYPE */ - -#ifdef HAVE_STRTOD -#define SDL_strtod strtod -#else -extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); -#endif - -#ifdef HAVE_ATOI -#define SDL_atoi atoi -#else -#define SDL_atoi(X) SDL_strtol(X, NULL, 0) -#endif - -#ifdef HAVE_ATOF -#define SDL_atof atof -#else -#define SDL_atof(X) SDL_strtod(X, NULL) -#endif - -#ifdef HAVE_STRCMP -#define SDL_strcmp strcmp -#else -extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); -#endif - -#ifdef HAVE_STRNCMP -#define SDL_strncmp strncmp -#else -extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); -#endif - -#if defined(HAVE_STRICMP) && !defined(HAVE_STRCASECMP) -#define strcasecmp stricmp -#define HAVE_STRCASECMP -#endif -#ifdef HAVE_STRCASECMP -#define SDL_strcasecmp strcasecmp -#else -extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); -#endif - -#ifdef HAVE_SSCANF -#define SDL_sscanf sscanf -#else -extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); -#endif - -#ifdef HAVE_SNPRINTF -#define SDL_snprintf snprintf -#else -extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); -#endif - -#ifdef HAVE_VSNPRINTF -#define SDL_vsnprintf vsnprintf -#else -extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); -#endif - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_string_h */ +#include "SDL_stdinc.h"
--- a/include/SDL_types.h Thu Feb 09 05:46:55 2006 +0000 +++ b/include/SDL_types.h Thu Feb 09 09:07:13 2006 +0000 @@ -20,105 +20,4 @@ slouken@libsdl.org */ -/* General data types used by the SDL library */ - -#ifndef _SDL_types_h -#define _SDL_types_h - -#include <sys/types.h> -#ifdef _MSC_VER -#ifndef _SIZE_T_DEFINED -#ifdef _WIN64 -typedef unsigned __int64 size_t; -#else -typedef _W64 unsigned int size_t; -#endif -#define _SIZE_T_DEFINED -#endif -typedef size_t uintptr_t; -#endif - -/* The number of elements in an array */ -#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) -#define SDL_TABLESIZE(table) SDL_arraysize(table) - -/* Basic data types */ -typedef enum SDL_bool { - SDL_FALSE = 0, - SDL_TRUE = 1 -} SDL_bool; - -#ifdef H_MMBASIC /* mmbasic.h (Tru64 MME) */ -/* Some of the basic types are already defined in mmbasic.h */ -typedef signed char Sint8; -typedef signed short Sint16; -typedef signed int Sint32; -#else -typedef unsigned char Uint8; -typedef signed char Sint8; -typedef unsigned short Uint16; -typedef signed short Sint16; -typedef unsigned int Uint32; -typedef signed int Sint32; -#endif - -/* Figure out how to support 64-bit datatypes */ -#if !defined(__STRICT_ANSI__) -#ifdef __osf__ /* Tru64 */ -#define SDL_HAS_64BIT_TYPE long -#elif defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_C) || defined(__DECC) || defined(__WATCOMC__) -#define SDL_HAS_64BIT_TYPE long long -#elif defined(_MSC_VER) /* VC++ */ -#define SDL_HAS_64BIT_TYPE __int64 -#endif -#endif /* !__STRICT_ANSI__ */ - -/* The 64-bit type isn't available on EPOC/Symbian OS */ -#ifdef __SYMBIAN32__ -#undef SDL_HAS_64BIT_TYPE -#endif - -/* The 64-bit datatype isn't supported on all platforms */ -#ifdef SDL_HAS_64BIT_TYPE -#ifndef H_MMBASIC -typedef unsigned SDL_HAS_64BIT_TYPE Uint64; -#endif -typedef SDL_HAS_64BIT_TYPE Sint64; -#else -/* This is really just a hack to prevent the compiler from complaining */ -typedef struct { - Uint32 hi; - Uint32 lo; -} Uint64, Sint64; -#endif - -/* Make sure the types really have the right sizes */ -#define SDL_COMPILE_TIME_ASSERT(name, x) \ - typedef int SDL_dummy_ ## name[(x) * 2 - 1] - -SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); -SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); -SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); -SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); -SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); -SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); -SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); -SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); - -/* Check to make sure enums are the size of ints, for structure packing. - For both Watcom C/C++ and Borland C/C++ the compiler option that makes - enums having the size of an int must be enabled. - This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). -*/ -/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ -#ifdef __MWERKS__ -#pragma enumsalwaysint on -#endif - -typedef enum { - DUMMY_ENUM_VALUE -} SDL_DUMMY_ENUM; - -SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); - -#endif +#include "SDL_stdinc.h"