diff options
author | Filippos Karapetis | 2010-06-25 19:09:19 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-25 19:09:19 +0000 |
commit | 4785e1fd3ffe2dbe862e9aafcf18eb2a10602bc4 (patch) | |
tree | 78493f7ba1b1037209dd9d5eddc2a5c8a8df85ab | |
parent | 6561b93f1e15e4b78bbf62044ea145e866978eeb (diff) | |
download | scummvm-rg350-4785e1fd3ffe2dbe862e9aafcf18eb2a10602bc4.tar.gz scummvm-rg350-4785e1fd3ffe2dbe862e9aafcf18eb2a10602bc4.tar.bz2 scummvm-rg350-4785e1fd3ffe2dbe862e9aafcf18eb2a10602bc4.zip |
Renamed some variables
svn-id: r50284
-rw-r--r-- | engines/sci/console.cpp | 14 | ||||
-rw-r--r-- | engines/sci/console.h | 2 | ||||
-rw-r--r-- | engines/sci/engine/klists.cpp | 122 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 6 |
4 files changed, 72 insertions, 72 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index e8cbb6cf0e..e50ae171c1 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2173,12 +2173,12 @@ bool Console::cmdViewReference(int argc, const char **argv) { case 0: break; case KSIG_LIST: { - List *l = _engine->_gamestate->_segMan->lookupList(reg); + List *list = _engine->_gamestate->_segMan->lookupList(reg); DebugPrintf("list\n"); - if (l) - printList(l); + if (list) + printList(list); else DebugPrintf("Invalid list.\n"); } @@ -3173,8 +3173,8 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV return 0; } -void Console::printList(List *l) { - reg_t pos = l->first; +void Console::printList(List *list) { + reg_t pos = list->first; reg_t my_prev = NULL_REG; DebugPrintf("\t<\n"); @@ -3201,9 +3201,9 @@ void Console::printList(List *l) { pos = node->succ; } - if (my_prev != l->last) + if (my_prev != list->last) DebugPrintf(" WARNING: Last node was expected to be %04x:%04x, was %04x:%04x!\n", - PRINT_REG(l->last), PRINT_REG(my_prev)); + PRINT_REG(list->last), PRINT_REG(my_prev)); DebugPrintf("\t>\n"); } diff --git a/engines/sci/console.h b/engines/sci/console.h index 5f3b0e3951..e353958a0d 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -147,7 +147,7 @@ private: bool cmdViewAccumulatorObject(int argc, const char **argv); bool segmentInfo(int nr); - void printList(List *l); + void printList(List *list); int printNode(reg_t addr); private: diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index 1fd34849ea..eb5334c3b9 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -58,20 +58,20 @@ static bool isSaneNodePointer(SegManager *segMan, reg_t addr) { } static void checkListPointer(SegManager *segMan, reg_t addr) { - List *l = segMan->lookupList(addr); + List *list = segMan->lookupList(addr); - if (!l) { + if (!list) { warning("isSaneListPointer (list %04x:%04x): The requested list wasn't found", PRINT_REG(addr)); return; } - if (l->first.isNull() && l->last.isNull()) { + if (list->first.isNull() && list->last.isNull()) { // Empty list is fine - } else if (!l->first.isNull() && !l->last.isNull()) { + } else if (!list->first.isNull() && !list->last.isNull()) { // Normal list - Node *node_a = segMan->lookupNode(l->first); - Node *node_z = segMan->lookupNode(l->last); + Node *node_a = segMan->lookupNode(list->first); + Node *node_z = segMan->lookupNode(list->last); if (!node_a) { warning("isSaneListPointer (list %04x:%04x): missing first node", PRINT_REG(addr)); @@ -101,25 +101,25 @@ static void checkListPointer(SegManager *segMan, reg_t addr) { return; } - isSaneNodePointer(segMan, l->first); + isSaneNodePointer(segMan, list->first); } else { // Not sane list... it's missing pointers to the first or last element - if (l->first.isNull()) + if (list->first.isNull()) warning("isSaneListPointer (list %04x:%04x): missing pointer to first element", PRINT_REG(addr)); - if (l->last.isNull()) + if (list->last.isNull()) warning("isSaneListPointer (list %04x:%04x): missing pointer to last element", PRINT_REG(addr)); } } reg_t kNewList(EngineState *s, int argc, reg_t *argv) { - reg_t listbase; - List *l = s->_segMan->allocateList(&listbase); - l->first = l->last = NULL_REG; - debugC(2, kDebugLevelNodes, "New listbase at %04x:%04x", PRINT_REG(listbase)); + reg_t listRef; + List *list = s->_segMan->allocateList(&listRef); + list->first = list->last = NULL_REG; + debugC(2, kDebugLevelNodes, "New listRef at %04x:%04x", PRINT_REG(listRef)); - return listbase; // Return list base address + return listRef; // Return list base address } reg_t kDisposeList(EngineState *s, int argc, reg_t *argv) { @@ -136,7 +136,7 @@ reg_t kNewNode(EngineState *s, int argc, reg_t *argv) { reg_t nodeKey = (argc == 2) ? argv[1] : argv[0]; s->r_acc = s->_segMan->newNode(nodeValue, nodeKey); - debugC(2, kDebugLevelNodes, "New nodebase at %04x:%04x", PRINT_REG(s->r_acc)); + debugC(2, kDebugLevelNodes, "New nodeRef at %04x:%04x", PRINT_REG(s->r_acc)); return s->r_acc; } @@ -145,11 +145,11 @@ reg_t kFirstNode(EngineState *s, int argc, reg_t *argv) { if (argv[0].isNull()) return NULL_REG; - List *l = s->_segMan->lookupList(argv[0]); + List *list = s->_segMan->lookupList(argv[0]); - if (l) { + if (list) { checkListPointer(s->_segMan, argv[0]); - return l->first; + return list->first; } else { return NULL_REG; } @@ -159,11 +159,11 @@ reg_t kLastNode(EngineState *s, int argc, reg_t *argv) { if (argv[0].isNull()) return NULL_REG; - List *l = s->_segMan->lookupList(argv[0]); + List *list = s->_segMan->lookupList(argv[0]); - if (l) { + if (list) { checkListPointer(s->_segMan, argv[0]); - return l->last; + return list->last; } else { return NULL_REG; } @@ -173,54 +173,56 @@ reg_t kEmptyList(EngineState *s, int argc, reg_t *argv) { if (argv[0].isNull()) return NULL_REG; - List *l = s->_segMan->lookupList(argv[0]); + List *list = s->_segMan->lookupList(argv[0]); checkListPointer(s->_segMan, argv[0]); - return make_reg(0, ((l) ? l->first.isNull() : 0)); + return make_reg(0, ((list) ? list->first.isNull() : 0)); } -static void _k_add_to_front(EngineState *s, reg_t listbase, reg_t nodebase) { - List *l = s->_segMan->lookupList(listbase); - Node *new_n = s->_segMan->lookupNode(nodebase); +static void _k_add_to_front(EngineState *s, reg_t listRef, reg_t nodeRef) { + List *list = s->_segMan->lookupList(listRef); + Node *newNode = s->_segMan->lookupNode(nodeRef); + + debugC(2, kDebugLevelNodes, "Adding node %04x:%04x to end of list %04x:%04x", PRINT_REG(nodeRef), PRINT_REG(listRef)); - debugC(2, kDebugLevelNodes, "Adding node %04x:%04x to end of list %04x:%04x", PRINT_REG(nodebase), PRINT_REG(listbase)); + if (!newNode) + error("Attempt to add non-node (%04x:%04x) to list at %04x:%04x", PRINT_REG(nodeRef), PRINT_REG(listRef)); + checkListPointer(s->_segMan, listRef); - if (!new_n) - error("Attempt to add non-node (%04x:%04x) to list at %04x:%04x", PRINT_REG(nodebase), PRINT_REG(listbase)); - checkListPointer(s->_segMan, listbase); + newNode->pred = NULL_REG; + newNode->succ = list->first; - new_n->succ = l->first; - new_n->pred = NULL_REG; // Set node to be the first and last node if it's the only node of the list - if (l->first.isNull()) - l->last = nodebase; + if (list->first.isNull()) + list->last = nodeRef; else { - Node *old_n = s->_segMan->lookupNode(l->first); - old_n->pred = nodebase; + Node *oldNode = s->_segMan->lookupNode(list->first); + oldNode->pred = nodeRef; } - l->first = nodebase; + list->first = nodeRef; } -static void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) { - List *l = s->_segMan->lookupList(listbase); - Node *new_n = s->_segMan->lookupNode(nodebase); +static void _k_add_to_end(EngineState *s, reg_t listRef, reg_t nodeRef) { + List *list = s->_segMan->lookupList(listRef); + Node *newNode = s->_segMan->lookupNode(nodeRef); - debugC(2, kDebugLevelNodes, "Adding node %04x:%04x to end of list %04x:%04x", PRINT_REG(nodebase), PRINT_REG(listbase)); + debugC(2, kDebugLevelNodes, "Adding node %04x:%04x to end of list %04x:%04x", PRINT_REG(nodeRef), PRINT_REG(listRef)); - if (!new_n) - error("Attempt to add non-node (%04x:%04x) to list at %04x:%04x", PRINT_REG(nodebase), PRINT_REG(listbase)); - checkListPointer(s->_segMan, listbase); + if (!newNode) + error("Attempt to add non-node (%04x:%04x) to list at %04x:%04x", PRINT_REG(nodeRef), PRINT_REG(listRef)); + checkListPointer(s->_segMan, listRef); + + newNode->pred = list->last; + newNode->succ = NULL_REG; - new_n->succ = NULL_REG; - new_n->pred = l->last; // Set node to be the first and last node if it's the only node of the list - if (l->last.isNull()) - l->first = nodebase; + if (list->last.isNull()) + list->first = nodeRef; else { - Node *old_n = s->_segMan->lookupNode(l->last); - old_n->succ = nodebase; + Node *old_n = s->_segMan->lookupNode(list->last); + old_n->succ = nodeRef; } - l->last = nodebase; + list->last = nodeRef; } reg_t kNextNode(EngineState *s, int argc, reg_t *argv) { @@ -253,7 +255,7 @@ reg_t kAddToFront(EngineState *s, int argc, reg_t *argv) { } reg_t kAddAfter(EngineState *s, int argc, reg_t *argv) { - List *l = s->_segMan->lookupList(argv[0]); + List *list = s->_segMan->lookupList(argv[0]); Node *firstnode = argv[1].isNull() ? NULL : s->_segMan->lookupNode(argv[1]); Node *newnode = s->_segMan->lookupNode(argv[2]); @@ -281,7 +283,7 @@ reg_t kAddAfter(EngineState *s, int argc, reg_t *argv) { if (oldnext.isNull()) // Appended after last node? // Set new node as last list node - l->last = argv[2]; + list->last = argv[2]; else s->_segMan->lookupNode(oldnext)->pred = argv[2]; @@ -328,16 +330,16 @@ reg_t kFindKey(EngineState *s, int argc, reg_t *argv) { reg_t kDeleteKey(EngineState *s, int argc, reg_t *argv) { reg_t node_pos = kFindKey(s, 2, argv); Node *n; - List *l = s->_segMan->lookupList(argv[0]); + List *list = s->_segMan->lookupList(argv[0]); if (node_pos.isNull()) return NULL_REG; // Signal failure n = s->_segMan->lookupNode(node_pos); - if (l->first == node_pos) - l->first = n->succ; - if (l->last == node_pos) - l->last = n->pred; + if (list->first == node_pos) + list->first = n->succ; + if (list->last == node_pos) + list->last = n->pred; if (!n->pred.isNull()) s->_segMan->lookupNode(n->pred)->succ = n->succ; @@ -374,8 +376,6 @@ reg_t kSort(EngineState *s, int argc, reg_t *argv) { reg_t order_func = argv[2]; int input_size = (int16)readSelectorValue(segMan, source, SELECTOR(size)); - int i; - reg_t input_data = readSelector(segMan, source, SELECTOR(elements)); reg_t output_data = readSelector(segMan, dest, SELECTOR(elements)); @@ -398,7 +398,7 @@ reg_t kSort(EngineState *s, int argc, reg_t *argv) { sort_temp_t *temp_array = (sort_temp_t *)malloc(sizeof(sort_temp_t) * input_size); - i = 0; + int i = 0; while (node) { reg_t params[1] = { node->value }; invokeSelector(s, order_func, SELECTOR(doit), argc, argv, 1, params); diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index 3740e53339..9394e717ec 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -505,13 +505,13 @@ Node *SegManager::allocateNode(reg_t *addr) { } reg_t SegManager::newNode(reg_t value, reg_t key) { - reg_t nodebase; - Node *n = allocateNode(&nodebase); + reg_t nodeRef; + Node *n = allocateNode(&nodeRef); n->pred = n->succ = NULL_REG; n->key = key; n->value = value; - return nodebase; + return nodeRef; } List *SegManager::lookupList(reg_t addr) { |