Route all inclusion of libc headers and most of POSIX headers through compat.h.

git-svn-id: https://svn.eduke32.com/eduke32@6074 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-02-25 08:15:36 +00:00
parent 22fbca52ca
commit aa04307ad1
62 changed files with 41 additions and 211 deletions

View file

@ -26,8 +26,7 @@
#define NEED_DSOUND_H
#include "windows_inc.h"
#include <stdlib.h>
#include <stdio.h>
#include "compat.h"
#include "driver_directsound.h"
#include "multivoc.h"

View file

@ -22,7 +22,6 @@
* libSDL output driver for MultiVoc
*/
#include <string.h>
#define _NEED_SDLMIXER
#include "compat.h"
#include "sdl_inc.h"

View file

@ -22,6 +22,8 @@
* FLAC source support for MultiVoc
*/
#include "compat.h"
#ifdef HAVE_FLAC
#define FLAC__NO_DLL
@ -32,13 +34,6 @@
#include "FLAC/all.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <errno.h>
#include "pitch.h"
#include "multivoc.h"
#include "_multivc.h"
@ -669,8 +664,6 @@ void MV_ReleaseFLACVoice(VoiceNode *voice)
voice->rawdataptr = 0;
}
#else
#include <stdlib.h>
#include <stdio.h>
#include "_multivc.h"
int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset,

View file

@ -24,13 +24,7 @@
* Raw, WAV, and VOC source support for MultiVoc
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <errno.h>
#include "compat.h"
#include "pitch.h"
#include "multivoc.h"
#include "_multivc.h"

View file

@ -21,9 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//-------------------------------------------------------------------------
#include "compat.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "drivers.h"
#include "multivoc.h"
#include "fx_man.h"

View file

@ -33,11 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
#include "pragmas.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <stdio.h>
#include "linklist.h"
#include "drivers.h"
#include "pitch.h"

View file

@ -28,8 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
(c) Copyright 1993 James R. Dose. All Rights Reserved.
**********************************************************************/
#include <stdlib.h>
#include <math.h>
#include "compat.h"
#include "pitch.h"
#define MAXDETUNE 50

View file

@ -22,15 +22,10 @@
* OggVorbis source support for MultiVoc
*/
#include "compat.h"
#ifdef HAVE_VORBIS
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <errno.h>
#include "pitch.h"
#include "multivoc.h"
#include "_multivc.h"
@ -483,8 +478,6 @@ void MV_ReleaseVorbisVoice( VoiceNode * voice )
voice->rawdataptr = 0;
}
#else
#include <stdlib.h>
#include <stdio.h>
#include "_multivc.h"
int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset,

View file

@ -4,11 +4,7 @@
* Adapted and remixed from superxa2wav
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdint.h>
#include "compat.h"
#include "pitch.h"
#include "multivoc.h"
#include "_multivc.h"

View file

@ -1,8 +1,5 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "compat.h"
#ifdef HAVE_XMP

View file

@ -91,7 +91,6 @@ extern void __cdecl stretchhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t
#else // !defined(NOASM) && (defined(_MSC_VER) || (defined(__GNUC__) && defined(__i386__)))
#define ENGINE_USING_A_C
#include <stdint.h>
#define prevlineasm1 vlineasm1

View file

@ -301,6 +301,7 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 ||
# include "msvc/inttypes.h" // from http://code.google.com/p/msinttypes/
#endif
#include <limits.h>
#include <stddef.h>
#include <stdarg.h>
#include <stdlib.h>
@ -308,6 +309,7 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 ||
#include <string.h>
#include <math.h>
#include <float.h>
#include <time.h>
#include <ctype.h>
@ -328,14 +330,11 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 ||
#if defined(_WIN32)
# include <io.h>
# include <direct.h>
#else
# include <unistd.h>
#endif
#ifdef _MSC_VER
# include <direct.h>
#endif
////////// External library headers //////////

View file

@ -5,8 +5,8 @@
#ifndef editor_h_
#define editor_h_
#include "compat.h"
#include "baselayer.h"
#include <math.h>
#ifdef __cplusplus
extern "C" {

View file

@ -9,8 +9,6 @@
extern "C" {
#endif
#include <limits.h>
#define EDUKE32_GENERATE_PRAGMAS \
EDUKE32_SCALER_PRAGMA(1) EDUKE32_SCALER_PRAGMA(2) EDUKE32_SCALER_PRAGMA(3) EDUKE32_SCALER_PRAGMA(4) \
EDUKE32_SCALER_PRAGMA(5) EDUKE32_SCALER_PRAGMA(6) EDUKE32_SCALER_PRAGMA(7) EDUKE32_SCALER_PRAGMA(8) \
@ -105,7 +103,6 @@ extern int32_t tabledivide32_noinline(int32_t n, int32_t d);
extern int32_t tabledivide64_noinline(int64_t n, int32_t d);
#ifdef GEKKO
#include <math.h>
static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return tabledivide64(ldexp(eax, ecx), ebx); }
#else
static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx)

