Programmatically replace all __LINUX__ with POSIX

Steps:
```sh
srcs=$(mktemp)
find . -name "*.cpp" -or -name "*.c" -or -name "*.h" -or -name "*.hpp" -or -name "*.cc" -or -name "*.hh" > $srcs
xargs sed -i 's/ifndef __LINUX__/if !defined(POSIX)/' < $srcs
xargs sed -i 's/ifdef __LINUX__/if defined(POSIX)/' < $srcs
xargs sed -i 's/defined(__LINUX__)/defined(POSIX)/' < $srcs
```
This commit is contained in:
Chris Sarbora 2024-07-12 18:11:54 -05:00
parent 87f6ef009f
commit 3da53e567f
No known key found for this signature in database
60 changed files with 180 additions and 180 deletions

View File

@ -50,7 +50,7 @@
#ifndef __BRIEFPARSE_H_
#define __BRIEFPARSE_H_
#if defined(__LINUX__)
#if defined(POSIX)
#include "linux_fix.h" //for stricmp
#endif

View File

@ -58,7 +58,7 @@
#include "newui.h"
#if defined(__LINUX__)
#if defined(POSIX)
void CIListBoxCallback(int ID, void *);
void CISliderCallback(int ID, void *);
#endif

View File

@ -92,7 +92,7 @@ struct game_api {
tOSIRISModuleInit *osiris_functions;
};
// The exported DLL function call prototypes
#if defined(__LINUX__)
#if defined(POSIX)
typedef void DLLFUNCCALL (*DLLGameCall_fp)(int eventnum, dllinfo *data);
typedef void DLLFUNCCALL (*DLLGameInit_fp)(int *api_func, uint8_t *all_ok, int num_teams_to_use);
typedef void DLLFUNCCALL (*DLLGameClose_fp)();

View File

