SCI: Rename some variables to match our naming conventions

svn-id: r50549
This commit is contained in:
Max Horn 2010-07-01 16:04:29 +00:00
parent e309f05162
commit 3f429d64a2
5 changed files with 61 additions and 61 deletions

View file

@ -609,13 +609,13 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) {
if (argv[1].segment == s->_segMan->getSysStringsSegment()) {
// Resize if necessary
const uint16 sysStringId = argv[1].toUint16();
if ((uint32)s->_segMan->sysStrings->_strings[sysStringId]._maxSize < index1 + count) {
free(s->_segMan->sysStrings->_strings[sysStringId]._value);
s->_segMan->sysStrings->_strings[sysStringId]._maxSize = index1 + count;
s->_segMan->sysStrings->_strings[sysStringId]._value = (char *)calloc(index1 + count, sizeof(char));
if ((uint32)s->_segMan->_sysStrings->_strings[sysStringId]._maxSize < index1 + count) {
free(s->_segMan->_sysStrings->_strings[sysStringId]._value);
s->_segMan->_sysStrings->_strings[sysStringId]._maxSize = index1 + count;
s->_segMan->_sysStrings->_strings[sysStringId]._value = (char *)calloc(index1 + count, sizeof(char));
}
strncpy(s->_segMan->sysStrings->_strings[sysStringId]._value + index1, string2 + index2, count);
strncpy(s->_segMan->_sysStrings->_strings[sysStringId]._value + index1, string2 + index2, count);
} else {
SciString *string1 = s->_segMan->lookupString(argv[1]);

View file

@ -179,7 +179,7 @@ reg_t kEmptyList(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, ((list) ? list->first.isNull() : 0));
}
static void _k_add_to_front(EngineState *s, reg_t listRef, reg_t nodeRef) {
static void addToFront(EngineState *s, reg_t listRef, reg_t nodeRef) {
List *list = s->_segMan->lookupList(listRef);
Node *newNode = s->_segMan->lookupNode(nodeRef);
@ -202,7 +202,7 @@ static void _k_add_to_front(EngineState *s, reg_t listRef, reg_t nodeRef) {
list->first = nodeRef;
}
static void _k_add_to_end(EngineState *s, reg_t listRef, reg_t nodeRef) {
static void addToEnd(EngineState *s, reg_t listRef, reg_t nodeRef) {
List *list = s->_segMan->lookupList(listRef);
Node *newNode = s->_segMan->lookupNode(nodeRef);
@ -250,7 +250,7 @@ reg_t kNodeValue(EngineState *s, int argc, reg_t *argv) {
}
reg_t kAddToFront(EngineState *s, int argc, reg_t *argv) {
_k_add_to_front(s, argv[0], argv[1]);
addToFront(s, argv[0], argv[1]);
return s->r_acc;
}
@ -288,14 +288,14 @@ reg_t kAddAfter(EngineState *s, int argc, reg_t *argv) {
s->_segMan->lookupNode(oldnext)->pred = argv[2];
} else { // !firstnode
_k_add_to_front(s, argv[0], argv[2]); // Set as initial list node
addToFront(s, argv[0], argv[2]); // Set as initial list node
}
return s->r_acc;
}
reg_t kAddToEnd(EngineState *s, int argc, reg_t *argv) {
_k_add_to_end(s, argv[0], argv[1]);
addToEnd(s, argv[0], argv[1]);
return s->r_acc;
}
@ -417,7 +417,7 @@ reg_t kSort(EngineState *s, int argc, reg_t *argv) {
for (i = 0;i < input_size;i++) {
reg_t lNode = s->_segMan->newNode(temp_array[i].value, temp_array[i].key);
_k_add_to_end(s, output_data, lNode);
addToEnd(s, output_data, lNode);
}
free(temp_array);

View file

@ -245,9 +245,9 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
}
}
s.syncAsSint32LE(Clones_seg_id);
s.syncAsSint32LE(Lists_seg_id);
s.syncAsSint32LE(Nodes_seg_id);
s.syncAsSint32LE(_clonesSegId);
s.syncAsSint32LE(_listsSegId);
s.syncAsSint32LE(_nodesSegId);
}

View file

@ -40,14 +40,14 @@ enum {
SegManager::SegManager(ResourceManager *resMan) {
_heap.push_back(0);
Clones_seg_id = 0;
Lists_seg_id = 0;
Nodes_seg_id = 0;
Hunks_seg_id = 0;
_clonesSegId = 0;
_listsSegId = 0;
_nodesSegId = 0;
_hunksSegId = 0;
#ifdef ENABLE_SCI32
Arrays_seg_id = 0;
String_seg_id = 0;
_arraysSegId = 0;
_stringSegId = 0;
#endif
_resMan = resMan;
@ -71,10 +71,10 @@ void SegManager::resetSegMan() {
// And reinitialize
_heap.push_back(0);
Clones_seg_id = 0;
Lists_seg_id = 0;
Nodes_seg_id = 0;
Hunks_seg_id = 0;
_clonesSegId = 0;
_listsSegId = 0;
_nodesSegId = 0;
_hunksSegId = 0;
// Reinitialize class table
_classTable.clear();
@ -82,10 +82,10 @@ void SegManager::resetSegMan() {
}
void SegManager::initSysStrings() {
sysStrings = (SystemStrings *)allocSegment(new SystemStrings(), &sysStringsSegment);
_sysStrings = (SystemStrings *)allocSegment(new SystemStrings(), &_sysStringsSegId);
// Allocate static buffer for savegame and CWD directories
SystemString *strSaveDir = &sysStrings->_strings[SYS_STRING_SAVEDIR];
SystemString *strSaveDir = &_sysStrings->_strings[SYS_STRING_SAVEDIR];
strSaveDir->_name = "savedir";
strSaveDir->_maxSize = MAX_SAVE_DIR_SIZE;
strSaveDir->_value = (char *)calloc(MAX_SAVE_DIR_SIZE, sizeof(char));
@ -94,7 +94,7 @@ void SegManager::initSysStrings() {
::strcpy(strSaveDir->_value, "");
// Allocate static buffer for the parser base
SystemString *strParserBase = &sysStrings->_strings[SYS_STRING_PARSER_BASE];
SystemString *strParserBase = &_sysStrings->_strings[SYS_STRING_PARSER_BASE];
strParserBase->_name = "parser-base";
strParserBase->_maxSize = MAX_PARSER_BASE;
strParserBase->_value = (char *)calloc(MAX_PARSER_BASE, sizeof(char));
@ -412,13 +412,13 @@ reg_t SegManager::allocateHunkEntry(const char *hunk_type, int size) {
HunkTable *table;
int offset;
if (!Hunks_seg_id)
allocSegment(new HunkTable(), &(Hunks_seg_id));
table = (HunkTable *)_heap[Hunks_seg_id];
if (!_hunksSegId)
allocSegment(new HunkTable(), &(_hunksSegId));
table = (HunkTable *)_heap[_hunksSegId];
offset = table->allocEntry();
reg_t addr = make_reg(Hunks_seg_id, offset);
reg_t addr = make_reg(_hunksSegId, offset);
Hunk *h = &(table->_table[offset]);
if (!h)
@ -446,14 +446,14 @@ Clone *SegManager::allocateClone(reg_t *addr) {
CloneTable *table;
int offset;
if (!Clones_seg_id)
table = (CloneTable *)allocSegment(new CloneTable(), &(Clones_seg_id));
if (!_clonesSegId)
table = (CloneTable *)allocSegment(new CloneTable(), &(_clonesSegId));
else
table = (CloneTable *)_heap[Clones_seg_id];
table = (CloneTable *)_heap[_clonesSegId];
offset = table->allocEntry();
*addr = make_reg(Clones_seg_id, offset);
*addr = make_reg(_clonesSegId, offset);
return &(table->_table[offset]);
}
@ -461,13 +461,13 @@ List *SegManager::allocateList(reg_t *addr) {
ListTable *table;
int offset;
if (!Lists_seg_id)
allocSegment(new ListTable(), &(Lists_seg_id));
table = (ListTable *)_heap[Lists_seg_id];
if (!_listsSegId)
allocSegment(new ListTable(), &(_listsSegId));
table = (ListTable *)_heap[_listsSegId];
offset = table->allocEntry();
*addr = make_reg(Lists_seg_id, offset);
*addr = make_reg(_listsSegId, offset);
return &(table->_table[offset]);
}
@ -475,13 +475,13 @@ Node *SegManager::allocateNode(reg_t *addr) {
NodeTable *table;
int offset;
if (!Nodes_seg_id)
allocSegment(new NodeTable(), &(Nodes_seg_id));
table = (NodeTable *)_heap[Nodes_seg_id];
if (!_nodesSegId)
allocSegment(new NodeTable(), &(_nodesSegId));
table = (NodeTable *)_heap[_nodesSegId];
offset = table->allocEntry();
*addr = make_reg(Nodes_seg_id, offset);
*addr = make_reg(_nodesSegId, offset);
return &(table->_table[offset]);
}
@ -851,14 +851,14 @@ SciArray<reg_t> *SegManager::allocateArray(reg_t *addr) {
ArrayTable *table;
int offset;
if (!Arrays_seg_id) {
table = (ArrayTable *)allocSegment(new ArrayTable(), &(Arrays_seg_id));
if (!_arraysSegId) {
table = (ArrayTable *)allocSegment(new ArrayTable(), &(_arraysSegId));
} else
table = (ArrayTable *)_heap[Arrays_seg_id];
table = (ArrayTable *)_heap[_arraysSegId];
offset = table->allocEntry();
*addr = make_reg(Arrays_seg_id, offset);
*addr = make_reg(_arraysSegId, offset);
return &(table->_table[offset]);
}
@ -891,14 +891,14 @@ SciString *SegManager::allocateString(reg_t *addr) {
StringTable *table;
int offset;
if (!String_seg_id) {
table = (StringTable *)allocSegment(new StringTable(), &(String_seg_id));
if (!_stringSegId) {
table = (StringTable *)allocSegment(new StringTable(), &(_stringSegId));
} else
table = (StringTable *)_heap[String_seg_id];
table = (StringTable *)_heap[_stringSegId];
offset = table->allocEntry();
*addr = make_reg(String_seg_id, offset);
*addr = make_reg(_stringSegId, offset);
return &(table->_table[offset]);
}

View file

@ -446,7 +446,7 @@ public:
/**
* Obtains the system strings segment ID
*/
SegmentId getSysStringsSegment() { return sysStringsSegment; }
SegmentId getSysStringsSegment() { return _sysStringsSegId; }
public: // TODO: make private
Common::Array<SegmentObj *> _heap;
@ -460,7 +460,7 @@ public: // TODO: make private
SciString *allocateString(reg_t *addr);
SciString *lookupString(reg_t addr);
void freeString(reg_t addr);
SegmentId getStringSegmentId() { return String_seg_id; }
SegmentId getStringSegmentId() { return _stringSegId; }
#endif
private:
@ -469,21 +469,21 @@ private:
ResourceManager *_resMan;
SegmentId Clones_seg_id; ///< ID of the (a) clones segment
SegmentId Lists_seg_id; ///< ID of the (a) list segment
SegmentId Nodes_seg_id; ///< ID of the (a) node segment
SegmentId Hunks_seg_id; ///< ID of the (a) hunk segment
SegmentId _clonesSegId; ///< ID of the (a) clones segment
SegmentId _listsSegId; ///< ID of the (a) list segment
SegmentId _nodesSegId; ///< ID of the (a) node segment
SegmentId _hunksSegId; ///< ID of the (a) hunk segment
/* System strings */
SegmentId sysStringsSegment;
SegmentId _sysStringsSegId;
public: // TODO: make private. Only kString() needs direct access
SystemStrings *sysStrings;
SystemStrings *_sysStrings;
private:
#ifdef ENABLE_SCI32
SegmentId Arrays_seg_id;
SegmentId String_seg_id;
SegmentId _arraysSegId;
SegmentId _stringSegId;
#endif
private: