[Scummvm-cvs-logs] SF.net SVN: scummvm:[40676] scummvm/trunk/engines/sci/engine

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon May 18 10:28:04 CEST 2009


Revision: 40676
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40676&view=rev
Author:   thebluegr
Date:     2009-05-18 08:28:04 +0000 (Mon, 18 May 2009)

Log Message:
-----------
Removed the unused file and line parameters from the list and list node lookup functions, and removed the LOOKUP_LIST and LOOKUP_NODE defines. Also, disabled the unused LOOKUP_SPECIES define

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/klists.cpp
    scummvm/trunk/engines/sci/engine/kpathing.cpp
    scummvm/trunk/engines/sci/engine/kstring.cpp
    scummvm/trunk/engines/sci/engine/scriptdebug.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2009-05-18 07:55:13 UTC (rev 40675)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2009-05-18 08:28:04 UTC (rev 40676)
@@ -236,25 +236,18 @@
 
 void process_sound_events(EngineState *s); /* Get all sound events, apply their changes to the heap */
 
-#define LOOKUP_NODE(addr) lookup_node(s, (addr), __FILE__, __LINE__)
-#define LOOKUP_LIST(addr) lookup_list(s, addr, __FILE__, __LINE__)
-
-Node *lookup_node(EngineState *s, reg_t addr, const char *file, int line);
+Node *lookup_node(EngineState *s, reg_t addr);
 /* Resolves an address into a list node
 ** Parameters: (EngineState *) s: The state to operate on
 **             (reg_t) addr: The address to resolve
-**             (const char *) file: The file the function was called from
-**             (int) line: The line number the function was called from
 ** Returns   : (Node *) The list node referenced, or NULL on error
 */
 
 
-List *lookup_list(EngineState *s, reg_t addr, const char *file, int line);
+List *lookup_list(EngineState *s, reg_t addr);
 /* Resolves a list pointer to a list
 ** Parameters: (EngineState *) s: The state to operate on
 **             (reg_t) addr: The address to resolve
-**             (const char *) file: The file the function was called from
-**             (int) line: The line number the function was called from
 ** Returns   : (List *) The list referenced, or NULL on error
 */
 

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-05-18 07:55:13 UTC (rev 40675)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-05-18 08:28:04 UTC (rev 40676)
@@ -817,10 +817,10 @@
 	}
 
 	if (cliplist_ref.segment)
-		cliplist = LOOKUP_LIST(cliplist_ref);
+		cliplist = lookup_list(s, cliplist_ref);
 
 	if (cliplist) {
-		Node *node = LOOKUP_NODE(cliplist->first);
+		Node *node = lookup_node(s, cliplist->first);
 
 		retval = 0; // Assume that we Can'tBeHere...
 
@@ -838,7 +838,7 @@
 				}
 
 			} // if (other_obj != obj)
-			node = LOOKUP_NODE(node->succ); // move on
+			node = lookup_node(s, node->succ); // move on
 		}
 	}
 
@@ -1983,7 +1983,7 @@
 		BREAKPOINT();
 	}
 
-	node = LOOKUP_NODE(list->first);
+	node = lookup_node(s, list->first);
 	while (node) {
 		reg_t obj = node->value; // The object we're using
 		reg_t next_node;
@@ -2008,7 +2008,7 @@
 		if (tempWidget)
 			GFX_ASSERT((*widget_list)->add(GFXWC(*widget_list), tempWidget));
 
-		node = LOOKUP_NODE(next_node); // Next node
+		node = lookup_node(s, next_node); // Next node
 	}
 
 	widget = (GfxDynView *)(*widget_list)->_contents;
@@ -2312,7 +2312,7 @@
 			return s->r_acc;
 		}
 
-		list = LOOKUP_LIST(list_ref);
+		list = lookup_list(s, list_ref);
 
 		pic_views = gfxw_new_list(s->picture_port->_bounds, 1);
 
