diff --git a/library/DFMemInfo.cpp b/library/DFMemInfo.cpp index 582a225db..8c0b1f864 100644 --- a/library/DFMemInfo.cpp +++ b/library/DFMemInfo.cpp @@ -712,7 +712,7 @@ string memory_info::getTraitName(const uint32_t traitIdx) const throw Error::MissingMemoryDefinition("traitname", traitIdx); } -std::vector< std::vector> const& memory_info::getAllTraits() +std::vector< std::vector > const& memory_info::getAllTraits() { return d->traits; } diff --git a/library/include/dfhack/DFMemInfo.h b/library/include/dfhack/DFMemInfo.h index 400dc5765..6eafee7a3 100644 --- a/library/include/dfhack/DFMemInfo.h +++ b/library/include/dfhack/DFMemInfo.h @@ -74,7 +74,7 @@ namespace DFHack std::string getTrait (const uint32_t, const uint32_t) const; std::string getTraitName(const uint32_t) const; std::string getLabor (const uint32_t); - std::vector< std::vector> const& getAllTraits(); + std::vector< std::vector > const& getAllTraits(); DFHack::t_level getLevelInfo(const uint32_t level) const; diff --git a/library/modules/Creatures.cpp b/library/modules/Creatures.cpp index ff2fbc6b8..2ec257f39 100644 --- a/library/modules/Creatures.cpp +++ b/library/modules/Creatures.cpp @@ -92,19 +92,19 @@ Creatures::Creatures(DFContextShared* _d) creatures.mood_offset = minfo->getOffset("creature_mood"); creatures.mood_skill_offset = minfo->getOffset("creature_mood_skill"); creatures.pickup_equipment_bit = minfo->getOffset("creature_pickup_equipment_bit"); - creatures.current_job_offset = minfo->getOffset("creature_current_job"); + creatures.current_job_offset = minfo->getOffset("creature_current_job"); // soul offsets creatures.soul_skills_vector_offset = minfo->getOffset("soul_skills_vector"); creatures.soul_mental_offset = minfo->getOffset("soul_mental"); creatures.soul_traits_offset = minfo->getOffset("soul_traits"); - + // appearance creatures.appearance_vector_offset = minfo->getOffset("creature_appearance_vector"); //birth creatures.birth_year_offset = minfo->getOffset("creature_birth_year"); creatures.birth_time_offset = minfo->getOffset("creature_birth_time"); - + // name offsets for the creature module creatures.name_firstname_offset = minfo->getOffset("name_firstname"); creatures.name_nickname_offset = minfo->getOffset("name_nickname"); @@ -172,17 +172,17 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball) */ // non-SHM slow path memory_info * minfo = d->d->offset_descriptor; - + // read pointer from vector at position uint32_t temp = d->p_cre->at (index); furball.origin = temp; Creatures2010::creature_offsets &offs = d->creatures; - + //read creature from memory - + // name d->d->readName(furball.name,temp + offs.name_offset); - + // basic stuff p->readDWord (temp + offs.happiness_offset, furball.happiness); p->readDWord (temp + offs.id_offset, furball.id); @@ -193,24 +193,24 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball) p->readWord (temp + offs.caste_offset, furball.caste); p->readDWord (temp + offs.flags1_offset, furball.flags1.whole); p->readDWord (temp + offs.flags2_offset, furball.flags2.whole); - + // physical attributes p->read(temp + offs.physical_offset, - sizeof(t_attrib) * NUM_CREATURE_PHYSICAL_ATTRIBUTES, - (uint8_t *)&furball.strength); - + sizeof(t_attrib) * NUM_CREATURE_PHYSICAL_ATTRIBUTES, + (uint8_t *)&furball.strength); + // mood stuff furball.mood = (int16_t) p->readWord (temp + offs.mood_offset); furball.mood_skill = p->readWord (temp + offs.mood_skill_offset); d->d->readName(furball.artifact_name, temp + offs.artifact_name_offset); - + // custom profession p->readSTLString(temp + offs.custom_profession_offset, furball.custom_profession, sizeof(furball.custom_profession)); //fill_char_buf (furball.custom_profession, p->readSTLString (temp + offs.custom_profession_offset)); // labors p->read (temp + offs.labors_offset, NUM_CREATURE_LABORS, furball.labors); - + // profession furball.profession = p->readByte (temp + offs.profession_offset); @@ -268,20 +268,20 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball) // a byte: this gives us 256 skills maximum. furball.defaultSoul.skills[i].id = p->readByte (temp2); furball.defaultSoul.skills[i].rating = - p->readByte (temp2 + offsetof(t_skill, rating)); + p->readByte (temp2 + offsetof(t_skill, rating)); furball.defaultSoul.skills[i].experience = - p->readWord (temp2 + offsetof(t_skill, experience)); + p->readWord (temp2 + offsetof(t_skill, experience)); } // mental attributes are part of the soul p->read(soul + offs.soul_mental_offset, - sizeof(t_attrib) * NUM_CREATURE_MENTAL_ATTRIBUTES, - (uint8_t *)&furball.defaultSoul.analytical_ability); - + sizeof(t_attrib) * NUM_CREATURE_MENTAL_ATTRIBUTES, + (uint8_t *)&furball.defaultSoul.analytical_ability); + // traits as well p->read(soul + offs.soul_traits_offset, - sizeof (uint16_t) * NUM_CREATURE_TRAITS, - (uint8_t *) &furball.defaultSoul.traits); + sizeof (uint16_t) * NUM_CREATURE_TRAITS, + (uint8_t *) &furball.defaultSoul.traits); } DfVector app(p, temp + offs.appearance_vector_offset); @@ -312,7 +312,7 @@ int32_t Creatures::ReadCreatureInBox (int32_t index, t_creature & furball, { if (!d->Started) return -1; - + Process *p = d->owner; /* if(d->creature_module) @@ -359,130 +359,151 @@ int32_t Creatures::ReadCreatureInBox (int32_t index, t_creature & furball, bool Creatures::WriteLabors(const uint32_t index, uint8_t labors[NUM_CREATURE_LABORS]) { - if(!d->Started) return false; - uint32_t temp = d->p_cre->at (index); - Process * p = d->owner; - - p->write(temp + d->creatures.labors_offset, NUM_CREATURE_LABORS, labors); - uint32_t pickup_equip; - p->readDWord(temp + d->creatures.pickup_equipment_bit, pickup_equip); - pickup_equip |= 1u; - p->writeDWord(temp + d->creatures.pickup_equipment_bit, pickup_equip); - return true; + if(!d->Started) + { + return false; + } + uint32_t temp = d->p_cre->at (index); + Process * p = d->owner; + + p->write(temp + d->creatures.labors_offset, NUM_CREATURE_LABORS, labors); + uint32_t pickup_equip; + p->readDWord(temp + d->creatures.pickup_equipment_bit, pickup_equip); + pickup_equip |= 1u; + p->writeDWord(temp + d->creatures.pickup_equipment_bit, pickup_equip); + return true; } bool Creatures::WriteHappiness(const uint32_t index, const uint32_t happinessValue) { - if(!d->Started) - return false; - - uint32_t temp = d->p_cre->at (index); - Process * p = d->owner; - p->writeDWord (temp + d->creatures.happiness_offset, happinessValue); - return true; + if(!d->Started) + { + return false; + } + uint32_t temp = d->p_cre->at (index); + Process * p = d->owner; + p->writeDWord (temp + d->creatures.happiness_offset, happinessValue); + return true; } bool Creatures::WriteFlags(const uint32_t index, - const uint32_t flags1, - const uint32_t flags2) + const uint32_t flags1, + const uint32_t flags2) { - if(!d->Started) - return false; - - uint32_t temp = d->p_cre->at (index); - Process * p = d->owner; - p->writeDWord (temp + d->creatures.flags1_offset, flags1); - p->writeDWord (temp + d->creatures.flags2_offset, flags1); - return true; + if(!d->Started) + { + return false; + } + uint32_t temp = d->p_cre->at (index); + Process * p = d->owner; + p->writeDWord (temp + d->creatures.flags1_offset, flags1); + p->writeDWord (temp + d->creatures.flags2_offset, flags1); + return true; } bool Creatures::WriteSkills(const uint32_t index, const t_soul &soul) { - if(!d->Started) - return false; - - uint32_t temp = d->p_cre->at (index); - Process * p = d->owner; - uint32_t souloff = p->readDWord(temp + d->creatures.default_soul_offset); - - if(!souloff) - return false; - + if(!d->Started) + { + return false; + } + + uint32_t temp = d->p_cre->at (index); + Process * p = d->owner; + uint32_t souloff = p->readDWord(temp + d->creatures.default_soul_offset); + + if(!souloff) + { + return false; + } + DfVector skills(p, souloff + d->creatures.soul_skills_vector_offset); - for (uint32_t i=0; iwriteByte(temp2 + offsetof(t_skill, rating), soul.skills[i].rating); - p->writeWord(temp2 + offsetof(t_skill, experience), soul.skills[i].experience); + p->writeByte(temp2 + offsetof(t_skill, rating), soul.skills[i].rating); + p->writeWord(temp2 + offsetof(t_skill, experience), soul.skills[i].experience); } - return true; + return true; } bool Creatures::WriteAttributes(const uint32_t index, const t_creature &creature) { - if(!d->Started) - return false; + if(!d->Started) + { + return false; + } - uint32_t temp = d->p_cre->at (index); - Process * p = d->owner; - uint32_t souloff = p->readDWord(temp + d->creatures.default_soul_offset); + uint32_t temp = d->p_cre->at (index); + Process * p = d->owner; + uint32_t souloff = p->readDWord(temp + d->creatures.default_soul_offset); - if(!souloff) - return false; + if(!souloff) + { + return false; + } - // physical attributes - p->write(temp + d->creatures.physical_offset, - sizeof(t_attrib) * NUM_CREATURE_PHYSICAL_ATTRIBUTES, - (uint8_t *)&creature.strength); + // physical attributes + p->write(temp + d->creatures.physical_offset, + sizeof(t_attrib) * NUM_CREATURE_PHYSICAL_ATTRIBUTES, + (uint8_t *)&creature.strength); - // mental attributes are part of the soul - p->write(souloff + d->creatures.soul_mental_offset, - sizeof(t_attrib) * NUM_CREATURE_MENTAL_ATTRIBUTES, - (uint8_t *)&creature.defaultSoul.analytical_ability); + // mental attributes are part of the soul + p->write(souloff + d->creatures.soul_mental_offset, + sizeof(t_attrib) * NUM_CREATURE_MENTAL_ATTRIBUTES, + (uint8_t *)&creature.defaultSoul.analytical_ability); - return true; + return true; } bool Creatures::WriteSex(const uint32_t index, const uint8_t sex) { - if(!d->Started) - return false; + if(!d->Started) + { + return false; + } - uint32_t temp = d->p_cre->at (index); - Process * p = d->owner; - p->writeByte (temp + d->creatures.sex_offset, sex); + uint32_t temp = d->p_cre->at (index); + Process * p = d->owner; + p->writeByte (temp + d->creatures.sex_offset, sex); } bool Creatures::WriteTraits(const uint32_t index, const t_soul &soul) { - if(!d->Started) - return false; + if(!d->Started) + { + return false; + } + + uint32_t temp = d->p_cre->at (index); + Process * p = d->owner; + uint32_t souloff = p->readDWord(temp + d->creatures.default_soul_offset); - uint32_t temp = d->p_cre->at (index); - Process * p = d->owner; - uint32_t souloff = p->readDWord(temp + d->creatures.default_soul_offset); + if(!souloff) + { + return false; + } - if(!souloff) - return false; + p->write(souloff + d->creatures.soul_traits_offset, + sizeof (uint16_t) * NUM_CREATURE_TRAITS, + (uint8_t *) &soul.traits); - p->write(souloff + d->creatures.soul_traits_offset, - sizeof (uint16_t) * NUM_CREATURE_TRAITS, - (uint8_t *) &soul.traits); - - return true; + return true; } bool Creatures::WriteMood(const uint32_t index, const uint16_t mood) { - if(!d->Started) - return false; + if(!d->Started) + { + return false; + } - uint32_t temp = d->p_cre->at (index); - Process * p = d->owner; - p->writeWord(temp + d->creatures.mood_offset, mood); - return true; + uint32_t temp = d->p_cre->at (index); + Process * p = d->owner; + p->writeWord(temp + d->creatures.mood_offset, mood); + return true; } uint32_t Creatures::GetDwarfRaceIndex() diff --git a/library/python/c api/gui.py b/library/python/c api/gui.py deleted file mode 100644 index 09a7c5c94..000000000 --- a/library/python/c api/gui.py +++ /dev/null @@ -1,25 +0,0 @@ -from ctypes import * -from pydfhack import libdfhack, ViewScreen - -libdfhack.Gui_ReadViewScreen.argtypes = [ c_void_p, c_void_p ] - -class Gui(object): - def __init__(self, ptr): - self._gui_ptr = ptr - - def start(self): - return libdfhack.Gui_Start(self._gui_ptr) - - def finish(self): - return libdfhack.Gui_Finish(self._gui_ptr) - - def read_pause_state(self): - return libdfhack.Gui_ReadPauseState(self._pos_ptr) > 0 - - def read_view_screen(self): - s = ViewScreen() - - if libdfhack.Gui_ReadViewScreen(self._gui_ptr, byref(s)) > 0: - return s - else: - return None diff --git a/library/python/c api/materials.py b/library/python/c api/materials.py deleted file mode 100644 index 04d82fddb..000000000 --- a/library/python/c api/materials.py +++ /dev/null @@ -1,141 +0,0 @@ -from ctypes import * -from pydftypes import libdfhack -from util import * - -_get_arg_types = [ c_void_p, _arr_create_func ] - -libdfhack.Materials_getInorganic.argtypes = _get_arg_types -libdfhack.Materials_getOrganic.argtypes = _get_arg_types -libdfhack.Materials_getTree.argtypes = _get_arg_types -libdfhack.Materials_getPlant.argtypes = _get_arg_types -libdfhack.Materials_getRace.argtypes = _get_arg_types -#libdfhack.Materials_getRaceEx.argtypes = _get_arg_types -libdfhack.Materials_getColor.argtypes = _get_arg_types -libdfhack.Materials_getOther.argtypes = _get_arg_types - -class Materials(object): - def __init__(self, ptr): - self._mat_ptr = ptr - - self.inorganic = None - self.organic = None - self.tree = None - self.plant = None - self.race = None - self.race_ex = None - self.color = None - self.other = None - - def read_inorganic(self): - return libdfhack.Materials_ReadInorganicMaterials(self._mat_ptr) - - def read_organic(self): - return libdfhack.Materials_ReadOrganicMaterials(self._mat_ptr) - - def read_wood(self): - return libdfhack.Materials_ReadWoodMaterials(self._mat_ptr) - - def read_plant(self): - return libdfhack.Materials_ReadPlantMaterials(self._mat_ptr) - - def read_creature_types(self): - return libdfhack.Materials_ReadCreatureTypes(self._mat_ptr) - - def read_creature_types_ex(self): - return libdfhack.Materials_ReadCreatureTypesEx(self._mat_ptr) - - def read_descriptor_colors(self): - return libdfhack.Materials_ReadDescriptorColors(self._mat_ptr) - - def read_others(self): - return libdfhack.Materials_ReadOthers(self._mat_ptr) - - def read_all(self): - libdfhack.Materials_ReadAllMaterials(self._mat_ptr) - - def get_description(self, material): - return libdfhack.Materials_getDescription(self._mat_ptr, byref(material)) - - def update_inorganic_cache(self): - def update_callback(count): - allocated = _allocate_array(Matgloss, count) - - self.inorganic = allocated[0] - - return allocated[1] - - callback = _arr_create_func(update_callback) - - return libdfhack.Materials_getInorganic(self._mat_ptr, callback) - - def update_organic_cache(self): - def update_callback(count): - allocated = _allocate_array(Matgloss, count) - - self.organic = allocated[0] - - return allocated[1] - - callback = _arr_create_func(update_callback) - - return libdfhack.Materials_getOrganic(self._mat_ptr, callback) - - def update_tree_cache(self): - def update_callback(count): - allocated = _allocate_array(Matgloss, count) - - self.tree = allocated[0] - - return allocated[1] - - callback = _arr_create_func(update_callback) - - return libdfhack.Materials_getTree(self._mat_ptr, callback) - - def update_plant_cache(self): - def update_callback(count): - allocated = _allocate_array(Matgloss, count) - - self.plant = allocated[0] - - return allocated[1] - - callback = _arr_create_func(update_callback) - - return libdfhack.Materials_getPlant(self._mat_ptr, callback) - - def update_race_cache(self): - def update_callback(count): - allocated = _allocate_array(Matgloss, count) - - self.race = allocated[0] - - return allocated[1] - - callback = _arr_create_func(update_callback) - - return libdfhack.Materials_getRace(self._mat_ptr, callback) - - def update_color_cache(self): - def update_callback(count): - allocated = _allocate_array(DescriptorColor, count) - - self.color = allocated[0] - - return allocated[1] - - callback = _arr_create_func(update_callback) - - return libdfhack.Materials_getColor(self._mat_ptr, callback) - - def update_other_cache(self): - def update_callback(count): - allocated = _allocate_array(MatglossOther, count) - - self.other = allocated[0] - - return allocated[1] - - callback = _arr_create_func(update_callback) - - return libdfhack.Materials_getOther(self._mat_ptr, callback) diff --git a/library/python/c api/position.py b/library/python/c api/position.py deleted file mode 100644 index ffa758150..000000000 --- a/library/python/c api/position.py +++ /dev/null @@ -1,43 +0,0 @@ -from ctypes import * -from pydftypes import libdfhack - -class Position(object): - def __init__(self, ptr): - self._pos_ptr = ptr - - self._vx, self._vy, self._vz = c_int(), c_int(), c_int() - self._cx, self._cy, self._cz = c_int(), c_int(), c_int() - self._ww, self._wh = c_int(), c_int() - - def get_view_coords(self): - if libdfhack.Position_getViewCoords(self._pos_ptr, byref(self._vx), byref(self._vy), byref(self._vz)) > 0: - return (self._vx.value, self._vy.value, self._vz.value) - else: - return (-1, -1, -1) - - def set_view_coords(self, v_coords): - self._vx.value, self._vy.value, self._vz.value = v_coords - - libdfhack.Position_setViewCoords(self._pos_ptr, self._vx, self._vy, self._vz) - - view_coords = property(get_view_coords, set_view_coords) - - def get_cursor_coords(self): - if libdfhack.Position_getCursorCoords(self._pos_ptr, byref(self._cx), byref(self._cy), byref(self._cz)) > 0: - return (self._cx.value, self._cy.value, self._cz.value) - else: - return (-1, -1, -1) - - def set_cursor_coords(self, c_coords): - self._cx.value, self._cy.value, self_cz.value = c_coords - - libdfhack.Position_setCursorCoords(self._pos_ptr, self._cx, self._cy, self._cz) - - cursor_coords = property(get_cursor_coords, set_cursor_coords) - - @property - def window_size(self): - if libdfhack.Position_getWindowSize(self._pos_ptr, byref(self._ww), byref(self._wh)) > 0: - return (self._ww.value, self._wh.value) - else: - return (-1, -1) diff --git a/library/python/c api/vegetation.py b/library/python/c api/vegetation.py deleted file mode 100644 index 0c22d26b5..000000000 --- a/library/python/c api/vegetation.py +++ /dev/null @@ -1,25 +0,0 @@ -from ctypes import * -from pydftypes import libdfhack, Tree - -class Vegetation(object): - def __init__(self, ptr): - self._v_ptr = ptr - - def start(self): - n = c_uint(0) - - if libdfhack.Vegetation_Start(self._v_ptr, byref(n)) > 0: - return int(n.value) - else: - return -1 - - def finish(self): - return libdfhack.Vegetation_Finish(self._v_ptr) > 0 - - def read(self, index): - t = Tree() - - if libdfhack.Vegetation_Read(self._v_ptr, c_uint(index), byref(t)) > 0: - return t - else: - return None diff --git a/library/python/CMakeLists.txt b/library/python/deprecated/CMakeLists.txt similarity index 100% rename from library/python/CMakeLists.txt rename to library/python/deprecated/CMakeLists.txt diff --git a/library/python/DF_API.cpp b/library/python/deprecated/DF_API.cpp similarity index 100% rename from library/python/DF_API.cpp rename to library/python/deprecated/DF_API.cpp diff --git a/library/python/DF_Buildings.cpp b/library/python/deprecated/DF_Buildings.cpp similarity index 100% rename from library/python/DF_Buildings.cpp rename to library/python/deprecated/DF_Buildings.cpp diff --git a/library/python/DF_Constructions.cpp b/library/python/deprecated/DF_Constructions.cpp similarity index 100% rename from library/python/DF_Constructions.cpp rename to library/python/deprecated/DF_Constructions.cpp diff --git a/library/python/DF_CreatureManager.cpp b/library/python/deprecated/DF_CreatureManager.cpp similarity index 100% rename from library/python/DF_CreatureManager.cpp rename to library/python/deprecated/DF_CreatureManager.cpp diff --git a/library/python/DF_CreatureType.cpp b/library/python/deprecated/DF_CreatureType.cpp similarity index 100% rename from library/python/DF_CreatureType.cpp rename to library/python/deprecated/DF_CreatureType.cpp diff --git a/library/python/DF_GUI.cpp b/library/python/deprecated/DF_GUI.cpp similarity index 100% rename from library/python/DF_GUI.cpp rename to library/python/deprecated/DF_GUI.cpp diff --git a/library/python/DF_Helpers.cpp b/library/python/deprecated/DF_Helpers.cpp similarity index 100% rename from library/python/DF_Helpers.cpp rename to library/python/deprecated/DF_Helpers.cpp diff --git a/library/python/DF_Imports.cpp b/library/python/deprecated/DF_Imports.cpp similarity index 100% rename from library/python/DF_Imports.cpp rename to library/python/deprecated/DF_Imports.cpp diff --git a/library/python/DF_Maps.cpp b/library/python/deprecated/DF_Maps.cpp similarity index 100% rename from library/python/DF_Maps.cpp rename to library/python/deprecated/DF_Maps.cpp diff --git a/library/python/DF_Material.cpp b/library/python/deprecated/DF_Material.cpp similarity index 100% rename from library/python/DF_Material.cpp rename to library/python/deprecated/DF_Material.cpp diff --git a/library/python/DF_MemInfo.cpp b/library/python/deprecated/DF_MemInfo.cpp similarity index 100% rename from library/python/DF_MemInfo.cpp rename to library/python/deprecated/DF_MemInfo.cpp diff --git a/library/python/DF_Position.cpp b/library/python/deprecated/DF_Position.cpp similarity index 100% rename from library/python/DF_Position.cpp rename to library/python/deprecated/DF_Position.cpp diff --git a/library/python/DF_Translate.cpp b/library/python/deprecated/DF_Translate.cpp similarity index 100% rename from library/python/DF_Translate.cpp rename to library/python/deprecated/DF_Translate.cpp diff --git a/library/python/DF_Vegetation.cpp b/library/python/deprecated/DF_Vegetation.cpp similarity index 100% rename from library/python/DF_Vegetation.cpp rename to library/python/deprecated/DF_Vegetation.cpp diff --git a/library/python/build-linux b/library/python/deprecated/build-linux similarity index 100% rename from library/python/build-linux rename to library/python/deprecated/build-linux diff --git a/library/python/build.bat b/library/python/deprecated/build.bat similarity index 100% rename from library/python/build.bat rename to library/python/deprecated/build.bat diff --git a/library/python/dfhack_api_ctypes.py b/library/python/deprecated/dfhack_api_ctypes.py similarity index 100% rename from library/python/dfhack_api_ctypes.py rename to library/python/deprecated/dfhack_api_ctypes.py diff --git a/library/python/examples/attachtest.py b/library/python/deprecated/examples/attachtest.py similarity index 100% rename from library/python/examples/attachtest.py rename to library/python/deprecated/examples/attachtest.py diff --git a/library/python/examples/miscutils.py b/library/python/deprecated/examples/miscutils.py similarity index 100% rename from library/python/examples/miscutils.py rename to library/python/deprecated/examples/miscutils.py diff --git a/library/python/examples/position.py b/library/python/deprecated/examples/position.py similarity index 100% rename from library/python/examples/position.py rename to library/python/deprecated/examples/position.py diff --git a/library/python/examples/settlementdump.py b/library/python/deprecated/examples/settlementdump.py similarity index 100% rename from library/python/examples/settlementdump.py rename to library/python/deprecated/examples/settlementdump.py diff --git a/library/python/examples/suspendtest.py b/library/python/deprecated/examples/suspendtest.py similarity index 100% rename from library/python/examples/suspendtest.py rename to library/python/deprecated/examples/suspendtest.py diff --git a/library/python/examples/treedump.py b/library/python/deprecated/examples/treedump.py similarity index 100% rename from library/python/examples/treedump.py rename to library/python/deprecated/examples/treedump.py diff --git a/library/python/ez_setup.py b/library/python/deprecated/ez_setup.py similarity index 100% rename from library/python/ez_setup.py rename to library/python/deprecated/ez_setup.py diff --git a/library/python/linsetup.py b/library/python/deprecated/linsetup.py similarity index 100% rename from library/python/linsetup.py rename to library/python/deprecated/linsetup.py diff --git a/library/python/pydfhack.cpp b/library/python/deprecated/pydfhack.cpp similarity index 100% rename from library/python/pydfhack.cpp rename to library/python/deprecated/pydfhack.cpp diff --git a/library/python/deprecated/pydfhack/__init__.py b/library/python/deprecated/pydfhack/__init__.py new file mode 100644 index 000000000..1f17c8569 --- /dev/null +++ b/library/python/deprecated/pydfhack/__init__.py @@ -0,0 +1 @@ +from .pydfapi import API diff --git a/library/python/pydfhack/blocks.py b/library/python/deprecated/pydfhack/blocks.py similarity index 100% rename from library/python/pydfhack/blocks.py rename to library/python/deprecated/pydfhack/blocks.py diff --git a/library/python/pydfhack/construction.py b/library/python/deprecated/pydfhack/construction.py similarity index 100% rename from library/python/pydfhack/construction.py rename to library/python/deprecated/pydfhack/construction.py diff --git a/library/python/pydfhack/creature.py b/library/python/deprecated/pydfhack/creature.py similarity index 100% rename from library/python/pydfhack/creature.py rename to library/python/deprecated/pydfhack/creature.py diff --git a/library/python/pydfhack/decorators.py b/library/python/deprecated/pydfhack/decorators.py similarity index 100% rename from library/python/pydfhack/decorators.py rename to library/python/deprecated/pydfhack/decorators.py diff --git a/library/python/deprecated/pydfhack/gui.py b/library/python/deprecated/pydfhack/gui.py new file mode 100644 index 000000000..07192f67c --- /dev/null +++ b/library/python/deprecated/pydfhack/gui.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +""" +Python class for DF_Hack::GUI +""" +from ._pydfhack import _GUIManager +class GUI(_GUIManager): + api = None + started = False + def __init__(self, api, *args, **kwds): + _GUIManager.__init__(self, args, kwds) + self.api = api + + def prepare(self): + """ + Enforce Suspend/Start + """ + if self.api.prepare(): + if not self.started: + self.started = self.Start() + return self.started + else: + return False + + + diff --git a/library/python/pydfhack/map.py b/library/python/deprecated/pydfhack/map.py similarity index 100% rename from library/python/pydfhack/map.py rename to library/python/deprecated/pydfhack/map.py diff --git a/library/python/deprecated/pydfhack/materials.py b/library/python/deprecated/pydfhack/materials.py new file mode 100644 index 000000000..13e02c682 --- /dev/null +++ b/library/python/deprecated/pydfhack/materials.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +""" +Python class for DF_Hack::Materials +""" +from ._pydfhack import _MaterialsManager +from .mixins import NoStart +from .decorators import suspend + +class Materials(NoStart, _MaterialsManager): + api = None + cls = _MaterialsManager + def __init__(self, api, *args, **kwds): + cls.__init__(self, args, kwds) + self.api = api + + @suspend + def Read_Wood_Materials(self, *args, **kw): + return self.cls.Read_Wood_Materials(self, *args, **kw) + + @suspend + def Read_Plant_Materials(self, *args, **kw): + return self.cls.Read_Plant_Materials(self, *args, **kw) + + @suspend + def Read_Inorganic_Materials(self, *args, **kw): + return self.cls.Read_Inorganic_Materials(self, *args, **kw) + + @suspend + def Read_Descriptor_Colors(self, *args, **kw): + return self.cls.Read_Descriptor_Colors(self, *args, **kw) + + @suspend + def Read_Creature_Types(self, *args, **kw): + return self.cls.Read_Creature_Types(self, *args, **kw) + + @suspend + def Read_Organic_Materials(self, *args, **kw): + return self.cls.Read_Organic_Materials(self, *args, **kw) + + @suspend + def Read_Creature_Types_Ex(self, *args, **kw): + return self.cls.Read_Creature_Types_Ex(self, *args, **kw) diff --git a/library/python/pydfhack/meminfo.py b/library/python/deprecated/pydfhack/meminfo.py similarity index 100% rename from library/python/pydfhack/meminfo.py rename to library/python/deprecated/pydfhack/meminfo.py diff --git a/library/python/pydfhack/mixins.py b/library/python/deprecated/pydfhack/mixins.py similarity index 100% rename from library/python/pydfhack/mixins.py rename to library/python/deprecated/pydfhack/mixins.py diff --git a/library/python/deprecated/pydfhack/position.py b/library/python/deprecated/pydfhack/position.py new file mode 100644 index 000000000..7956ea812 --- /dev/null +++ b/library/python/deprecated/pydfhack/position.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +""" +Python class for DF_Hack::Position +""" +from ._pydfhack import _PositionManager +from .blocks import Point, Block +from .mixins import NoStart +from .decorators import suspend + +class Position(NoStart, _PositionManager): + api = None + cls = _PositionManager + def __init__(self, api, *args, **kwds): + self.cls.__init__(self, args, kwds) + self.api = api + + @suspend + def get_cursor(self): + coords = self.cursor_coords + if coords: + return Point(*coords) + else: + return None + + @suspend + def get_window_size(self): + wsize = self.window_size + return wsize + + @suspend + def get_view_coords(self): + coords = self.view_coords + return Point(*coords) + + @suspend + def get_cursor_tile(self): + point = self.get_cursor() + if point: + tile = self.api.maps.get_tile(point=point) + return tile + else: + return None diff --git a/library/python/pydfhack/pydfapi.py b/library/python/deprecated/pydfhack/pydfapi.py similarity index 100% rename from library/python/pydfhack/pydfapi.py rename to library/python/deprecated/pydfhack/pydfapi.py diff --git a/library/python/pydfhack/pydfhackflags.py b/library/python/deprecated/pydfhack/pydfhackflags.py similarity index 100% rename from library/python/pydfhack/pydfhackflags.py rename to library/python/deprecated/pydfhack/pydfhackflags.py diff --git a/library/python/pydfhack/pydftypes.py b/library/python/deprecated/pydfhack/pydftypes.py similarity index 100% rename from library/python/pydfhack/pydftypes.py rename to library/python/deprecated/pydfhack/pydftypes.py diff --git a/library/python/pydfhack/translation.py b/library/python/deprecated/pydfhack/translation.py similarity index 100% rename from library/python/pydfhack/translation.py rename to library/python/deprecated/pydfhack/translation.py diff --git a/library/python/deprecated/pydfhack/vegetation.py b/library/python/deprecated/pydfhack/vegetation.py new file mode 100644 index 000000000..ce1262a13 --- /dev/null +++ b/library/python/deprecated/pydfhack/vegetation.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +""" +Python class for DF_Hack::Vegetation +""" +from ._pydfhack import _VegetationManager +from .mixins import NeedsStart +from .decorators import suspend + +class Vegetation(NeedsStart, _VegetationManager): + api = None + cls = _VegetationManager + def __init__(self, api, *args, **kwds): + self.cls.__init__(self, args, kwds) + self.api = api + + @suspend + def Read(self, *args, **kw): + return self.cls.Read(self, *args, **kw) diff --git a/library/python/setup.py b/library/python/deprecated/setup.py similarity index 100% rename from library/python/setup.py rename to library/python/deprecated/setup.py diff --git a/library/python/test.py b/library/python/deprecated/test.py similarity index 100% rename from library/python/test.py rename to library/python/deprecated/test.py diff --git a/library/python/tools/shell.py b/library/python/deprecated/tools/shell.py similarity index 100% rename from library/python/tools/shell.py rename to library/python/deprecated/tools/shell.py diff --git a/library/python/tools/trees.py b/library/python/deprecated/tools/trees.py similarity index 100% rename from library/python/tools/trees.py rename to library/python/deprecated/tools/trees.py diff --git a/library/python/pydfhack/__init__.py b/library/python/pydfhack/__init__.py index 1f17c8569..99cf04305 100644 --- a/library/python/pydfhack/__init__.py +++ b/library/python/pydfhack/__init__.py @@ -1 +1,14 @@ -from .pydfapi import API +import context + +__all__ = [ "buildings", + "constructions", + "context", + "creatures", + "dftypes", + "flags", + "gui", + "items", + "maps", + "materials", + "position" + "vegetation" ] \ No newline at end of file diff --git a/library/python/c api/buildings.py b/library/python/pydfhack/buildings.py similarity index 100% rename from library/python/c api/buildings.py rename to library/python/pydfhack/buildings.py diff --git a/library/python/c api/constructions.py b/library/python/pydfhack/constructions.py similarity index 100% rename from library/python/c api/constructions.py rename to library/python/pydfhack/constructions.py diff --git a/library/python/c api/context.py b/library/python/pydfhack/context.py similarity index 86% rename from library/python/c api/context.py rename to library/python/pydfhack/context.py index eed236b09..0afc2cf25 100644 --- a/library/python/c api/context.py +++ b/library/python/pydfhack/context.py @@ -167,39 +167,4 @@ class Context(object): if self._tran_obj is None: self._tran_obj = translation.Translation(libdfhack.Context_getTranslation(self._c_ptr)) - return self._tran_obj - -def reveal(): - df_cm = ContextManager("Memory.xml") - df = df_cm.get_single_context() - - df.attach() - - m = df.maps - - m.start() - - m_x, m_y, m_z = m.size - - for x in xrange(m_x): - for y in xrange(m_y): - for z in xrange(m_z): - if m.is_valid_block(x, y, z): - d = m.read_designations(x, y, z) - - for i in d: - for j in i: - j.bits.hidden = 0 - - m.write_designations(x, y, z, d) - - m.finish() - df.detach() - -def resume(): - df_cm = ContextManager("Memory.xml") - df = df_cm.get_single_context() - - df.attach() - df.force_resume() - df.detach() + return self._tran_obj \ No newline at end of file diff --git a/library/python/c api/creatures.py b/library/python/pydfhack/creatures.py similarity index 100% rename from library/python/c api/creatures.py rename to library/python/pydfhack/creatures.py diff --git a/library/python/c api/dfhack_api_ctypes.py b/library/python/pydfhack/dfhack_api_ctypes.py similarity index 100% rename from library/python/c api/dfhack_api_ctypes.py rename to library/python/pydfhack/dfhack_api_ctypes.py diff --git a/library/python/c api/pydftypes.py b/library/python/pydfhack/dftypes.py similarity index 100% rename from library/python/c api/pydftypes.py rename to library/python/pydfhack/dftypes.py diff --git a/library/python/c api/enum.py b/library/python/pydfhack/enum.py similarity index 100% rename from library/python/c api/enum.py rename to library/python/pydfhack/enum.py diff --git a/library/python/c api/pydfhackflags.py b/library/python/pydfhack/flags.py similarity index 100% rename from library/python/c api/pydfhackflags.py rename to library/python/pydfhack/flags.py diff --git a/library/python/pydfhack/gui.py b/library/python/pydfhack/gui.py index 07192f67c..09a7c5c94 100644 --- a/library/python/pydfhack/gui.py +++ b/library/python/pydfhack/gui.py @@ -1,25 +1,25 @@ -# -*- coding: utf-8 -*- -""" -Python class for DF_Hack::GUI -""" -from ._pydfhack import _GUIManager -class GUI(_GUIManager): - api = None - started = False - def __init__(self, api, *args, **kwds): - _GUIManager.__init__(self, args, kwds) - self.api = api +from ctypes import * +from pydfhack import libdfhack, ViewScreen - def prepare(self): - """ - Enforce Suspend/Start - """ - if self.api.prepare(): - if not self.started: - self.started = self.Start() - return self.started - else: - return False - - +libdfhack.Gui_ReadViewScreen.argtypes = [ c_void_p, c_void_p ] + +class Gui(object): + def __init__(self, ptr): + self._gui_ptr = ptr + + def start(self): + return libdfhack.Gui_Start(self._gui_ptr) + + def finish(self): + return libdfhack.Gui_Finish(self._gui_ptr) + def read_pause_state(self): + return libdfhack.Gui_ReadPauseState(self._pos_ptr) > 0 + + def read_view_screen(self): + s = ViewScreen() + + if libdfhack.Gui_ReadViewScreen(self._gui_ptr, byref(s)) > 0: + return s + else: + return None diff --git a/library/python/c api/items.py b/library/python/pydfhack/items.py similarity index 100% rename from library/python/c api/items.py rename to library/python/pydfhack/items.py diff --git a/library/python/c api/maps.py b/library/python/pydfhack/maps.py similarity index 100% rename from library/python/c api/maps.py rename to library/python/pydfhack/maps.py diff --git a/library/python/pydfhack/materials.py b/library/python/pydfhack/materials.py index 13e02c682..04d82fddb 100644 --- a/library/python/pydfhack/materials.py +++ b/library/python/pydfhack/materials.py @@ -1,42 +1,141 @@ -# -*- coding: utf-8 -*- -""" -Python class for DF_Hack::Materials -""" -from ._pydfhack import _MaterialsManager -from .mixins import NoStart -from .decorators import suspend - -class Materials(NoStart, _MaterialsManager): - api = None - cls = _MaterialsManager - def __init__(self, api, *args, **kwds): - cls.__init__(self, args, kwds) - self.api = api - - @suspend - def Read_Wood_Materials(self, *args, **kw): - return self.cls.Read_Wood_Materials(self, *args, **kw) - - @suspend - def Read_Plant_Materials(self, *args, **kw): - return self.cls.Read_Plant_Materials(self, *args, **kw) - - @suspend - def Read_Inorganic_Materials(self, *args, **kw): - return self.cls.Read_Inorganic_Materials(self, *args, **kw) - - @suspend - def Read_Descriptor_Colors(self, *args, **kw): - return self.cls.Read_Descriptor_Colors(self, *args, **kw) - - @suspend - def Read_Creature_Types(self, *args, **kw): - return self.cls.Read_Creature_Types(self, *args, **kw) - - @suspend - def Read_Organic_Materials(self, *args, **kw): - return self.cls.Read_Organic_Materials(self, *args, **kw) - - @suspend - def Read_Creature_Types_Ex(self, *args, **kw): - return self.cls.Read_Creature_Types_Ex(self, *args, **kw) +from ctypes import * +from pydftypes import libdfhack +from util import * + +_get_arg_types = [ c_void_p, _arr_create_func ] + +libdfhack.Materials_getInorganic.argtypes = _get_arg_types +libdfhack.Materials_getOrganic.argtypes = _get_arg_types +libdfhack.Materials_getTree.argtypes = _get_arg_types +libdfhack.Materials_getPlant.argtypes = _get_arg_types +libdfhack.Materials_getRace.argtypes = _get_arg_types +#libdfhack.Materials_getRaceEx.argtypes = _get_arg_types +libdfhack.Materials_getColor.argtypes = _get_arg_types +libdfhack.Materials_getOther.argtypes = _get_arg_types + +class Materials(object): + def __init__(self, ptr): + self._mat_ptr = ptr + + self.inorganic = None + self.organic = None + self.tree = None + self.plant = None + self.race = None + self.race_ex = None + self.color = None + self.other = None + + def read_inorganic(self): + return libdfhack.Materials_ReadInorganicMaterials(self._mat_ptr) + + def read_organic(self): + return libdfhack.Materials_ReadOrganicMaterials(self._mat_ptr) + + def read_wood(self): + return libdfhack.Materials_ReadWoodMaterials(self._mat_ptr) + + def read_plant(self): + return libdfhack.Materials_ReadPlantMaterials(self._mat_ptr) + + def read_creature_types(self): + return libdfhack.Materials_ReadCreatureTypes(self._mat_ptr) + + def read_creature_types_ex(self): + return libdfhack.Materials_ReadCreatureTypesEx(self._mat_ptr) + + def read_descriptor_colors(self): + return libdfhack.Materials_ReadDescriptorColors(self._mat_ptr) + + def read_others(self): + return libdfhack.Materials_ReadOthers(self._mat_ptr) + + def read_all(self): + libdfhack.Materials_ReadAllMaterials(self._mat_ptr) + + def get_description(self, material): + return libdfhack.Materials_getDescription(self._mat_ptr, byref(material)) + + def update_inorganic_cache(self): + def update_callback(count): + allocated = _allocate_array(Matgloss, count) + + self.inorganic = allocated[0] + + return allocated[1] + + callback = _arr_create_func(update_callback) + + return libdfhack.Materials_getInorganic(self._mat_ptr, callback) + + def update_organic_cache(self): + def update_callback(count): + allocated = _allocate_array(Matgloss, count) + + self.organic = allocated[0] + + return allocated[1] + + callback = _arr_create_func(update_callback) + + return libdfhack.Materials_getOrganic(self._mat_ptr, callback) + + def update_tree_cache(self): + def update_callback(count): + allocated = _allocate_array(Matgloss, count) + + self.tree = allocated[0] + + return allocated[1] + + callback = _arr_create_func(update_callback) + + return libdfhack.Materials_getTree(self._mat_ptr, callback) + + def update_plant_cache(self): + def update_callback(count): + allocated = _allocate_array(Matgloss, count) + + self.plant = allocated[0] + + return allocated[1] + + callback = _arr_create_func(update_callback) + + return libdfhack.Materials_getPlant(self._mat_ptr, callback) + + def update_race_cache(self): + def update_callback(count): + allocated = _allocate_array(Matgloss, count) + + self.race = allocated[0] + + return allocated[1] + + callback = _arr_create_func(update_callback) + + return libdfhack.Materials_getRace(self._mat_ptr, callback) + + def update_color_cache(self): + def update_callback(count): + allocated = _allocate_array(DescriptorColor, count) + + self.color = allocated[0] + + return allocated[1] + + callback = _arr_create_func(update_callback) + + return libdfhack.Materials_getColor(self._mat_ptr, callback) + + def update_other_cache(self): + def update_callback(count): + allocated = _allocate_array(MatglossOther, count) + + self.other = allocated[0] + + return allocated[1] + + callback = _arr_create_func(update_callback) + + return libdfhack.Materials_getOther(self._mat_ptr, callback) diff --git a/library/python/pydfhack/position.py b/library/python/pydfhack/position.py index 7956ea812..ffa758150 100644 --- a/library/python/pydfhack/position.py +++ b/library/python/pydfhack/position.py @@ -1,42 +1,43 @@ -# -*- coding: utf-8 -*- -""" -Python class for DF_Hack::Position -""" -from ._pydfhack import _PositionManager -from .blocks import Point, Block -from .mixins import NoStart -from .decorators import suspend - -class Position(NoStart, _PositionManager): - api = None - cls = _PositionManager - def __init__(self, api, *args, **kwds): - self.cls.__init__(self, args, kwds) - self.api = api - - @suspend - def get_cursor(self): - coords = self.cursor_coords - if coords: - return Point(*coords) - else: - return None +from ctypes import * +from pydftypes import libdfhack + +class Position(object): + def __init__(self, ptr): + self._pos_ptr = ptr - @suspend - def get_window_size(self): - wsize = self.window_size - return wsize + self._vx, self._vy, self._vz = c_int(), c_int(), c_int() + self._cx, self._cy, self._cz = c_int(), c_int(), c_int() + self._ww, self._wh = c_int(), c_int() - @suspend def get_view_coords(self): - coords = self.view_coords - return Point(*coords) - - @suspend - def get_cursor_tile(self): - point = self.get_cursor() - if point: - tile = self.api.maps.get_tile(point=point) - return tile + if libdfhack.Position_getViewCoords(self._pos_ptr, byref(self._vx), byref(self._vy), byref(self._vz)) > 0: + return (self._vx.value, self._vy.value, self._vz.value) + else: + return (-1, -1, -1) + + def set_view_coords(self, v_coords): + self._vx.value, self._vy.value, self._vz.value = v_coords + + libdfhack.Position_setViewCoords(self._pos_ptr, self._vx, self._vy, self._vz) + + view_coords = property(get_view_coords, set_view_coords) + + def get_cursor_coords(self): + if libdfhack.Position_getCursorCoords(self._pos_ptr, byref(self._cx), byref(self._cy), byref(self._cz)) > 0: + return (self._cx.value, self._cy.value, self._cz.value) + else: + return (-1, -1, -1) + + def set_cursor_coords(self, c_coords): + self._cx.value, self._cy.value, self_cz.value = c_coords + + libdfhack.Position_setCursorCoords(self._pos_ptr, self._cx, self._cy, self._cz) + + cursor_coords = property(get_cursor_coords, set_cursor_coords) + + @property + def window_size(self): + if libdfhack.Position_getWindowSize(self._pos_ptr, byref(self._ww), byref(self._wh)) > 0: + return (self._ww.value, self._wh.value) else: - return None + return (-1, -1) diff --git a/library/python/c api/util.py b/library/python/pydfhack/util.py similarity index 100% rename from library/python/c api/util.py rename to library/python/pydfhack/util.py diff --git a/library/python/pydfhack/vegetation.py b/library/python/pydfhack/vegetation.py index ce1262a13..0c22d26b5 100644 --- a/library/python/pydfhack/vegetation.py +++ b/library/python/pydfhack/vegetation.py @@ -1,18 +1,25 @@ -# -*- coding: utf-8 -*- -""" -Python class for DF_Hack::Vegetation -""" -from ._pydfhack import _VegetationManager -from .mixins import NeedsStart -from .decorators import suspend +from ctypes import * +from pydftypes import libdfhack, Tree -class Vegetation(NeedsStart, _VegetationManager): - api = None - cls = _VegetationManager - def __init__(self, api, *args, **kwds): - self.cls.__init__(self, args, kwds) - self.api = api +class Vegetation(object): + def __init__(self, ptr): + self._v_ptr = ptr + + def start(self): + n = c_uint(0) - @suspend - def Read(self, *args, **kw): - return self.cls.Read(self, *args, **kw) + if libdfhack.Vegetation_Start(self._v_ptr, byref(n)) > 0: + return int(n.value) + else: + return -1 + + def finish(self): + return libdfhack.Vegetation_Finish(self._v_ptr) > 0 + + def read(self, index): + t = Tree() + + if libdfhack.Vegetation_Read(self._v_ptr, c_uint(index), byref(t)) > 0: + return t + else: + return None diff --git a/tools/playground/incrementalsearch.cpp b/tools/playground/incrementalsearch.cpp index ff3f5b592..e4d46dab5 100644 --- a/tools/playground/incrementalsearch.cpp +++ b/tools/playground/incrementalsearch.cpp @@ -36,40 +36,68 @@ class holder class address { public: - uint64_t addr_; - unsigned int valid : 1; - virtual void print(SegmentedFinder& sff) - { - cout << hex << "0x" << addr_ << endl; - }; - address(const uint64_t addr) - { - addr_ = addr; - valid = false; - } - address & operator=(const uint64_t in) - { - addr_ = in; - valid = false; - return *this; - } - bool isValid(SegmentedFinder& sff) + uint64_t addr_; + unsigned int valid : 1; + virtual void print(SegmentedFinder& sff) + { + cout << hex << "0x" << addr_ << endl; + }; + address(const uint64_t addr) + { + addr_ = addr; + valid = false; + } + virtual address & operator=(const uint64_t in) + { + addr_ = in; + valid = false; + return *this; + } + virtual bool isValid(SegmentedFinder& sff) + { + if(valid) return true; + if(sff.getSegmentForAddress(addr_)) { - if(valid) return true; - if(sff.getSegmentForAddress(addr_)) - { - valid = 1; - } + valid = 1; } + } + virtual bool equals (SegmentedFinder & sf, address & rhs) + { + return rhs.addr_ == addr_; + } }; +// pointer to a null-terminated byte string class Cstr: public address { void print(SegmentedFinder & sf) { cout << hex << "0x" << addr_ << ": \"" << sf.Translate(addr_) << "\"" << endl; } + bool equals(SegmentedFinder & sf,const char * rhs) + { + uint32_t addr2 = *(sf.Translate(addr_)); + return strcmp(sf.Translate(addr2), rhs) == 0; + } + template + bool equalsP(SegmentedFinder & sf,inType rhs) + { + return Predicate(addr_, sf, rhs); + } + bool isValid(SegmentedFinder& sf) + { + if (address::isValid(sf)) + { + // read the pointer + uint32_t addr2 = *(sf.Translate(addr_)); + // is it a real pointer? a pretty weak test, but whatever. + if(sf.getSegmentForAddress(addr2)) + return true; + } + return false; + } }; + // STL STRING #ifdef LINUX_BUILD class STLstr: public address