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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Feb 21 05:43:50 CET 2009


Revision: 38661
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38661&view=rev
Author:   fingolfin
Date:     2009-02-21 04:43:49 +0000 (Sat, 21 Feb 2009)

Log Message:
-----------
SCI: Yet more cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/klists.cpp
    scummvm/trunk/engines/sci/engine/kscripts.cpp
    scummvm/trunk/engines/sci/include/kdebug.h
    scummvm/trunk/engines/sci/include/kernel.h
    scummvm/trunk/engines/sci/include/resource.h
    scummvm/trunk/engines/sci/scicore/resource_patch.cpp
    scummvm/trunk/engines/sci/scicore/tools.cpp

Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp	2009-02-21 04:25:56 UTC (rev 38660)
+++ scummvm/trunk/engines/sci/engine/klists.cpp	2009-02-21 04:43:49 UTC (rev 38661)
@@ -91,10 +91,6 @@
 	return _lookup_list(s, addr, file, line, 0);
 }
 
-int listp(state_t *s, reg_t addr) {
-	return (s->seg_manager.heap[addr.segment]->type == MEM_OBJ_LISTS && ENTRY_IS_VALID(&(s->seg_manager.heap[addr.segment]->data.lists), addr.offset));
-}
-
 #ifdef DISABLE_VALIDATIONS
 
 #define sane_nodep(a, b) 1

Modified: scummvm/trunk/engines/sci/engine/kscripts.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kscripts.cpp	2009-02-21 04:25:56 UTC (rev 38660)
+++ scummvm/trunk/engines/sci/engine/kscripts.cpp	2009-02-21 04:43:49 UTC (rev 38661)
@@ -104,7 +104,7 @@
 	return 0;
 }
 
