Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
It's now possible to build SDL without any C runtime at all on Windows,
using Visual C++ 2005
  • Loading branch information
slouken committed Feb 6, 2006
1 parent da7ad9a commit 5a96984
Show file tree
Hide file tree
Showing 101 changed files with 8,883 additions and 602 deletions.
Binary file modified VisualC.zip
Binary file not shown.
1 change: 1 addition & 0 deletions configure.in
Expand Up @@ -3008,6 +3008,7 @@ src/main/Makefile
src/main/macos/Makefile
src/main/macosx/Makefile
src/main/macosx/Info.plist
src/stdlib/Makefile
src/audio/Makefile
src/audio/alsa/Makefile
src/audio/arts/Makefile
Expand Down
6 changes: 6 additions & 0 deletions include/Makefile.am
Expand Up @@ -10,8 +10,10 @@ libSDLinclude_HEADERS = \
SDL_audio.h \
SDL_byteorder.h \
SDL_cdrom.h \
SDL_config.h \
SDL_copying.h \
SDL_cpuinfo.h \
SDL_ctype.h \
SDL_endian.h \
SDL_error.h \
SDL_events.h \
Expand All @@ -27,11 +29,15 @@ libSDLinclude_HEADERS = \
SDL_opengl.h \
SDL_quit.h \
SDL_rwops.h \
SDL_stdarg.h \
SDL_stdlib.h \
SDL_string.h \
SDL_syswm.h \
SDL_thread.h \
SDL_timer.h \
SDL_types.h \
SDL_version.h \
SDL_video.h \
SDL_windows.h \
begin_code.h \
close_code.h
2 changes: 0 additions & 2 deletions include/SDL_audio.h
Expand Up @@ -25,8 +25,6 @@
#ifndef _SDL_audio_h
#define _SDL_audio_h

#include <stdio.h>

#include "SDL_main.h"
#include "SDL_types.h"
#include "SDL_error.h"
Expand Down
87 changes: 87 additions & 0 deletions include/SDL_config.h
@@ -0,0 +1,87 @@
/*
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
*/

#ifndef _SDL_config_h
#define _SDL_config_h

/* This is a set of defines to configure the SDL features */

#define HAVE_STDARG_H

/* Comment this if you want to build without any libc requirements */
#define HAVE_LIBC
#ifdef HAVE_LIBC

/* Various C library headers */
#define HAVE_CTYPE_H
#define HAVE_STDIO_H
#define HAVE_STDLIB_H
#define HAVE_MALLOC_H
#define HAVE_STRING_H
#if !defined(_WIN32_WCE)
#define HAVE_SIGNAL_H
#endif

/* Features provided by SDL_stdlib.h */
#if !defined(_WIN32) /* Don't use C runtime versions of these on Windows */
#define HAVE_GETENV
#define HAVE_PUTENV
#endif
#define HAVE_MALLOC
#define HAVE_REALLOC
#define HAVE_FREE
#define HAVE_ALLOCA
/*#define HAVE_QSORT*/

/* Features provided by SDL_string.h */
#define HAVE_MEMSET
#define HAVE_MEMCPY
#define HAVE_MEMMOVE
#define HAVE_MEMCMP
#define HAVE_STRLEN
#define HAVE_STRCPY
#define HAVE_STRNCPY
/*#define HAVE__STRREV*/
/*#define HAVE__STRUPR*/
/*#define HAVE__STRLWR*/
#define HAVE_STRCHR
#define HAVE_STRRCHR
#define HAVE_STRSTR
/*#define HAVE_ITOA*/
/*#define HAVE__LTOA*/
/*#define HAVE__UITOA*/
/*#define HAVE__ULTOA*/
/*#define HAVE_STRTOL*/
/*#define HAVE__I64TOA*/
/*#define HAVE__UI64TOA*/
/*#define HAVE_STRTOLL*/
#define HAVE_STRCMP
#define HAVE_STRNCMP
/*#define HAVE_STRICMP*/
/*#define HAVE_STRCASECMP*/
#define HAVE_SSCANF
/*#define HAVE_SNPRINTF*/
#define HAVE_VSNPRINTF

#endif /* HAVE_LIBC */

#endif /* _SDL_config_h */
39 changes: 39 additions & 0 deletions include/SDL_ctype.h
@@ -0,0 +1,39 @@
/*
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_ */
2 changes: 0 additions & 2 deletions include/SDL_endian.h
Expand Up @@ -37,8 +37,6 @@
and other data sources.
*/

#include <stdio.h>

#include "SDL_types.h"
#include "SDL_rwops.h"
#include "SDL_byteorder.h"
Expand Down
4 changes: 4 additions & 0 deletions include/SDL_events.h
Expand Up @@ -38,6 +38,10 @@
extern "C" {
#endif

/* General keyboard/mouse state definitions */
#define SDL_RELEASED 0
#define SDL_PRESSED 1

/* Event enumerations */
typedef enum {
SDL_NOEVENT = 0, /* Unused (do not remove) */
Expand Down
30 changes: 16 additions & 14 deletions include/SDL_getenv.h
Expand Up @@ -23,29 +23,31 @@
#ifndef _SDL_getenv_h
#define _SDL_getenv_h

#include "SDL_config.h"

#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif

#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

/* Not all environments have a working getenv()/putenv() */

#if defined(macintosh) || defined(WIN32) || defined(_WIN32_WCE)
#define NEED_SDL_GETENV
#ifdef HAVE_GETENV
#define SDL_getenv getenv
#else
#define getenv SDL_getenv
extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
#endif

#ifdef NEED_SDL_GETENV

/* Put a variable of the form "name=value" into the environment */
#ifdef HAVE_PUTENV
#define SDL_putenv putenv
#else
#define putenv SDL_putenv
extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
#define putenv(X) SDL_putenv(X)

/* Retrieve a variable named "name" from the environment */
extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
#define getenv(X) SDL_getenv(X)

#endif /* NEED_GETENV */
#endif

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_mouse.h
Expand Up @@ -115,7 +115,7 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
Button 4: Mouse wheel up (may also be a real button)
Button 5: Mouse wheel down (may also be a real button)
*/
#define SDL_BUTTON(X) (SDL_PRESSED << ((X)-1))
#define SDL_BUTTON(X) (1 << ((X)-1))
#define SDL_BUTTON_LEFT 1
#define SDL_BUTTON_MIDDLE 2
#define SDL_BUTTON_RIGHT 3
Expand Down
14 changes: 13 additions & 1 deletion include/SDL_rwops.h
Expand Up @@ -27,7 +27,11 @@
#ifndef _SDL_RWops_h
#define _SDL_RWops_h

#include "SDL_config.h"

#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif

#include "SDL_types.h"

Expand Down Expand Up @@ -63,10 +67,12 @@ typedef struct SDL_RWops {

Uint32 type;
union {
#ifdef HAVE_STDIO_H
struct {
int autoclose;
FILE *fp;
} stdio;
#endif
struct {
Uint8 *base;
Uint8 *here;
Expand All @@ -84,17 +90,23 @@ typedef struct 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 /* Seek from the beginning of data */
#define RW_SEEK_CUR 1 /* Seek relative to current read point */
#define RW_SEEK_END 2 /* Seek relative to the end of data */

/* Macros to easily read and write from an SDL_RWops structure */
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, SEEK_CUR)
#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)
Expand Down
34 changes: 34 additions & 0 deletions include/SDL_stdarg.h
@@ -0,0 +1,34 @@
/*
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
*/

#ifndef _SDL_stdarg_h
#define _SDL_stdarg_h

#include "SDL_config.h"

#ifdef HAVE_STDARG_H
#include <stdarg.h>
#else
#error Need stdarg.h equivalent for this platform
#endif

#endif /* _SDL_stdarg_h */

0 comments on commit 5a96984

Please sign in to comment.