diff --git a/CMakeLists.txt b/CMakeLists.txt index 80ab3ab0d..5578a3889 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,17 +6,42 @@ enable_testing() INCLUDE (CheckIncludeFiles) INCLUDE (CheckSymbolExists) 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_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 (mkdir "sys/stat.h" HAVE_MKDIR) -CHECK_SYMBOL_EXISTS (_mkdir "direct.h" HAVE__MKDIR) +CHECK_SYMBOL_EXISTS (_stricmp "string.h" HAVE__STRICMP) +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 ( - ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_BINARY_DIR}/include/config.h) + ${CMAKE_CURRENT_SOURCE_DIR}/autoconf.h.in + ${CMAKE_BINARY_DIR}/include/autoconf.h) INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/include) +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AUTOCONF") IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL") diff --git a/autoconf.h.in b/autoconf.h.in new file mode 100644 index 000000000..4a098fcc7 --- /dev/null +++ b/autoconf.h.in @@ -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 + +#if defined(HAVE_STRINGS_H) +#include +#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 +#elif defined(HAVE_DIRECT_MKDIR) +#include +#define _mkdir(a) mkdir(a) +#elif defined(HAVE_SYS_STAT_MKDIR) +#include +#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 diff --git a/config.h.in b/config.h.in deleted file mode 100644 index 9ea6eb099..000000000 --- a/config.h.in +++ /dev/null @@ -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 diff --git a/configure b/configure index 5442b1b90..16aba09c7 100755 --- a/configure +++ b/configure @@ -21,6 +21,6 @@ echo "Building with $CC and $JOBS jobs" mkdir -p $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 test diff --git a/src/attributes/object.c b/src/attributes/object.c index b4177ab9b..c0d0e0800 100644 --- a/src/attributes/object.c +++ b/src/attributes/object.c @@ -37,6 +37,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* stdc includes */ #include +#include #include typedef struct object_data { diff --git a/src/attributes/raceprefix.c b/src/attributes/raceprefix.c index c5068368c..22026d3cf 100644 --- a/src/attributes/raceprefix.c +++ b/src/attributes/raceprefix.c @@ -25,6 +25,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +#include attrib_type at_raceprefix = { "raceprefix", NULL, a_finalizestring, NULL, a_writestring, a_readstring, diff --git a/src/bind_building.c b/src/bind_building.c index 9c63abe87..9ecc72a3f 100644 --- a/src/bind_building.c +++ b/src/bind_building.c @@ -22,6 +22,8 @@ without prior permission by the authors of Eressea. #include #include +#include +#include int tolua_buildinglist_next(lua_State * L) { diff --git a/src/bind_faction.c b/src/bind_faction.c index 53a4f4fc7..0dfcb360e 100644 --- a/src/bind_faction.c +++ b/src/bind_faction.c @@ -30,6 +30,7 @@ without prior permission by the authors of Eressea. #include #include +#include int tolua_factionlist_next(lua_State * L) { diff --git a/src/bind_hashtable.c b/src/bind_hashtable.c index eba8b1c2c..c57d724f0 100644 --- a/src/bind_hashtable.c +++ b/src/bind_hashtable.c @@ -26,6 +26,7 @@ without prior permission by the authors of Eressea. #include #include +#include #include static int tolua_hashtable_get(lua_State * L) diff --git a/src/bind_message.c b/src/bind_message.c index 2959c6c5c..77a30e493 100644 --- a/src/bind_message.c +++ b/src/bind_message.c @@ -16,6 +16,8 @@ #include #include +#include +#include #define E_OK 0 #define E_INVALID_MESSAGE 1 diff --git a/src/bind_monsters.c b/src/bind_monsters.c index 640e667fa..9749e7e08 100644 --- a/src/bind_monsters.c +++ b/src/bind_monsters.c @@ -13,6 +13,7 @@ #include #include +#include static int tolua_levitate_ship(lua_State * L) { diff --git a/src/bind_region.c b/src/bind_region.c index 46652c1ab..7606a266d 100644 --- a/src/bind_region.c +++ b/src/bind_region.c @@ -40,6 +40,8 @@ without prior permission by the authors of Eressea. #include #include +#include +#include int tolua_regionlist_next(lua_State * L) { diff --git a/src/bind_ship.c b/src/bind_ship.c index 7b9a61b67..bcab0d794 100644 --- a/src/bind_ship.c +++ b/src/bind_ship.c @@ -23,6 +23,8 @@ without prior permission by the authors of Eressea. #include #include +#include +#include int tolua_shiplist_next(lua_State * L) { diff --git a/src/bind_storage.c b/src/bind_storage.c index 4d982e00c..22e12d117 100644 --- a/src/bind_storage.c +++ b/src/bind_storage.c @@ -23,6 +23,8 @@ without prior permission by the authors of Eressea. #include #include +#include +#include #include diff --git a/src/bind_unit.c b/src/bind_unit.c index cbb840305..2d2c71dca 100755 --- a/src/bind_unit.c +++ b/src/bind_unit.c @@ -55,6 +55,8 @@ without prior permission by the authors of Eressea. #include #include +#include +#include #include static int tolua_unit_get_objects(lua_State * L) diff --git a/src/economy.c b/src/economy.c index 236e4fe1c..7b679367a 100644 --- a/src/economy.c +++ b/src/economy.c @@ -76,6 +76,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* libs includes */ #include #include +#include #include #include #include diff --git a/src/eressea.pkg.c b/src/eressea.pkg.c index cebc27274..612f30fcb 100644 --- a/src/eressea.pkg.c +++ b/src/eressea.pkg.c @@ -1,6 +1,6 @@ /* ** 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" diff --git a/src/helpers.c b/src/helpers.c index 491a6f2e5..1f6b12400 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -35,6 +35,7 @@ without prior permission by the authors of Eressea. #include #include +#include static int lua_giveitem(unit * s, unit * d, const item_type * itype, int n, struct order *ord) diff --git a/src/json.c b/src/json.c index fed00eb65..d27a53841 100644 --- a/src/json.c +++ b/src/json.c @@ -1,6 +1,5 @@ -#include +#include "platform.h" #include -#include #include "json.h" @@ -11,6 +10,9 @@ #include #include "cJSON.h" +#include +#include +#include #include 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) { char id[32]; cJSON *data; - snprintf(id, sizeof(id), "%u", r->uid); + _snprintf(id, sizeof(id), "%u", r->uid); cJSON_AddItemToObject(json, id, data = cJSON_CreateObject()); cJSON_AddNumberToObject(data, "x", r->x); cJSON_AddNumberToObject(data, "y", r->y); diff --git a/src/kernel/battle.c b/src/kernel/battle.c index 039e7d35a..22ac2c6e0 100644 --- a/src/kernel/battle.c +++ b/src/kernel/battle.c @@ -70,6 +70,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include #include #pragma endregion diff --git a/src/kernel/calendar.c b/src/kernel/calendar.c index 5a09ff738..798114a97 100644 --- a/src/kernel/calendar.c +++ b/src/kernel/calendar.c @@ -2,6 +2,7 @@ #include "calendar.h" #include +#include int first_turn = 0; int first_month = 0; diff --git a/src/kernel/connection.c b/src/kernel/connection.c index 2c588cb9c..7bfd0c6e6 100644 --- a/src/kernel/connection.c +++ b/src/kernel/connection.c @@ -39,6 +39,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include unsigned int nextborder = 0; diff --git a/src/kernel/curse.c b/src/kernel/curse.c index 467e9ac4e..a804fa289 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -49,6 +49,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* libc includes */ #include +#include #include #include #include diff --git a/src/kernel/equipment.c b/src/kernel/equipment.c index 5aee01a7d..b94b0c307 100644 --- a/src/kernel/equipment.c +++ b/src/kernel/equipment.c @@ -35,6 +35,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* libc includes */ #include #include +#include static equipment *equipment_sets; diff --git a/src/kernel/magic_test.c b/src/kernel/magic_test.c index 8a4a1ef69..910eb27c4 100644 --- a/src/kernel/magic_test.c +++ b/src/kernel/magic_test.c @@ -16,6 +16,8 @@ #include #include +#include + void test_updatespells(CuTest * tc) { faction * f; diff --git a/src/kernel/move.c b/src/kernel/move.c index c66a0b629..72bacb310 100644 --- a/src/kernel/move.c +++ b/src/kernel/move.c @@ -67,6 +67,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include #include int *storms; diff --git a/src/kernel/names.c b/src/kernel/names.c index a0089829b..3a26c7b22 100644 --- a/src/kernel/names.c +++ b/src/kernel/names.c @@ -42,6 +42,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include #include const char *describe_braineater(unit * u, const struct locale *lang) diff --git a/src/kernel/player.c b/src/kernel/player.c index f914580c9..55261714c 100644 --- a/src/kernel/player.c +++ b/src/kernel/player.c @@ -16,6 +16,7 @@ #include #include +#include #include #include diff --git a/src/kernel/region.c b/src/kernel/region.c index ee20e2067..4da863036 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -60,6 +60,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include #include extern int dice_rand(const char *s); diff --git a/src/kernel/reports.c b/src/kernel/reports.c index 4b20ccbf3..1980a8c28 100644 --- a/src/kernel/reports.c +++ b/src/kernel/reports.c @@ -1590,7 +1590,7 @@ static seen_region **prepare_report(faction * f) int write_reports(faction * f, time_t ltime) { - int backup = 1, maxbackup = 128; + int backup = 1, maxbackup = 128*1000; bool gotit = false; struct report_context ctx; const char *encoding = "UTF-8"; @@ -1629,9 +1629,9 @@ int write_reports(faction * f, time_t ltime) if (errno) { char zText[64]; puts(" ERROR"); - sprintf(zText, "Waiting %u seconds before retry", backup); + sprintf(zText, "Waiting %u seconds before we retry", backup/1000); perror(zText); - sleep(backup); + _sleep(backup); if (backup < maxbackup) { backup *= 2; } diff --git a/src/kernel/reports_test.c b/src/kernel/reports_test.c index 0bfa47e34..218f2d429 100644 --- a/src/kernel/reports_test.c +++ b/src/kernel/reports_test.c @@ -9,6 +9,8 @@ #include #include +#include + static void test_reorder_units(CuTest * tc) { region *r; diff --git a/src/kernel/spell.c b/src/kernel/spell.c index 6184d4b43..2af5ad16f 100644 --- a/src/kernel/spell.c +++ b/src/kernel/spell.c @@ -30,6 +30,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* libc includes */ #include +#include #include static critbit_tree cb_spells; diff --git a/src/kernel/spellbook.c b/src/kernel/spellbook.c index 8b13b57e6..ac2faf622 100644 --- a/src/kernel/spellbook.c +++ b/src/kernel/spellbook.c @@ -8,6 +8,8 @@ #include "spellbook.h" #include +#include +#include spellbook * create_spellbook(const char * name) { diff --git a/src/kernel/spellbook_test.c b/src/kernel/spellbook_test.c index 277952e0c..4e4bfe779 100644 --- a/src/kernel/spellbook_test.c +++ b/src/kernel/spellbook_test.c @@ -10,6 +10,7 @@ #include #include +#include int count_spell_cb(spellbook_entry * sbe, void * ptr) { diff --git a/src/kernel/sqlite.c b/src/kernel/sqlite.c index b7c9951a3..cb9e8b903 100644 --- a/src/kernel/sqlite.c +++ b/src/kernel/sqlite.c @@ -7,6 +7,7 @@ #include #include #include +#include faction *get_faction_by_id(int uid) { diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 8d304251d..7f2aa226f 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -61,6 +61,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* libc includes */ #include #include +#include #include #include diff --git a/src/laws.c b/src/laws.c index c3c395f8b..429e6a73b 100755 --- a/src/laws.c +++ b/src/laws.c @@ -94,6 +94,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* libc includes */ #include #include +#include #include #include #include diff --git a/src/modules/score.c b/src/modules/score.c index 062479432..6d0163691 100644 --- a/src/modules/score.c +++ b/src/modules/score.c @@ -40,6 +40,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* libc includes */ #include +#include int average_score_of_age(int age, int a) { diff --git a/src/platform.h b/src/platform.h index 1fa0661ed..4a941b2dd 100644 --- a/src/platform.h +++ b/src/platform.h @@ -52,82 +52,34 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # define _CRT_DISABLE_PERFCRIT_LOCKS #endif -#endif /* _MSC_VER_ */ - -#ifdef __cplusplus -# include -# include -extern "C" { -#else -# include -# include -#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 -# include -# include -#endif - /* define CRTDBG to enable MSVC CRT Debug library functions */ -#if defined(_DEBUG) && defined(_MSC_VER) && defined(CRTDBG) +#if defined(_DEBUG) && defined(CRTDBG) # include # define _CRTDBG_MAP_ALLOC #endif -/**** **** - ** Architecture Dependent ** - **** ****/ +# define HAVE_INLINE +# define INLINE_FUNCTION __inline +#endif /* _MSC_VER_ */ -/* für solaris: */ -#ifdef SOLARIS -# define _SYS_PROCSET_H -# define _XOPEN_SOURCE -#endif - -#ifdef __GNUC__ -# ifndef _BSD_SOURCE -# define _BSD_SOURCE -# define __USE_BSD -# endif -/* # include */ -# include /* strncasecmp-Prototyp */ +#if defined __GNUC__ +# define HAVE_INLINE +# define INLINE_FUNCTION static __inline +# undef _BSD_SOURCE +# define _BSD_SOURCE +# undef __USE_BSD +# define __USE_BSD #endif #ifdef _BSD_SOURCE +# undef __EXTENSIONS__ # define __EXTENSIONS__ #endif -#ifdef WIN32 -# define HAVE__MKDIR_WITHOUT_PERMISSION -# define HAVE__SLEEP_MSEC -#endif - -#if defined(__USE_SVID) || defined(_BSD_SOURCE) || defined(__USE_XOPEN_EXTENDED) || defined(_BE_SETUP_H) || defined(CYGWIN) -# include -# define HAVE_UNISTD_H -# define HAVE_STRCASECMP -# define HAVE_STRNCASECMP -# define HAVE_ACCESS -# define HAVE_STAT -typedef struct stat stat_type; -# include -# 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 +#ifdef SOLARIS +# define _SYS_PROCSET_H +#undef _XOPEN_SOURCE +# define _XOPEN_SOURCE #endif /* TinyCC */ @@ -136,90 +88,6 @@ typedef struct stat stat_type; # define INLINE_FUNCTION #endif -/* lcc-win32 */ -#ifdef __LCC__ -# include -# include -# include -# 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 /* 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 -# define access(f, m) _access(f, m) -#endif -#define HAVE_ACCESS - -/* MSVC has _stat, not stat */ -# define HAVE_STAT -#include -# 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 ** **** ****/ @@ -251,19 +119,24 @@ typedef struct _stat stat_type; #define TOLUA_CAST (char*) -#if !defined(HAVE__STRDUP) -# if defined(HAVE_STRDUP) -# define _strdup(s) strdup(s) -# endif +#ifdef USE_AUTOCONF +# include #endif -#if defined(HAVE__MKDIR) -# include +#if !defined(MAX_PATH) +#if defined(PATH_MAX) +# define MAX_PATH PATH_MAX #else -# if defined(HAVE_MKDIR) -# include -# define _mkdir(s) mkdir(s, 0777) -# endif +# define MAX_PATH 256 +#endif +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include #endif #endif diff --git a/src/process.pkg.c b/src/process.pkg.c index 467a9677f..5192665dd 100644 --- a/src/process.pkg.c +++ b/src/process.pkg.c @@ -1,6 +1,6 @@ /* ** 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" diff --git a/src/races/races.c b/src/races/races.c index c2af9b323..af253b3ad 100644 --- a/src/races/races.c +++ b/src/races/races.c @@ -8,7 +8,7 @@ * */ -#include "platform.h" +#include #include #include "races.h" @@ -27,6 +27,9 @@ #include #include +#include +#include + void age_firedragon(struct unit *u); void age_dragon(struct unit *u); void age_illusion(struct unit *u); @@ -40,7 +43,7 @@ static void oldfamiliars(unit * u) char fname[64]; /* 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); equip_unit(u, get_equipment(fname)); } diff --git a/src/settings.pkg.c b/src/settings.pkg.c index 32c928dbb..3b06cc03d 100644 --- a/src/settings.pkg.c +++ b/src/settings.pkg.c @@ -1,6 +1,6 @@ /* ** 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" diff --git a/src/spells/borders.c b/src/spells/borders.c index 86767d06c..bc6802a33 100644 --- a/src/spells/borders.c +++ b/src/spells/borders.c @@ -23,6 +23,7 @@ #include #include +#include typedef struct wallcurse { curse *buddy; diff --git a/src/spells/combatspells.c b/src/spells/combatspells.c index a6eaf97f1..cc168dbd1 100644 --- a/src/spells/combatspells.c +++ b/src/spells/combatspells.c @@ -44,6 +44,7 @@ /* libc includes */ #include +#include #include #define EFFECT_HEALING_SPELL 5 diff --git a/src/spells/spells.c b/src/spells/spells.c index 46217f70e..d52808f19 100644 --- a/src/spells/spells.c +++ b/src/spells/spells.c @@ -83,6 +83,7 @@ #include #include #include +#include #include #include diff --git a/src/summary.c b/src/summary.c index eedab42e2..ad62181a6 100644 --- a/src/summary.c +++ b/src/summary.c @@ -34,6 +34,7 @@ #include #include +#include #include #undef SUMMARY_BOM /* write a BOM in the summary file */ diff --git a/src/tests.c b/src/tests.c index cbb72279b..28baa367a 100644 --- a/src/tests.c +++ b/src/tests.c @@ -19,6 +19,8 @@ #include #include +#include +#include struct race *test_create_race(const char *name) { diff --git a/src/util/bool.h b/src/util/bool.h index 6da28be80..0bdebc9ec 100644 --- a/src/util/bool.h +++ b/src/util/bool.h @@ -1,4 +1,3 @@ -#include #if HAVE_STDBOOL_H # include #else diff --git a/src/util/bsdstring.c b/src/util/bsdstring.c index 0b677525e..255e9f10d 100644 --- a/src/util/bsdstring.c +++ b/src/util/bsdstring.c @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/src/util/filereader.h b/src/util/filereader.h index 995d9f88f..9637c1394 100644 --- a/src/util/filereader.h +++ b/src/util/filereader.h @@ -9,6 +9,8 @@ */ #ifndef UTIL_FILEREADER_H #define UTIL_FILEREADER_H + +#include #ifdef __cplusplus extern "C" { #endif diff --git a/src/util/listbox.c b/src/util/listbox.c index 9532def74..91ff14c1e 100644 --- a/src/util/listbox.c +++ b/src/util/listbox.c @@ -18,6 +18,7 @@ #include +#include #include #include diff --git a/src/util/parser.c b/src/util/parser.c index 3634ba541..4a4ffcc29 100644 --- a/src/util/parser.c +++ b/src/util/parser.c @@ -4,6 +4,7 @@ #include "log.h" #include +#include #include #include diff --git a/src/util/sql.c b/src/util/sql.c index 82d1fa9c9..a91d57a5a 100644 --- a/src/util/sql.c +++ b/src/util/sql.c @@ -23,6 +23,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +#include #include static FILE *sqlstream = NULL; diff --git a/src/util/unicode.c b/src/util/unicode.c index 33db457e7..5f6c715b5 100644 --- a/src/util/unicode.c +++ b/src/util/unicode.c @@ -12,6 +12,7 @@ #include "unicode.h" #include +#include #include #define B00000000 0x00 diff --git a/storage b/storage index 38495edd9..eabc730c2 160000 --- a/storage +++ b/storage @@ -1 +1 @@ -Subproject commit 38495edd9c2dfa544ab3b9b29e9ea254e57e06e1 +Subproject commit eabc730c24e67a9f21ea7c32c558075582275d61