use cmake for autoconf, slim down platform.h

This commit is contained in:
Enno Rehling 2014-03-15 19:29:11 +01:00
parent fc1a56d46a
commit 1a7d892a96
55 changed files with 248 additions and 185 deletions

View File

@ -6,17 +6,42 @@ enable_testing()
INCLUDE (CheckIncludeFiles) INCLUDE (CheckIncludeFiles)
INCLUDE (CheckSymbolExists) INCLUDE (CheckSymbolExists)
CHECK_INCLUDE_FILES (stdbool.h HAVE_STDBOOL_H) CHECK_INCLUDE_FILES (stdbool.h HAVE_STDBOOL_H)
CHECK_SYMBOL_EXISTS (_Bool "stdbool.h" HAVE__BOOL) CHECK_INCLUDE_FILES (windows.h HAVE_WINDOWS_H)
CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H) CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H)
CHECK_SYMBOL_EXISTS (strdup "string.h" HAVE_STRDUP) CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
IF (HAVE_WINDOWS_H)
CHECK_SYMBOL_EXISTS (_sleep "windows.h" HAVE__SLEEP)
ENDIF(HAVE_WINDOWS_H)
IF(HAVE_STDBOOL_H)
CHECK_SYMBOL_EXISTS (_Bool "stdbool.h" HAVE__BOOL)
ENDIF(HAVE_STDBOOL_H)
IF(HAVE_UNISTD_H)
CHECK_SYMBOL_EXISTS (sleep "unistd.h" HAVE_SLEEP)
CHECK_SYMBOL_EXISTS (usleep "unistd.h" HAVE_USLEEP)
ENDIF(HAVE_UNISTD_H)
CHECK_SYMBOL_EXISTS (strcasecmp "string.h" HAVE_STRCASECMP)
CHECK_SYMBOL_EXISTS (strncasecmp "string.h" HAVE_STRNCASECMP)
CHECK_SYMBOL_EXISTS (_strlwr "string.h" HAVE__STRLWR)
CHECK_SYMBOL_EXISTS (_strcmpl "string.h" HAVE__STRCMPL)
CHECK_SYMBOL_EXISTS (_strdup "string.h" HAVE__STRDUP) CHECK_SYMBOL_EXISTS (_strdup "string.h" HAVE__STRDUP)
CHECK_SYMBOL_EXISTS (mkdir "sys/stat.h" HAVE_MKDIR) CHECK_SYMBOL_EXISTS (_stricmp "string.h" HAVE__STRICMP)
CHECK_SYMBOL_EXISTS (_mkdir "direct.h" HAVE__MKDIR) CHECK_SYMBOL_EXISTS (_memicmp "string.h" HAVE__MEMICMP)
CHECK_SYMBOL_EXISTS (strcmpl "string.h" HAVE_STRCMPL)
CHECK_SYMBOL_EXISTS (strdup "string.h" HAVE_STRDUP)
CHECK_SYMBOL_EXISTS (stricmp "string.h" HAVE_STRICMP)
CHECK_SYMBOL_EXISTS (memicmp "string.h" HAVE_MEMICMP)
CHECK_SYMBOL_EXISTS (strlwr "string.h" HAVE_STRLWR)
CHECK_SYMBOL_EXISTS (snprintf "stdio.h" HAVE_SNPRINTF)
CHECK_SYMBOL_EXISTS (_snprintf "stdio.h" HAVE__SNPRINTF)
CHECK_SYMBOL_EXISTS (mkdir "sys/stat.h" HAVE_SYS_STAT_MKDIR)
CHECK_SYMBOL_EXISTS (mkdir "direct.h" HAVE_DIRECT_MKDIR)
CHECK_SYMBOL_EXISTS (_mkdir "direct.h" HAVE_DIRECT__MKDIR)
CONFIGURE_FILE ( CONFIGURE_FILE (
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/autoconf.h.in
${CMAKE_BINARY_DIR}/include/config.h) ${CMAKE_BINARY_DIR}/include/autoconf.h)
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/include) INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/include)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AUTOCONF")
IF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")

115
autoconf.h.in Normal file
View File

@ -0,0 +1,115 @@
#pragma once
#ifndef CMAKE_AUTOCONF_H
#define CMAKE_AUTOCONF_H
#cmakedefine HAVE_STDBOOL_H 1
#cmakedefine HAVE_STRINGS_H 1
#cmakedefine HAVE_WINDOWS_H 1
#cmakedefine HAVE_UNISTD_H 1
#cmakedefine HAVE__BOOL 1
#cmakedefine HAVE_STRCASECMP 1
#cmakedefine HAVE_STRNCASECMP 1
#cmakedefine HAVE__STRICMP 1
#cmakedefine HAVE_SNPRINTF 1
#cmakedefine HAVE__SNPRINTF 1
#cmakedefine HAVE_SLEEP 1
#cmakedefine HAVE_USLEEP 1
#cmakedefine HAVE__SLEEP 1
#cmakedefine HAVE_STRDUP 1
#cmakedefine HAVE__STRDUP 1
#cmakedefine HAVE_STRICMP 1
#cmakedefine HAVE__STRCMPL 1
#cmakedefine HAVE_STRCMPL 1
#cmakedefine HAVE__MEMICMP 1
#cmakedefine HAVE_MEMICMP 1
#cmakedefine HAVE__STRLWR 1
#cmakedefine HAVE_STRLWR 1
#cmakedefine HAVE_SYS_STAT_MKDIR 1
#cmakedefine HAVE_DIRECT_MKDIR 1
#cmakedefine HAVE_DIRECT__MKDIR 1
#include <stddef.h>
#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif
#if !defined(HAVE__MEMICMP)
#if defined(HAVE_MEMICMP)
#define _memicmp(a, b, n) memicmp(a, b, n)
#elif defined(HAVE_STRNCASECMP)
#define _memicmp(a, b, n) strncasecmp(a, b, n)
#else
#define _memicmp(a, b, n) lcp_memicmp(a, b, n)
#endif
#endif
#if !defined(HAVE__STRCMPL)
#if defined(HAVE_STRCMPL)
#define _strcmpl(a, b) strcmpl(a, b)
#elif defined(HAVE__STRICMP)
#define _strcmpl(a, b) _stricmp(a, b)
#elif defined(HAVE_STRICMP)
#define _strcmpl(a, b) stricmp(a, b)
#elif defined(HAVE_STRCASECMP)
#define _strcmpl(a, b) strcasecmp(a, b)
#else
#define _strcmpl(a, b) lcp_strcmpl(a, b)
#endif
#endif
#if defined(HAVE_DIRECT__MKDIR)
#include <direct.h>
#elif defined(HAVE_DIRECT_MKDIR)
#include <direct.h>
#define _mkdir(a) mkdir(a)
#elif defined(HAVE_SYS_STAT_MKDIR)
#include <sys/stat.h>
#define _mkdir(a) mkdir(a, 0777)
#endif
#if !defined(HAVE__STRLWR)
#if defined(HAVE_STRLWR)
#define _strlwr(a) strlwr(a)
#else
#define _strlwr(a) lcp_strlwr(a)
#endif
#endif
#if !defined(HAVE__STRDUP)
#if defined(HAVE_STRDUP)
#define _strdup(a) strdup(a)
#else
#define _strdup(a) lcp_strdup(a)
#endif
#endif
#if !defined(HAVE__SLEEP)
#if defined(HAVE_USLEEP)
#define _sleep(a) usleep(a)
#elif defined(HAVE_SLEEP)
#define _sleep(a) sleep((a)/1000)
#else
#define _sleep(a) lcp_sleep(a)
#endif
#endif
#if !defined(HAVE__SNPRINTF)
#if defined(HAVE_SNPRINTF)
#define _snprintf snprintf
#else
#define _snprintf lcp_snprintf
#endif
#endif
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
#if !defined(DBG_UNREFERENCED_PARAMETER)
#define DBG_UNREFERENCED_PARAMETER(x) x
#endif
#endif

View File

