|
|
@ -24,9 +24,6 @@ distribution.
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ERROR_H_INCLUDED
|
|
|
|
|
|
|
|
#define ERROR_H_INCLUDED
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Export.h"
|
|
|
|
#include "Export.h"
|
|
|
|
#include "Pragma.h"
|
|
|
|
#include "Pragma.h"
|
|
|
|
#include <string>
|
|
|
|
#include <string>
|
|
|
@ -42,176 +39,34 @@ namespace DFHack
|
|
|
|
* the whole array of DFHack exceptions from the rest
|
|
|
|
* the whole array of DFHack exceptions from the rest
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class DFHACK_EXPORT All : public std::exception{};
|
|
|
|
class DFHACK_EXPORT All : public std::exception{};
|
|
|
|
class DFHACK_EXPORT AllMemdef : public All{};
|
|
|
|
class DFHACK_EXPORT AllSymbols : public All{};
|
|
|
|
class DFHACK_EXPORT NoProcess : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "couldn't find a suitable process";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DFHACK_EXPORT CantAttach : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "couldn't attach to process";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DFHACK_EXPORT NoMapLoaded : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "no map has been loaded in the dwarf fortress process";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DFHACK_EXPORT BadMapDimensions : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
BadMapDimensions(uint32_t& _x, uint32_t& _y) : x(_x), y(_y) {}
|
|
|
|
|
|
|
|
const uint32_t x;
|
|
|
|
|
|
|
|
const uint32_t y;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "both x and y needs to be between 0 and 48";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// a call to DFHack::mem_info::get* failed
|
|
|
|
|
|
|
|
class DFHACK_EXPORT MissingMemoryDefinition : public AllMemdef
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
MissingMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "memory object not declared: type=" << type << " key=" << key;
|
|
|
|
|
|
|
|
full = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by functios using integer keys, such as getTrait
|
|
|
|
|
|
|
|
MissingMemoryDefinition(const char* _type, uint32_t _key) : type(_type)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream s1;
|
|
|
|
|
|
|
|
s1 << _key;
|
|
|
|
|
|
|
|
key = s1.str();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "memory object not declared: type=" << type << " key=" << key;
|
|
|
|
|
|
|
|
full = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~MissingMemoryDefinition() throw(){};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string full;
|
|
|
|
|
|
|
|
const std::string type;
|
|
|
|
|
|
|
|
std::string key;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return full.c_str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// a call to DFHack::mem_info::get* failed
|
|
|
|
|
|
|
|
class DFHACK_EXPORT UnsetMemoryDefinition : public AllMemdef
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
UnsetMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "memory object not set: type " << type << " key " << key;
|
|
|
|
|
|
|
|
full = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by functios using integer keys, such as getTrait
|
|
|
|
|
|
|
|
UnsetMemoryDefinition(const char* _type, uint32_t _key) : type(_type)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream s1;
|
|
|
|
|
|
|
|
s1 << _key;
|
|
|
|
|
|
|
|
key = s1.str();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "memory object not set: type " << type << " key " << key;
|
|
|
|
|
|
|
|
full = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~UnsetMemoryDefinition() throw(){};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string full;
|
|
|
|
|
|
|
|
const std::string type;
|
|
|
|
|
|
|
|
std::string key;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return full.c_str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// a call to DFHack::mem_info::get* failed
|
|
|
|
|
|
|
|
class DFHACK_EXPORT InvalidMemoryDefinition : public AllMemdef
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
InvalidMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "memory object is INVALID: type " << type << " key " << key;
|
|
|
|
|
|
|
|
full = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by functios using integer keys, such as getTrait
|
|
|
|
|
|
|
|
InvalidMemoryDefinition(const char* _type, uint32_t _key) : type(_type)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream s1;
|
|
|
|
|
|
|
|
s1 << _key;
|
|
|
|
|
|
|
|
key = s1.str();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "memory object is INVALID: type " << type << " key " << key;
|
|
|
|
|
|
|
|
full = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~InvalidMemoryDefinition() throw(){};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string full;
|
|
|
|
|
|
|
|
const std::string type;
|
|
|
|
|
|
|
|
std::string key;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return full.c_str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Syntax errors and whatnot, the xml can't be read
|
|
|
|
// Syntax errors and whatnot, the xml can't be read
|
|
|
|
class DFHACK_EXPORT MemoryXmlParse : public All
|
|
|
|
class DFHACK_EXPORT SymbolsXmlParse : public AllSymbols
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
MemoryXmlParse(const char* _desc, int _id, int _row, int _col)
|
|
|
|
SymbolsXmlParse(const char* _desc, int _id, int _row, int _col)
|
|
|
|
:desc(_desc), id(_id), row(_row), col(_col)
|
|
|
|
:desc(_desc), id(_id), row(_row), col(_col)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::stringstream s;
|
|
|
|
std::stringstream s;
|
|
|
|
s << "error " << id << ": " << desc << ", at row " << row << " col " << col;
|
|
|
|
s << "error " << id << ": " << desc << ", at row " << row << " col " << col;
|
|
|
|
full = s.str();
|
|
|
|
full = s.str();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string full;
|
|
|
|
std::string full;
|
|
|
|
const std::string desc;
|
|
|
|
const std::string desc;
|
|
|
|
const int id;
|
|
|
|
const int id;
|
|
|
|
const int row;
|
|
|
|
const int row;
|
|
|
|
const int col;
|
|
|
|
const int col;
|
|
|
|
virtual ~MemoryXmlParse() throw(){};
|
|
|
|
virtual ~SymbolsXmlParse() throw(){};
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return full.c_str();
|
|
|
|
return full.c_str();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class DFHACK_EXPORT MemoryXmlBadAttribute : public All
|
|
|
|
class DFHACK_EXPORT SymbolsXmlBadAttribute : public All
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
MemoryXmlBadAttribute(const char* _attr) : attr(_attr)
|
|
|
|
SymbolsXmlBadAttribute(const char* _attr) : attr(_attr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::stringstream s;
|
|
|
|
std::stringstream s;
|
|
|
|
s << "attribute is either missing or invalid: " << attr;
|
|
|
|
s << "attribute is either missing or invalid: " << attr;
|
|
|
@ -219,58 +74,34 @@ namespace DFHack
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::string full;
|
|
|
|
std::string full;
|
|
|
|
std::string attr;
|
|
|
|
std::string attr;
|
|
|
|
|
|
|
|
virtual ~SymbolsXmlBadAttribute() throw(){};
|
|
|
|
virtual ~MemoryXmlBadAttribute() throw(){};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return full.c_str();
|
|
|
|
return full.c_str();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class DFHACK_EXPORT MemoryXmlNoRoot : public All
|
|
|
|
class DFHACK_EXPORT SymbolsXmlNoRoot : public All
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
MemoryXmlNoRoot() {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual ~MemoryXmlNoRoot() throw(){};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "no pElem found";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DFHACK_EXPORT MemoryXmlNoDFExtractor : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
MemoryXmlNoDFExtractor(const char* _name) : name(_name)
|
|
|
|
SymbolsXmlNoRoot() {}
|
|
|
|
{
|
|
|
|
virtual ~SymbolsXmlNoRoot() throw(){};
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "DFExtractor != " << name;
|
|
|
|
|
|
|
|
full = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~MemoryXmlNoDFExtractor() throw(){};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string name;
|
|
|
|
|
|
|
|
std::string full;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return full.c_str();
|
|
|
|
return "Symbol file is missing root element.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class DFHACK_EXPORT MemoryXmlUnderspecifiedEntry : public All
|
|
|
|
class DFHACK_EXPORT SymbolsXmlUnderspecifiedEntry : public All
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
MemoryXmlUnderspecifiedEntry(const char * _where) : where(_where)
|
|
|
|
SymbolsXmlUnderspecifiedEntry(const char * _where) : where(_where)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::stringstream s;
|
|
|
|
std::stringstream s;
|
|
|
|
s << "underspecified MemInfo entry, each entry needs to set both the name attribute and have a value. parent: " << where;
|
|
|
|
s << "Underspecified symbol file entry, each entry needs to set both the name attribute and have a value. parent: " << where;
|
|
|
|
full = s.str();
|
|
|
|
full = s.str();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
virtual ~MemoryXmlUnderspecifiedEntry() throw(){};
|
|
|
|
virtual ~SymbolsXmlUnderspecifiedEntry() throw(){};
|
|
|
|
std::string where;
|
|
|
|
std::string where;
|
|
|
|
std::string full;
|
|
|
|
std::string full;
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
virtual const char* what() const throw()
|
|
|
@ -278,104 +109,6 @@ namespace DFHack
|
|
|
|
return full.c_str();
|
|
|
|
return full.c_str();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class DFHACK_EXPORT MemoryXmlUnknownType : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
MemoryXmlUnknownType(const char* _type) : type(_type)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "unknown MemInfo type: " << type;
|
|
|
|
|
|
|
|
full = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~MemoryXmlUnknownType() throw(){};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string type;
|
|
|
|
|
|
|
|
std::string full;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return full.c_str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DFHACK_EXPORT SHMServerDisappeared : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
SHMServerDisappeared(){}
|
|
|
|
|
|
|
|
virtual ~SHMServerDisappeared() throw(){};
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "The server process has disappeared";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class DFHACK_EXPORT SHMLockingError : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
SHMLockingError(const char* _type) : type(_type)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "SHM locking error: " << type;
|
|
|
|
|
|
|
|
full = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~SHMLockingError() throw(){};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string type;
|
|
|
|
|
|
|
|
std::string full;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return full.c_str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class DFHACK_EXPORT MemoryAccessDenied : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
std::string descr;
|
|
|
|
|
|
|
|
MemoryAccessDenied(uint64_t address)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream s;
|
|
|
|
|
|
|
|
s << "Invalid memory access @0x" << std::hex << address;
|
|
|
|
|
|
|
|
descr = s.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~MemoryAccessDenied() throw(){};
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return descr.c_str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class DFHACK_EXPORT SHMVersionMismatch : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
SHMVersionMismatch() {}
|
|
|
|
|
|
|
|
virtual ~SHMVersionMismatch() throw(){};
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "SHM VERSION MISMATCH";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class DFHACK_EXPORT SHMAttachFailure : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
SHMAttachFailure() {}
|
|
|
|
|
|
|
|
virtual ~SHMAttachFailure() throw(){};
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "SHM ATTACH FAILURE";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class DFHACK_EXPORT ModuleNotInitialized : public All
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ModuleNotInitialized() {}
|
|
|
|
|
|
|
|
virtual ~ModuleNotInitialized() throw(){};
|
|
|
|
|
|
|
|
virtual const char* what() const throw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "Programmer error: module not initialized!";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ERROR_H_INCLUDED
|
|
|
|
|
|
|
|