No more generated config files.

develop
Petr Mrázek 2011-03-20 06:20:23 +01:00
parent c06df18ea7
commit fe92edfb4e
10 changed files with 20 additions and 40 deletions

@ -163,19 +163,16 @@ SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
# Are we 64bit? (Damn you, ptrace()!) # Are we 64bit? (Damn you, ptrace()!)
IF( CMAKE_SIZEOF_VOID_P MATCHES 4 ) IF( CMAKE_SIZEOF_VOID_P MATCHES 8 )
SET( HAVE_64_BIT 0 ) ADD_DEFINITIONS(-DHAVE_64_BIT)
ELSE()
SET( HAVE_64_BIT 1 )
ENDIF() 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) ADD_DEFINITIONS(-DBUILD_DFHACK_LIB -DTIXML_USE_STL)
IF(UNIX) IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
add_definitions(-DUSE_CONFIG_H)
find_library(X11_LIBRARY X11) find_library(X11_LIBRARY X11)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall") SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden") SET(CMAKE_CXX_FLAGS "-fvisibility=hidden")

@ -116,7 +116,7 @@ Context * BadContexts::operator[](uint32_t index)
ContextManager::ContextManager (const string path_to_xml) : d (new Private()) 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 += "/";
d->xml += path_to_xml; d->xml += path_to_xml;
d->pEnum = new ProcessEnumerator(d->xml); d->pEnum = new ProcessEnumerator(d->xml);

@ -83,21 +83,24 @@ void LinuxProcessBase::getMemRanges( vector<t_memrange> & ranges )
sprintf(buffer, "/proc/%lu/maps", (long unsigned)my_pid); sprintf(buffer, "/proc/%lu/maps", (long unsigned)my_pid);
FILE *mapFile = ::fopen(buffer, "r"); FILE *mapFile = ::fopen(buffer, "r");
uint64_t offset, device1, device2, node; size_t start, end, offset, device1, device2, node;
while (fgets(buffer, 1024, mapFile)) while (fgets(buffer, 1024, mapFile))
{ {
t_memrange temp; t_memrange temp;
temp.name[0] = 0; temp.name[0] = 0;
sscanf(buffer, "%zx-%zx %s %zx %2zu:%2zu %zu %s", sscanf(buffer, "%zx-%zx %s %zx %2zu:%2zu %zu %s",
&temp.start, &start,
&temp.end, &end,
(char*)&permissions, (char*)&permissions,
&offset, &device1, &device2, &node, &offset, &device1, &device2, &node,
(char*)&temp.name); (char*)&temp.name);
temp.start = start;
temp.end = end;
temp.read = permissions[0] == 'r'; temp.read = permissions[0] == 'r';
temp.write = permissions[1] == 'w'; temp.write = permissions[1] == 'w';
temp.execute = permissions[2] == 'x'; temp.execute = permissions[2] == 'x';
temp.shared = permissions[3] == 's';
temp.valid = true; temp.valid = true;
ranges.push_back(temp); ranges.push_back(temp);
} }

@ -1,7 +0,0 @@
#ifndef CONFIG_H
#define CONFIG_H
#cmakedefine MEMXML_DATA_PATH @MEMXML_DATA_PATH@
#cmakedefine HAVE_64_BIT
#endif // CONFIG_H

@ -74,6 +74,8 @@ namespace DFHack
bool write : 1; bool write : 1;
// permission to execute // permission to execute
bool execute : 1; bool execute : 1;
// is a shared region
bool shared : 1;
inline bool isInRange( uint64_t address) inline bool isInRange( uint64_t address)
{ {
if (address >= start && address < end) return true; if (address >= start && address < end) return true;

@ -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 World::ReadCurrentMonth and World::ReadCurrentDay
« Sent to: peterix on: June 04, 2010, 04:44:30 » « Sent to: peterix on: June 04, 2010, 04:44:30 »
« You have forwarded or responded to this message. » « 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. 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 Using 28 and doing the calculation on the value stored at the memory location
specified by memory.xml gets me the current month/date. specified by memory.xml gets me the current month/date.

@ -30,16 +30,10 @@ distribution.
#define BUILD_DFHACK_LIB #define BUILD_DFHACK_LIB
#endif #endif
// wizardry for the cmake-generated config.h // wizardry for adding quotes to macros
#define _QUOTEME(x) #x #define _QUOTEME(x) #x
#define QUOT(x) _QUOTEME(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 // one file for globals
#include "dfhack/DFGlobal.h" #include "dfhack/DFGlobal.h"

@ -70,7 +70,7 @@ DFHACK_TOOL(dfweather weather.cpp)
#DFHACK_TOOL(dfautosearch autosearch.cpp) #DFHACK_TOOL(dfautosearch autosearch.cpp)
DFHACK_TOOL(dfincremental incrementalsearch.cpp) DFHACK_TOOL(dfincremental incrementalsearch.cpp)
# veinlook - look at the map... sort of
IF(UNIX) IF(UNIX)
SET(VEINLOOK_BUILT "NO") SET(VEINLOOK_BUILT "NO")
SET(CURSES_NEED_WIDE "YES") SET(CURSES_NEED_WIDE "YES")
@ -87,13 +87,8 @@ IF(UNIX)
SET(NCURSES_H "cursesw.h") SET(NCURSES_H "cursesw.h")
endif(CURSES_HAVE_NCURSESW_NCURSES_H) endif(CURSES_HAVE_NCURSESW_NCURSES_H)
IF(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) ADD_EXECUTABLE(dfveinlook veinlook.cpp)
set_property( TARGET dfveinlook PROPERTY COMPILE_DEFINITIONS NCURSES_H=${NCURSES_H} )
INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(dfveinlook dfhack ${CURSES_LIBRARIES}) TARGET_LINK_LIBRARIES(dfveinlook dfhack ${CURSES_LIBRARIES})
install(TARGETS install(TARGETS

@ -1,6 +0,0 @@
#ifndef CURSES_FAKE_H
#define CURSES_FAKE_H
#include <@NCURSES_H@>
#endif // CURSES_FAKE_H

@ -9,7 +9,9 @@
using namespace std; using namespace std;
#include <sstream> #include <sstream>
#include "fake-curses.h" // the header name comes from the build system.
#define INCLUDE_NAME() <NCURSES_H>
#include INCLUDE_NAME()
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>
#include <locale.h> #include <locale.h>