mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-09 03:58:14 +03:00
Added GetSourceAt() with code pos
This commit is contained in:
parent
dc028b87e4
commit
bb97ec8933
2 changed files with 13 additions and 1 deletions
|
@ -84,6 +84,17 @@ bool AbstractScript::GetSourceAt(size_t sourcePos, str *sourceLine, int& column,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AbstractScript::GetSourceAt(const unsigned char *sourcePos, str *sourceLine, int& column, int& line)
|
||||
{
|
||||
const sourceinfo_t *codePos = m_ProgToSource->findKeyValue(sourcePos);
|
||||
|
||||
if (!codePos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return GetSourceAt(codePos->sourcePos, sourceLine, column, line);
|
||||
}
|
||||
|
||||
void AbstractScript::PrintSourcePos(sourceinfo_t *sourcePos, bool dev)
|
||||
{
|
||||
int line;
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
size_t m_SourceLength;
|
||||
|
||||
// Developper variable
|
||||
con_set<uchar *, sourceinfo_t> *m_ProgToSource;
|
||||
con_set<const uchar *, sourceinfo_t> *m_ProgToSource;
|
||||
|
||||
public:
|
||||
AbstractScript();
|
||||
|
@ -62,6 +62,7 @@ public:
|
|||
str & Filename(void);
|
||||
const_str ConstFilename(void);
|
||||
bool GetSourceAt(size_t sourcePos, str *sourceLine, int &column, int &line);
|
||||
bool GetSourceAt(const unsigned char *sourcePos, str *sourceLine, int &column, int &line);
|
||||
void PrintSourcePos(sourceinfo_t *sourcePos, bool dev);
|
||||
void PrintSourcePos(size_t sourcePos, bool dev);
|
||||
void PrintSourcePos(unsigned char *m_pCodePos, bool dev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue