mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-13 15:31:28 +00:00
minor updates to some files from uhexen2 (for sake of symmetry between the two trees.)
git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1337 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
c1705e00d4
commit
1bc6a7fbaf
4 changed files with 223 additions and 5 deletions
|
@ -59,7 +59,7 @@
|
|||
# endif
|
||||
|
||||
#elif defined(__MORPHOS__) || defined(__AROS__) || defined(AMIGAOS) || \
|
||||
defined(__amigaos__) || defined(__amigados__) || \
|
||||
defined(__amigaos__) || defined(__amigaos4__) ||defined(__amigados__) || \
|
||||
defined(AMIGA) || defined(_AMIGA) || defined(__AMIGA__)
|
||||
|
||||
# if !defined(PLATFORM_AMIGA)
|
||||
|
@ -108,6 +108,13 @@
|
|||
#endif /* PLATFORM_BSD (for convenience) */
|
||||
|
||||
|
||||
#if defined(PLATFORM_AMIGA) && !defined(PLATFORM_AMIGAOS3)
|
||||
# if !defined(__MORPHOS__) && !defined(__AROS__) && !defined(__amigaos4__)
|
||||
# define PLATFORM_AMIGAOS3 1
|
||||
# endif
|
||||
#endif /* PLATFORM_AMIGAOS3 (for convenience) */
|
||||
|
||||
|
||||
#if defined(_WIN64)
|
||||
# define PLATFORM_STRING "Win64"
|
||||
#elif defined(_WIN32)
|
||||
|
@ -130,6 +137,8 @@
|
|||
# define PLATFORM_STRING "MorphOS"
|
||||
#elif defined(__AROS__)
|
||||
# define PLATFORM_STRING "AROS"
|
||||
#elif defined(__amigaos4__)
|
||||
# define PLATFORM_STRING "AmigaOS4"
|
||||
#elif defined(PLATFORM_AMIGA)
|
||||
# define PLATFORM_STRING "AmigaOS"
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
|
|
195
quakespasm/Quake/filenames.h
Normal file
195
quakespasm/Quake/filenames.h
Normal file
|
@ -0,0 +1,195 @@
|
|||
/* Macros for taking apart, interpreting and processing file names.
|
||||
*
|
||||
* These are here because some non-Posix (a.k.a. DOSish) systems have
|
||||
* drive letter brain-damage at the beginning of an absolute file name,
|
||||
* use forward- and back-slash in path names interchangeably, and
|
||||
* some of them have case-insensitive file names.
|
||||
*
|
||||
* Copyright 2000, 2001, 2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* This is based on filenames.h from BFD, the Binary File Descriptor
|
||||
* library, changed further for our needs.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef FILENAMES_H
|
||||
#define FILENAMES_H
|
||||
|
||||
#include <string.h>
|
||||
#include "compiler.h" /* for inline, etc */
|
||||
|
||||
/* ---------------------- Windows, DOS, OS2: ---------------------- */
|
||||
#if defined(__MSDOS__) || defined(MSDOS) || defined(__DOS__) || \
|
||||
defined(__DJGPP__) || defined(__OS2__) || defined(__EMX__) || \
|
||||
defined(_WIN32) || defined(__CYGWIN__)
|
||||
|
||||
#define HAVE_DOS_BASED_FILE_SYSTEM 1
|
||||
#define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
|
||||
|
||||
#define HAS_DRIVE_SPEC(f) ((f)[0] && ((f)[1] == ':'))
|
||||
#define STRIP_DRIVE_SPEC(f) ((f) + 2)
|
||||
#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\')
|
||||
/* both '/' and '\\' work as dir separator. djgpp likes changing
|
||||
* '\\' into '/', so I define DIR_SEPARATOR_CHAR as '/' for djgpp,
|
||||
* '\\' otherwise. */
|
||||
#ifdef __DJGPP__
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#define DIR_SEPARATOR_STR "/"
|
||||
#else
|
||||
#define DIR_SEPARATOR_CHAR '\\'
|
||||
#define DIR_SEPARATOR_STR "\\"
|
||||
#endif
|
||||
/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is
|
||||
only semi-absolute. This is because the users of IS_ABSOLUTE_PATH
|
||||
want to know whether to prepend the current working directory to
|
||||
a file name, which should not be done with a name like d:foo. */
|
||||
#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || HAS_DRIVE_SPEC((f)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path) {
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strchr(_the_path, '/');
|
||||
char *p2 = strchr(_the_path, '\\');
|
||||
if (p1 == NULL) return p2;
|
||||
if (p2 == NULL) return p1;
|
||||
return (p1 < p2)? p1 : p2;
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (char *_the_path) {
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strrchr(_the_path, '/');
|
||||
char *p2 = strrchr(_the_path, '\\');
|
||||
if (p1 == NULL) return p2;
|
||||
if (p2 == NULL) return p1;
|
||||
return (p1 > p2)? p1 : p2;
|
||||
}
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
/* FIXME: What about C:FOO ? */
|
||||
const char *p1 = strchr(_the_path, '/');
|
||||
const char *p2 = strchr(_the_path, '\\');
|
||||
if (p1 == NULL) return p2;
|
||||
if (p2 == NULL) return p1;
|
||||
return (p1 < p2)? p1 : p2;
|
||||
}
|
||||
static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
/* FIXME: What about C:FOO ? */
|
||||
const char *p1 = strrchr(_the_path, '/');
|
||||
const char *p2 = strrchr(_the_path, '\\');
|
||||
if (p1 == NULL) return p2;
|
||||
if (p2 == NULL) return p1;
|
||||
return (p1 > p2)? p1 : p2;
|
||||
}
|
||||
#else
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strchr(_the_path, '/');
|
||||
char *p2 = strchr(_the_path, '\\');
|
||||
if (p1 == NULL) return p2;
|
||||
if (p2 == NULL) return p1;
|
||||
return (p1 < p2)? p1 : p2;
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strrchr(_the_path, '/');
|
||||
char *p2 = strrchr(_the_path, '\\');
|
||||
if (p1 == NULL) return p2;
|
||||
if (p2 == NULL) return p1;
|
||||
return (p1 > p2)? p1 : p2;
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
||||
/* ----------------- AmigaOS, MorphOS, AROS, etc: ----------------- */
|
||||
#elif defined(__MORPHOS__) || defined(__AROS__) || defined(AMIGAOS) || \
|
||||
defined(__amigaos__) || defined(__amigaos4__) ||defined(__amigados__) || \
|
||||
defined(AMIGA) || defined(_AMIGA) || defined(__AMIGA__)
|
||||
|
||||
#define HAS_DRIVE_SPEC(f) (0) /* */
|
||||
#define STRIP_DRIVE_SPEC(f) (f) /* */
|
||||
#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == ':')
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#define DIR_SEPARATOR_STR "/"
|
||||
#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (strchr((f), ':')))
|
||||
#define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path) {
|
||||
char *p = strchr(_the_path, ':');
|
||||
if (p != NULL) return p;
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (char *_the_path) {
|
||||
char *p = strrchr(_the_path, '/');
|
||||
if (p != NULL) return p;
|
||||
return strchr(_the_path, ':');
|
||||
}
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
const char *p = strchr(_the_path, ':');
|
||||
if (p != NULL) return p;
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
const char *p = strrchr(_the_path, '/');
|
||||
if (p != NULL) return p;
|
||||
return strchr(_the_path, ':');
|
||||
}
|
||||
#else
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
char *p = strchr(_the_path, ':');
|
||||
if (p != NULL) return p;
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
char *p = strrchr(_the_path, '/');
|
||||
if (p != NULL) return p;
|
||||
return strchr(_the_path, ':');
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
||||
/* ---------------------- assumed UNIX-ish : ---------------------- */
|
||||
#else /* */
|
||||
|
||||
#define IS_DIR_SEPARATOR(c) ((c) == '/')
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#define DIR_SEPARATOR_STR "/"
|
||||
#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]))
|
||||
#define HAS_DRIVE_SPEC(f) (0)
|
||||
#define STRIP_DRIVE_SPEC(f) (f)
|
||||
|
||||
#ifdef __cplusplus
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path) {
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (char *_the_path) {
|
||||
return strrchr(_the_path, '/');
|
||||
}
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
return strrchr(_the_path, '/');
|
||||
}
|
||||
#else
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
return strrchr(_the_path, '/');
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* FILENAMES_H */
|
||||
|
|
@ -121,7 +121,7 @@ typedef unsigned int in_addr_t; /* u_int32_t */
|
|||
#define selectsocket(_N,_R,_W,_E,_T) \
|
||||
WaitSelect((_N),(_R),(_W),(_E),(_T),NULL)
|
||||
#define IOCTLARG_P(x) (char *) x
|
||||
#if defined(__AMIGA__) && !defined(__MORPHOS__)
|
||||
#if defined(__amigaos4__) || defined(PLATFORM_AMIGAOS3)
|
||||
#define inet_ntoa(x) Inet_NtoA(x.s_addr) /* Inet_NtoA(*(ULONG*)&x) */
|
||||
#define h_errno Errno()
|
||||
#endif
|
||||
|
|
|
@ -63,8 +63,22 @@ static inline int q_isblank(int c)
|
|||
|
||||
static inline int q_isspace(int c)
|
||||
{
|
||||
return (q_isblank(c) || c == '\n' || c == '\r' ||
|
||||
c == '\f' || c == '\v');
|
||||
switch(c) {
|
||||
case ' ': case '\t':
|
||||
case '\n': case '\r':
|
||||
case '\f': case '\v': return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int q_isgraph(int c)
|
||||
{
|
||||
return (c > 0x20 && c <= 0x7e);
|
||||
}
|
||||
|
||||
static inline int q_isprint(int c)
|
||||
{
|
||||
return (c >= 0x20 && c <= 0x7e);
|
||||
}
|
||||
|
||||
static inline int q_toascii(int c)
|
||||
|
@ -82,4 +96,4 @@ static inline int q_toupper(int c)
|
|||
return ((q_islower(c)) ? (c & ~('a' - 'A')) : c);
|
||||
}
|
||||
|
||||
#endif /* Q_CTYPE_H */
|
||||
#endif /* Q_CTYPE_H */
|
||||
|
|
Loading…
Reference in a new issue