View file

@ -1,6 +1,6 @@
// Windows layer-independent code
#include <compat.h>
#include "compat.h"
#define WindowClass "buildapp"

View file

@ -21,7 +21,6 @@
#import <Cocoa/Cocoa.h>
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
/* For some reason, Apple removed setAppleMenu from the headers in 10.4,
but the method still is there and works. To avoid warnings, we declare

View file

@ -10,7 +10,7 @@
#endif
#include <stdint.h>
#include "compat.h"
#include "compat.h"
#include "baselayer.h"

View file

@ -5,29 +5,16 @@
// This file has been modified from Ken Silverman's original release
// by Jonathon Fowler (jf@jonof.id.au)
#include "compat.h"
#ifdef CACHE1D_COMPRESS_ONLY
// Standalone libcache1d.so containing only the compression/decompression
// functions.
# include <stdint.h>
# include <stdio.h>
# include <string.h>
# include <stddef.h>
# include <assert.h>
# define BFILE FILE
# define C1D_STATIC
# define B_LITTLE16(x) (x)
# define B_LITTLE32(x) (x)
# define Bmemset memset
# define Bmemcpy memcpy
# define Bassert assert
# define bsize_t size_t
#else
// cache1d.o for EDuke32
# define C1D_STATIC static
#include "compat.h"
#ifdef _WIN32
// for FILENAME_CASE_CHECK
# define NEED_SHELLAPI_H

View file

@ -7,7 +7,6 @@
#ifdef _WIN32
# define NEED_SHLOBJ_H
# include "windows_inc.h"
# include <direct.h>
#elif __APPLE__
# include "osxbits.h"
#endif

View file

@ -1,6 +1,5 @@
#include "compat.h"
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#define dynamicgtkfoo__
#include "dynamicgtk.h"

View file

@ -31,8 +31,6 @@
# include "polymost.h"
#endif
#include <math.h> // pow
#include "engine_priv.h"
#include "palette.h"

View file

@ -1,9 +1,6 @@
#include "compat.h"
#include "glbuild.h"
#include "baselayer.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#if defined USE_OPENGL

View file

@ -1,9 +1,4 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "compat.h"
#include "dynamicgtk.h"

View file

@ -32,16 +32,9 @@ credits.
#include "compat.h"
#include "baselayer.h"
#include "kplib.h"
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include "pragmas.h"
#if !defined(_WIN32)
#include <unistd.h>
#include <dirent.h>
# if !defined __INTEL_COMPILER
typedef long long __int64;

View file

@ -17,9 +17,6 @@
#include "common.h"
#include "palette.h"
#include <math.h>
#include <float.h>
static int32_t curextra=MAXTILES;
#define MIN_CACHETIME_PRINT 10

View file

@ -2,7 +2,7 @@
#if defined USE_OPENGL && defined POLYMER
#include <math.h>
#include "compat.h"
#define POLYMER_C
#include "polymer.h"

View file

@ -33,9 +33,6 @@ int32_t rendmode=0;
int32_t usemodels=1;
int32_t usehightile=1;
#include <math.h> //<-important!
#include <float.h>
typedef struct { float x, cy[2], fy[2]; int32_t tag; int16_t n, p, ctag, ftag; } vsptyp;
#define VSPMAX 4096 //<- careful!
static vsptyp vsp[VSPMAX];

View file

@ -1,7 +1,7 @@
#include "windows_inc.h"
#include <malloc.h>
#include "compat.h"
#include "rawinput.h"
#include "winlayer.h"
#include "scancodes.h"

View file

@ -1,8 +1,5 @@
#if (PNG_LIBPNG_VER > 10599)
# include <string.h>
#endif
#include "compat.h"
#include "build.h"
#include "editor.h"

View file

@ -10,7 +10,6 @@
#include "baselayer.h"
#include "compat.h"
#include "cache1d.h"
#include <math.h>
#define ISWS(x) ((x == ' ') || (x == '\t') || (x == '\r') || (x == '\n'))

View file

@ -8,11 +8,9 @@
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif
#include <stdlib.h>
#include <math.h> // pow
#include "compat.h"
#include <signal.h>
#include "sdl_inc.h"
#include "compat.h"
#include "renderlayer.h"
#include "cache1d.h"
//#include "pragmas.h"

View file

@ -16,8 +16,6 @@
#include "kplib.h"
#include "palette.h"
#include <math.h>
//For loading/conversion only
static vec3_t voxsiz;

View file

@ -1,8 +1,7 @@
// Windows DIB/DirectDraw interface layer for the Build Engine
// Originally by Jonathon Fowler (jf@jonof.id.au)
#include <math.h>
#include <malloc.h>
#include "compat.h"
#include "build.h"

View file

@ -20,10 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "compat.h"
#include "duke3d.h"
#include <time.h>
#include <math.h> // sqrt
#include "scriplib.h"
#include "savegame.h"

View file

@ -2,11 +2,6 @@
#include "compat.h"
#include <stdint.h>
#include <stdlib.h> // getenv
#include <errno.h>
#include <string.h> // strerror
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -20,8 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include <time.h>
#include <stdlib.h>
#include "compat.h"
#include "m32script.h"
#include "m32def.h"

View file

@ -1,12 +1,7 @@
#include "compat.h"
#include "mdump.h"
#include <assert.h>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <tchar.h>
LPCSTR MiniDumper::m_szAppName;

View file

@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "compat.h"
#include "duke3d.h"
#include "osdcmds.h"
#include "savegame.h"
@ -29,8 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "menus.h"
#include "cheats.h"
#include <sys/stat.h>
#include "in_android.h"
#ifndef __ANDROID__
droidinput_t droidinput;

View file

@ -31,8 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#include <stdlib.h>
#include <string.h>
#include "compat.h"
#include "standard.h"
#include "music.h"
#include "_midi.h"

View file

@ -20,12 +20,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include "compat.h"
#include "music.h"
#include "midi.h"
#include "mpu401.h"
#include "compat.h"
#ifndef TRUE
#define TRUE (1 == 1)

View file

@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "compat.h"
#include <math.h>
#include "duke3d.h"
#include "build.h"
#include "namesdyn.h"

View file

@ -30,9 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
#include <stdio.h>
#include <errno.h>
#include "duke3d.h"
#include "cache1d.h"
@ -44,9 +41,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#endif
#if defined FORK_EXEC_MIDI // fork/exec based external midi player
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/wait.h>
static char **external_midi_argv;

View file

@ -22,9 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Stripped sounds.c for use in Mapster32, breaks all ties to game & music
#include <stdio.h>
#include <string.h>
#include "compat.h"
#include "baselayer.h"

View file

@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "compat.h"
#include "gtkpixdata.h"
#if defined(LINKED_GTK)

View file

@ -3,12 +3,7 @@
* template.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "compat.h"
#include "gtkpixdata.h"
#include <gdk-pixbuf/gdk-pixdata.h>

View file

@ -31,12 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include <stdlib.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <fcntl.h>
#include <errno.h>
#include "compat.h"
#include "file_lib.h"

View file

@ -38,9 +38,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "scriplib.h"
#include "file_lib.h"
#include "_scrplib.h"
#include <string.h>
#include <stdio.h>
#include <ctype.h>
static script_t *scriptfiles[MAXSCRIPTFILES];

View file

@ -23,7 +23,6 @@
#include "compat.h"
#include "saveable.h"
#include <stdlib.h>
#define maxModules 35

View file

@ -23,7 +23,7 @@ Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include <math.h>
#include "compat.h"
#include "build.h"
#include "cache1d.h"

View file

@ -3,12 +3,7 @@
* template.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "compat.h"
#include <gdk-pixbuf/gdk-pixdata.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

View file

@ -5,9 +5,6 @@
*/
// Bstring and C++ STL --> C conversion by Hendricks266
#include <stdio.h>
#include <string.h>
#include "compat.h"
////////// Bstring //////////

