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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jan 29 12:03:55 CET 2010


Revision: 47665
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47665&view=rev
Author:   fingolfin
Date:     2010-01-29 11:03:54 +0000 (Fri, 29 Jan 2010)

Log Message:
-----------
SCI: Move selector stuff to new header; reorder k_argc & k_argp param of invoke_selector

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/kernel32.cpp
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/klists.cpp
    scummvm/trunk/engines/sci/engine/kmovement.cpp
    scummvm/trunk/engines/sci/engine/kparse.cpp
    scummvm/trunk/engines/sci/engine/kpathing.cpp
    scummvm/trunk/engines/sci/engine/kscripts.cpp
    scummvm/trunk/engines/sci/engine/selector.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/graphics/animate.cpp
    scummvm/trunk/engines/sci/graphics/controls.cpp
    scummvm/trunk/engines/sci/graphics/gfx.cpp
    scummvm/trunk/engines/sci/graphics/gui.cpp
    scummvm/trunk/engines/sci/graphics/menu.cpp
    scummvm/trunk/engines/sci/sound/audio.cpp
    scummvm/trunk/engines/sci/sound/soundcmd.cpp

Added Paths:
-----------
    scummvm/trunk/engines/sci/engine/selector.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/console.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -32,6 +32,7 @@
 #include "sci/resource.h"
 #include "sci/engine/savegame.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/gc.h"
 #include "sci/engine/kernel_types.h"	// for determine_reg_type
 #ifdef USE_OLD_MUSIC_FUNCTIONS

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2010-01-29 11:03:54 UTC (rev 47665)
@@ -195,54 +195,6 @@
 	Common::StringList _kernelNames;
 };
 
-/******************** Selector functionality ********************/
-
-enum SelectorInvocation {
-	kStopOnInvalidSelector = 0,
-	kContinueOnInvalidSelector = 1
-};
-
-/**
- * Retrieves a selector from an object.
- * @param segMan	the segment mananger
- * @param _obj_		the address of the object which the selector should be read from
- * @param _slc_		the selector to read
- * @return			the selector value as a reg_t
- * This macro halts on error. 'selector' must be a selector name registered in vm.h's
- * SelectorCache and mapped in script.cpp.
- */
-#define GET_SEL32(segMan, _obj_, _slc_) read_selector(segMan, _obj_, ((SciEngine*)g_engine)->getKernel()->_selectorCache._slc_)
-#define GET_SEL32V(segMan, _obj_, _slc_) (GET_SEL32(segMan, _obj_, _slc_).offset)
-
-/**
- * Writes a selector value to an object.
- * @param segMan	the segment mananger
- * @param _obj_		the address of the object which the selector should be written to
- * @param _slc_		the selector to read
- * @param _val_		the value to write
- * This macro halts on error. 'selector' must be a selector name registered in vm.h's
- * SelectorCache and mapped in script.cpp.
- */
-#define PUT_SEL32(segMan, _obj_, _slc_, _val_) write_selector(segMan, _obj_, ((SciEngine*)g_engine)->getKernel()->_selectorCache._slc_, _val_)
-#define PUT_SEL32V(segMan, _obj_, _slc_, _val_) PUT_SEL32(segMan, _obj_, _slc_, make_reg(0, _val_))
-
-
-/**
- * Kludge for use with invoke_selector(). Used for compatibility with compilers
- * that cannot handle vararg macros.
- */
-#define INV_SEL(_object_, _selector_, _noinvalid_) \
-	s, _object_,  s->_kernel->_selectorCache._selector_, _noinvalid_, argv, argc
-
-
-reg_t read_selector(SegManager *segMan, reg_t object, Selector selector_id);
-void write_selector(SegManager *segMan, reg_t object, Selector selector_id, reg_t value);
-int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid,
-	StackPtr k_argp, int k_argc, int argc, ...);
-int invoke_selector_argv(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid,
-	StackPtr k_argp, int k_argc, int argc, const reg_t *argv);
-
-
 /******************** Text functionality ********************/
 /**
  * Looks up text referenced by scripts

Modified: scummvm/trunk/engines/sci/engine/kernel32.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -28,6 +28,7 @@
 #include "sci/engine/kernel.h"
 #include "sci/engine/segment.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/graphics/gui.h"
 
 namespace Sci {

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -25,6 +25,7 @@
 
 #include "sci/sci.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/kernel.h"
 #include "sci/console.h"
 #include "sci/debug.h"	// for g_debug_simulated_key

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -32,6 +32,7 @@
 #include "sci/resource.h"
 #include "sci/video/seq_decoder.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/kernel.h"
 #include "sci/graphics/gui.h"
 #include "sci/graphics/animate.h"

Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/klists.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -24,6 +24,7 @@
  */
 
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/kernel.h"
 
 namespace Sci {
@@ -535,7 +536,7 @@
 				write_selector(s->_segMan, curObject, slc, argv[2]);
 			}
 		} else {
-			invoke_selector_argv(s, curObject, slc, kContinueOnInvalidSelector, argv, argc, argc - 2, argv + 2);
+			invoke_selector_argv(s, curObject, slc, kContinueOnInvalidSelector, argc, argv, argc - 2, argv + 2);
 		}
 
 		// Lookup node again, since the nodetable it was in may have been reallocated