@ -3240,7 +3240,7 @@ void ReadTerrainSkyAndLightChunk(CFILE *fp, int version) {
Terrain_sky.flags = cf_ReadInt(fp);
#ifdef __LINUX__
#if defined(POSIX)
if (FindArg("-noterrainfog") > 0) {
Terrain_sky.flags &= ~TF_FOG;
}

View File

@ -438,7 +438,7 @@ bool Show_osiris_debug = false;
// 0, only when the level ends
// The exported DLL function call prototypes
#if defined(__LINUX__)
#if defined(POSIX)
typedef char DLLFUNCCALL (*InitializeDLL_fp)(tOSIRISModuleInit *function_list);
typedef void DLLFUNCCALL (*ShutdownDLL_fp)(void);
typedef int DLLFUNCCALL (*GetGOScriptID_fp)(const char *name, uint8_t isdoor);
@ -3144,7 +3144,7 @@ int Osiris_ExtractScriptsFromHog(int library_handle, bool is_mission_hog) {
int count = 0;
const char *script_extension;
#if defined(__LINUX__)
#if defined(POSIX)
#if defined(MACOSX)
script_extension = "*.dylib";
#else

View File

@ -679,7 +679,7 @@ struct video_menu {
sheet->AddLongRadioButton("1600x1200");
*resolution = iTemp;
#if !defined(__LINUX__)
#if !defined(POSIX)
// renderer bit depth
switch (Render_preferred_bitdepth) {
case 16:
@ -708,7 +708,7 @@ struct video_menu {
sheet->NewGroup(TXT_MONITOR, 0, 180);
vsync = sheet->AddLongCheckBox(TXT_CFG_VSYNCENABLED, (Render_preferred_state.vsync_on != 0));
#ifndef __LINUX__
#if !defined(POSIX)
sheet->AddText("");
sheet->AddLongButton(TXT_AUTO_GAMMA, IDV_AUTOGAMMA);
#endif
@ -723,7 +723,7 @@ struct video_menu {
Render_preferred_state.mipping = (*mipmapping) ? 1 : 0;
if (vsync)
Render_preferred_state.vsync_on = (*vsync) ? 1 : 0;
#if !defined(__LINUX__)
#if !defined(POSIX)
if (bitdepth)
Render_preferred_bitdepth = (*bitdepth) == 1 ? 32 : 16;
#endif
@ -753,7 +753,7 @@ struct video_menu {
// process
void process(int res) {
#ifndef __LINUX__
#if !defined(POSIX)
switch (res) {
case IDV_AUTOGAMMA:
config_gamma();

View File

@ -94,7 +94,7 @@
#include <math.h>
#include "psrand.h"
#if defined(__LINUX__)
#if defined(POSIX)
#include "linux_fix.h"
#endif

View File

@ -108,7 +108,7 @@
#include <string.h>
#include <stdlib.h>
#ifndef __LINUX__
#if !defined(POSIX)
typedef int socklen_t;
#endif
@ -788,7 +788,7 @@ void PrintDedicatedMessage(const char *fmt, ...) {
DedicatedSocketputs(buf);
}
#ifdef __LINUX__
#if defined(POSIX)
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>

View File

@ -511,7 +511,7 @@ struct tLoadGameDialogData {
chunked_bitmap chunk;
};
#if defined(__LINUX__)
#if defined(POSIX)
void LoadGameDialogCB(newuiTiledWindow *wnd, void *data)
#else
void __cdecl LoadGameDialogCB(newuiTiledWindow *wnd, void *data)

View File

@ -1904,7 +1904,7 @@ void InitMatcens() {
atexit(DestroyAllMatcens);
}
#if defined(__LINUX__)
#if defined(POSIX)
void DestroyAllMatcens()
#else
void __cdecl DestroyAllMatcens()

View File

@ -826,7 +826,7 @@ int msn_ExtractZipFile(char *zipfilename, char *mn3name) {
return 1;
}
#ifdef __LINUX__
#if defined(POSIX)
char *_strlwr(char *string) {
char *ptr = string;
while (*ptr) {

View File

@ -103,7 +103,7 @@ enum tmmItemFX {
void MenuScene(); // display menu scene
/////////////////////////////////////////////////////////////////////
// gcc doesn't like the tQueue template in psclass.h
#ifdef __LINUX__
#if defined(POSIX)
// tQueue
// a circular queue implementation
class tmmItemQueue {
@ -144,7 +144,7 @@ class mmItem : public UIGadget {
int16_t m_alpha; // alpha for text item
int16_t m_satcount;
tmmItemFX m_curfx; // current effect
#ifndef __LINUX__
#if !defined(POSIX)
tQueue<tmmItemFX, 8> m_fxqueue; // special effects queue
#else
tmmItemQueue m_fxqueue;

View File

@ -498,7 +498,7 @@
#include "object_external.h"
#include "player_external.h"
#if defined(__LINUX__)
#if defined(POSIX)
#include "linux_fix.h"
#endif

View File

@ -328,7 +328,7 @@ extern bool Multi_Gamelist_changed;
int CheckMissionForScript(char *mission, char *script, int dedicated_server_num_teams);
void ShowNetgameInfo(network_game *game);
// The exported DLL function call prototypes
#if defined(__LINUX__)
#if defined(POSIX)
typedef void DLLFUNCCALL (*DLLMultiCall_fp)(int eventnum);
typedef void DLLFUNCCALL (*DLLMultiScoreCall_fp)(int eventnum, void *data);
typedef void DLLFUNCCALL (*DLLMultiInit_fp)(int *api_fp);

View File

@ -107,7 +107,7 @@
#ifndef __MULTI_EXTERNAL_H_
#define __MULTI_EXTERNAL_H_
#if defined(__LINUX__)
#if defined(POSIX)
#include <cstring>
#include <cstdint>
typedef uintptr_t DWORD;

View File

@ -187,7 +187,7 @@
#ifndef NEWUI_H
#define NEWUI_H
#if defined(__LINUX__)
#if defined(POSIX)
#include "linux_fix.h" //fix some of the stricmp's
#endif

View File

@ -142,13 +142,13 @@ void just_exit(void) {
#endif
SDL_Quit();
#ifdef __LINUX__
#if defined(POSIX)
sync(); // just in case.
#endif
_exit(0);
}
#ifdef __LINUX__
#if defined(POSIX)
void fatal_signal_handler(int signum) {
switch (signum) {
case SIGHUP:
@ -612,7 +612,7 @@ int main(int argc, char *argv[]) {
}
bool run_d3 = true;
#ifdef __LINUX__
#if defined(POSIX)
if (flags & APPFLAG_USESERVICE) {
run_d3 = false;
pid_t np = fork();

View File

@ -2717,7 +2717,7 @@ static g3Point *slist[256];
// Draws the 2 triangles of the Terrainlist[index] (software)
int DrawTerrainTrianglesSoftware(int index, int bm_handle, int upper_left, int lower_right) {
/*
#ifndef __LINUX__
#if !defined(POSIX)
int i,tlist[4],close=0,lit=0;
float closest_z=9999;
int color;

View File

@ -24,7 +24,7 @@
#include "bitmap.h"
#include "mono.h"
#include "mem.h"
#ifndef __LINUX__
#if !defined(POSIX)
#include "Macros.h"
#endif

View File

@ -28,7 +28,7 @@
#include <memory>
#include <vector>
#ifndef __LINUX__
#if !defined(POSIX)
// Non-Linux Build Includes
#include <io.h>
#else
@ -425,7 +425,7 @@ CFILE *open_file_in_directory(const std::filesystem::path &filename, const char
fp = fopen(using_filename.u8string().c_str(), tmode);
if (!fp) {
#ifdef __LINUX__
#if defined(POSIX)
// If we tried to open file for reading, assume there maybe case-sensitive files
if (tmode[0] == 'r') {
// Try different cases of the filename

View File

@ -133,7 +133,7 @@
#define IDNO 7
#endif
// #define DEBUG_LEVEL 0 //DAJ
#if defined(WIN32) || defined(__LINUX__)
#if defined(WIN32) || defined(POSIX)
constexpr const int OSMBOX_OK = 1;
constexpr const int OSMBOX_YESNO = 2;
constexpr const int OSMBOX_YESNOCANCEL = 3;
@ -172,7 +172,7 @@ void Debug_ConsolePrintfAt(int n, int row, int col, const char *format, ...);
#if !defined(RELEASE)
#include "debugbreak.h"
#if defined(WIN32)
#elif defined(__LINUX__)
#elif defined(POSIX)
void ddio_InternalKeyClose();
#else
#define debug_break()

View File

@ -118,7 +118,7 @@ bool ddio_GetBinaryPath(char *exec_path, size_t len) {
fprintf(stderr, "Buffer too small; need size %u\n", size);
return false;
}
#elif defined(__LINUX__)
#elif defined(POSIX)
if (realpath("/proc/self/exe", exec_path) == NULL) {
perror("realpath");
return false;

View File

@ -23,7 +23,7 @@
#include "briefinglocalizer.h"
#include "briefinglocalizerDlg.h"
#ifdef __LINUX__
#if defined(POSIX)
#include "linux_fix.h"
#endif

View File

@ -63,7 +63,7 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef __LINUX__
#if defined(POSIX)
// sorry, I'm lazy, I guess we could copy the defines
// that we need to transalte winsock->linux into this header...but no need to now
#include "inetgetfile.h"
@ -75,14 +75,14 @@
#include "CFtp.h"
#ifdef __LINUX__
#if defined(POSIX)
void *FTPObjThread(void *obj)
#else
void FTPObjThread(void *obj)
#endif
{
((CFtpGet *)obj)->WorkerThread();
#ifdef __LINUX__
#if defined(POSIX)
return NULL;
#endif
}
@ -199,7 +199,7 @@ CFtpGet::CFtpGet(char *URL, char *localfile, char *Username, char *Password) {
m_State = FTP_STATE_INTERNAL_ERROR;
return;
}
#elif defined(__LINUX__)
#elif defined(POSIX)
pthread_t thread;
if (!inet_LoadThreadLib()) {
m_State = FTP_STATE_INTERNAL_ERROR;
@ -216,7 +216,7 @@ CFtpGet::CFtpGet(char *URL, char *localfile, char *Username, char *Password) {
CFtpGet::~CFtpGet() {
if (m_ListenSock != INVALID_SOCKET) {
shutdown(m_ListenSock, 2);
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_ListenSock);
#else
close(m_ListenSock);
@ -224,7 +224,7 @@ CFtpGet::~CFtpGet() {
}
if (m_DataSock != INVALID_SOCKET) {
shutdown(m_DataSock, 2);
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_DataSock);
#else
close(m_DataSock);
@ -232,7 +232,7 @@ CFtpGet::~CFtpGet() {
}
if (m_ControlSock != INVALID_SOCKET) {
shutdown(m_ControlSock, 2);
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_ControlSock);
#else
close(m_ControlSock);
@ -317,7 +317,7 @@ uint32_t CFtpGet::GetFile() {
m_DataSock = accept(m_ListenSock, NULL, NULL); //(SOCKADDR *)&sockaddr,&iAddrLength);
// Close the listen socket
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_ListenSock);
#else
close(m_ListenSock);
@ -388,7 +388,7 @@ uint32_t CFtpGet::IssuePort() {
// Tell the server which port to use for data.
nReplyCode = SendFTPCommand(szCommandString);
if (nReplyCode != 200) {
#ifdef __LINUX__
#if defined(POSIX)
// I don't know if this is just Linux or do to a bug I fixed while porting to linux
// for some reason I kept getting reply 250 here and have to read again to get the
// "200 PORT Command OK" or whatever
@ -485,7 +485,7 @@ uint32_t CFtpGet::ReadFTPServerReply() {
if (iBytesRead == SOCKET_ERROR) {
int iWinsockErr = WSAGetLastError();
#ifdef __LINUX__
#if defined(POSIX)
if (0 == iWinsockErr) {
continue;
}
@ -531,7 +531,7 @@ uint32_t CFtpGet::ReadDataChannel() {
return 0;
nBytesRecv = recv(m_DataSock, (char *)&sDataBuffer, sizeof(sDataBuffer), 0);
#ifdef __LINUX__
#if defined(POSIX)
if (nBytesRecv == -1) {
int iWinsockErr = WSAGetLastError();
if (iWinsockErr == 0) {

View File

@ -129,7 +129,7 @@
#define mem_free(a) free(a)
#endif
#ifdef __LINUX__
#if defined(POSIX)
inline void Sleep(int millis) {
struct timeval tv;
@ -143,7 +143,7 @@ inline void Sleep(int millis) {
#define NW_AGHBN_LOOKUP 2
#define NW_AGHBN_READ 3
#ifndef __LINUX__
#if !defined(POSIX)
void __cdecl http_gethostbynameworker(void *parm);
#else
void *http_gethostbynameworker(void *parm);
@ -151,7 +151,7 @@ void *http_gethostbynameworker(void *parm);
int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname);
#ifndef __LINUX__
#if !defined(POSIX)
void HTTPObjThread(void *obj)
#else
void *HTTPObjThread(void *obj)
@ -161,7 +161,7 @@ void *HTTPObjThread(void *obj)
((ChttpGet *)obj)->m_Aborted = true;
// OutputDebugString("http transfer exiting....\n");
#ifdef __LINUX__
#if defined(POSIX)
return NULL;
#endif
}
@ -264,7 +264,7 @@ void ChttpGet::GetFile(char *URL, char *localfile) {
m_State = HTTP_STATE_INTERNAL_ERROR;
return;
}
#elif defined(__LINUX__)
#elif defined(POSIX)
pthread_t thread;
if (!inet_LoadThreadLib()) {
m_State = HTTP_STATE_INTERNAL_ERROR;
@ -280,7 +280,7 @@ void ChttpGet::GetFile(char *URL, char *localfile) {
ChttpGet::~ChttpGet() {
if (m_DataSock != INVALID_SOCKET) {
shutdown(m_DataSock, 2);
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_DataSock);
#else
close(m_DataSock);
@ -484,7 +484,7 @@ int ChttpGet::ConnectSocket() {
int serr = connect(m_DataSock, (SOCKADDR *)&hostaddr, sizeof(SOCKADDR));
int cerr = WSAGetLastError();
if (serr) {
#ifdef __LINUX__
#if defined(POSIX)
while ((cerr == WSAEALREADY) || (cerr == WSAEINVAL) || (cerr == WSAEWOULDBLOCK) || (cerr == EINPROGRESS))
#else
while ((cerr == WSAEALREADY) || (cerr == WSAEINVAL) || (cerr == WSAEWOULDBLOCK))
@ -529,7 +529,7 @@ char *ChttpGet::GetHTTPLine() {
if (SOCKET_ERROR == iBytesRead) {
int error = WSAGetLastError();
#ifdef __LINUX__
#if defined(POSIX)
if (WSAEWOULDBLOCK == error || 0 == error)
#else
if (WSAEWOULDBLOCK == error)
@ -552,7 +552,7 @@ char *ChttpGet::GetHTTPLine() {
if (SOCKET_ERROR == iBytesRead) {
int error = WSAGetLastError();
#ifdef __LINUX__
#if defined(POSIX)
if (WSAEWOULDBLOCK == error || 0 == error)
#else
if (WSAEWOULDBLOCK == error)
@ -612,7 +612,7 @@ uint32_t ChttpGet::ReadDataChannel() {
if (SOCKET_ERROR == nBytesRecv) {
int error = WSAGetLastError();
#ifdef __LINUX__
#if defined(POSIX)
if (WSAEWOULDBLOCK == error || 0 == error)
#else
if (WSAEWOULDBLOCK == error)
@ -648,7 +648,7 @@ uint32_t ChttpGet::ReadDataChannel() {
async_dns_lookup httpaslu;
async_dns_lookup *http_lastaslu = NULL;
#ifndef __LINUX__
#if !defined(POSIX)
void __cdecl http_gethostbynameworker(void *parm);
#else
void *http_gethostbynameworker(void *parm);
@ -672,7 +672,7 @@ int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
#ifdef WIN32
_beginthread(http_gethostbynameworker, 0, newaslu);
#elif defined(__LINUX__)
#elif defined(POSIX)
pthread_t thread;
if (!inet_LoadThreadLib()) {
return 0;
@ -704,20 +704,20 @@ int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
}
// This is the worker thread which does the lookup.
#ifndef __LINUX__
#if !defined(POSIX)
void __cdecl http_gethostbynameworker(void *parm)
#else
void *http_gethostbynameworker(void *parm)
#endif
{
#ifdef __LINUX__
#if defined(POSIX)
df_pthread_detach(df_pthread_self());
#endif
async_dns_lookup *lookup = (async_dns_lookup *)parm;
HOSTENT *he = gethostbyname(lookup->host);
if (he == NULL) {
lookup->error = true;
#ifdef __LINUX__
#if defined(POSIX)
return NULL;
#else
return;
@ -729,7 +729,7 @@ void *http_gethostbynameworker(void *parm)
}
mem_free(lookup);
#ifdef __LINUX__
#if defined(POSIX)
return NULL;
#endif
}

View File

@ -90,7 +90,7 @@
extern char *Proxy_server;
extern int16_t Proxy_port;
#ifdef __LINUX__
#if defined(POSIX)
pthread_create_fp df_pthread_create = NULL;
pthread_exit_fp df_pthread_exit = NULL;
pthread_detach_fp df_pthread_detach = NULL;

View File

@ -19,7 +19,7 @@
#if defined(WIN32)
#include <windows.h>
#include "ddraw.h"
#elif defined(__LINUX__)
#elif defined(POSIX)
#include "linux_fix.h"
#include "lnxscreenmode.h"
#else
@ -83,7 +83,7 @@ static HWND hOpenGLWnd = NULL;
static HDC hOpenGLDC = NULL;
HGLRC ResourceContext;
static WORD Saved_gamma_values[256 * 3];
#elif defined(__LINUX__)
#elif defined(POSIX)
static Display *OpenGL_Display = NULL;
static Window OpenGL_Window;
static XVisualInfo OpenGL_VisualInfo;
@ -355,7 +355,7 @@ void opengl_SetDefaults() {
Last_texel_unit_set = -1;
OpenGL_multitexture_state = false;
#ifdef __LINUX__
#if defined(POSIX)
OpenGL_UseLists = (FindArg("-gllists")) ? true : false;
if (OpenGL_UseLists) {
#endif
@ -366,7 +366,7 @@ void opengl_SetDefaults() {
dglVertexPointer(3, GL_FLOAT, 0, GL_verts);
dglColorPointer(4, GL_FLOAT, 0, GL_colors);
dglTexCoordPointer(4, GL_FLOAT, 0, GL_tex_coords);
#ifdef __LINUX__
#if defined(POSIX)
}
#endif
@ -494,7 +494,7 @@ int opengl_Setup(HDC glhdc) {
return 1;
}
#elif defined(__LINUX__)
#elif defined(POSIX)
bool opengl_GetXConfig(Display *dpy, XVisualInfo *vis, int attrib, int *value) {
int res;
@ -783,7 +783,7 @@ int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) {
// Save gamma values for later
GetDeviceGammaRamp(hOpenGLDC, (LPVOID)Saved_gamma_values);
#elif defined(__LINUX__)
#elif defined(POSIX)
/***********************************************************
* LINUX OPENGL
***********************************************************
@ -985,7 +985,7 @@ void opengl_Close(const bool just_resizing) {
// Change our display back
if (!WindowGL)
ChangeDisplaySettings(NULL, 0);
#elif defined(__LINUX__)
#elif defined(POSIX)
// Restore our video mode
LinuxVideoMode.Lock(false);
LinuxVideoMode.RestoreVideoMode();
@ -1034,7 +1034,7 @@ void opengl_Close(const bool just_resizing) {
SetDeviceGammaRamp(hOpenGLDC, (LPVOID)Saved_gamma_values);
// I'm freeing the DC here - samir
ReleaseDC(hOpenGLWnd, hOpenGLDC);
#elif defined(__LINUX__)
#elif defined(POSIX)
#else
@ -1561,11 +1561,11 @@ void opengl_DrawMultitexturePolygon(int handle, g3Point **p, int nv, int map_typ
opengl_SetMultitextureBlendMode(true);
// And draw!
#ifdef __LINUX__
#if defined(POSIX)
if (OpenGL_UseLists) {
#endif
dglDrawArrays(GL_POLYGON, 0, nv);
#ifdef __LINUX__
#if defined(POSIX)
} else {
dglBegin(GL_POLYGON);
for (i = 0; i < nv; i++) {
@ -1746,7 +1746,7 @@ void opengl_DrawPolygon(int handle, g3Point **p, int nv, int map_type) {
colorp->a = alpha;
}
#ifdef __LINUX__
#if defined(POSIX)
// MY TEST HACK...MAYBE BAD DRIVERS? OR MAYBE THIS IS
// HOW IT SHOULD BE DONE (STILL BUGGY)
// Texture this polygon!
@ -1778,11 +1778,11 @@ void opengl_DrawPolygon(int handle, g3Point **p, int nv, int map_type) {
}
// And draw!
#ifdef __LINUX__
#if defined(POSIX)
if (OpenGL_UseLists) {
#endif
dglDrawArrays(GL_POLYGON, 0, nv);
#ifdef __LINUX__
#if defined(POSIX)
} else {
dglBegin(GL_POLYGON);
for (i = 0; i < nv; i++) {
@ -1880,7 +1880,7 @@ void opengl_Flip() {
#if defined(WIN32)
SwapBuffers((HDC)hOpenGLDC);
#elif defined(__LINUX__)
#elif defined(POSIX)
glXWaitGL();
glXSwapBuffers(OpenGL_Display, OpenGL_Window);
#endif
@ -2561,7 +2561,7 @@ void opengl_GetStatistics(tRendererStats *stats) {
stats->texture_uploads = OpenGL_last_uploaded;
}
#ifdef __LINUX__
#if defined(POSIX)
void CreateFullScreenWindow(Display *dpy, Window rootwin, Window window, int DisplayScreen, int DisplayWidth,
int DisplayHeight) {
// see if a motif based window manager is running. do this by

View File

@ -439,7 +439,7 @@
#endif
// Renderers for Linux version
#if defined(__LINUX__)
#if defined(POSIX)
#define USE_OPENGL
#define USE_GLIDE
// #define USE_D3D

View File

@ -21,7 +21,7 @@
#include <cstdio>
#include <cstdint>
#ifdef __LINUX__
#if defined(POSIX)
#include "linux_fix.h"
#endif

View File

@ -23,7 +23,7 @@
#include "cfile.h"
#ifdef __LINUX__
#if defined(POSIX)
#include "linux_fix.h" //needed for stricmp's throughout bitmap lib
#endif

View File

@ -52,7 +52,7 @@
#ifndef __LNXVIDEOMODE_H__
#define __LNXVIDEOMODE_H__
#ifdef __LINUX__
#if defined(POSIX)
#include "linux_fix.h"
#endif
#include <SDL.h>

View File

@ -26,7 +26,7 @@
#include "bitmap.h"
#include "manage_external.h"
#if defined(__LINUX__)
#if defined(POSIX)
#include "linux_fix.h" //for strnicmp,etc.
#endif

View File

@ -105,7 +105,7 @@ struct module {
HINSTANCE handle; // handle to the DLL
};
//=======================================================================
#elif defined(__LINUX__)
#elif defined(POSIX)
//==========================Linux Definitions============================
#define MODPROCADDRESS void *

View File

@ -189,7 +189,7 @@ static inline void INADDR_GET_SUN_SUNB(struct in_addr *st, uint8_t *s_b1, uint8_
*s_b4 = st->S_un.S_un_b.s_b4;
}
#elif defined(__LINUX__)
#elif defined(POSIX)
// Linux includes/defines
#include <sys/types.h>
@ -490,7 +490,7 @@ struct async_dns_lookup {
bool abort; // read only to worker thread. If this is set, don't fill in the struct.
// rcg06212000 added to let us join the thread at completion...
#ifdef __LINUX__
#if defined(POSIX)
SDL_Thread *threadId;
#endif
};
@ -500,7 +500,7 @@ struct async_dns_lookup {
#else
#define CDECLCALL
#endif
#ifdef __LINUX__
#if defined(POSIX)
// rcg06192000 used to return void *.
int CDECLCALL gethostbynameworker(void *parm);
#else

View File

@ -22,7 +22,7 @@
#include <cstdlib>
#include <cstdint>
#ifdef __LINUX__
#if defined(POSIX)
#include "linux_fix.h"
#endif

View File

@ -26,8 +26,8 @@
#define USE_RTP
#endif
#if defined(__LINUX__)
// #if defined(__LINUX__)
#if defined(POSIX)
// #if defined(POSIX)
#ifdef USE_RTP
#undef USE_RTP // no rtp for now
#endif
@ -35,7 +35,7 @@
// use INT64 for 64bit integers
#ifdef USE_RTP
#if defined(__LINUX__)
#if defined(POSIX)
#define INT64 int64_t
#else
#define INT64 signed __int64

View File

@ -267,7 +267,7 @@
#ifndef UI_H
#define UI_H
#if defined(__LINUX__)
#if defined(POSIX)
#include "linux_fix.h" //for stricmp's through code
#endif
@ -399,7 +399,7 @@ private:
void CheckFocusOnSlaves(int mx, int my);
// universal variables
#ifdef __LINUX__ // gcc has a hard time tracing through some of the derived classes that access m_Wnd
#if defined(POSIX) // gcc has a hard time tracing through some of the derived classes that access m_Wnd
public:
#else
protected:
@ -421,7 +421,7 @@ protected:
void UnlockFocus(); // releases lock on input to gadget.
// called from outside gadget hierarchy.
#ifdef __LINUX__ // gcc has a hard time tracing through the dervived classes of newuiButton and thinks it can't access
#if defined(POSIX) // gcc has a hard time tracing through the dervived classes of newuiButton and thinks it can't access
// OnFormat()
public:
#else

View File

@ -70,7 +70,7 @@
#include <cstdlib>
#include <cctype>
#ifdef __LINUX__
#if defined(POSIX)
#include <sys/time.h>
#include <term.h>
#include <termios.h>
@ -85,7 +85,7 @@
#undef buttons
#endif
#ifdef __LINUX__
#if defined(POSIX)
static struct termios Linux_initial_terminal_settings;
#endif
@ -122,7 +122,7 @@ void LnxAppShutdown() {
LinuxAppDontCallShutdown = true;
if (LinuxAppFlags & OEAPP_CONSOLE) {
con_Destroy();
#ifdef __LINUX__
#if defined(POSIX)
tcsetattr(0, TCSANOW, &Linux_initial_terminal_settings);
#endif
}
@ -134,7 +134,7 @@ oeLnxApplication::oeLnxApplication(unsigned flags) {
m_AppActive = true;
if (flags & OEAPP_CONSOLE) {
#ifdef __LINUX__
#if defined(POSIX)
tcgetattr(0, &Linux_initial_terminal_settings);
#endif
con_Create(m_Flags);
@ -150,7 +150,7 @@ oeLnxApplication::oeLnxApplication(unsigned flags) {
// Create object with a premade info
oeLnxApplication::oeLnxApplication(tLnxAppInfo *appinfo) {
#ifdef __LINUX__
#if defined(POSIX)
tcgetattr(0, &Linux_initial_terminal_settings);
#endif
m_Flags = appinfo->flags;

View File

@ -19,7 +19,7 @@
#ifndef LNXAPP_H
#define LNXAPP_H
#ifdef __LINUX__
#if defined(POSIX)
#include "linux_fix.h"
#endif

View File

@ -45,7 +45,7 @@
#include <stdio.h>
#include <sys/types.h>
#ifdef __LINUX__
#if defined(POSIX)
#include <unistd.h>
#include <pwd.h>
#else
@ -215,7 +215,7 @@ bool oeLnxAppDatabase::write(const char *label, int entry) {
// get the current user's name from the os
void oeLnxAppDatabase::get_user_name(char *buffer, size_t *size) {
#ifdef __LINUX__
#if defined(POSIX)
struct passwd *pwuid = getpwuid(geteuid());
if ((pwuid != NULL) && (pwuid->pw_name != NULL)) {

View File

@ -441,7 +441,7 @@
#include <cstring>
#include <filesystem>
#if defined(__LINUX__)
#if defined(POSIX)
#include "linux_fix.h"
#endif
#include "descent.h"

View File

@ -188,7 +188,7 @@
*
* $NoKeywords: $
*/
#ifndef __LINUX__
#if !defined(POSIX)
#include <new.h>
#endif
#if defined(MACOSX)
@ -247,7 +247,7 @@ bool Mem_superlow_memory_mode = false;
// If this is set, the mem library ignores mem_free() calls. All the memory is then freed at once on exit.
bool Mem_quick_exit = false;
#if defined(__LINUX__)
#if defined(POSIX)
// Linux memory management
int LnxTotalMemUsed;
@ -308,7 +308,7 @@ bool mem_dumpmallocstofile(char *filename) { return false; }
#pragma mark -
#else // defined(__LINUX__)
#else // defined(POSIX)
// Windows memory management
// Uncomment this to detect memory leaks and memory overwrites. Slows down mallocs and frees a little.
@ -368,7 +368,7 @@ void operator delete(void *ptr)
int handle_program_memory_depletion(size_t size);
HANDLE Heap;
void mem_Init() {
#if defined(WIN32) || defined(__LINUX__)
#if defined(WIN32) || defined(POSIX)
// allocate failsafe block for memory used by any functions after we run out of memory.
// (printf for instance needs heap memory, as well as our error library.)
MEMORYSTATUS ms;
@ -443,7 +443,7 @@ void mem_Init() {
}
return;
#endif
#if defined(WIN32) || defined(__LINUX__)
#if defined(WIN32) || defined(POSIX)
Mem_failsafe_block = mem_malloc(128);
if (!Mem_failsafe_block) {
Error("No available heap memory.");

View File

@ -234,7 +234,7 @@ static inline void SetDebugBreakHandlers(void (*stop)(), void (*resume)()) {
if (_heapchk() != _HEAPOK) \
Int3(); \
} while (0)
#elif defined(__LINUX__)
#elif defined(POSIX)
#include "SDL.h"
// For some reason Linux doesn't like the \ continuation character, so I have to uglify this
#define DEBUG_BREAK() \

View File

@ -39,7 +39,7 @@
#include <stdlib.h>
#include <ctype.h>
#ifdef __LINUX__
#if defined(POSIX)
#include <ctype.h>
#endif

View File

@ -96,7 +96,7 @@
#include "pserror.h"
#include "ddio.h"
#ifdef __LINUX__
#if defined(POSIX)
#include <dlfcn.h>
static bool mod_FindRealFileNameCaseInsenstive(const char *directory, const char *filename, char *new_filename);
@ -108,7 +108,7 @@ static bool mod_FindRealFileNameCaseInsenstive(const char *directory, const char
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#if defined(__LINUX__)
#if defined(POSIX)
#include "linux_fix.h"
#endif
#if defined(WIN32) // INSTEAD OF MAKING MODULE HAVE DEPENDENCIES, PUT THE 2 DDIO FUNCTIONS I NEED HERE
@ -158,7 +158,7 @@ static void dd_MakePath(char *newPath, const char *absolutePathHeader, const cha
}
va_end(args);
}
#elif defined(__LINUX__)
#elif defined(POSIX)
// Split a pathname into its component parts
static void dd_SplitPath(const char *srcPath, char *path, char *filename, char *ext) {
int pathStart = -1;
@ -281,7 +281,7 @@ void mod_GetRealModuleName(const char *modfilename, char *realmodfilename) {
if (*extension == '\0')
#if defined(WIN32)
strcat(filename, ".dll");
#elif defined(__LINUX__)
#elif defined(POSIX)
#if defined(MACOSX)
strcat(filename, ".dylib");
#else
@ -294,12 +294,12 @@ void mod_GetRealModuleName(const char *modfilename, char *realmodfilename) {
strcat(filename, ".dll");
else
strcat(filename, extension);
#elif defined(__LINUX__) && !defined(MACOSX)
#elif defined(POSIX) && !defined(MACOSX)
if (!stricmp(extension, ".dll") || !stricmp(extension, "msl") || !stricmp(extension, "dylib"))
strcat(filename, ".so");
else
strcat(filename, extension);
#elif defined(__LINUX__) && defined(MACOSX)
#elif defined(POSIX) && defined(MACOSX)
if (!stricmp(extension, ".dll") || !stricmp(extension, "msl") || !stricmp(extension, "so"))
strcat(filename, ".dylib");
else
@ -348,7 +348,7 @@ bool mod_LoadModule(module *handle, const char *imodfilename, int flags) {
}
return false;
}
#elif defined(__LINUX__)
#elif defined(POSIX)
int f = 0;
if (flags & MODF_LAZY)
f |= RTLD_LAZY;
@ -398,7 +398,7 @@ bool mod_FreeModule(module *handle) {
}
#if defined(WIN32)
ret = (FreeLibrary(handle->handle) != 0);
#elif defined(__LINUX__)
#elif defined(POSIX)
dlclose(handle->handle); // dlclose() returns an int, but no docs say what values!!!
#endif
handle->handle = NULL;
@ -460,7 +460,7 @@ MODPROCADDRESS mod_GetSymbol(module *handle, const char *symstr, uint8_t parmbyt
}
return NULL;
}
#elif defined(__LINUX__)
#elif defined(POSIX)
sym = dlsym(handle->handle, symstr);
if (!sym) {
ModLastError = MODERR_OTHER;
@ -476,7 +476,7 @@ int mod_GetLastError(void) {
// Clear out the errors
#if defined(WIN32)
SetLastError(0);
#elif defined(__LINUX__)
#elif defined(POSIX)
dlerror();
#endif
int ret = ModLastError;
@ -484,7 +484,7 @@ int mod_GetLastError(void) {
return ret;
}
#ifdef __LINUX__
#if defined(POSIX)
#include <assert.h>
#include <stdarg.h>
#include <sys/stat.h>

View File

@ -72,7 +72,7 @@ void mve_SetCallback(MovieFrameCallback_fp callBack) {
// used to tell movie library how to render movies.
void mve_SetRenderProperties(int16_t x, int16_t y, int16_t w, int16_t h, renderer_type type, bool hicolor) {}
#ifdef __LINUX__
#if defined(POSIX)
// locates the case-sensitive movie file name
std::filesystem::path mve_FindMovieFileRealName(const std::filesystem::path &movie) {
// split into directory and file...
@ -104,7 +104,7 @@ int mve_PlayMovie(const std::filesystem::path &pMovieName, oeApplication *pApp)
#ifndef NO_MOVIES
// first, find that movie..
std::filesystem::path real_name;
#ifdef __LINUX__
#if defined(POSIX)
real_name = mve_FindMovieFileRealName(pMovieName);
if (real_name.empty()) {
mprintf(0, "MOVIE: No such file %s\n", pMovieName.u8string().c_str());
@ -356,7 +356,7 @@ intptr_t mve_SequenceStart(const char *mvename, void *fhandle, oeApplication *ap
#ifndef NO_MOVIES
// first, find that movie..
std::filesystem::path real_name;
#ifdef __LINUX__
#if defined(POSIX)
real_name = mve_FindMovieFileRealName(mvename);
if (real_name.empty()) {
mprintf(0, "MOVIE: No such file %s\n", mvename);

View File

@ -81,7 +81,7 @@
typedef UINT_PTR SOCKET;
#endif
#ifdef __LINUX__
#if defined(POSIX)
extern int FTPObjThread(void *obj);
#else
extern void FTPObjThread(void *obj);

View File

@ -267,7 +267,7 @@
#include "ship.h"
#include "pstypes.h"
#ifdef __LINUX__
#if defined(POSIX)
#include <string.h>
#include "linux_fix.h"
#endif
@ -827,7 +827,7 @@ typedef void(DLLFUNCCALL DLLAVCall_fp)(int eventnum);
typedef void(DLLFUNCCALL DLLAVClose_fp)();
typedef void(DLLFUNCCALL DLLAVGetVersion_fp)(int *version);
typedef void(DLLFUNCCALL DLLRunCheck_fp)(char *d3_path);
#elif defined(__LINUX__)
#elif defined(POSIX)
typedef void DLLFUNCCALL(DLLAVInit_fp)(int *ptr);
typedef void DLLFUNCCALL(DLLAVCall_fp)(int eventnum);
typedef void DLLFUNCCALL(DLLAVClose_fp)();

View File

@ -86,7 +86,7 @@
// At the end of this file is an example of usage
#if defined(__LINUX__)
#if defined(POSIX)
#include <ctype.h>
#include <errno.h>
#include <netinet/in.h>

View File

@ -74,7 +74,7 @@ typedef int socklen_t;
#include <stdio.h>
#include <stdlib.h>
#ifdef __LINUX__
#if defined(POSIX)
// sorry, I'm lazy, I guess we could copy the defines
// that we need to transalte winsock->linux into this header...but no need to now
#include "SDL_thread.h"
@ -84,14 +84,14 @@ typedef int socklen_t;
#include "CFtp.h"
// MTS: only used in this file?
#ifdef __LINUX__
#if defined(POSIX)
int FTPObjThread(void *obj)
#else
void FTPObjThread(void *obj)
#endif
{
((CFtpGet *)obj)->WorkerThread();
#ifdef __LINUX__
#if defined(POSIX)
return 0;
#endif
}
@ -208,7 +208,7 @@ CFtpGet::CFtpGet(char *URL, char *localfile, char *Username, char *Password) {
m_State = FTP_STATE_INTERNAL_ERROR;
return;
}
#elif defined(__LINUX__)
#elif defined(POSIX)
// pthread_t thread;
SDL_Thread *thread;
@ -231,7 +231,7 @@ CFtpGet::CFtpGet(char *URL, char *localfile, char *Username, char *Password) {
CFtpGet::~CFtpGet() {
if (m_ListenSock != INVALID_SOCKET) {
shutdown(m_ListenSock, 2);
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_ListenSock);
#else
close(m_ListenSock);
@ -239,7 +239,7 @@ CFtpGet::~CFtpGet() {
}
if (m_DataSock != INVALID_SOCKET) {
shutdown(m_DataSock, 2);
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_DataSock);
#else
close(m_DataSock);
@ -247,7 +247,7 @@ CFtpGet::~CFtpGet() {
}
if (m_ControlSock != INVALID_SOCKET) {
shutdown(m_ControlSock, 2);
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_ControlSock);
#else
close(m_ControlSock);
@ -332,7 +332,7 @@ uint32_t CFtpGet::GetFile() {
m_DataSock = accept(m_ListenSock, NULL, NULL); //(SOCKADDR *)&sockaddr,&iAddrLength);
// Close the listen socket
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_ListenSock);
#else
close(m_ListenSock);
@ -403,7 +403,7 @@ uint32_t CFtpGet::IssuePort() {
// Tell the server which port to use for data.
nReplyCode = SendFTPCommand(szCommandString);
if (nReplyCode != 200) {
#ifdef __LINUX__
#if defined(POSIX)
// I don't know if this is just Linux or do to a bug I fixed while porting to linux
// for some reason I kept getting reply 250 here and have to read again to get the
// "200 PORT Command OK" or whatever
@ -500,7 +500,7 @@ uint32_t CFtpGet::ReadFTPServerReply() {
if (iBytesRead == SOCKET_ERROR) {
int iWinsockErr = WSAGetLastError();
#ifdef __LINUX__
#if defined(POSIX)
if (0 == iWinsockErr) {
continue;
}
@ -546,7 +546,7 @@ uint32_t CFtpGet::ReadDataChannel() {
return 0;
nBytesRecv = recv(m_DataSock, (char *)&sDataBuffer, sizeof(sDataBuffer), 0);
#ifdef __LINUX__
#if defined(POSIX)
if (nBytesRecv == -1) {
int iWinsockErr = WSAGetLastError();
if (iWinsockErr == 0) {

View File

@ -138,7 +138,7 @@
#define mem_free(a) free(a)
#endif
#ifdef __LINUX__
#if defined(POSIX)
#include "SDL_thread.h"
@ -154,7 +154,7 @@ inline void Sleep(int millis) {
#define NW_AGHBN_LOOKUP 2
#define NW_AGHBN_READ 3
#ifndef __LINUX__
#if !defined(POSIX)
static void HTTPObjThread(void *obj);
static void __cdecl http_gethostbynameworker(void *parm);
#else
@ -164,7 +164,7 @@ static int http_gethostbynameworker(void *parm);
static int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname);
#ifndef __LINUX__
#if !defined(POSIX)
void HTTPObjThread(void *obj)
#else
int HTTPObjThread(void *obj)
@ -174,7 +174,7 @@ int HTTPObjThread(void *obj)
((ChttpGet *)obj)->m_Aborted = true;
// OutputDebugString("http transfer exiting....\n");
#ifdef __LINUX__
#if defined(POSIX)
return 0;
#endif
}
@ -282,7 +282,7 @@ void ChttpGet::GetFile(char *URL, char *localfile) {
m_State = HTTP_STATE_INTERNAL_ERROR;
return;
}
#elif defined(__LINUX__)
#elif defined(POSIX)
// pthread_t thread;
SDL_Thread *thread;
@ -303,7 +303,7 @@ void ChttpGet::GetFile(char *URL, char *localfile) {
ChttpGet::~ChttpGet() {
if (m_DataSock != INVALID_SOCKET) {
shutdown(m_DataSock, 2);
#ifndef __LINUX__
#if !defined(POSIX)
closesocket(m_DataSock);
#else
close(m_DataSock);
@ -507,7 +507,7 @@ int ChttpGet::ConnectSocket() {
int serr = connect(m_DataSock, (SOCKADDR *)&hostaddr, sizeof(SOCKADDR));
int cerr = WSAGetLastError();
if (serr) {
#ifdef __LINUX__
#if defined(POSIX)
while ((cerr == WSAEALREADY) || (cerr == WSAEINVAL) || (cerr == WSAEWOULDBLOCK) || (cerr == EINPROGRESS))
#else
while ((cerr == WSAEALREADY) || (cerr == WSAEINVAL) || (cerr == WSAEWOULDBLOCK))
@ -552,7 +552,7 @@ char *ChttpGet::GetHTTPLine() {
if (SOCKET_ERROR == iBytesRead) {
int error = WSAGetLastError();
#ifdef __LINUX__
#if defined(POSIX)
if (WSAEWOULDBLOCK == error || 0 == error)
#else
if (WSAEWOULDBLOCK == error)
@ -575,7 +575,7 @@ char *ChttpGet::GetHTTPLine() {
if (SOCKET_ERROR == iBytesRead) {
int error = WSAGetLastError();
#ifdef __LINUX__
#if defined(POSIX)
if (WSAEWOULDBLOCK == error || 0 == error)
#else
if (WSAEWOULDBLOCK == error)
@ -635,7 +635,7 @@ uint32_t ChttpGet::ReadDataChannel() {
if (SOCKET_ERROR == nBytesRecv) {
int error = WSAGetLastError();
#ifdef __LINUX__
#if defined(POSIX)
if (WSAEWOULDBLOCK == error || 0 == error)
#else
if (WSAEWOULDBLOCK == error)
@ -689,7 +689,7 @@ int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
#ifdef WIN32
_beginthread(http_gethostbynameworker, 0, newaslu);
#elif defined(__LINUX__)
#elif defined(POSIX)
// pthread_t thread;
if (!inet_LoadThreadLib()) {
return 0;
@ -703,7 +703,7 @@ int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
if (http_lastaslu)
http_lastaslu->abort = true;
#ifdef __LINUX__
#if defined(POSIX)
SDL_WaitThread(http_lastaslu->threadId, NULL);
#endif
@ -713,7 +713,7 @@ int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
return -1;
if (httpaslu.done) {
// free(http_lastaslu);
#ifdef __LINUX__
#if defined(POSIX)
SDL_WaitThread(http_lastaslu->threadId, NULL);
#endif
@ -721,7 +721,7 @@ int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
memcpy(ip, &httpaslu.ip, sizeof(uint32_t));
return 1;
} else if (httpaslu.error) {
#ifdef __LINUX__
#if defined(POSIX)
SDL_WaitThread(http_lastaslu->threadId, NULL);
#endif
@ -735,20 +735,20 @@ int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
}
// This is the worker thread which does the lookup.
#ifndef __LINUX__
#if !defined(POSIX)
void __cdecl http_gethostbynameworker(void *parm)
#else
int http_gethostbynameworker(void *parm)
#endif
{
#ifdef __LINUX__
#if defined(POSIX)
// df_pthread_detach(df_pthread_self());
#endif
async_dns_lookup *lookup = (async_dns_lookup *)parm;
HOSTENT *he = gethostbyname(lookup->host);
if (he == NULL) {
lookup->error = true;
#ifdef __LINUX__
#if defined(POSIX)
return 0;
#else
return;
@ -760,7 +760,7 @@ int http_gethostbynameworker(void *parm)
}
mem_free(lookup);
#ifdef __LINUX__
#if defined(POSIX)
return 0;
#endif
}

View File

@ -84,7 +84,7 @@
extern char *Proxy_server;
extern int16_t Proxy_port;
#ifdef __LINUX__
#if defined(POSIX)
/* ryan sez: use SDL.
pthread_create_fp df_pthread_create = NULL;
pthread_exit_fp df_pthread_exit = NULL;

View File

@ -23,7 +23,7 @@
#include <cstdio>
#include <cstring>
#ifdef __LINUX__
#if defined(POSIX)
#include <sys/time.h>
#include <unistd.h>
#endif
@ -202,7 +202,7 @@ int ConnectToChatServer(const char *serveraddr, int16_t chat_port, char *nicknam
if (SOCKET_ERROR == connect(Chatsock, (SOCKADDR *)&Chataddr, sizeof(SOCKADDR_IN))) {
int ret = WSAGetLastError();
#ifndef __LINUX__
#if !defined(POSIX)
if (WSAEWOULDBLOCK == WSAGetLastError())
#else
if (EINPROGRESS == ret || 0 == ret)
@ -456,7 +456,7 @@ const char *ChatGetString() {
bytesread = recv(Chatsock, ch, 1, 0);
if (bytesread == SOCKET_ERROR) {
uint32_t lerror = WSAGetLastError();
#ifndef __LINUX__
#if !defined(POSIX)
if (WSAEWOULDBLOCK != lerror)
#else
if (WSAEWOULDBLOCK != lerror && 0 != lerror)

View File

@ -338,7 +338,7 @@
if (DLLDebugBreak_callback_resume) \
DLLDebugBreak_callback_resume(); \
} while (0)
#elif defined(__LINUX__)
#elif defined(POSIX)
// For some reason Linux doesn't like the \ continuation character, so I have to uglify this
#define DLLmprintf(...) DLLDebug_ConsolePrintf(__VA_ARGS__)
#ifdef DEBUG_BREAK

View File

@ -294,7 +294,7 @@ typedef int socklen_t;
#endif
#include <stdlib.h>
#include <string.h>
#ifdef __LINUX__
#if defined(POSIX)
#if !MACOSX
#include <netinet/in.h>
#endif
@ -519,7 +519,7 @@ struct reliable_socket {
static reliable_socket reliable_sockets[MAXRELIABLESOCKETS];
//*******************************
#ifdef __LINUX__
#if defined(POSIX)
#include <fcntl.h>
#endif
@ -2069,7 +2069,7 @@ static async_dns_lookup *lastaslu = NULL;
#define CDECLCALL
#endif
#ifdef __LINUX__
#if defined(POSIX)
int CDECLCALL gethostbynameworker(void *parm);
#include "SDL.h"
#include "SDL_thread.h"
@ -2123,7 +2123,7 @@ int nw_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
lastaslu->abort = true;
// rcg06212000 join the thread.
#ifdef __LINUX__
#if defined(POSIX)
SDL_WaitThread(lastaslu->threadId, NULL);
free(lastaslu);
#endif
@ -2131,7 +2131,7 @@ int nw_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
// rcg06262000 don't need all the rigamarole since we join the thread.
#if (!defined(__LINUX__))
#if (!defined(POSIX))
async_dns_lookup *newaslu;
newaslu = (async_dns_lookup *)mem_malloc(sizeof(async_dns_lookup));
memset(&newaslu->ip, 0, sizeof(uint32_t));
@ -2153,7 +2153,7 @@ int nw_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
#ifdef WIN32
_beginthread(gethostbynameworker, 0, newaslu);
#elif defined(__LINUX__)
#elif defined(POSIX)
// rcg06192000 use SDL threads.
/*
nw_LoadThreadLibrary();
@ -2196,7 +2196,7 @@ int nw_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
lastaslu->abort = true;
// rcg06212000 join the thread.
#ifdef __LINUX__
#if defined(POSIX)
SDL_WaitThread(lastaslu->threadId, NULL);
#endif
} // if
@ -2206,7 +2206,7 @@ int nw_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
return -1;
if (aslu.done) {
// rcg06212000 join the thread.
#ifdef __LINUX__
#if defined(POSIX)
SDL_WaitThread(aslu.threadId, NULL);
#endif
@ -2215,7 +2215,7 @@ int nw_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
return 1;
} else if (aslu.error) {
// rcg06212000 join the thread.
#ifdef __LINUX__
#if defined(POSIX)
SDL_WaitThread(aslu.threadId, NULL);
#else
mem_free(lastaslu);
@ -2230,14 +2230,14 @@ int nw_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
}
// This is the worker thread which does the lookup.
#ifdef __LINUX__
#if defined(POSIX)
int CDECLCALL gethostbynameworker(void *parm)
#else
void CDECLCALL gethostbynameworker(void *parm)
#endif
{
// rcg06192000 nope.
// #ifdef __LINUX__
// #if defined(POSIX)
// dpthread_detach(dpthread_self());
// #endif
@ -2249,7 +2249,7 @@ void CDECLCALL gethostbynameworker(void *parm)
if (he == NULL) {
lookup->error = true;
#ifdef __LINUX__
#if defined(POSIX)
return 0;
#else
return;
@ -2267,11 +2267,11 @@ void CDECLCALL gethostbynameworker(void *parm)
}
// rcg06252000 don't free this, 'cause we need the threadId.
#ifndef __LINUX__
#if !defined(POSIX)
mem_free(lookup);
#endif
#ifdef __LINUX__
#if defined(POSIX)
return 0;
#endif
}

View File

@ -446,7 +446,7 @@ int opengl_Setup(oeApplication *app, int *width, int *height) {
OpenGLDLLHandle = LoadOpenGLDLL(gl_library);
if (!(OpenGLDLLHandle)) {
// rcg07072000 last ditch effort...
#ifdef __LINUX__
#if defined(POSIX)
strcpy(gl_library, "libGL.so.1");
#else
strcpy(gl_library, "opengl32.dll");

View File

@ -31,7 +31,7 @@
#if defined(WIN32)
#define GLFUNCCALL __stdcall
#elif defined(__LINUX__)
#elif defined(POSIX)
#include <unistd.h>
#define GLFUNCCALL
#endif
@ -488,7 +488,7 @@ module *LoadOpenGLDLL(const char *dllname) {
dwglGetProcAddress = (wglGetProcAddress_fp)mod_GetSymbol(&OpenGLDLLInst, "wglGetProcAddress", 255);
if (!dwglGetProcAddress)
goto dll_error;
#elif defined(__LINUX__)
#elif defined(POSIX)
// bk000614 - have to fix globals
extern glAlphaFunc_fp dglAlphaFunc;

View File

@ -24,7 +24,7 @@
#include "osiris_common.h"
#ifdef __LINUX__
#if defined(POSIX)
#include "linux_lib.h"
#endif

View File

@ -241,7 +241,7 @@
#include "room.h"
#include "doorway.h"
#if defined(WIN32) || defined(__LINUX__)
#if defined(WIN32) || defined(POSIX)
#include "../manage/soundpage.h"
#include "../Descent3/sounds.h"
#endif

View File

@ -125,7 +125,7 @@
#include <string.h>
#ifdef __LINUX__
#if defined(POSIX)
int UIButton::m_ButtonFont;
#endif