View file

@ -19,10 +19,6 @@
*/
// DOS 16-bit real mode UI --> portable command line conversion by Hendricks266
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "compat.h"
const char APP_NAME[] = "Build Game Customization Suite v0.2-EDuke32";

View file

@ -1,10 +1,7 @@
// XXX: This program is not in sync with EDuke32 (e.g. texcacheheader type).
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <sys/stat.h>
#include "compat.h"
#include <dirent.h>
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1

View file

@ -1,8 +1,6 @@
#include <stdio.h>
#include "inttypes.h"
#include "kplib.h"
#include "compat.h"
#include "kplib.h"
struct icon {
int32_t width,height;

View file

@ -1,6 +1,4 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "compat.h"
#define MAXNUMTILES 256

View file

@ -1,14 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#define Bmemcmp memcmp
#include "compat.h"
#ifndef USE_OPENGL
# define USE_OPENGL
#endif

View file

@ -1,6 +1,4 @@
#include <stdio.h>
#include <math.h>
#include "compat.h"
typedef struct { float x, y, z; } point3d;

View file

@ -1,7 +1,6 @@
// gcc b.c -Lc:/mingw32/lib -lmingw32 -lSDLmain -lSDL
#include <stdio.h>
#include <string.h>
#include "compat.h"
#include "sdl_inc.h"
#include "sdlkeytrans.cpp"

View file

@ -1,5 +1,3 @@
#include <math.h>
#include "compat.h"
#define PI 3.141592653589793

View file

@ -4,9 +4,6 @@
#include "glbuild.h"
#include "mdsprite.h"
#include <stdio.h>
#include <errno.h>
static md2head_t head;

View file

@ -1,6 +1,4 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "compat.h"
struct hsv {
float h, s, v;

View file

@ -39,9 +39,7 @@
NOTE: This program does not fall under BUILDLIC.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "compat.h"
int main(int argc, char **argv)
{