diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 4c0a4a74a..4a04466fa 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -163,19 +163,16 @@ SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE ) LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) # Are we 64bit? (Damn you, ptrace()!) -IF( CMAKE_SIZEOF_VOID_P MATCHES 4 ) - SET( HAVE_64_BIT 0 ) -ELSE() - SET( HAVE_64_BIT 1 ) +IF( CMAKE_SIZEOF_VOID_P MATCHES 8 ) + ADD_DEFINITIONS(-DHAVE_64_BIT) ENDIF() -CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/library/config.h.cmake ${CMAKE_SOURCE_DIR}/library/private/config.h ) - +#CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/library/config.h.cmake ${CMAKE_SOURCE_DIR}/library/private/config.h ) +ADD_DEFINITIONS(-DMEMXML_DATA_PATH="${MEMXML_DATA_PATH}") ADD_DEFINITIONS(-DBUILD_DFHACK_LIB -DTIXML_USE_STL) IF(UNIX) add_definitions(-DLINUX_BUILD) - add_definitions(-DUSE_CONFIG_H) find_library(X11_LIBRARY X11) SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall") SET(CMAKE_CXX_FLAGS "-fvisibility=hidden") diff --git a/library/DFContextManager.cpp b/library/DFContextManager.cpp index bfe5a3b98..1bac79794 100644 --- a/library/DFContextManager.cpp +++ b/library/DFContextManager.cpp @@ -116,7 +116,7 @@ Context * BadContexts::operator[](uint32_t index) ContextManager::ContextManager (const string path_to_xml) : d (new Private()) { - d->xml = QUOT (MEMXML_DATA_PATH); + d->xml = MEMXML_DATA_PATH; d->xml += "/"; d->xml += path_to_xml; d->pEnum = new ProcessEnumerator(d->xml); diff --git a/library/DFProcess-linux-base.cpp b/library/DFProcess-linux-base.cpp index 2c5261edb..b4dc40134 100644 --- a/library/DFProcess-linux-base.cpp +++ b/library/DFProcess-linux-base.cpp @@ -83,21 +83,24 @@ void LinuxProcessBase::getMemRanges( vector & ranges ) sprintf(buffer, "/proc/%lu/maps", (long unsigned)my_pid); FILE *mapFile = ::fopen(buffer, "r"); - uint64_t offset, device1, device2, node; + size_t start, end, offset, device1, device2, node; while (fgets(buffer, 1024, mapFile)) { t_memrange temp; temp.name[0] = 0; sscanf(buffer, "%zx-%zx %s %zx %2zu:%2zu %zu %s", - &temp.start, - &temp.end, + &start, + &end, (char*)&permissions, &offset, &device1, &device2, &node, (char*)&temp.name); + temp.start = start; + temp.end = end; temp.read = permissions[0] == 'r'; temp.write = permissions[1] == 'w'; temp.execute = permissions[2] == 'x'; + temp.shared = permissions[3] == 's'; temp.valid = true; ranges.push_back(temp); } diff --git a/library/config.h.cmake b/library/config.h.cmake deleted file mode 100644 index 91066de47..000000000 --- a/library/config.h.cmake +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -#cmakedefine MEMXML_DATA_PATH @MEMXML_DATA_PATH@ -#cmakedefine HAVE_64_BIT - -#endif // CONFIG_H \ No newline at end of file diff --git a/library/include/dfhack/DFProcess.h b/library/include/dfhack/DFProcess.h index 6ff7f37ba..d7046c132 100644 --- a/library/include/dfhack/DFProcess.h +++ b/library/include/dfhack/DFProcess.h @@ -74,6 +74,8 @@ namespace DFHack bool write : 1; // permission to execute bool execute : 1; + // is a shared region + bool shared : 1; inline bool isInRange( uint64_t address) { if (address >= start && address < end) return true; diff --git a/library/modules/World.cpp b/library/modules/World.cpp index 87fd186e7..4827b8785 100644 --- a/library/modules/World.cpp +++ b/library/modules/World.cpp @@ -185,7 +185,7 @@ FIXME: Japa said that he had to do this with the time stuff he got from here World::ReadCurrentMonth and World::ReadCurrentDay « Sent to: peterix on: June 04, 2010, 04:44:30 » « You have forwarded or responded to this message. » -ReplyQuoteRemove + Shouldn't these be /28 and %28 instead of 24? There're 28 days in a DF month. Using 28 and doing the calculation on the value stored at the memory location specified by memory.xml gets me the current month/date. diff --git a/library/private/Internal.h b/library/private/Internal.h index 13c9119e1..59e4792b9 100644 --- a/library/private/Internal.h +++ b/library/private/Internal.h @@ -30,16 +30,10 @@ distribution. #define BUILD_DFHACK_LIB #endif -// wizardry for the cmake-generated config.h +// wizardry for adding quotes to macros #define _QUOTEME(x) #x #define QUOT(x) _QUOTEME(x) -#ifdef USE_CONFIG_H // set by cmake for Linux builds - #include "config.h" -#else - #define MEMXML_DATA_PATH . -#endif - // one file for globals #include "dfhack/DFGlobal.h" diff --git a/tools/supported/CMakeLists.txt b/tools/supported/CMakeLists.txt index d652a3d29..96b59301c 100644 --- a/tools/supported/CMakeLists.txt +++ b/tools/supported/CMakeLists.txt @@ -70,7 +70,7 @@ DFHACK_TOOL(dfweather weather.cpp) #DFHACK_TOOL(dfautosearch autosearch.cpp) DFHACK_TOOL(dfincremental incrementalsearch.cpp) - +# veinlook - look at the map... sort of IF(UNIX) SET(VEINLOOK_BUILT "NO") SET(CURSES_NEED_WIDE "YES") @@ -87,13 +87,8 @@ IF(UNIX) SET(NCURSES_H "cursesw.h") endif(CURSES_HAVE_NCURSESW_NCURSES_H) IF(NCURSES_H) - # OPTION( VARIABLE "Description" Initial state) - #OPTION( WITH_FOO "Enable FOO support" ON ) - #OPTION( WITH_BAR "Enable BAR component" OFF ) - #SET( BAZ 18 ) - CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/fake-curses.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/fake-curses.h ) - # veinlook - look at the map... sort of ADD_EXECUTABLE(dfveinlook veinlook.cpp) + set_property( TARGET dfveinlook PROPERTY COMPILE_DEFINITIONS NCURSES_H=${NCURSES_H} ) INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(dfveinlook dfhack ${CURSES_LIBRARIES}) install(TARGETS diff --git a/tools/supported/fake-curses.h.cmake b/tools/supported/fake-curses.h.cmake deleted file mode 100644 index 4e148a2f7..000000000 --- a/tools/supported/fake-curses.h.cmake +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef CURSES_FAKE_H -#define CURSES_FAKE_H - -#include <@NCURSES_H@> - -#endif // CURSES_FAKE_H \ No newline at end of file diff --git a/tools/supported/veinlook.cpp b/tools/supported/veinlook.cpp index 8fa7fccca..83594fb1d 100644 --- a/tools/supported/veinlook.cpp +++ b/tools/supported/veinlook.cpp @@ -9,7 +9,9 @@ using namespace std; #include -#include "fake-curses.h" +// the header name comes from the build system. +#define INCLUDE_NAME() +#include INCLUDE_NAME() #include #include #include