@@ -568,7 +569,7 @@
 			// Can this happen with variable selectors?
 			warning("kListFirstTrue: Attempted to access a variable selector");
 		} else {
-			invoke_selector_argv(s, curObject, slc, kContinueOnInvalidSelector, argv, argc, argc - 2, argv + 2);
+			invoke_selector_argv(s, curObject, slc, kContinueOnInvalidSelector, argc, argv, argc - 2, argv + 2);
 
 			// Check if the result is true
 			if (!s->r_acc.isNull())
@@ -606,7 +607,7 @@
 			// Can this happen with variable selectors?
 			warning("kListAllTrue: Attempted to access a variable selector");
 		} else {
-			invoke_selector_argv(s, curObject, slc, kContinueOnInvalidSelector, argv, argc, argc - 2, argv + 2);
+			invoke_selector_argv(s, curObject, slc, kContinueOnInvalidSelector, argc, argv, argc - 2, argv + 2);
 
 			// Check if the result isn't true
 			if (s->r_acc.isNull())

Modified: scummvm/trunk/engines/sci/engine/kmovement.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmovement.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/kmovement.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -26,6 +26,7 @@
 #include "sci/sci.h"
 #include "sci/resource.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/kernel.h"
 #include "sci/graphics/animate.h"
 

Modified: scummvm/trunk/engines/sci/engine/kparse.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kparse.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/kparse.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -27,6 +27,7 @@
 
 #include "sci/resource.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/message.h"
 #include "sci/engine/kernel.h"
 

Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -25,6 +25,7 @@
 
 #include "sci/sci.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/kernel.h"
 #include "sci/graphics/gui.h"
 

Modified: scummvm/trunk/engines/sci/engine/kscripts.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kscripts.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/kscripts.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -26,6 +26,7 @@
 #include "sci/sci.h"
 #include "sci/resource.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/kernel_types.h"
 #include "sci/engine/kernel.h"
 

Modified: scummvm/trunk/engines/sci/engine/selector.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/selector.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/selector.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -25,6 +25,7 @@
 
 #include "sci/sci.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 
 namespace Sci {
 
@@ -54,7 +55,7 @@
 }
 
 int invoke_selector_argv(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid,
-	StackPtr k_argp, int k_argc, int argc, const reg_t *argv) {
+	int k_argc, StackPtr k_argp, int argc, const reg_t *argv) {
 	int i;
 	int framesize = 2 + 1 * argc;
 	reg_t address;
@@ -96,7 +97,7 @@
 }
 
 int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid,
-	StackPtr k_argp, int k_argc, int argc, ...) {
+	int k_argc, StackPtr k_argp, int argc, ...) {
 	va_list argp;
 	reg_t *args = new reg_t[argc];
 
@@ -105,7 +106,7 @@
 		args[i] = va_arg(argp, reg_t);
 	va_end(argp);
 
-	int retval = invoke_selector_argv(s, object, selector_id, noinvalid, k_argp, k_argc, argc, args);
+	int retval = invoke_selector_argv(s, object, selector_id, noinvalid, k_argc, k_argp, argc, args);
 
 	delete[] args;
 	return retval;

Added: scummvm/trunk/engines/sci/engine/selector.h
===================================================================
--- scummvm/trunk/engines/sci/engine/selector.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/engine/selector.h	2010-01-29 11:03:54 UTC (rev 47665)
@@ -0,0 +1,88 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SCI_ENGINE_SELECTOR_H
+#define SCI_ENGINE_SELECTOR_H
+
+#include "common/scummsys.h"
+
+#include "sci/engine/vm_types.h"	// for reg_t
+#include "sci/engine/vm.h"
+
+namespace Sci {
+
+
+/******************** Selector functionality ********************/
+
+enum SelectorInvocation {
+	kStopOnInvalidSelector = 0,
+	kContinueOnInvalidSelector = 1
+};
+
+/**
+ * Retrieves a selector from an object.
+ * @param segMan	the segment mananger
+ * @param _obj_		the address of the object which the selector should be read from
+ * @param _slc_		the selector to read
+ * @return			the selector value as a reg_t
+ * This macro halts on error. 'selector' must be a selector name registered in vm.h's
+ * SelectorCache and mapped in script.cpp.
+ */
+#define GET_SEL32(segMan, _obj_, _slc_) read_selector(segMan, _obj_, ((SciEngine *)g_engine)->getKernel()->_selectorCache._slc_)
+#define GET_SEL32V(segMan, _obj_, _slc_) (GET_SEL32(segMan, _obj_, _slc_).offset)
+
+/**
+ * Writes a selector value to an object.
+ * @param segMan	the segment mananger
+ * @param _obj_		the address of the object which the selector should be written to
+ * @param _slc_		the selector to read
+ * @param _val_		the value to write
+ * This macro halts on error. 'selector' must be a selector name registered in vm.h's
+ * SelectorCache and mapped in script.cpp.
+ */
+#define PUT_SEL32(segMan, _obj_, _slc_, _val_) write_selector(segMan, _obj_, ((SciEngine *)g_engine)->getKernel()->_selectorCache._slc_, _val_)
+#define PUT_SEL32V(segMan, _obj_, _slc_, _val_) PUT_SEL32(segMan, _obj_, _slc_, make_reg(0, _val_))
+
+
+/**
+ * Kludge for use with invoke_selector(). Used for compatibility with compilers
+ * that cannot handle vararg macros.
+ */
+#define INV_SEL(_object_, _selector_, _noinvalid_) \
+	s, _object_,  s->_kernel->_selectorCache._selector_, _noinvalid_, argc, argv
+
+
+reg_t read_selector(SegManager *segMan, reg_t object, Selector selector_id);
+void write_selector(SegManager *segMan, reg_t object, Selector selector_id, reg_t value);
+int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid,
+	int k_argc, StackPtr k_argp, int argc, ...);
+int invoke_selector_argv(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid,
+	int k_argc, StackPtr k_argp, int argc, const reg_t *argv);
+
+
+
+} // End of namespace Sci
+
+#endif // SCI_ENGINE_KERNEL_H


