- removed most extern "C" from the rest of the code base.

This commit is contained in:
Christoph Oelckers 2019-09-21 20:14:34 +02:00
parent 5855886a5f
commit 5050716bc0
39 changed files with 2 additions and 657 deletions

View file

@ -36,10 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "limits.h"
#include "multivoc.h"
#ifdef __cplusplus
extern "C" {
#endif
enum FX_ERRORS
{
FX_Warning = -2,
@ -118,8 +114,4 @@ static FORCE_INLINE int32_t FX_SoundsPlaying(void) { return MV_VoicesPlaying();
static FORCE_INLINE int32_t FX_StopSound(int32_t handle) { return FX_CheckMVErr(MV_Kill(handle)); }
static FORCE_INLINE int32_t FX_StopAllSounds(void) { return FX_CheckMVErr(MV_KillAllVoices()); }
#ifdef __cplusplus
}
#endif
#endif

View file

@ -34,10 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
#include "drivers.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
FMT_UNKNOWN,
@ -133,8 +129,4 @@ int32_t MV_Init(int32_t soundcard, int32_t MixRate, int32_t Voices, int32_t numc
int32_t MV_Shutdown(void);
void MV_SetPrintf(void (*function)(const char *fmt, ...));
#ifdef __cplusplus
}
#endif
#endif

View file

@ -32,69 +32,6 @@ typedef int64_t coord_t;
typedef int64_t inthi_t;
#define inthi_rintf llrintf
#if !defined(NOASM) && (defined(_MSC_VER) || (defined(__GNUC__) && defined(__i386__)))
#if defined __linux || defined __APPLE__ || defined EDUKE32_BSD || defined __SYLLABLE__
#define __cdecl
#endif
#ifdef __cplusplus
extern "C"
{
#endif
extern int32_t __cdecl mmxoverlay();
extern int32_t __cdecl sethlinesizes(int32_t,int32_t,int32_t);
extern int32_t __cdecl setpalookupaddress(char *);
extern int32_t __cdecl setuphlineasm4(int32_t,int32_t);
extern int32_t __cdecl hlineasm4(ssize_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setuprhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl rhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl rmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setupqrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl qrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setvlinebpl(int32_t);
extern int32_t __cdecl fixtransluscence(int32_t);
extern int32_t __cdecl prevlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl vlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl vlineasm1nonpow2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setuptvlineasm(int32_t,int32_t);
extern int32_t __cdecl tvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl tvlineasm1nonpow2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setuptvlineasm2(int32_t,int32_t,int32_t);
extern int32_t __cdecl tvlineasm2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl mvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl mvlineasm1nonpow2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setupvlineasm(int32_t);
extern int32_t __cdecl vlineasm4(int32_t,char *);
extern int32_t __cdecl setupmvlineasm(int32_t,int32_t);
extern int32_t __cdecl mvlineasm4(int32_t,char *);
extern int32_t __cdecl setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl spritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl mspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl tsetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl tspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl mhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl mhlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl msethlineshift(int32_t,int32_t);
extern int32_t __cdecl thline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl thlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl tsethlineshift(int32_t,int32_t);
extern int32_t __cdecl setupslopevlin(int32_t,int32_t,int32_t);
extern int32_t __cdecl slopevlin(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl settransnormal();
extern int32_t __cdecl settransreverse();
extern int32_t __cdecl setupdrawslab(int32_t,int32_t);
extern int32_t __cdecl drawslab(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern void __cdecl stretchhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#ifdef __cplusplus
}
#endif
#else // !defined(NOASM) && (defined(_MSC_VER) || (defined(__GNUC__) && defined(__i386__)))
#define ENGINE_USING_A_C
@ -148,6 +85,4 @@ void stretchhline (intptr_t p0, int32_t u, bssize_t cnt, int32_t uinc, intptr_t
void mmxoverlay();
#endif // else
#endif // a_h_

View file

@ -11,10 +11,6 @@
#include "osd.h"
#include "timer.h"
#ifdef __cplusplus
extern "C" {
#endif
extern int app_main(int argc, char const * const * argv);
extern const char* AppProperName;
extern const char* AppTechnicalName;
@ -278,10 +274,6 @@ int32_t baselayer_init();
void makeasmwriteable(void);
void maybe_redirect_outputs(void);
#ifdef __cplusplus
}
#endif
#include "print.h"
#endif // baselayer_h_

View file

@ -29,10 +29,6 @@
#include "vfs.h"
#include "cache1d.h"
#ifdef __cplusplus
extern "C" {
#endif
enum rendmode_t {
REND_CLASSIC,
REND_POLYMOST = 3,
@ -271,21 +267,17 @@ enum {
# define EXTERN extern
#endif
#ifdef __cplusplus
}
#endif
#if defined __cplusplus && (defined USE_OPENGL || defined POLYMER)
# define USE_STRUCT_TRACKERS
#endif
#ifdef USE_STRUCT_TRACKERS
extern "C" {
static FORCE_INLINE void sector_tracker_hook__(intptr_t address);
static FORCE_INLINE void wall_tracker_hook__(intptr_t address);
static FORCE_INLINE void sprite_tracker_hook__(intptr_t address);
}
#define TRACKER_NAME__ SectorTracker
#define TRACKER_HOOK_ sector_tracker_hook__
@ -528,10 +520,6 @@ static inline void inplace_vx_tweak_wall(walltypevx *vxwal, int32_t yaxp)
int32_t getwalldist(vec2_t const in, int const wallnum);
int32_t getwalldist(vec2_t const in, int const wallnum, vec2_t * const out);
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint32_t mdanimtims;
int16_t mdanimcur;
@ -1489,10 +1477,6 @@ int32_t loaddefinitionsfile(const char *fn);
// -2, board is dodgy
int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
#ifdef __cplusplus
}
#endif
#include "hash.h"
#ifdef POLYMER
@ -1502,9 +1486,6 @@ int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos,
# include "polymost.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
static FORCE_INLINE void renderDisableFog(void)
{
@ -1616,8 +1597,4 @@ extern int32_t(*saveboard_replace)(const char *filename, const vec3_t *dapos, in
extern void(*PolymostProcessVoxels_Callback)(void);
#endif
#ifdef __cplusplus
}
#endif
#endif // build_h_

View file

@ -13,10 +13,6 @@
#include "vfs.h"
#ifdef __cplusplus
extern "C" {
#endif
extern char *kpzbuf;
extern int32_t kpzbufsiz;
extern int32_t kpzbufload(const char *);
@ -157,9 +153,5 @@ int32_t kdfread_LZ4(void *buffer, int dasizeof, int count, buildvfs_kfd fil);
void dfwrite(const void *buffer, int dasizeof, int count, buildvfs_FILE fil);
void dfwrite_LZ4(const void *buffer, int dasizeof, int count, buildvfs_FILE fil);
#ifdef __cplusplus
}
#endif
#endif // cache1d_h_

View file

@ -11,10 +11,6 @@
#ifndef clip_h_
#define clip_h_
#ifdef __cplusplus
extern "C" {
#endif
#define MAXCLIPSECTORS 512
#define MAXCLIPNUM 2048
#define CLIPCURBHEIGHT (1<<8)
@ -86,8 +82,4 @@ int32_t clipmovex(vec3_t *const pos, int16_t *const sectnum, int32_t xvect, int3
int pushmove(vec3_t *const vect, int16_t *const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true) ATTRIBUTE((nonnull(1, 2)));
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,10 +1,6 @@
#include "compat.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void initfastcolorlookup_scale(int32_t rscale, int32_t gscale, int32_t bscale);
extern void initfastcolorlookup_palette(uint8_t const * pal) ATTRIBUTE((nonnull(1)));
extern void initfastcolorlookup_gridvectors(void);
@ -21,7 +17,3 @@ static FORCE_INLINE int32_t getclosestcol_nocache(int32_t r, int32_t g, int32_t
{
return getclosestcol_nocache_lim(r, g, b, 255);
}
#ifdef __cplusplus
}
#endif

View file

@ -12,11 +12,6 @@
#include "pragmas.h" // klabs
#include "scriptfile.h"
#ifdef __cplusplus
extern "C" {
#endif
extern bool playing_rr;
extern bool playing_blood;
@ -53,14 +48,8 @@ enum
//// EXTERN DECLS
extern struct strllist *CommandPaths, *CommandGrps;
#ifdef __cplusplus
extern "C" {
#endif
extern const char *s_buildRev;
extern const char *s_buildTimestamp;
#ifdef __cplusplus
}
#endif
//// FUNCTIONS
extern void PrintBuildInfo(void);
@ -155,8 +144,4 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows);
void Duke_CommonCleanup(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -81,11 +81,7 @@
////////// Language and compiler feature polyfills //////////
#ifdef __cplusplus
# define EXTERNC extern "C"
#else
# define EXTERNC
#endif
#ifndef UNREFERENCED_PARAMETER
# define UNREFERENCED_PARAMETER(x) (x) = (x)
@ -1222,10 +1218,6 @@ static inline void append_ext_UNSAFE(char *outbuf, const char *ext)
/* Begin dependence on compat.o object. */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef USE_PHYSFS
////////// Directory enumeration //////////
@ -1350,9 +1342,6 @@ static FORCE_INLINE void *xaligned_alloc(const bsize_t alignment, const bsize_t
#define Xaligned_alloc(alignment, size) (EDUKE32_PRE_XALLOC xaligned_alloc(alignment, size))
#define Xfree(ptr) (EDUKE32_PRE_XALLOC xfree(ptr))
#define Xaligned_free(ptr) (EDUKE32_PRE_XALLOC xaligned_free(ptr))
#ifdef __cplusplus
}
#endif
////////// More utility functions //////////

View file

@ -4,10 +4,6 @@
#ifndef hash_h_
#define hash_h_
#ifdef __cplusplus
extern "C" {
#endif
// Hash functions
typedef struct hashitem_ // size is 12/24 bytes.
@ -81,8 +77,4 @@ void inthash_delete(inthashtable_t *t, intptr_t key);
// ideally we would find the next largest prime number
#define INTHASH_SIZE(size) ((size * 4u / 3u) | 1u)
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,10 +1,6 @@
#ifndef HIGHTILE_PRIV_H
#define HIGHTILE_PRIV_H
#ifdef __cplusplus
extern "C" {
#endif
struct hicskybox_t {
char *face[6];
};
@ -136,8 +132,4 @@ enum
#define GRAYSCALE_COEFF_GREEN 0.59
#define GRAYSCALE_COEFF_BLUE 0.11
#ifdef __cplusplus
}
#endif
#endif

View file

@ -11,10 +11,6 @@
#include "compat.h"
#ifdef __cplusplus
extern "C" {
#endif
// These two follow the argument order of the C functions "read" and "write":
// handle, buffer, length.
typedef int32_t (*klzw_readfunc)(intptr_t, void *, int32_t);
@ -23,8 +19,4 @@ typedef void (*klzw_writefunc)(intptr_t, void const *, int32_t);
int32_t klzw_read_compressed(void *buffer, int dasizeof, int count, intptr_t const f, klzw_readfunc readfunc);
void klzw_write_compressed(const void * const buffer, int dasizeof, int count, intptr_t const f, klzw_writefunc writefunc);
#ifdef __cplusplus
}
#endif
#endif // klzw_h_

View file

@ -5,10 +5,6 @@
#include "vfs.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
buildvfs_FILE fil; //0:no file open, !=0:open file (either stand-alone or zip)
@ -61,7 +57,3 @@ static inline int32_t filnamcmp(const char *j, const char *i)
return *i != '\0' || *j != '\0';
}
extern int32_t wildmatch(const char *match, const char *wild);
#ifdef __cplusplus
}
#endif

View file

@ -1,10 +1,6 @@
#ifndef mdsprite_h_
# define mdsprite_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef USE_OPENGL
#include "hightile.h"
@ -239,8 +235,4 @@ enum {
HUDFLAG_NODEPTH = 8,
};
#ifdef __cplusplus
}
#endif
#endif // !mdsprite_h_

View file

@ -7,10 +7,6 @@
#include "vfs.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "mutex.h"
typedef struct {
@ -306,9 +302,5 @@ extern int osdcmd_restartvid(osdcmdptr_t parm);
extern void M32RunScript(const char *s);
#ifdef __cplusplus
}
#endif
#endif // osd_h_

View file

@ -2,10 +2,6 @@
#define osxbits_h_
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
int osx_msgbox(const char *name, const char *msg);
int osx_ynbox(const char *name, const char *msg);
@ -14,8 +10,4 @@ char *osx_getsupportdir(int32_t local);
char *osx_getappdir(void);
char *osx_getapplicationsdir(int32_t local);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -14,10 +14,6 @@
#include "cache1d.h"
#include "vfs.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MAXBASEPALS 256
#define MAXPALOOKUPS 256
#define MAXBLENDTABS 256
@ -138,8 +134,4 @@ extern glblend_t glblend[MAXBLENDTABS];
extern void handle_blend(uint8_t enable, uint8_t blend, uint8_t def);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -10,10 +10,6 @@
void Polymost_CacheHitList(uint8_t* hash);
#ifdef __cplusplus
extern "C" {
#endif
class FHardwareTexture;
typedef struct { uint8_t r, g, b, a; } coltype;
typedef struct { float r, g, b, a; } coltypef;
@ -296,10 +292,6 @@ extern hitdata_t polymost_hitdata;
extern void polymost_setupglowtexture(int32_t texunits, FHardwareTexture *tex);
extern void polymost_setupdetailtexture(int32_t texunits, FHardwareTexture* tex);
#ifdef __cplusplus
}
#endif
#endif
#endif

View file

@ -9,9 +9,6 @@
#ifndef pragmas_h_
#define pragmas_h_
#ifdef __cplusplus
extern "C" {
#endif
#define EDUKE32_GENERATE_PRAGMAS \
EDUKE32_SCALER_PRAGMA(1) EDUKE32_SCALER_PRAGMA(2) EDUKE32_SCALER_PRAGMA(3) EDUKE32_SCALER_PRAGMA(4) \
@ -23,13 +20,7 @@ extern "C" {
EDUKE32_SCALER_PRAGMA(25) EDUKE32_SCALER_PRAGMA(26) EDUKE32_SCALER_PRAGMA(27) EDUKE32_SCALER_PRAGMA(28) \
EDUKE32_SCALER_PRAGMA(29) EDUKE32_SCALER_PRAGMA(30) EDUKE32_SCALER_PRAGMA(31)
#if !defined(NOASM) && defined __cplusplus
extern "C" {
#endif
extern int32_t reciptable[2048], fpuasm;
#if !defined(NOASM) && defined __cplusplus
}
#endif
// break the C version of divscale out from the others
// because asm version overflows in drawmapview()
@ -143,8 +134,6 @@ EDUKE32_GENERATE_PRAGMAS EDUKE32_SCALER_PRAGMA(32)
#endif
#ifdef __cplusplus
}
template <typename T>
static FORCE_INLINE void swap(T * const a, T * const b)
{
@ -153,15 +142,6 @@ static FORCE_INLINE void swap(T * const a, T * const b)
*b = t;
}
#define swapptr swap
extern "C" {
#else
static FORCE_INLINE void swapptr(void *a, void *b)
{
intptr_t const t = *(intptr_t*) a;
*(intptr_t*) a = *(intptr_t*) b;
*(intptr_t*) b = t;
}
#endif
#ifndef pragmas_have_swaps
#define swapchar swap
@ -263,8 +243,5 @@ static inline void swapbufreverse(void *s, void *d, int32_t c)
swapchar(dst++, src--);
}
#ifdef __cplusplus
}
#endif
#endif // pragmas_h_

View file

@ -2,10 +2,6 @@
#ifndef BUILD_SCRIPTFILE_H_
#define BUILD_SCRIPTFILE_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char *textbuf;
uint32_t textlength;
@ -34,8 +30,4 @@ int32_t scriptfile_getsymbolvalue(char const *name, int32_t *val);
int32_t scriptfile_addsymbolvalue(char const *name, int32_t val);
void scriptfile_clearsymbols(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,10 +1,6 @@
#ifndef texcache_h_
# define texcache_h_
#ifdef __cplusplus
extern "C" {
#endif
#include "vfs.h"
#ifdef USE_OPENGL
@ -22,8 +18,4 @@ extern pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashad
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -156,57 +156,7 @@ void joyReadButtons(int32_t *pResult) { *pResult = appactive ? joystick.bits : 0
# include <sys/mman.h>
#endif
#if !defined(NOASM) && !defined(GEKKO) && !defined(__ANDROID__)
#ifdef __cplusplus
extern "C" {
#endif
extern intptr_t dep_begin, dep_end;
#ifdef __cplusplus
}
#endif
#endif
#if !defined(NOASM) && !defined(GEKKO) && !defined(__ANDROID__)
static int32_t nx_unprotect(intptr_t beg, intptr_t end, int prot)
{
# if defined _WIN32
# define B_PROT_RW PAGE_READWRITE
# define B_PROT_RX PAGE_EXECUTE_READ
# define B_PROT_RWX PAGE_EXECUTE_READWRITE
DWORD oldprot;
if (!VirtualProtect((LPVOID) beg, (SIZE_T)end - (SIZE_T)beg, prot, &oldprot))
{
initprintf("VirtualProtect() error! Crashing in 3... 2... 1...\n");
return 1;
}
# elif defined __linux || defined EDUKE32_BSD || defined __APPLE__
# define B_PROT_RW (PROT_READ|PROT_WRITE)
# define B_PROT_RX (PROT_READ|PROT_EXEC)
# define B_PROT_RWX (PROT_READ|PROT_WRITE|PROT_EXEC)
int32_t pagesize;
size_t dep_begin_page;
pagesize = sysconf(_SC_PAGE_SIZE);
if (pagesize == -1)
{
initprintf("Error getting system page size\n");
return 1;
}
dep_begin_page = ((size_t)beg) & ~(pagesize-1);
if (mprotect((void *) dep_begin_page, (size_t)end - dep_begin_page, prot) < 0)
{
initprintf("Error making code writeable (errno=%d)\n", errno);
return 1;
}
# else
# error "Don't know how to unprotect the self-modifying assembly on this platform!"
# endif
return 0;
}
#endif
// Calculate ylookup[] and call setvlinebpl()
@ -248,9 +198,6 @@ void calc_ylookup(int32_t bpl, int32_t lastyidx)
void makeasmwriteable(void)
{
#if !defined(NOASM) && !defined(GEKKO) && !defined(__ANDROID__)
nx_unprotect((intptr_t)&dep_begin, (intptr_t)&dep_end, B_PROT_RWX);
#endif
}
int32_t vsync=0;

View file

@ -159,9 +159,6 @@ static int16_t **dotp1, **dotp2;
static int8_t tempbuf[MAXWALLS];
// referenced from asm
#if !defined(NOASM) && defined __cplusplus
extern "C" {
#endif
int32_t ebpbak, espbak;
int32_t reciptable[2048], fpuasm;
intptr_t asm1, asm2, asm3, asm4, palookupoffse[4];
@ -170,9 +167,6 @@ int32_t vince[4];
intptr_t bufplce[4];
int32_t globaltilesizy;
int32_t globalx1, globaly2, globalx3, globaly3;
#if !defined(NOASM) && defined __cplusplus
}
#endif
int32_t sloptable[SLOPTABLESIZ];
static intptr_t slopalookup[16384]; // was 2048

View file

@ -24,145 +24,12 @@
# define YAX_MAXDRAWS 8
#endif
#if !defined(NOASM) && defined __cplusplus
extern "C" {
#endif
extern intptr_t asm1, asm2, asm3, asm4;
extern int32_t globalx1, globaly2;
#if !defined(NOASM) && defined __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern uint16_t ATTRIBUTE((used)) sqrtable[4096], ATTRIBUTE((used)) shlookup[4096+256];
#if defined(_MSC_VER) && !defined(NOASM)
//
// Microsoft C Inline Assembly Routines
//
static inline int32_t nsqrtasm(int32_t a)
{
_asm
{
push ebx
mov eax, a
test eax, 0xff000000
mov ebx, eax
jnz short over24
shr ebx, 12
mov cx, word ptr shlookup[ebx*2]
jmp short under24
over24 :
shr ebx, 24
mov cx, word ptr shlookup[ebx*2+8192]
under24 :
shr eax, cl
mov cl, ch
mov ax, word ptr sqrtable[eax*2]
shr eax, cl
pop ebx
}
}
static inline int32_t getclipmask(int32_t a, int32_t b, int32_t c, int32_t d)
{
_asm
{
push ebx
mov eax, a
mov ebx, b
mov ecx, c
mov edx, d
sar eax, 31
add ebx, ebx
adc eax, eax
add ecx, ecx
adc eax, eax
add edx, edx
adc eax, eax
mov ebx, eax
shl ebx, 4
or al, 0xf0
xor eax, ebx
pop ebx
}
}
static inline int32_t getkensmessagecrc(void *b)
{
_asm
{
push ebx
mov ebx, b
xor eax, eax
mov ecx, 32
beg:
mov edx, dword ptr[ebx+ecx*4-4]
ror edx, cl
adc eax, edx
bswap eax
loop short beg
pop ebx
}
}
#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // _MSC_VER
//
// GCC "Inline" Assembly Routines
//
#define nsqrtasm(a) \
({ int32_t __r, __a=(a); \
__asm__ __volatile__ ( \
"testl $0xff000000, %%eax\n\t" \
"movl %%eax, %%ebx\n\t" \
"jnz 0f\n\t" \
"shrl $12, %%ebx\n\t" \
"movw " ASMSYM("shlookup") "(,%%ebx,2), %%cx\n\t" \
"jmp 1f\n\t" \
"0:\n\t" \
"shrl $24, %%ebx\n\t" \
"movw (" ASMSYM("shlookup") "+8192)(,%%ebx,2), %%cx\n\t" \
"1:\n\t" \
"shrl %%cl, %%eax\n\t" \
"movb %%ch, %%cl\n\t" \
"movw " ASMSYM("sqrtable") "(,%%eax,2), %%ax\n\t" \
"shrl %%cl, %%eax" \
: "=a" (__r) : "a" (__a) : "ebx", "ecx", "cc"); \
__r; })
#define getclipmask(a,b,c,d) \
({ int32_t __a=(a), __b=(b), __c=(c), __d=(d); \
__asm__ __volatile__ ("sarl $31, %%eax; addl %%ebx, %%ebx; adcl %%eax, %%eax; " \
"addl %%ecx, %%ecx; adcl %%eax, %%eax; addl %%edx, %%edx; " \
"adcl %%eax, %%eax; movl %%eax, %%ebx; shl $4, %%ebx; " \
"orb $0xf0, %%al; xorl %%ebx, %%eax" \
: "=a" (__a), "=b" (__b), "=c" (__c), "=d" (__d) \
: "a" (__a), "b" (__b), "c" (__c), "d" (__d) : "cc"); \
__a; })
#define getkensmessagecrc(b) \
({ int32_t __a, __b=(b); \
__asm__ __volatile__ ( \
"xorl %%eax, %%eax\n\t" \
"movl $32, %%ecx\n\t" \
"0:\n\t" \
"movl -4(%%ebx,%%ecx,4), %%edx\n\t" \
"rorl %%cl, %%edx\n\t" \
"adcl %%edx, %%eax\n\t" \
"bswapl %%eax\n\t" \
"loop 0b" \
: "=a" (__a) : "b" (__b) : "ecx", "edx" \
__a; })
#else // __GNUC__ && __i386__
static inline int32_t nsqrtasm(uint32_t a)
{
@ -203,7 +70,6 @@ extern uint16_t ATTRIBUTE((used)) sqrtable[4096], ATTRIBUTE((used)) shlookup[409
return 0x56c764d4l;
}
#endif
extern int16_t thesector[MAXWALLSB], thewall[MAXWALLSB];
extern int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
@ -401,10 +267,6 @@ static FORCE_INLINE void set_globalpos(int32_t const x, int32_t const y, int32_t
globalposz = z, fglobalposz = (float)z;
}
#ifdef __cplusplus
}
#endif
template <typename T> static FORCE_INLINE void tileUpdatePicnum(T * const tileptr, int const obj)
{
auto &tile = *tileptr;

View file

@ -4,11 +4,5 @@
# define REV "r(?)"
#endif
#ifdef __cplusplus
extern "C" {
#endif
const char* s_buildRev = REV;
const char* s_buildTimestamp = __DATE__ " " __TIME__;
#ifdef __cplusplus
}
#endif

View file

@ -330,84 +330,13 @@ static void sighandler(int signum)
}
#endif
#ifdef __ANDROID__
int mobile_halted = 0;
#ifdef __cplusplus
extern "C"
{
#endif
void G_Shutdown(void);
#ifdef __cplusplus
}
#endif
int sdlayer_mobilefilter(void *userdata, SDL_Event *event)
{
switch (event->type)
{
case SDL_APP_TERMINATING:
// yes, this calls into the game, ugh
if (mobile_halted == 1)
G_Shutdown();
mobile_halted = 1;
return 0;
case SDL_APP_LOWMEMORY:
gltexinvalidatetype(INVALIDATE_ALL);
return 0;
case SDL_APP_WILLENTERBACKGROUND:
mobile_halted = 1;
return 0;
case SDL_APP_DIDENTERBACKGROUND:
gltexinvalidatetype(INVALIDATE_ALL);
// tear down video?
return 0;
case SDL_APP_WILLENTERFOREGROUND:
// restore video?
return 0;
case SDL_APP_DIDENTERFOREGROUND:
mobile_halted = 0;
return 0;
default:
return 1;//!halt;
}
UNREFERENCED_PARAMETER(userdata);
}
#endif
#ifdef __ANDROID__
# include <setjmp.h>
static jmp_buf eduke32_exit_jmp_buf;
static int eduke32_return_value;
void eduke32_exit_return(int retval)
{
eduke32_return_value = retval;
longjmp(eduke32_exit_jmp_buf, 1);
EDUKE32_UNREACHABLE_SECTION(return);
}
#endif
#ifdef _WIN32
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
#elif defined __ANDROID__
# ifdef __cplusplus
extern "C" int eduke32_android_main(int argc, char const *argv[]);
# endif
int eduke32_android_main(int argc, char const *argv[])
#elif defined GEKKO
int SDL_main(int argc, char *argv[])
#else
int main(int argc, char *argv[])
#endif
{
#ifdef __ANDROID__
if (setjmp(eduke32_exit_jmp_buf))
{
return eduke32_return_value;
}
#endif
#if defined _WIN32 && defined SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING
// Thread naming interferes with debugging using MinGW-w64's GDB.
@ -451,8 +380,6 @@ int main(int argc, char *argv[])
MessageBox(0, "This application requires a newer Windows version to run.", apptitle, MB_OK | MB_ICONSTOP);
return -1;
}
#elif defined(GEKKO)
wii_open();
#elif defined(HAVE_GTK2)
// Pre-initialize SDL video system in order to make sure XInitThreads() is called
// before GTK starts talking to X11.

View file

@ -40,10 +40,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "compat.h"
#include "keyboard.h"
#ifdef __cplusplus
extern "C" {
#endif
//****************************************************************************
//
@ -177,7 +173,4 @@ typedef struct
//
//***************************************************************************
#ifdef __cplusplus
}
#endif
#endif

View file

@ -35,9 +35,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#ifndef animlib_public_h_
#define animlib_public_h_
#ifdef __cplusplus
extern "C" {
#endif
# pragma pack(push,1)
@ -148,7 +145,4 @@ uint8_t * ANIM_DrawFrame(int32_t framenumber);
uint8_t * ANIM_GetPalette(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -35,9 +35,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#ifndef control_public_h_
#define control_public_h_
#ifdef __cplusplus
extern "C" {
#endif
//***************************************************************************
@ -260,7 +257,4 @@ void CONTROL_ProcessBinds(void);
extern int32_t CONTROL_ButtonFlags[CONTROL_NUM_FLAGS];
extern bool CONTROL_SmoothMouse;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2,31 +2,7 @@
#ifndef __joystick_h
#define __joystick_h
#ifdef __cplusplus
extern "C" {
#endif
#if defined(GEKKO)
#define WII_A 0x00000001
#define WII_B 0x00000002
#define WII_1 0x00000004
#define WII_2 0x00000008
#define WII_MINUS 0x00000010
#define WII_PLUS 0x00000020
#define WII_HOME 0x00000040
#define WII_Z 0x00000080
#define WII_C 0x00000100
#define WII_X 0x00000200
#define WII_Y 0x00000400
#define WII_FULL_L 0x00000800
#define WII_FULL_R 0x00001000
#define WII_ZL 0x00002000
#define WII_ZR 0x00004000
#define WII_DPAD_UP 0x00008000
#define WII_DPAD_RIGHT 0x00010000
#define WII_DPAD_DOWN 0x00020000
#define WII_DPAD_LEFT 0x00040000
#endif
#define HAT_CENTERED 0x00
#define HAT_UP 0x01
@ -52,7 +28,4 @@ int32_t JOYSTICK_GetAxis( int32_t a );
void JOYSTICK_ClearAxis( int32_t a );
void JOYSTICK_ClearAllAxes( void );
#ifdef __cplusplus
}
#endif
#endif /* __joystick_h */

View file

@ -33,10 +33,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "baselayer.h" // for the keyboard stuff
#include "scancodes.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef uint8_t kb_scancode;
// translation table for taking key names to scancodes and back again
@ -104,7 +100,4 @@ static inline void KB_Shutdown(void) { keySetCallback((void (*)(int32_t, int32_t
const char * KB_ScanCodeToString( kb_scancode scancode ); // convert scancode into a string
kb_scancode KB_StringToScanCode( const char * string ); // convert a string into a scancode
#ifdef __cplusplus
}
#endif
#endif

View file

@ -32,10 +32,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "baselayer.h"
#ifdef __cplusplus
extern "C" {
#endif
#define LEFT_MOUSE 1
#define RIGHT_MOUSE 2
#define MIDDLE_MOUSE 4
@ -58,7 +54,4 @@ static inline int32_t MOUSE_GetButtons(void) { return mouseReadButtons(); }
static inline void MOUSE_ClearButton(int32_t b) { g_mouseBits &= ~b; }
static inline void MOUSE_ClearAllButtons(void) { g_mouseBits = 0; }
#ifdef __cplusplus
}
#endif
#endif /* __mouse_h */

View file

@ -28,9 +28,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#ifndef scriplib_public_h_
#define scriplib_public_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
==============
@ -225,8 +222,4 @@ void SCRIPT_PutBoolean(int32_t scripthandle, char *sectionname, char *entryname,
void SCRIPT_PutDouble(int32_t scripthandle, char *sectionname, char *entryname, double number, int32_t defaultvalue);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -31,9 +31,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#ifndef scriplib_private_h_
#define scriplib_private_h_
#ifdef __cplusplus
extern "C" {
#endif
#define SCRIPTSECTIONSTART ('[')
#define SCRIPTSECTIONEND (']')
@ -202,8 +199,4 @@ void SCRIPT_AddEntry
void SCRIPT_DecodeToken ( int32_t scripthandle, char * str );
#ifdef __cplusplus
}
#endif
#endif

View file

@ -3,10 +3,6 @@
#include "compat.h"
#ifdef __cplusplus
extern "C" {
#endif
#define POLY 0xEDB88320
#ifdef BITNESS64
@ -18,8 +14,4 @@ extern uint32_t crc32table[4][256];
extern uint32_t Bcrc32(const void* data, int length, uint32_t crc);
extern void initcrc32table(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -3,10 +3,6 @@
#include "compat.h"
#ifdef __cplusplus
extern "C"
{
#endif
/* These options may let the optimizer to remove some calls to the functions.
@ -304,9 +300,6 @@ extern fix16_t fix16_from_str(const char *buf);
) \
)
#ifdef __cplusplus
}
#include "fix16.hpp"
#endif
#endif

View file

@ -3,11 +3,6 @@
#include "compat.h"
#ifdef __cplusplus
extern "C"
{
#endif
static FORCE_INLINE CONSTEXPR int64_t int64_const(int32_t hi, uint32_t lo) { return (((int64_t)hi << 32) | lo); }
static FORCE_INLINE CONSTEXPR int64_t int64_from_int32(int32_t x) { return (int64_t)x; }
static FORCE_INLINE CONSTEXPR int32_t int64_hi(int64_t x) { return (x >> 32); }
@ -30,8 +25,4 @@ static FORCE_INLINE CONSTEXPR int int64_cmp_ge(int64_t x, int64_t y) { return (x
static FORCE_INLINE CONSTEXPR int int64_cmp_lt(int64_t x, int64_t y) { return (x < y); }
static FORCE_INLINE CONSTEXPR int int64_cmp_le(int64_t x, int64_t y) { return (x <= y); }
#ifdef __cplusplus
}
#endif
#endif

View file

@ -201,10 +201,6 @@ typedef struct sjson_node
// Not multi-threaded. Do not use the same context in multiple threads
typedef struct sjson_context sjson_context;
#ifdef __cplusplus
extern "C" {
#endif
sjson_context* sjson_create_context(int pool_size, int str_buffer_size, void* alloc_user);
void sjson_destroy_context(sjson_context* ctx);
void sjson_reset_context(sjson_context* ctx);
@ -284,10 +280,6 @@ sjson_node* sjson_put_uint16s(sjson_context* ctx, sjson_node* parent, const char
*/
bool sjson_check(const sjson_node* node, char errmsg[256]);
#ifdef __cplusplus
}
#endif
#endif // SJSON_H_
#if defined(SJSON_IMPLEMENT)