-int is_object(state_t *s, reg_t object) {
+bool is_object(state_t *s, reg_t object) {
 	return obj_get(s, object) != NULL;
 }
 

Modified: scummvm/trunk/engines/sci/include/kdebug.h
===================================================================
--- scummvm/trunk/engines/sci/include/kdebug.h	2009-02-21 04:25:56 UTC (rev 38660)
+++ scummvm/trunk/engines/sci/include/kdebug.h	2009-02-21 04:43:49 UTC (rev 38661)
@@ -77,32 +77,16 @@
 
 
 
-#ifdef __GNUC__XXX
-
-#define SCIkwarn(arguments...) _SCIGNUkdebug(__PRETTY_FUNCTION__, ## arguments)
-
-#else /* !__GNUC__ */
-
-#define SCIkwarn _SCIkwarn
-
-#endif /* !__GNUC__ */
-
 /* Internal functions */
-void
-_SCIkwarn(struct _state *s, const char *file, int line, int area, const char *format, ...);
-void
-_SCIkdebug(struct _state *s, const char *file, int line, int area, const char *format, ...);
-void
-_SCIGNUkdebug(const char *funcname, struct _state *s, const char *file, int line, int area, const char *format, ...);
+void _SCIkdebug(struct _state *s, const char *file, int line, int area, const char *format, ...);
+void _SCIGNUkdebug(const char *funcname, struct _state *s, const char *file, int line, int area, const char *format, ...);
 
 /* If mode=1, enables debugging for specified areas. If mode=0, disables
 ** debugging for specified areas.
 ** Valid area characters: ulgcmfbad
 */
+void set_debug_mode(struct _state *s, int mode, const char *areas);
 
-void
-set_debug_mode(struct _state *s, int mode, const char *areas);
-
 extern int sci_debug_flags;
 
 /* Debug flags */

Modified: scummvm/trunk/engines/sci/include/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/include/kernel.h	2009-02-21 04:25:56 UTC (rev 38660)
+++ scummvm/trunk/engines/sci/include/kernel.h	2009-02-21 04:43:49 UTC (rev 38661)
@@ -83,21 +83,17 @@
 */
 
 
-reg_t
-read_selector(struct _state *s,  reg_t object, selector_t selector_id, const char *fname, int line);
-void
-write_selector(struct _state *s, reg_t object, selector_t selector_id, reg_t value,
+reg_t read_selector(struct _state *s,  reg_t object, selector_t selector_id, const char *fname, int line);
+void write_selector(struct _state *s, reg_t object, selector_t selector_id, reg_t value,
                const char *fname, int line);
-int
-invoke_selector(struct _state *s, reg_t object, int selector_id, int noinvalid, int kfunct,
+int invoke_selector(struct _state *s, reg_t object, int selector_id, int noinvalid, int kfunct,
                 stack_ptr_t k_argp, int k_argc, const char *fname, int line, int argc, ...);
 
 
 
 
 /******************** Text functionality ********************/
-char *
-kernel_lookup_text(struct _state *s, reg_t address, int index);
+char *kernel_lookup_text(struct _state *s, reg_t address, int index);
 /* Looks up text referenced by scripts
 ** Parameters: (state_t *s): The current state
 **             (reg_t) address: The address to look up
@@ -133,16 +129,7 @@
 #endif /* !SCI_KERNEL_DEBUG */
 
 
-int
-listp(struct _state *s, reg_t address);
-/* Determines whether the object at <address> is a list
-** Parameters: (state_t *) s: The state to use
-**             (reg_t) address: The address to check
-** Returns   : (int) 0 if not, non-zero if it is a list.
-*/
-
-int
-is_object(struct _state *s, reg_t obj);
+bool is_object(struct _state *s, reg_t obj);
 /* Checks whether a heap address contains an object
 ** Parameters: (state_t *) s: The current state
 **             (reg_t) obj: The address to check
@@ -150,16 +137,7 @@
 */
 
 
-/* Functions for internal macro use */
-void
-_SCIkvprintf(FILE *file, const char *format, va_list args);
-void
-_SCIkprintf(FILE *file, const char *format, ...)  GCC_PRINTF(2, 3);
 
-
-
-
-
 /******************** Kernel function parameter macros ********************/
 
 /* Returns the parameter value or (alt) if not enough parameters were supplied */
@@ -175,10 +153,8 @@
 #define SKPV_OR_ALT(x,a) KP_SINT(KP_ALT(x, make_reg(0, a)))
 #define UKPV_OR_ALT(x,a) KP_UINT(KP_ALT(x, make_reg(0, a)))
 
-reg_t *
-kernel_dereference_reg_pointer(struct _state *s, reg_t pointer, int entries);
-byte *
-kernel_dereference_bulk_pointer(struct _state *s, reg_t pointer, int entries);
+reg_t *kernel_dereference_reg_pointer(struct _state *s, reg_t pointer, int entries);
+byte *kernel_dereference_bulk_pointer(struct _state *s, reg_t pointer, int entries);
 #define kernel_dereference_char_pointer(state, pointer, entries) (char*)kernel_dereference_bulk_pointer(state, pointer, entries)
 /* Dereferences a heap pointer
 ** Parameters: (state_t *) s: The state to operate on
@@ -202,8 +178,7 @@
 
 
 
-int
-kernel_oops(struct _state *s, const char *file, int line, const char *reason);
+int kernel_oops(struct _state *s, const char *file, int line, const char *reason);
 /* Halts script execution and informs the user about an internal kernel error or failed assertion
 ** Paramters: (state_t *) s: The state to use
 **            (const char *) file: The file the oops occured in
@@ -220,16 +195,14 @@
 
 extern int sci01_priority_table_flags; /* 1: delete, 2: print */
 
-int
-_find_priority_band(struct _state *s, int band);
+int _find_priority_band(struct _state *s, int band);
 /* Finds the position of the priority band specified
 ** Parameters: (state_t *) s: State to search in
 **             (int) band: Band to look for
 ** Returns   : (int) Offset at which the band starts
 */
 
-int
-_find_view_priority(struct _state *s, int y);
+int _find_view_priority(struct _state *s, int y);
 /* Does the opposite of _find_priority_band
 ** Parameters: (state_t *) s: State
 **             (int) y: Coordinate to check
@@ -257,16 +230,14 @@
 
 /******************** Dynamic view list functions ********************/
 
-abs_rect_t
-set_base(struct _state *s, reg_t object);
+abs_rect_t set_base(struct _state *s, reg_t object);
 /* Determines the base rectangle of the specified view object
 ** Parameters: (state_t *) s: The state to use
 **             (reg_t) object: The object to set
 ** Returns   : (abs_rect) The absolute base rectangle
 */
 
-extern abs_rect_t
-	get_nsrect(struct _state *s, reg_t object, byte clip);
+extern abs_rect_t get_nsrect(struct _state *s, reg_t object, byte clip);
 /* Determines the now-seen rectangle of a view object
 ** Parameters: (state_t *) s: The state to use
 **             (reg_t) object: The object to check
@@ -276,11 +247,9 @@
 ** now-seen area.
 */
 
-void
-_k_dyn_view_list_prepare_change(struct _state *s);
+void _k_dyn_view_list_prepare_change(struct _state *s);
 /* Removes all views in anticipation of a new window or text */
-void
-_k_dyn_view_list_accept_change(struct _state *s);
+void _k_dyn_view_list_accept_change(struct _state *s);
 /* Redraws all views after a new window or text was added */
 
 
@@ -288,14 +257,12 @@
 
 /******************** Misc functions ********************/
 
-void
-process_sound_events(struct _state *s); /* Get all sound events, apply their changes to the heap */
+void process_sound_events(struct _state *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_t *
-lookup_node(struct _state *s, reg_t addr, const char *file, int line);
+node_t *lookup_node(struct _state *s, reg_t addr, const char *file, int line);
 /* Resolves an address into a list node
 ** Parameters: (state_t *) s: The state to operate on
 **             (reg_t) addr: The address to resolve
@@ -305,8 +272,7 @@
 */
 
 
-list_t *
-lookup_list(struct _state *s, reg_t addr, const char *file, int line);
+list_t *lookup_list(struct _state *s, reg_t addr, const char *file, int line);
 /* Resolves a list pointer to a list
 ** Parameters: (state_t *) s: The state to operate on
 **             (reg_t) addr: The address to resolve

Modified: scummvm/trunk/engines/sci/include/resource.h
===================================================================
--- scummvm/trunk/engines/sci/include/resource.h	2009-02-21 04:25:56 UTC (rev 38660)
+++ scummvm/trunk/engines/sci/include/resource.h	2009-02-21 04:43:49 UTC (rev 38661)
@@ -260,15 +260,10 @@
 #  define sci_unlink unlink
 #  define sci_rmdir rmdir
 
-#ifndef HAVE_FFS
-int sci_ffs(int _mask);
-#else
-#define sci_ffs ffs
-#endif
+/** Find first set bit in bits and return its index. Returns 0 if bits is 0. */
+int sci_ffs(int bits);
 
-
-void
-sci_sched_yield(void);
+void sci_sched_yield(void);
 /* Yields the running process/thread to the scheduler
 ** Parameters: (void)
 ** Returns   : after a while.

Modified: scummvm/trunk/engines/sci/scicore/resource_patch.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/resource_patch.cpp	2009-02-21 04:25:56 UTC (rev 38660)
+++ scummvm/trunk/engines/sci/scicore/resource_patch.cpp	2009-02-21 04:43:49 UTC (rev 38661)
@@ -104,11 +104,6 @@
 
 
 int sci0_read_resource_patches(ResourceSource *source, resource_t **resource_p, int *resource_nr_p) {
-	// FIXME: Use only one specific dir, instead of SearchMan?
-	//chdir(source->location_dir_name.c_str());
-	//sci_init_dir(&dir);
-	//entry = sci_find_first(&dir, "*.???");
-
 	Common::ArchiveMemberList files;
 	SearchMan.listMatchingMembers(files, "*.???");
 
@@ -119,7 +114,6 @@
 		int i;
 		unsigned int resname_len;
 		char *endptr;
-printf("sci0_read_resource_patches: scanning '%s'\n", name.c_str());
 
 		for (i = sci_view; i < sci_invalid_resource; i++)
 			if (scumm_strnicmp(sci_resource_types[i], name.c_str(),
@@ -148,13 +142,7 @@
 	return 0;
 }
 
-int
-sci1_read_resource_patches(ResourceSource *source, resource_t **resource_p, int *resource_nr_p) {
-	// FIXME: Use only one specific dir, instead of SearchMan?
-	//chdir(source->location_dir_name.c_str());
-	//sci_init_dir(&dir);
-	//entry = sci_find_first(&dir, "*.*");
-
+int sci1_read_resource_patches(ResourceSource *source, resource_t **resource_p, int *resource_nr_p) {
 	Common::ArchiveMemberList files;
 	SearchMan.listMatchingMembers(files, "*.*");
 

Modified: scummvm/trunk/engines/sci/scicore/tools.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/tools.cpp	2009-02-21 04:25:56 UTC (rev 38660)
+++ scummvm/trunk/engines/sci/scicore/tools.cpp	2009-02-21 04:43:49 UTC (rev 38661)
@@ -96,7 +96,8 @@
 int sci_ffs(int _mask) {
 	int retval = 0;
 
-	if (!_mask) return 0;
+	if (!_mask)
+		return 0;
 	retval++;
 	while (!(_mask & 1)) {
 		retval++;
@@ -109,45 +110,22 @@
 
 /******************** Debug functions ********************/
 
-void
-_SCIkvprintf(FILE *file, const char *format, va_list args) {
-	vfprintf(file, format, args);
-	if (con_file) vfprintf(con_file, format, args);
-}
 
-void
-_SCIkprintf(FILE *file, const char *format, ...) {
-	va_list args;
 
-	va_start(args, format);
-	_SCIkvprintf(file, format, args);
-	va_end(args);
-}
+/* Functions for internal macro use */
+void _SCIkvprintf(FILE *file, const char *format, va_list args);
+void _SCIkprintf(FILE *file, const char *format, ...)  GCC_PRINTF(2, 3);
 
-
-void
-_SCIkwarn(state_t *s, const char *file, int line, int area, const char *format, ...) {
-	va_list args;
-
-	if (area == SCIkERROR_NR)
-		_SCIkprintf(stderr, "ERROR: ");
-	else
-		_SCIkprintf(stderr, "Warning: ");
-
-	va_start(args, format);
-	_SCIkvprintf(stderr, format, args);
-	va_end(args);
-	fflush(NULL);
-
-	if (sci_debug_flags & _DEBUG_FLAG_BREAK_ON_WARNINGS) script_debug_flag = 1;
+void _SCIkvprintf(FILE *file, const char *format, va_list args) {
+	vfprintf(file, format, args);
+	if (con_file) vfprintf(con_file, format, args);
 }
 
-void
-_SCIkdebug(state_t *s, const char *file, int line, int area, const char *format, ...) {
+void _SCIkdebug(state_t *s, const char *file, int line, int area, const char *format, ...) {
 	va_list args;
 
 	if (s->debug_mode & (1 << area)) {
-		_SCIkprintf(stdout, " kernel: (%s L%d): ", file, line);
+		fprintf(stdout, " kernel: (%s L%d): ", file, line);
 		va_start(args, format);
 		_SCIkvprintf(stdout, format, args);
 		va_end(args);
@@ -155,22 +133,22 @@
 	}
 }
 
-void
-_SCIGNUkdebug(const char *funcname, state_t *s, const char *file, int line, int area, const char *format, ...) {
+void _SCIGNUkdebug(const char *funcname, state_t *s, const char *file, int line, int area, const char *format, ...) {
 	va_list xargs;
 	int error = ((area == SCIkWARNING_NR) || (area == SCIkERROR_NR));
 
 	if (error || (s->debug_mode & (1 << area))) { /* Is debugging enabled for this area? */
 
-		_SCIkprintf(stderr, "FSCI: ");
+		fprintf(stderr, "FSCI: ");
 
 		if (area == SCIkERROR_NR)
-			_SCIkprintf(stderr, "ERROR in %s ", funcname);
+			fprintf(stderr, "ERROR in %s ", funcname);
 		else if (area == SCIkWARNING_NR)
-			_SCIkprintf(stderr, "%s: Warning ", funcname);
-		else _SCIkprintf(stderr, funcname);
+			fprintf(stderr, "%s: Warning ", funcname);
+		else
+			fprintf(stderr, funcname);
 
-		_SCIkprintf(stderr, "(%s L%d): ", file, line);
+		fprintf(stderr, "(%s L%d): ", file, line);
 
 		va_start(xargs, format);
 		_SCIkvprintf(stderr, format, xargs);


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