Property changes on: scummvm/trunk/engines/sci/engine/selector.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -26,6 +26,7 @@
 #include "sci/sci.h"	// for INCLUDE_OLDGFX
 
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/vm.h"
 #include "sci/engine/script.h"
 #include "sci/engine/message.h"

Modified: scummvm/trunk/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -29,6 +29,7 @@
 
 #include "sci/sci.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/vm.h"
 #include "sci/graphics/gfx.h"
 #include "sci/graphics/view.h"
@@ -91,7 +92,7 @@
 		signal = GET_SEL32V(_s->_segMan, curObject, signal);
 		if (!(signal & kSignalFrozen)) {
 			// Call .doit method of that object
-			invoke_selector(_s, curObject, _s->_kernel->_selectorCache.doit, kContinueOnInvalidSelector, argv, argc, 0);
+			invoke_selector(_s, curObject, _s->_kernel->_selectorCache.doit, kContinueOnInvalidSelector, argc, argv, 0);
 			// Lookup node again, since the nodetable it was in may have been reallocated
 			curNode = _s->_segMan->lookupNode(curAddress);
 		}
@@ -486,7 +487,7 @@
 
 		if (signal & kSignalDisposeMe) {
 			// Call .delete_ method of that object
-			invoke_selector(_s, curObject, _s->_kernel->_selectorCache.delete_, kContinueOnInvalidSelector, argv, argc, 0);
+			invoke_selector(_s, curObject, _s->_kernel->_selectorCache.delete_, kContinueOnInvalidSelector, argc, argv, 0);
 		}
 		listIterator--;
 	}

Modified: scummvm/trunk/engines/sci/graphics/controls.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/controls.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/graphics/controls.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -30,6 +30,7 @@
 #include "sci/sci.h"
 #include "sci/event.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/graphics/gfx.h"
 #include "sci/graphics/font.h"
 #include "sci/graphics/text.h"

Modified: scummvm/trunk/engines/sci/graphics/gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -29,6 +29,7 @@
 
 #include "sci/sci.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/graphics/gfx.h"
 #include "sci/graphics/animate.h"
 #include "sci/graphics/font.h"

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -30,6 +30,7 @@
 #include "sci/debug.h"	// for g_debug_sleeptime_factor
 #include "sci/event.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/graphics/gui.h"
 #include "sci/graphics/screen.h"
 #include "sci/graphics/palette.h"

Modified: scummvm/trunk/engines/sci/graphics/menu.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/menu.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/graphics/menu.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -30,6 +30,7 @@
 #include "sci/sci.h"
 #include "sci/event.h"
 #include "sci/engine/state.h"
+#include "sci/engine/selector.h"
 #include "sci/graphics/helpers.h"
 #include "sci/graphics/gfx.h"
 #include "sci/graphics/animate.h"

Modified: scummvm/trunk/engines/sci/sound/audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/audio.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/sound/audio.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -24,6 +24,7 @@
  */
 
 #include "sci/resource.h"
+#include "sci/engine/selector.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/seg_manager.h"
 #include "sci/sound/audio.h"

Modified: scummvm/trunk/engines/sci/sound/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-01-29 04:02:54 UTC (rev 47664)
+++ scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-01-29 11:03:54 UTC (rev 47665)
@@ -33,6 +33,8 @@
 #include "sci/sound/music.h"
 #include "sci/sound/soundcmd.h"
 
+#include "sci/engine/selector.h"
+
 namespace Sci {
 
 #define SCI1_SOUND_FLAG_MAY_PAUSE        1 /* Only here for completeness; The interpreter doesn't touch this bit */


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