@@ -2976,7 +2976,7 @@
 						// after all, damage the cast list
 
 	if (cast_list_ref.segment) {
-		cast_list = LOOKUP_LIST(cast_list_ref);
+		cast_list = lookup_list(s, cast_list_ref);
 		if (!cast_list)
 			return s->r_acc;
 	}

Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp	2009-05-18 07:55:13 UTC (rev 40675)
+++ scummvm/trunk/engines/sci/engine/klists.cpp	2009-05-18 08:28:04 UTC (rev 40676)
@@ -28,7 +28,7 @@
 
 namespace Sci {
 
-Node *lookup_node(EngineState *s, reg_t addr, const char *file, int line) {
+Node *lookup_node(EngineState *s, reg_t addr) {
 	if (!addr.offset && !addr.segment)
 		return NULL; // Non-error null
 
@@ -53,7 +53,7 @@
 	return &(nt->_table[addr.offset]);
 }
 
-List *lookup_list(EngineState *s, reg_t addr, const char *file, int line) {
+List *lookup_list(EngineState *s, reg_t addr) {
 	MemObject *mobj = GET_SEGMENT(*s->seg_manager, addr.segment, MEM_OBJ_LISTS);
 
 	if (!mobj) {
@@ -85,7 +85,7 @@
 	reg_t prev = addr;
 
 	do {
-		Node *node = LOOKUP_NODE(addr);
+		Node *node = lookup_node(s, addr);
 
 		if (!node)
 			return 0;
@@ -102,7 +102,7 @@
 }
 
 int sane_listp(EngineState *s, reg_t addr) {
-	List *l = LOOKUP_LIST(addr);
+	List *l = lookup_list(s, addr);
 	int empties = 0;
 
 	if (IS_NULL_REG(l->first))
@@ -117,8 +117,8 @@
 	if (!empties) {
 		Node *node_a, *node_z;
 
-		node_a = LOOKUP_NODE(l->first);
-		node_z = LOOKUP_NODE(l->last);
+		node_a = lookup_node(s, l->first);
+		node_z = lookup_node(s, l->last);
 
 		if (!node_a || !node_z)
 			return 0;
@@ -147,7 +147,7 @@
 }
 
 reg_t kDisposeList(EngineState *s, int funct_nr, int argc, reg_t *argv) {
-	List *l = LOOKUP_LIST(argv[0]);
+	List *l = lookup_list(s, argv[0]);
 
 	if (!l) {
 		// FIXME: This should be an error, but it's turned to a warning for now
@@ -162,7 +162,7 @@
 		reg_t n_addr = l->first;
 
 		while (!IS_NULL_REG(n_addr)) { // Free all nodes
-			Node *n = LOOKUP_NODE(n_addr);
+			Node *n = lookup_node(s, n_addr);
 			s->seg_manager->free_Node(n_addr);
 			n_addr = n->succ;
 		}
@@ -200,7 +200,7 @@
 reg_t kFirstNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
 	if (IS_NULL_REG(argv[0]))
 		return NULL_REG;
-	List *l = LOOKUP_LIST(argv[0]);
+	List *l = lookup_list(s, argv[0]);
 
 	if (l && !sane_listp(s, argv[0]))
 		error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
@@ -212,7 +212,7 @@
 }
 
 reg_t kLastNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
-	List *l = LOOKUP_LIST(argv[0]);
+	List *l = lookup_list(s, argv[0]);
 
 	if (l && !sane_listp(s, argv[0]))
 		error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
@@ -224,7 +224,7 @@
 }
 
 reg_t kEmptyList(EngineState *s, int funct_nr, int argc, reg_t *argv) {
-	List *l = LOOKUP_LIST(argv[0]);
+	List *l = lookup_list(s, argv[0]);
 
 	if (!l || !sane_listp(s, argv[0]))
 		error("List at "PREG" is invalid or not sane anymore!\n", PRINT_REG(argv[0]));
@@ -233,8 +233,8 @@
 }
 
 void _k_add_to_front(EngineState *s, reg_t listbase, reg_t nodebase) {
-	List *l = LOOKUP_LIST(listbase);
-	Node *new_n = LOOKUP_NODE(nodebase);
+	List *l = lookup_list(s, listbase);
+	Node *new_n = lookup_node(s, nodebase);
 
 	SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
 
@@ -250,15 +250,15 @@
 	if (IS_NULL_REG(l->first))
 		l->last = nodebase;
 	else {
-		Node *old_n = LOOKUP_NODE(l->first);
+		Node *old_n = lookup_node(s, l->first);
 		old_n->pred = nodebase;
 	}
 	l->first = nodebase;
 }
 
 void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) {
-	List *l = LOOKUP_LIST(listbase);
-	Node *new_n = LOOKUP_NODE(nodebase);
+	List *l = lookup_list(s, listbase);
+	Node *new_n = lookup_node(s, nodebase);
 
 	SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
 
@@ -274,14 +274,14 @@
 	if (IS_NULL_REG(l->last))
 		l->first = nodebase;
 	else {
-		Node *old_n = LOOKUP_NODE(l->last);
+		Node *old_n = lookup_node(s, l->last);
 		old_n->succ = nodebase;
 	}
 	l->last = nodebase;
 }
 
 reg_t kNextNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
-	Node *n = LOOKUP_NODE(argv[0]);
+	Node *n = lookup_node(s, argv[0]);
 	if (!sane_nodep(s, argv[0])) {
 		error("List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
 		script_error_flag = script_debug_flag = 0;
@@ -292,7 +292,7 @@
 }
 
 reg_t kPrevNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
-	Node *n = LOOKUP_NODE(argv[0]);
+	Node *n = lookup_node(s, argv[0]);
 	if (!sane_nodep(s, argv[0]))
 		error("List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
 
@@ -300,7 +300,7 @@
 }
 
 reg_t kNodeValue(EngineState *s, int funct_nr, int argc, reg_t *argv) {
-	Node *n = LOOKUP_NODE(argv[0]);
+	Node *n = lookup_node(s, argv[0]);
 	if (!sane_nodep(s, argv[0])) {
 		error("List node at "PREG" is not sane!\n", PRINT_REG(argv[0]));
 		script_debug_flag = script_error_flag = 0;
@@ -316,9 +316,9 @@
 }
 
 reg_t kAddAfter(EngineState *s, int funct_nr, int argc, reg_t *argv) {
-	List *l = LOOKUP_LIST(argv[0]);
-	Node *firstnode = IS_NULL_REG(argv[1]) ? NULL : LOOKUP_NODE(argv[1]);
-	Node *newnode = LOOKUP_NODE(argv[2]);
+	List *l =lookup_list(s, argv[0]);
+	Node *firstnode = IS_NULL_REG(argv[1]) ? NULL : lookup_node(s, argv[1]);
+	Node *newnode = lookup_node(s, argv[2]);
 
 	if (!l || !sane_listp(s, argv[0]))
 		error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
@@ -345,7 +345,7 @@
 			// Set new node as last list node
 			l->last = argv[2];
 		else
-			LOOKUP_NODE(oldnext)->pred = argv[2];
+			lookup_node(s, oldnext)->pred = argv[2];
 
 		return s->r_acc;
 	} else { // !firstnode
@@ -370,12 +370,12 @@
 	if (!sane_listp(s, list_pos))
 		error("List at "PREG" is not sane anymore!\n", PRINT_REG(list_pos));
 
-	node_pos = LOOKUP_LIST(list_pos)->first;
+	node_pos = lookup_list(s, list_pos)->first;
 
 	SCIkdebug(SCIkNODES, "First node at "PREG"\n", PRINT_REG(node_pos));
 
 	while (!IS_NULL_REG(node_pos)) {
-		Node *n = LOOKUP_NODE(node_pos);
+		Node *n = lookup_node(s, node_pos);
 		if (REG_EQ(n->key, key)) {
 			SCIkdebug(SCIkNODES, " Found key at "PREG"\n", PRINT_REG(node_pos));
 			return node_pos;
@@ -392,21 +392,21 @@
 reg_t kDeleteKey(EngineState *s, int funct_nr, int argc, reg_t *argv) {
 	reg_t node_pos = kFindKey(s, funct_nr, 2, argv);
 	Node *n;
-	List *l = LOOKUP_LIST(argv[0]);
+	List *l = lookup_list(s, argv[0]);
 
 	if (IS_NULL_REG(node_pos))
 		return NULL_REG; // Signal falure
 
-	n = LOOKUP_NODE(node_pos);
+	n = lookup_node(s, node_pos);
 	if (REG_EQ(l->first, node_pos))
 		l->first = n->succ;
 	if (REG_EQ(l->last, node_pos))
 		l->last = n->pred;
 
 	if (!IS_NULL_REG(n->pred))
-		LOOKUP_NODE(n->pred)->succ = n->succ;
+		lookup_node(s, n->pred)->succ = n->succ;
 	if (!IS_NULL_REG(n->succ))
-		LOOKUP_NODE(n->succ)->pred = n->pred;
+		lookup_node(s, n->succ)->pred = n->pred;
 
 	//s->seg_manager->free_Node(node_pos);
 
@@ -458,8 +458,8 @@
 
 	PUT_SEL32V(dest, size, input_size);
 
-	list = LOOKUP_LIST(input_data);
-	node = LOOKUP_NODE(list->first);
+	list = lookup_list(s, input_data);
+	node = lookup_node(s, list->first);
 
 	i = 0;
 	while (node) {
@@ -468,7 +468,7 @@
 		temp_array[i].value = node->value;
 		temp_array[i].order = s->r_acc;
 		i++;
-		node = LOOKUP_NODE(node->succ);
+		node = lookup_node(s, node->succ);
 	}
 
 	qsort(temp_array, input_size, sizeof(sort_temp_t), sort_temp_cmp);

Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp	2009-05-18 07:55:13 UTC (rev 40675)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp	2009-05-18 08:28:04 UTC (rev 40676)
@@ -385,18 +385,18 @@
 	if (!poly_list.segment)
 		return;
 
-	list = LOOKUP_LIST(poly_list);
+	list = lookup_list(s, poly_list);
 
 	if (!list) {
 		warning("[avoidpath] Could not obtain polygon list");
 		return;
 	}
 
-	node = LOOKUP_NODE(list->first);
+	node = lookup_node(s, list->first);
 
 	while (node) {
 		draw_polygon(s, node->value);
-		node = LOOKUP_NODE(node->succ);
+		node = lookup_node(s, node->succ);
 	}
 }
 
@@ -431,7 +431,7 @@
 	if (!poly_list.segment)
 		return;
 
-	list = LOOKUP_LIST(poly_list);
+	list = lookup_list(s, poly_list);
 
 	if (!list) {
 		warning("[avoidpath] Could not obtain polygon list");
@@ -439,11 +439,11 @@
 	}
 
 	sciprintf("Polygons:\n");
-	node = LOOKUP_NODE(list->first);
+	node = lookup_node(s, list->first);
 
 	while (node) {
 		print_polygon(s, node->value);
-		node = LOOKUP_NODE(node->succ);
+		node = lookup_node(s, node->succ);
 	}
 }
 
@@ -1367,11 +1367,11 @@
 
 	// Convert all polygons
 	if (poly_list.segment) {
-		List *list = LOOKUP_LIST(poly_list);
-		Node *node = LOOKUP_NODE(list->first);
+		List *list = lookup_list(s, poly_list);
+		Node *node = lookup_node(s, list->first);
 
 		while (node) {
-			Node *dup = LOOKUP_NODE(list->first);
+			Node *dup = lookup_node(s, list->first);
 
 			// Workaround for game bugs that put a polygon in the list more than once
 			while (dup != node) {
@@ -1379,7 +1379,7 @@
 					warning("[avoidpath] Ignoring duplicate polygon");
 					break;
 				}
-				dup = LOOKUP_NODE(dup->succ);
+				dup = lookup_node(s, dup->succ);
 			}
 
 			if (dup == node) {
@@ -1389,7 +1389,7 @@
 				count += KP_UINT(GET_SEL32(node->value, size));
 			}
 
-			node = LOOKUP_NODE(node->succ);
+			node = lookup_node(s, node->succ);
 		}
 	}
 

Modified: scummvm/trunk/engines/sci/engine/kstring.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kstring.cpp	2009-05-18 07:55:13 UTC (rev 40675)
+++ scummvm/trunk/engines/sci/engine/kstring.cpp	2009-05-18 08:28:04 UTC (rev 40676)
@@ -188,8 +188,8 @@
 
 	s->_synonyms.clear();
 
-	list = LOOKUP_LIST(GET_SEL32(object, elements));
-	node = LOOKUP_NODE(list->first);
+	list = lookup_list(s, GET_SEL32(object, elements));
+	node = lookup_node(s, list->first);
 
 	while (node) {
 		reg_t objpos = node->value;
@@ -227,7 +227,7 @@
 
 		}
 
-		node = LOOKUP_NODE(node->succ);
+		node = lookup_node(s, node->succ);
 	}
 
 	SCIkdebug(SCIkPARSER, "A total of %d synonyms are active now.\n", s->_synonyms.size());

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-18 07:55:13 UTC (rev 40675)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-18 08:28:04 UTC (rev 40676)
@@ -82,9 +82,12 @@
 
 char inputbuf[256] = "";
 
+#if 0
+// Unused
 #define LOOKUP_SPECIES(species) (\
 	(species >= 1000) ? species : *(s->_classtable[species].scriptposp) \
 		+ s->_classtable[species].class_offset)
+#endif
 
 const char *_debug_get_input_default() {
 	char newinpbuf[256];
@@ -573,7 +576,7 @@
 			break;
 
 		case KSIG_LIST: {
-			List *l = LOOKUP_LIST(reg);
+			List *l = lookup_list(s, reg);
 
 			sciprintf("list\n");
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list