@ -1,7 +0,0 @@
#cmakedefine HAVE_STDBOOL_H 1
#cmakedefine HAVE__BOOL 1
#cmakedefine HAVE_STRINGS_H 1
#cmakedefine HAVE_STRDUP 1
#cmakedefine HAVE__STRDUP 1
#cmakedefine HAVE_MKDIR 1
#cmakedefine HAVE__MKDIR 1

2
configure vendored
View File

@ -21,6 +21,6 @@ echo "Building with $CC and $JOBS jobs"
mkdir -p $BIN_DIR mkdir -p $BIN_DIR
cd $BIN_DIR cd $BIN_DIR
CC="$CC" cmake .. -DCMAKE_MODULE_PATH=$PWD/../cmake/Modules -DCMAKE_BUILD_TYPE=Debug CC="$CC" ../s/cmake-init
make -j$JOBS make -j$JOBS
make test make test

View File

@ -37,6 +37,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* stdc includes */ /* stdc includes */
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <assert.h> #include <assert.h>
typedef struct object_data { typedef struct object_data {

View File

@ -25,6 +25,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
attrib_type at_raceprefix = { attrib_type at_raceprefix = {
"raceprefix", NULL, a_finalizestring, NULL, a_writestring, a_readstring, "raceprefix", NULL, a_finalizestring, NULL, a_writestring, a_readstring,

View File

@ -22,6 +22,8 @@ without prior permission by the authors of Eressea.
#include <util/language.h> #include <util/language.h>
#include <tolua.h> #include <tolua.h>
#include <stdlib.h>
#include <string.h>
int tolua_buildinglist_next(lua_State * L) int tolua_buildinglist_next(lua_State * L)
{ {

View File

@ -30,6 +30,7 @@ without prior permission by the authors of Eressea.
#include <quicklist.h> #include <quicklist.h>
#include <tolua.h> #include <tolua.h>
#include <string.h>
int tolua_factionlist_next(lua_State * L) int tolua_factionlist_next(lua_State * L)
{ {

View File

@ -26,6 +26,7 @@ without prior permission by the authors of Eressea.
#include <tolua.h> #include <tolua.h>
#include <lua.h> #include <lua.h>
#include <string.h>
#include <assert.h> #include <assert.h>
static int tolua_hashtable_get(lua_State * L) static int tolua_hashtable_get(lua_State * L)

View File

@ -16,6 +16,8 @@
#include <tolua.h> #include <tolua.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include <stdlib.h>
#define E_OK 0 #define E_OK 0
#define E_INVALID_MESSAGE 1 #define E_INVALID_MESSAGE 1

View File

@ -13,6 +13,7 @@
#include <quicklist.h> #include <quicklist.h>
#include <tolua.h> #include <tolua.h>
#include <stdlib.h>
static int tolua_levitate_ship(lua_State * L) static int tolua_levitate_ship(lua_State * L)
{ {

View File

@ -40,6 +40,8 @@ without prior permission by the authors of Eressea.
#include <tolua.h> #include <tolua.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include <stdlib.h>
int tolua_regionlist_next(lua_State * L) int tolua_regionlist_next(lua_State * L)
{ {

View File

@ -23,6 +23,8 @@ without prior permission by the authors of Eressea.
#include <util/language.h> #include <util/language.h>
#include <tolua.h> #include <tolua.h>
#include <string.h>
#include <stdlib.h>
int tolua_shiplist_next(lua_State * L) int tolua_shiplist_next(lua_State * L)
{ {

View File

@ -23,6 +23,8 @@ without prior permission by the authors of Eressea.
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <tolua.h> #include <tolua.h>

View File

@ -55,6 +55,8 @@ without prior permission by the authors of Eressea.
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h> #include <limits.h>
static int tolua_unit_get_objects(lua_State * L) static int tolua_unit_get_objects(lua_State * L)

View File

@ -76,6 +76,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* libs includes */ /* libs includes */
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <limits.h> #include <limits.h>

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: eressea ** Lua binding: eressea
** Generated automatically by tolua 5.1.3 on Thu Mar 13 14:40:47 2014. ** Generated automatically by tolua 5.1.3 on Sat Mar 15 19:26:36 2014.
*/ */
#include "tolua.h" #include "tolua.h"

View File

@ -35,6 +35,7 @@ without prior permission by the authors of Eressea.
#include <lua.h> #include <lua.h>
#include <assert.h> #include <assert.h>
#include <string.h>
static int static int
lua_giveitem(unit * s, unit * d, const item_type * itype, int n, struct order *ord) lua_giveitem(unit * s, unit * d, const item_type * itype, int n, struct order *ord)

View File

@ -1,6 +1,5 @@
#include <util/bool.h> #include "platform.h"
#include <util/base36.h> #include <util/base36.h>
#include <platform.h>
#include "json.h" #include "json.h"
@ -11,6 +10,9 @@
#include <stream.h> #include <stream.h>
#include "cJSON.h" #include "cJSON.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h> #include <assert.h>
int json_import(struct stream * out) { int json_import(struct stream * out) {
@ -26,7 +28,7 @@ int json_export(stream * out, unsigned int flags) {
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
char id[32]; char id[32];
cJSON *data; cJSON *data;
snprintf(id, sizeof(id), "%u", r->uid); _snprintf(id, sizeof(id), "%u", r->uid);
cJSON_AddItemToObject(json, id, data = cJSON_CreateObject()); cJSON_AddItemToObject(json, id, data = cJSON_CreateObject());
cJSON_AddNumberToObject(data, "x", r->x); cJSON_AddNumberToObject(data, "x", r->x);
cJSON_AddNumberToObject(data, "y", r->y); cJSON_AddNumberToObject(data, "y", r->y);

View File

@ -70,6 +70,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <limits.h> #include <limits.h>
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#pragma endregion #pragma endregion

View File

@ -2,6 +2,7 @@
#include "calendar.h" #include "calendar.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
int first_turn = 0; int first_turn = 0;
int first_month = 0; int first_month = 0;

View File

@ -39,6 +39,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <assert.h> #include <assert.h>
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
unsigned int nextborder = 0; unsigned int nextborder = 0;

View File

@ -49,6 +49,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* libc includes */ /* libc includes */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <assert.h> #include <assert.h>

View File

@ -35,6 +35,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
static equipment *equipment_sets; static equipment *equipment_sets;

View File

@ -16,6 +16,8 @@
#include <CuTest.h> #include <CuTest.h>
#include <tests.h> #include <tests.h>
#include <stdlib.h>
void test_updatespells(CuTest * tc) void test_updatespells(CuTest * tc)
{ {
faction * f; faction * f;

View File

@ -67,6 +67,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
int *storms; int *storms;

View File

@ -42,6 +42,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <ctype.h> #include <ctype.h>
#include <wctype.h> #include <wctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
const char *describe_braineater(unit * u, const struct locale *lang) const char *describe_braineater(unit * u, const struct locale *lang)

View File

@ -16,6 +16,7 @@
#include <util/goodies.h> #include <util/goodies.h>
#include <util/rng.h> #include <util/rng.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>

View File

@ -60,6 +60,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
extern int dice_rand(const char *s); extern int dice_rand(const char *s);

View File

@ -1590,7 +1590,7 @@ static seen_region **prepare_report(faction * f)
int write_reports(faction * f, time_t ltime) int write_reports(faction * f, time_t ltime)
{ {
int backup = 1, maxbackup = 128; int backup = 1, maxbackup = 128*1000;
bool gotit = false; bool gotit = false;
struct report_context ctx; struct report_context ctx;
const char *encoding = "UTF-8"; const char *encoding = "UTF-8";
@ -1629,9 +1629,9 @@ int write_reports(faction * f, time_t ltime)
if (errno) { if (errno) {
char zText[64]; char zText[64];
puts(" ERROR"); puts(" ERROR");
sprintf(zText, "Waiting %u seconds before retry", backup); sprintf(zText, "Waiting %u seconds before we retry", backup/1000);
perror(zText); perror(zText);
sleep(backup); _sleep(backup);
if (backup < maxbackup) { if (backup < maxbackup) {
backup *= 2; backup *= 2;
} }

View File

@ -9,6 +9,8 @@
#include <CuTest.h> #include <CuTest.h>
#include <tests.h> #include <tests.h>
#include <string.h>
static void test_reorder_units(CuTest * tc) static void test_reorder_units(CuTest * tc)
{ {
region *r; region *r;

View File

@ -30,6 +30,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
static critbit_tree cb_spells; static critbit_tree cb_spells;

View File

@ -8,6 +8,8 @@
#include "spellbook.h" #include "spellbook.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h>
spellbook * create_spellbook(const char * name) spellbook * create_spellbook(const char * name)
{ {

View File

@ -10,6 +10,7 @@
#include <CuTest.h> #include <CuTest.h>
#include <tests.h> #include <tests.h>
#include <stdlib.h>
int count_spell_cb(spellbook_entry * sbe, void * ptr) int count_spell_cb(spellbook_entry * sbe, void * ptr)
{ {

View File

@ -7,6 +7,7 @@
#include <sqlite3.h> #include <sqlite3.h>
#include <md5.h> #include <md5.h>
#include <assert.h> #include <assert.h>
#include <string.h>
faction *get_faction_by_id(int uid) faction *get_faction_by_id(int uid)
{ {

View File

@ -61,6 +61,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
#include <limits.h> #include <limits.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>

View File

@ -94,6 +94,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>

View File

@ -40,6 +40,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* libc includes */ /* libc includes */
#include <math.h> #include <math.h>
#include <stdio.h>
int average_score_of_age(int age, int a) int average_score_of_age(int age, int a)
{ {

View File

@ -52,82 +52,34 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# define _CRT_DISABLE_PERFCRIT_LOCKS # define _CRT_DISABLE_PERFCRIT_LOCKS
#endif #endif
#endif /* _MSC_VER_ */
#ifdef __cplusplus
# include <cstdio>
# include <cstdlib>
extern "C" {
#else
# include <stdio.h>
# include <stdlib.h>
#endif
/**** ****
** Debugging Libraries **
**** ****/
#if defined __GNUC__
# define HAVE_INLINE
# define INLINE_FUNCTION static __inline
#endif
/* define USE_DMALLOC to enable use of the dmalloc library */
#ifdef USE_DMALLOC
# include <stdlib.h>
# include <string.h>
# include <dmalloc.h>
#endif
/* define CRTDBG to enable MSVC CRT Debug library functions */ /* define CRTDBG to enable MSVC CRT Debug library functions */
#if defined(_DEBUG) && defined(_MSC_VER) && defined(CRTDBG) #if defined(_DEBUG) && defined(CRTDBG)
# include <crtdbg.h> # include <crtdbg.h>
# define _CRTDBG_MAP_ALLOC # define _CRTDBG_MAP_ALLOC
#endif #endif
/**** **** # define HAVE_INLINE
** Architecture Dependent ** # define INLINE_FUNCTION __inline
**** ****/ #endif /* _MSC_VER_ */
/* für solaris: */ #if defined __GNUC__
#ifdef SOLARIS # define HAVE_INLINE
# define _SYS_PROCSET_H # define INLINE_FUNCTION static __inline
# define _XOPEN_SOURCE # undef _BSD_SOURCE
#endif # define _BSD_SOURCE
# undef __USE_BSD
#ifdef __GNUC__ # define __USE_BSD
# ifndef _BSD_SOURCE
# define _BSD_SOURCE
# define __USE_BSD
# endif
/* # include <features.h> */
# include <strings.h> /* strncasecmp-Prototyp */
#endif #endif
#ifdef _BSD_SOURCE #ifdef _BSD_SOURCE
# undef __EXTENSIONS__
# define __EXTENSIONS__ # define __EXTENSIONS__
#endif #endif
#ifdef WIN32 #ifdef SOLARIS
# define HAVE__MKDIR_WITHOUT_PERMISSION # define _SYS_PROCSET_H
# define HAVE__SLEEP_MSEC #undef _XOPEN_SOURCE
#endif # define _XOPEN_SOURCE
#if defined(__USE_SVID) || defined(_BSD_SOURCE) || defined(__USE_XOPEN_EXTENDED) || defined(_BE_SETUP_H) || defined(CYGWIN)
# include <unistd.h>
# define HAVE_UNISTD_H
# define HAVE_STRCASECMP
# define HAVE_STRNCASECMP
# define HAVE_ACCESS
# define HAVE_STAT
typedef struct stat stat_type;
# include <string.h>
# define HAVE_SNPRINTF
#ifdef _POSIX_SOURCE /* MINGW doesn't seem to have these */
# define HAVE_EXECINFO
# define HAVE_SIGACTION
# define HAVE_LINK
# define HAVE_SLEEP
#endif
#endif #endif
/* TinyCC */ /* TinyCC */
@ -136,90 +88,6 @@ typedef struct stat stat_type;
# define INLINE_FUNCTION # define INLINE_FUNCTION
#endif #endif
/* lcc-win32 */
#ifdef __LCC__
# include <string.h>
# include <direct.h>
# include <io.h>
# define HAVE_ACCESS
# define HAVE_STAT
typedef struct stat stat_type;
# define HAVE_STRICMP
# define HAVE_STRNICMP
# define HAVE_SLEEP
# define snprintf _snprintf
# define HAVE_SNPRINTF
# undef HAVE_STRCASECMP
# undef HAVE_STRNCASECMP
# define R_OK 4
#endif
/* Microsoft Visual C */
#ifdef _MSC_VER
# include <string.h> /* must be included here so strdup is not redefined */
# define R_OK 4
# define HAVE_INLINE
# define INLINE_FUNCTION __inline
# define snprintf _snprintf
# define HAVE_SNPRINTF
/* MSVC has _access, not access */
#ifndef access
#include <io.h>
# define access(f, m) _access(f, m)
#endif
#define HAVE_ACCESS
/* MSVC has _stat, not stat */
# define HAVE_STAT
#include <sys/stat.h>
# define stat(a, b) _stat(a, b)
typedef struct _stat stat_type;
# define stricmp(a, b) _stricmp(a, b)
# define HAVE_STRICMP
# define strnicmp(a, b, c) _strnicmp(a, b, c)
# define HAVE_STRNICMP
# undef HAVE_STRCASECMP
# undef HAVE_STRNCASECMP
#endif
/* replacements for missing functions: */
#ifndef HAVE_STRCASECMP
# if defined(HAVE_STRICMP)
# define strcasecmp stricmp
# elif defined(HAVE__STRICMP)
# define strcasecmp _stricmp
# endif
#endif
#ifndef HAVE_STRNCASECMP
# if defined(HAVE_STRNICMP)
# define strncasecmp strnicmp
# elif defined(HAVE__STRNICMP)
# define strncasecmp _strnicmp
# endif
#endif
#ifndef HAVE_SLEEP
#ifdef HAVE__SLEEP_MSEC
# define sleep(sec) _sleep(1000*sec)
#elif defined(HAVE__SLEEP)
# define sleep(sec) _sleep(sec)
#endif
#endif
#if !defined(MAX_PATH)
# if defined(PATH_MAX)
# define MAX_PATH PATH_MAX
# else
# define MAX_PATH 1024
# endif
#endif
/**** **** /**** ****
** min/max macros ** ** min/max macros **
**** ****/ **** ****/
@ -251,19 +119,24 @@ typedef struct _stat stat_type;
#define TOLUA_CAST (char*) #define TOLUA_CAST (char*)
#if !defined(HAVE__STRDUP) #ifdef USE_AUTOCONF
# if defined(HAVE_STRDUP) # include <autoconf.h>
# define _strdup(s) strdup(s)
# endif
#endif #endif
#if defined(HAVE__MKDIR) #if !defined(MAX_PATH)
# include <direct.h> #if defined(PATH_MAX)
# define MAX_PATH PATH_MAX
#else #else
# if defined(HAVE_MKDIR) # define MAX_PATH 256
# include <sys/stat.h> #endif
# define _mkdir(s) mkdir(s, 0777) #endif
# endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif #endif
#endif #endif

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: process ** Lua binding: process
** Generated automatically by tolua 5.1.3 on Sat Mar 8 10:21:00 2014. ** Generated automatically by tolua 5.1.3 on Sat Mar 15 19:26:36 2014.
*/ */
#include "tolua.h" #include "tolua.h"

View File

@ -8,7 +8,7 @@
* *
*/ */
#include "platform.h" #include <platform.h>
#include <kernel/config.h> #include <kernel/config.h>
#include "races.h" #include "races.h"
@ -27,6 +27,9 @@
#include <util/functions.h> #include <util/functions.h>
#include <util/rng.h> #include <util/rng.h>
#include <string.h>
#include <stdio.h>
void age_firedragon(struct unit *u); void age_firedragon(struct unit *u);
void age_dragon(struct unit *u); void age_dragon(struct unit *u);
void age_illusion(struct unit *u); void age_illusion(struct unit *u);
@ -40,7 +43,7 @@ static void oldfamiliars(unit * u)
char fname[64]; char fname[64];
/* these familiars have no special skills. /* these familiars have no special skills.
*/ */
snprintf(fname, sizeof(fname), "%s_familiar", u_race(u)->_name[0]); _snprintf(fname, sizeof(fname), "%s_familiar", u_race(u)->_name[0]);
create_mage(u, M_GRAY); create_mage(u, M_GRAY);
equip_unit(u, get_equipment(fname)); equip_unit(u, get_equipment(fname));
} }

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: settings ** Lua binding: settings
** Generated automatically by tolua 5.1.3 on Sat Mar 8 10:21:00 2014. ** Generated automatically by tolua 5.1.3 on Sat Mar 15 19:26:36 2014.
*/ */
#include "tolua.h" #include "tolua.h"

View File

@ -23,6 +23,7 @@
#include <storage.h> #include <storage.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h>
typedef struct wallcurse { typedef struct wallcurse {
curse *buddy; curse *buddy;

View File

@ -44,6 +44,7 @@
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#define EFFECT_HEALING_SPELL 5 #define EFFECT_HEALING_SPELL 5

View File

@ -83,6 +83,7 @@
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>

View File

@ -34,6 +34,7 @@
#include <util/lists.h> #include <util/lists.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#undef SUMMARY_BOM /* write a BOM in the summary file */ #undef SUMMARY_BOM /* write a BOM in the summary file */

View File

@ -19,6 +19,8 @@
#include <util/log.h> #include <util/log.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h>
struct race *test_create_race(const char *name) struct race *test_create_race(const char *name)
{ {

View File

@ -1,4 +1,3 @@
#include <config.h>
#if HAVE_STDBOOL_H #if HAVE_STDBOOL_H
# include <stdbool.h> # include <stdbool.h>
#else #else

View File

@ -1,4 +1,5 @@
#include <platform.h> #include <platform.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>

View File

@ -9,6 +9,8 @@
*/ */
#ifndef UTIL_FILEREADER_H #ifndef UTIL_FILEREADER_H
#define UTIL_FILEREADER_H #define UTIL_FILEREADER_H
#include <stdio.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -18,6 +18,7 @@
#include <util/log.h> #include <util/log.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>

View File

@ -4,6 +4,7 @@
#include "log.h" #include "log.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <wctype.h> #include <wctype.h>
#include <memory.h> #include <memory.h>

View File

@ -23,6 +23,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
static FILE *sqlstream = NULL; static FILE *sqlstream = NULL;

View File

@ -12,6 +12,7 @@
#include "unicode.h" #include "unicode.h"
#include <errno.h> #include <errno.h>
#include <string.h>
#include <wctype.h> #include <wctype.h>
#define B00000000 0x00 #define B00000000 0x00

@ -1 +1 @@
Subproject commit 38495edd9c2dfa544ab3b9b29e9ea254e57e06e1 Subproject commit eabc730c24e67a9f21ea7c32c558075582275d61