DECOMPILER: Add 'pos' parameter to processSpecialMetadata

svn-id: r52036
This commit is contained in:
Max Horn committed 2010-08-12 12:46:57 +00:00
1 parent 2460cad3ef
commit cfe883f0b6
6 files changed
+12 -11

No files matched your search

+2 -2
View File
@@ -355,7 +355,7 @@ void CodeGenerator::process(GraphVertex v) {
bool returnsValue = (it->_codeGenData.find("r") == 0);
std::string metadata = (!returnsValue ? it->_codeGenData : it->_codeGenData.substr(1));
for (size_t i = 0; i < metadata.length(); i++)
processSpecialMetadata(*it, metadata[i]);
processSpecialMetadata(*it, metadata[i], i);
_stack.push(new CallEntry(it->_name, _argList));
if (!returnsValue) {
std::stringstream stream;
@@ -386,7 +386,7 @@ void CodeGenerator::addArg(EntryPtr p) {
_argList.push_back(p);
}
void CodeGenerator::processSpecialMetadata(const Instruction inst, char c) {
void CodeGenerator::processSpecialMetadata(const Instruction &inst, char c, int pos) {
switch (c) {
case 'p':
addArg(_stack.pop());
+2 -1
View File
@@ -414,8 +414,9 @@ protected:
*
* @param inst The instruction being processed.
* @param c The character signifying the action to be taken.
* @param pos The position at which c occurred in the metadata.
*/
virtual void processSpecialMetadata(const Instruction inst, char c);
virtual void processSpecialMetadata(const Instruction &inst, char c, int pos);
/**
* Add an argument to the argument list.
+4 -4
View File
@@ -141,7 +141,7 @@ void Kyra::Kyra2CodeGenerator::processInst(const Instruction inst) {
_argList.clear();
Function f = _engine->_functions.find(inst._params[0].getUnsigned())->second;
for (size_t i = 0; i < f._metadata.length(); i++)
processSpecialMetadata(inst, f._metadata[i]);
processSpecialMetadata(inst, f._metadata[i], i);
_stack.push(new CallEntry(f._name, _argList));
// Leave call on stack if this is a condition, or other calls follow in same group
if (_curGroup->_type == kIfCond || _curGroup->_type == kWhileCond || _curGroup->_type == kDoWhileCond || inst._address != findLastCall()._address) {
@@ -164,7 +164,7 @@ void Kyra::Kyra2CodeGenerator::processInst(const Instruction inst) {
bool returnsValue = (inst._codeGenData.find("r") == 1);
std::string metadata = (!returnsValue ? inst._codeGenData.substr(1) : inst._codeGenData.substr(2));
for (size_t i = 0; i < metadata.length(); i++)
processSpecialMetadata(inst, metadata[i]);
processSpecialMetadata(inst, metadata[i], i);
_stack.push(new CallEntry(inst._name, _argList));
// Leave call on stack if this is a condition, or other calls follow in same group
if (_curGroup->_type == kIfCond || _curGroup->_type == kWhileCond || _curGroup->_type == kDoWhileCond || inst._address != findLastCall()._address) {
@@ -209,7 +209,7 @@ const Instruction &Kyra::Kyra2CodeGenerator::findLastCall() {
return *_curGroup->_end;
}
void Kyra::Kyra2CodeGenerator::processSpecialMetadata(const Instruction inst, char c) {
void Kyra::Kyra2CodeGenerator::processSpecialMetadata(const Instruction &inst, char c, int pos) {
switch (c) {
case '0':
_stackOffset = 0;
@@ -231,7 +231,7 @@ void Kyra::Kyra2CodeGenerator::processSpecialMetadata(const Instruction inst, ch
}
break;
default:
CodeGenerator::processSpecialMetadata(inst, c);
CodeGenerator::processSpecialMetadata(inst, c, pos);
break;
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ public:
Kyra2CodeGenerator(Engine *engine, std::ostream &output) : CodeGenerator(engine, output, kLIFO, kLIFO) {}
protected:
void processInst(const Instruction inst);
virtual void processSpecialMetadata(const Instruction inst, char c);
virtual void processSpecialMetadata(const Instruction &inst, char c, int pos);
std::string constructFuncSignature(const Function &func);
};
+2 -2
View File
@@ -423,7 +423,7 @@ std::string Scumm::v6::Scummv6CodeGenerator::decodeArrayName(uint16 arrID) {
return s.str();
}
void Scumm::v6::Scummv6CodeGenerator::processSpecialMetadata(const Instruction inst, char c) {
void Scumm::v6::Scummv6CodeGenerator::processSpecialMetadata(const Instruction &inst, char c, int pos) {
switch (c) {
// All of these meanings are taken from descumm.
case 'l':
@@ -458,7 +458,7 @@ void Scumm::v6::Scummv6CodeGenerator::processSpecialMetadata(const Instruction i
addArg(_stack.pop());
break;
default:
CodeGenerator::processSpecialMetadata(inst, c);
CodeGenerator::processSpecialMetadata(inst, c, pos);
break;
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ public:
Scummv6CodeGenerator(Engine *engine, std::ostream &output) : CodeGenerator(engine, output, kFIFO, kFIFO) {}
protected:
void processInst(const Instruction inst);
virtual void processSpecialMetadata(const Instruction inst, char c);
virtual void processSpecialMetadata(const Instruction &inst, char c, int pos);
};
} // End of namespace v6