[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/extension.cpp libbase/e...
From: |
Chad Musick |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/extension.cpp libbase/e... |
Date: |
Sun, 23 Sep 2007 08:48:20 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Chad Musick <cmusick> 07/09/23 08:48:19
Modified files:
. : ChangeLog
libbase : extension.cpp extension.h
server : Makefile.am Property.h PropertyList.cpp
PropertyList.h as_function.cpp as_object.cpp
as_object.h as_value.cpp
edit_text_character.cpp movie_root.cpp
sprite_instance.cpp swf_function.cpp
textformat.cpp
server/asobj : AsBroadcaster.cpp ContextMenu.cpp Global.cpp
Makefile.am NetStream.cpp Stage.cpp xml.cpp
server/parser : abc_block.cpp abc_block.h
server/vm : ASHandlers.cpp VM.cpp
testsuite/misc-ming.all: KeyTest-Runner.cpp
Added files:
server : namedStrings.cpp namedStrings.h
server/asobj : ClassHierarchy.cpp ClassHierarchy.h
Log message:
Two large changes:
Move pre-defined string enumeration to its own file.
Add a system for on-demand loading of ActionScript objects. The hope
is to
extend this to loading them as extensions and to use the same system to
load all extensions on-demand.
More work on the ActionScript 3 parser.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4380&r2=1.4381
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/extension.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/extension.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.124&r2=1.125
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Property.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/PropertyList.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/PropertyList.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_function.cpp?cvsroot=gnash&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.75&r2=1.76
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.120&r2=1.121
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.96&r2=1.97
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.356&r2=1.357
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/gnash/server/textformat.cpp?cvsroot=gnash&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gnash/server/namedStrings.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/namedStrings.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/AsBroadcaster.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ContextMenu.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Makefile.am?cvsroot=gnash&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.cpp?cvsroot=gnash&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.cpp?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ClassHierarchy.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ClassHierarchy.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/abc_block.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/abc_block.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.135&r2=1.136
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/KeyTest-Runner.cpp?cvsroot=gnash&r1=1.6&r2=1.7
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4380
retrieving revision 1.4381
diff -u -b -r1.4380 -r1.4381
--- ChangeLog 22 Sep 2007 21:46:17 -0000 1.4380
+++ ChangeLog 23 Sep 2007 08:48:16 -0000 1.4381
@@ -1,3 +1,33 @@
+2007-09-23 Chad Musick <address@hidden>
+
+ * server/namedStrings.cpp,.h: New files. Move pre-load string
+ enumeration from as_object and add new enumerations for the
+ known ActionScript classes.
+ * server/asobj/ClassHierarchy.cpp,.h: New files. Delay loading
+ ActionScript classes until they are needed. At the moment,
+ does not support loading them as extensions, though this is
+ planned.
+ * server/Makefile.am: Add new files
+ * server/Property.h: Define a new type DestructiveGetterSetterProperty
+ which servers as a place-holder to allow transparent loading
+ of resources when the value is fetched.
+ * server/PropertyList.h,.cpp: New functions to allow use of the
+ (self)Destructive getters.
+ * server/as_function.cpp as_object.cpp,.h as_value.cpp
+ edit_text_character.cpp movie_root.cpp sprite_instance.cpp
+ swf_function.cpp textformat.cpp: Change to new string enums.
+ * server/asobj/AsBroadcaster.cpp ContextMenu.cpp NetStream.cpp
+ Stage.cpp xml.cpp: Change to new string enums.
+ * server/asobj/Global.cpp: Use new ClassHierarchy object to
+ delay-load actionscript classes, except for Object, Function, Array.
+ * server/asobj/Makefile.am: Add new files
+ * server/parser/abc_block.cpp,.h: More work (still incomplete) on
+ parsing ActionScript 3.
+ * server/vm/ASHandlers.cpp VM.cpp: Change to new string enums.
+ * testsuite/misc-ming.all/KeyTest-Runner.cpp: Change to new string
enums.
+ * libbase/extension.cpp,.h: Add a function to load a library by
+ naming both the library and the function to be called.
+
2007-09-22 Sandro Santilli <address@hidden>
* testsuite/misc-ming.all/init_action_test.c:
Index: libbase/extension.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/extension.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- libbase/extension.cpp 15 Sep 2007 17:53:09 -0000 1.13
+++ libbase/extension.cpp 23 Sep 2007 08:48:17 -0000 1.14
@@ -16,7 +16,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: extension.cpp,v 1.13 2007/09/15 17:53:09 rsavoye Exp $ */
+/* $Id: extension.cpp,v 1.14 2007/09/23 08:48:17 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -162,6 +162,34 @@
}
bool
+Extension::initModuleWithFunc(const char *module, const char *func,
+ as_object &obj)
+{
+ SharedLib::initentry *symptr;
+ SharedLib *sl;
+
+ log_msg(_("Initializing module: \"%s\""), module);
+
+ if (_plugins[module] == 0) {
+ sl = new SharedLib(module);
+ sl->openLib();
+ _plugins[module] = sl;
+ } else {
+ sl = _plugins[module];
+ }
+
+ symptr = sl->getInitEntry(func);
+
+ if (symptr) {
+ symptr(obj);
+ } else {
+ log_error(_("Couldn't get class_init symbol: \"%s\""), func);
+ }
+
+ return true;
+}
+
+bool
Extension::scanDir()
{
// GNASH_REPORT_FUNCTION;
Index: libbase/extension.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/extension.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libbase/extension.h 1 Jul 2007 10:54:08 -0000 1.6
+++ libbase/extension.h 23 Sep 2007 08:48:17 -0000 1.7
@@ -45,6 +45,8 @@
// open a module
// initialize the module within Gnash
bool initModule(const char *module, as_object &obj);
+ // open a module, initialize the module within Gnash. Known function
name.
+ bool initModuleWithFunc(const char *module, const char *func, as_object
&obj);
bool initNewObject(as_object &obj);
void dumpModules();
private:
Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -b -r1.124 -r1.125
--- server/Makefile.am 28 Aug 2007 08:45:11 -0000 1.124
+++ server/Makefile.am 23 Sep 2007 08:48:17 -0000 1.125
@@ -18,7 +18,7 @@
#
#
-# $Id: Makefile.am,v 1.124 2007/08/28 08:45:11 strk Exp $
+# $Id: Makefile.am,v 1.125 2007/09/23 08:48:17 cmusick Exp $
AUTOMAKE_OPTIONS =
@@ -79,6 +79,7 @@
matrix.cpp \
movie_instance.cpp \
movie_root.cpp \
+ namedStrings.cpp \
rect.cpp \
shm.cpp \
sprite_instance.cpp \
@@ -159,6 +160,7 @@
mouse_button_state.h \
movie_instance.h \
movie_root.h \
+ namedStrings.h \
rect.h \
render.h \
resource.h \
Index: server/Property.h
===================================================================
RCS file: /sources/gnash/gnash/server/Property.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/Property.h 1 Jul 2007 10:54:18 -0000 1.8
+++ server/Property.h 23 Sep 2007 08:48:17 -0000 1.9
@@ -38,6 +38,7 @@
///
class Property
{
+protected: // For DestructiveGetterSetterProperty
/// Properties flags
as_prop_flags _flags;
@@ -178,6 +179,7 @@
///
class GetterSetterProperty: public Property
{
+protected: // For use in DestructiveGetterSetterProperty
/// Actual Getter / Setter (the workhorse)
GetterSetter _getset;
@@ -232,6 +234,77 @@
}
};
+/// A destructive Getter/Setter property.
+///
+/// Just like a regular Getter/Setter property, but you only get one chance
+/// to call its getValue -- it then becomes a simple property whose value is
+/// the value returned by getValue.
+///
+class DestructiveGetterSetterProperty : public GetterSetterProperty
+{
+private:
+ mutable bool mDestroyed;
+ mutable as_value mValue;
+
+public:
+ /// Construct a DestructiveGetterSetterProperty
+ DestructiveGetterSetterProperty(const GetterSetter& getset)
+ :
+ GetterSetterProperty(getset),
+ mDestroyed(false),
+ mValue()
+ {/**/}
+
+ /// Allow specific flags.
+ DestructiveGetterSetterProperty(const GetterSetter& getset,
+ const as_prop_flags& flags)
+ :
+ GetterSetterProperty(getset, flags),
+ mDestroyed(false),
+ mValue()
+ {/**/}
+
+ /// Copy constructor
+ DestructiveGetterSetterProperty(const DestructiveGetterSetterProperty&
o)
+ :
+ GetterSetterProperty(o),
+ mDestroyed(o.mDestroyed),
+ mValue(o.mValue)
+ {/**/}
+
+ Property* clone() const
+ {
+ if (mDestroyed)
+ return new SimpleProperty(mValue, _flags);
+ return new DestructiveGetterSetterProperty(*this);
+ }
+
+ /// The point of the destructive type: Only call getter once.
+ as_value getValue(as_object& this_ptr) const
+ {
+ if (!mDestroyed)
+ {
+ mDestroyed = true; // Be sure we can set in get if we
like.
+ mValue = _getset.getValue(&this_ptr);
+ }
+ return mValue;
+ }
+
+ /// Set the value (destroys)
+ void setValue(as_object& /*this_ptr*/, const as_value &value)
+ {
+ // Destroy, if not already.
+ mValue = value;
+ mDestroyed = true;
+ }
+
+ /// Set GetterSetter, mValue as reachable (for GC)
+ void setReachable() const
+ {
+ _getset.setReachable();
+ mValue.setReachable();
+ }
+};
} // namespace gnash
Index: server/PropertyList.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/PropertyList.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/PropertyList.cpp 19 Sep 2007 14:20:48 -0000 1.19
+++ server/PropertyList.cpp 23 Sep 2007 08:48:17 -0000 1.20
@@ -262,6 +262,20 @@
return true;
}
+bool
+PropertyList::addDestructiveGetterSetter(string_table::key key,
+ as_function& getter, as_function& setter)
+{
+ iterator found = _props.find(key);
+ if (found != _props.end())
+ return false; // Already exists.
+
+ DestructiveGetterSetterProperty* prop =
+ new DestructiveGetterSetterProperty(GetterSetter(getter,
setter));
+ _props[key] = prop;
+ return true;
+}
+
void
PropertyList::clear()
{
Index: server/PropertyList.h
===================================================================
RCS file: /sources/gnash/gnash/server/PropertyList.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/PropertyList.h 16 Sep 2007 16:48:13 -0000 1.17
+++ server/PropertyList.h 23 Sep 2007 08:48:17 -0000 1.18
@@ -241,6 +241,24 @@
bool addGetterSetter(string_table::key key, as_function& getter,
as_function& setter);
+ /// \brief
+ /// Add a destructive getter/setter property, if not already extant.
+ ///
+ /// @param key
+ /// Name of the property. Case-sensitive search.
+ ///
+ /// @param getter
+ /// A function to invoke when this property value is requested.
+ ///
+ /// @param setter
+ /// A function to invoke when setting this property's value.
+ ///
+ /// @return true if the property was successfully added, false
+ /// otherwise.
+ ///
+ bool addDestructiveGetterSetter(string_table::key key,
+ as_function& getter, as_function& setter);
+
/// Set the flags of a property.
//
/// @param key
Index: server/as_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_function.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/as_function.cpp 19 Sep 2007 14:20:48 -0000 1.41
+++ server/as_function.cpp 23 Sep 2007 08:48:17 -0000 1.42
@@ -31,6 +31,7 @@
#include "GnashException.h"
#include "VM.h"
#include "Object.h" // for getObjectInterface
+#include "namedStrings.h"
#include <typeinfo>
#include <iostream>
@@ -72,7 +73,6 @@
static boost::intrusive_ptr<as_object> proto;
if ( proto.get() == NULL ) {
-
// Initialize Function prototype
proto = new as_object(getObjectInterface());
VM::get().addStatic(proto.get());
@@ -140,7 +140,7 @@
// this function should likely return the *new*
// prototype, not the old !!
as_value proto;
- get_member(as_object::PROP_PROTOTYPE, &proto);
+ get_member(NSV::PROP_PROTOTYPE, &proto);
return proto.to_object();
}
@@ -354,7 +354,7 @@
// a literal string in lowercase. (we should likely avoid
calling
// get_member as a whole actually, and use a getProto() or
similar
// method directly instead) TODO
- bool func_has_prototype = get_member(as_object::PROP_PROTOTYPE,
&proto);
+ bool func_has_prototype = get_member(NSV::PROP_PROTOTYPE,
&proto);
assert(func_has_prototype);
IF_VERBOSE_ACTION (
Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- server/as_object.cpp 19 Sep 2007 14:20:49 -0000 1.63
+++ server/as_object.cpp 23 Sep 2007 08:48:17 -0000 1.64
@@ -35,7 +35,7 @@
#include <string>
#include <boost/algorithm/string/case_conv.hpp>
#include <utility> // for std::pair
-
+#include "namedStrings.h"
// Anonymous namespace used for module-static defs
namespace {
@@ -64,7 +64,7 @@
///
void operator() (string_table::key name, const as_value& val)
{
- if (name == as_object::PROP_uuPROTOuu) return;
+ if (name == NSV::PROP_uuPROTOuu) return;
//log_msg(_("Setting member '%s' to value '%s'"), name.c_str(),
val.to_debug_string().c_str());
_tgt.set_member(name, val);
}
@@ -120,7 +120,7 @@
as_object::findProperty(string_table::key key)
{
// don't enter an infinite loop looking for __proto__ ...
- if (key == as_object::PROP_uuPROTOuu)
+ if (key == NSV::PROP_uuPROTOuu)
{
return _members.getProperty(key);
}
@@ -147,7 +147,7 @@
as_object::findGetterSetter(string_table::key key)
{
// don't enter an infinite loop looking for __proto__ ...
- if (key == as_object::PROP_uuPROTOuu)
+ if (key == NSV::PROP_uuPROTOuu)
{
Property* prop = _members.getProperty(key);
if ( ! prop ) return NULL;
@@ -181,7 +181,7 @@
void
as_object::set_prototype(boost::intrusive_ptr<as_object> proto, int flags)
{
- static string_table::key key = as_object::PROP_uuPROTOuu;
+ static string_table::key key = NSV::PROP_uuPROTOuu;
// TODO: check what happens if __proto__ is set as a user-defined
getter/setter
if (_members.setValue(key, as_value(proto.get()), *this) )
@@ -304,6 +304,18 @@
assert(success);
}
+bool
+as_object::init_destructive_property(string_table::key key, as_function&
getter,
+ as_function& setter, int flags)
+{
+ bool success;
+
+ // No case check, since we've already got the key.
+ success = _members.addDestructiveGetterSetter(key, getter, setter);
+ _members.setFlags(key, flags, 0);
+ return success;
+}
+
void
as_object::init_readonly_property(const std::string& key, as_function& getter,
int initflags)
{
@@ -613,7 +625,7 @@
boost::intrusive_ptr<as_object>
as_object::get_prototype()
{
- static string_table::key key = as_object::PROP_uuPROTOuu;
+ static string_table::key key = NSV::PROP_uuPROTOuu;
as_value tmp;
// I don't think any subclass should override getting __proto__
anyway...
//if ( ! get_member(key, &tmp) ) return NULL;
Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- server/as_object.h 19 Sep 2007 14:20:49 -0000 1.70
+++ server/as_object.h 23 Sep 2007 08:48:17 -0000 1.71
@@ -70,76 +70,6 @@
public ref_counted
#endif
{
-public:
- typedef enum
- {
- PROP_ADD_LISTENER = 1,
- PROP_ALIGN,
- PROP_uALPHA,
- PROP_BLOCK_INDENT,
- PROP_BOLD,
- PROP_BROADCAST_MESSAGE,
- PROP_BULLET,
- PROP_CALLEE,
- PROP_COLOR,
- PROP_CONSTRUCTOR,
- PROP_uuCONSTRUCTORuu,
- PROP_uCURRENTFRAME,
- PROP_uDROPTARGET,
- PROP_ENABLED,
- PROP_uFOCUSRECT,
- PROP_uFRAMESLOADED,
- PROP_uHEIGHT,
- PROP_uHIGHQUALITY,
- PROP_HTML_TEXT,
- PROP_INDENT,
- PROP_ITALIC,
- PROP_LEADING,
- PROP_LEFT_MARGIN,
- PROP_LENGTH,
- PROP_uLISTENERS,
- PROP_LOADED,
- PROP_uNAME,
- PROP_ON_LOAD,
- PROP_ON_RESIZE,
- PROP_ON_ROLL_OUT,
- PROP_ON_ROLL_OVER,
- PROP_ON_SELECT,
- PROP_ON_STATUS,
- PROP_uPARENT,
- PROP_uuPROTOuu,
- PROP_PROTOTYPE,
- PROP_PUSH,
- PROP_REMOVE_LISTENER,
- PROP_RIGHT_MARGIN,
- PROP_uROTATION,
- PROP_SCALE_MODE,
- PROP_SIZE,
- PROP_uSOUNDBUFTIME,
- PROP_SPLICE,
- PROP_iSTAGE,
- PROP_STATUS,
- PROP_uTARGET,
- PROP_TEXT,
- PROP_TEXT_COLOR,
- PROP_TEXT_WIDTH,
- PROP_TO_STRING,
- PROP_uTOTALFRAMES,
- PROP_UNDERLINE,
- PROP_uURL,
- PROP_VALUE_OF,
- PROP_uVISIBLE,
- PROP_uWIDTH,
- PROP_X,
- PROP_uX,
- PROP_uXMOUSE,
- PROP_uXSCALE,
- PROP_Y,
- PROP_uY,
- PROP_uYMOUSE,
- PROP_uYSCALE
- } standard_properties;
-
private:
/// Properties of this objects
PropertyList _members;
@@ -305,6 +235,34 @@
as_function& setter, int
flags=as_prop_flags::dontDelete|as_prop_flags::dontEnum);
/// \brief
+ /// Initialize a destructive getter/setter property
+ ///
+ /// A destructive getter/setter can be used as a place holder for the
real
+ /// value of a property. As soon as getValue is invoked on the getter,
+ /// it destroys itself after setting its property to the return value of
+ /// getValue.
+ ///
+ /// @param key
+ /// Name of the property.
+ /// Will be converted to lowercase if VM is initialized for SWF6 or
lower.
+ ///
+ /// @param getter
+ /// A function to invoke when this property value is requested.
+ /// add_ref will be called on the function.
+ ///
+ /// @param setter
+ /// A function to invoke when setting this property's value.
+ /// add_ref will be called on the function.
+ ///
+ /// @param flags
+ /// Flags for the new member. By default dontDelete and dontEnum.
+ /// See as_prop_flags::Flags.
+ ///
+ ///
+ bool init_destructive_property(string_table::key key, as_function&
getter,
+ as_function& setter, int flags=as_prop_flags::dontEnum);
+
+ /// \brief
/// Use this method for read-only properties.
//
/// This method achieves the same as the above init_property method.
Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- server/as_value.cpp 19 Sep 2007 14:20:49 -0000 1.75
+++ server/as_value.cpp 23 Sep 2007 08:48:17 -0000 1.76
@@ -33,6 +33,7 @@
#include "Boolean.h" // for automatic as_value::BOOLEAN => Boolean as object
#include "action.h" // for call_method0
#include "utility.h" // for typeName()
+#include "namedStrings.h"
#include <boost/algorithm/string/case_conv.hpp>
@@ -135,7 +136,7 @@
bool gotValidToStringResult = false;
if ( env )
{
- string_table::key methodname =
as_object::PROP_TO_STRING;
+ string_table::key methodname =
NSV::PROP_TO_STRING;
as_value method;
if ( obj->get_member(methodname, &method) )
{
@@ -211,7 +212,7 @@
if ( m_type == OBJECT || m_type == AS_FUNCTION )
{
as_object* obj = m_object_value;
- string_table::key methodname = as_object::PROP_VALUE_OF;
+ string_table::key methodname = NSV::PROP_VALUE_OF;
as_value method;
if ( obj->get_member(methodname, &method) )
{
@@ -290,7 +291,7 @@
as_object* obj = m_object_value;
if ( env )
{
- string_table::key methodname =
as_object::PROP_VALUE_OF;
+ string_table::key methodname =
NSV::PROP_VALUE_OF;
as_value method;
if (obj->get_member(methodname, &method) )
{
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -b -r1.120 -r1.121
--- server/edit_text_character.cpp 20 Sep 2007 15:44:41 -0000 1.120
+++ server/edit_text_character.cpp 23 Sep 2007 08:48:17 -0000 1.121
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: edit_text_character.cpp,v 1.120 2007/09/20 15:44:41 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.121 2007/09/23 08:48:17 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -37,6 +37,7 @@
#include "builtin_function.h" // for getter/setter properties
#include "font.h" // for using the _font member
#include "Object.h" // for getObjectInterface
+#include "namedStrings.h"
#include <algorithm>
#include <string>
@@ -773,14 +774,14 @@
{
default:
break;
- case as_object::PROP_TEXT:
+ case NSV::PROP_TEXT:
//if (name == "text")
{
int version =
get_parent()->get_movie_definition()->get_version();
set_text_value(val.to_string_versioned(version).c_str());
return;
}
- case as_object::PROP_HTML_TEXT:
+ case NSV::PROP_HTML_TEXT:
//if (name == "htmlText")
{
int version =
get_parent()->get_movie_definition()->get_version();
@@ -788,7 +789,7 @@
format_text();
return;
}
- case as_object::PROP_uX:
+ case NSV::PROP_uX:
//else if (name == "_x")
{
matrix m = get_matrix();
@@ -799,7 +800,7 @@
return;
}
- case as_object::PROP_uY:
+ case NSV::PROP_uY:
//else if (name == "_y")
{
matrix m = get_matrix();
@@ -810,7 +811,7 @@
return;
}
- case as_object::PROP_uWIDTH:
+ case NSV::PROP_uWIDTH:
{
float nw = PIXELS_TO_TWIPS(val.to_number()); // TODO: pass an
as_environment !
if ( _bounds.width() == nw )
@@ -850,7 +851,7 @@
return;
}
- case as_object::PROP_uHEIGHT:
+ case NSV::PROP_uHEIGHT:
{
float nh = PIXELS_TO_TWIPS(val.to_number()); // TODO: pass an
as_environment !
if ( _bounds.height() == nh )
@@ -890,13 +891,13 @@
return;
}
- case as_object::PROP_uVISIBLE:
+ case NSV::PROP_uVISIBLE:
//else if (name == "_visible")
{
set_visible(val.to_bool());
return;
}
- case as_object::PROP_uALPHA:
+ case NSV::PROP_uALPHA:
//else if (name == "_alpha")
{
// @@ TODO this should be generic to class character!
@@ -925,25 +926,25 @@
{
default:
break;
- case as_object::PROP_TEXT:
+ case NSV::PROP_TEXT:
//if (name == "text")
{
val->set_string(get_text_value());
return true;
}
- case as_object::PROP_HTML_TEXT:
+ case NSV::PROP_HTML_TEXT:
//if (name == "htmlText")
{
val->set_string(get_text_value());
return true;
}
- case as_object::PROP_uVISIBLE:
+ case NSV::PROP_uVISIBLE:
//else if (name == "_visible")
{
val->set_bool(get_visible());
return true;
}
- case as_object::PROP_uALPHA:
+ case NSV::PROP_uALPHA:
//else if (name == "_alpha")
{
// @@ TODO this should be generic to class character!
@@ -951,21 +952,21 @@
val->set_double(cx.m_[3][0] * 100.f);
return true;
}
- case as_object::PROP_uX:
+ case NSV::PROP_uX:
//else if (name == "_x")
{
matrix m = get_matrix(); // @@ get_world_matrix()???
val->set_double(TWIPS_TO_PIXELS(m.m_[0][2]));
return true;
}
- case as_object::PROP_uY:
+ case NSV::PROP_uY:
//else if (name == "_y")
{
matrix m = get_matrix(); // @@ get_world_matrix()???
val->set_double(TWIPS_TO_PIXELS(m.m_[1][2]));
return true;
}
- case as_object::PROP_uWIDTH:
+ case NSV::PROP_uWIDTH:
{
val->set_double(TWIPS_TO_PIXELS(get_width()));
#ifdef GNASH_DEBUG_TEXTFIELDS
@@ -973,7 +974,7 @@
#endif // GNASH_DEBUG_TEXTFIELDS
return true;
}
- case as_object::PROP_uHEIGHT:
+ case NSV::PROP_uHEIGHT:
{
val->set_double(TWIPS_TO_PIXELS(get_height()));
#ifdef GNASH_DEBUG_TEXTFIELDS
@@ -981,7 +982,7 @@
#endif // GNASH_DEBUG_TEXTFIELDS
return true;
}
- case as_object::PROP_TEXT_WIDTH:
+ case NSV::PROP_TEXT_WIDTH:
//else if (name == "textWidth")
{
// Return the width, in pixels, of the text as laid out.
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -b -r1.96 -r1.97
--- server/movie_root.cpp 22 Sep 2007 08:21:12 -0000 1.96
+++ server/movie_root.cpp 23 Sep 2007 08:48:17 -0000 1.97
@@ -32,6 +32,7 @@
#include "Stage.h"
#include "utility.h"
#include "URL.h"
+#include "namedStrings.h"
#ifdef NEW_KEY_LISTENER_LIST_DESIGN
#include "action.h"
#endif
@@ -235,7 +236,7 @@
if ( ! VM::isInitialized() ) return NULL;
as_object* global = VM::get().getGlobal();
if ( ! global ) return NULL;
- if (!global->get_member(as_object::PROP_iSTAGE, &v) ) return NULL;
+ if (!global->get_member(NSV::PROP_iSTAGE, &v) ) return NULL;
return boost::dynamic_pointer_cast<Stage>(v.to_object());
}
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.356
retrieving revision 1.357
diff -u -b -r1.356 -r1.357
--- server/sprite_instance.cpp 22 Sep 2007 17:32:32 -0000 1.356
+++ server/sprite_instance.cpp 23 Sep 2007 08:48:18 -0000 1.357
@@ -52,6 +52,7 @@
#include "gnash.h" // for point class !
#include "Timeline.h" // for restoreDisplayList
#include "Object.h" // for getObjectInterface
+#include "namedStrings.h"
#include <vector>
#include <string>
@@ -954,7 +955,7 @@
float x = 0;
float y = 0;
- if ( ! obj->get_member(as_object::PROP_X, &tmp) )
+ if ( ! obj->get_member(NSV::PROP_X, &tmp) )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("MovieClip.globalToLocal(%s): "
@@ -965,7 +966,7 @@
}
x = PIXELS_TO_TWIPS(tmp.to_number(&fn.env()));
- if ( ! obj->get_member(as_object::PROP_Y, &tmp) )
+ if ( ! obj->get_member(NSV::PROP_Y, &tmp) )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("MovieClip.globalToLocal(%s): "
@@ -980,8 +981,8 @@
matrix world_mat = sprite->get_world_matrix();
world_mat.transform_by_inverse(pt);
- obj->set_member(as_object::PROP_X, TWIPS_TO_PIXELS(round(pt.m_x)));
- obj->set_member(as_object::PROP_Y, TWIPS_TO_PIXELS(round(pt.m_y)));
+ obj->set_member(NSV::PROP_X, TWIPS_TO_PIXELS(round(pt.m_x)));
+ obj->set_member(NSV::PROP_Y, TWIPS_TO_PIXELS(round(pt.m_y)));
return ret;
}
@@ -1016,7 +1017,7 @@
float x = 0;
float y = 0;
- if ( ! obj->get_member(as_object::PROP_X, &tmp) )
+ if ( ! obj->get_member(NSV::PROP_X, &tmp) )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("MovieClip.localToGlobal(%s): "
@@ -1027,7 +1028,7 @@
}
x = PIXELS_TO_TWIPS(tmp.to_number(&fn.env()));
- if ( ! obj->get_member(as_object::PROP_Y, &tmp) )
+ if ( ! obj->get_member(NSV::PROP_Y, &tmp) )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("MovieClip.localToGlobal(%s): "
@@ -1042,8 +1043,8 @@
matrix world_mat = sprite->get_world_matrix();
world_mat.transform(pt);
- obj->set_member(as_object::PROP_X, TWIPS_TO_PIXELS(round(pt.m_x)));
- obj->set_member(as_object::PROP_Y, TWIPS_TO_PIXELS(round(pt.m_y)));
+ obj->set_member(NSV::PROP_X, TWIPS_TO_PIXELS(round(pt.m_x)));
+ obj->set_member(NSV::PROP_Y, TWIPS_TO_PIXELS(round(pt.m_y)));
return ret;
@@ -3337,10 +3338,10 @@
//
if ( swfversion > 5 )
{
- set_member(as_object::PROP_uuCONSTRUCTORuu, ctor);
+ set_member(NSV::PROP_uuCONSTRUCTORuu, ctor);
if ( swfversion == 6 )
{
- set_member(as_object::PROP_CONSTRUCTOR, ctor);
+ set_member(NSV::PROP_CONSTRUCTOR, ctor);
}
}
}
@@ -3599,7 +3600,7 @@
as_value enabled;
// const_cast needed due to get_member being non-const due to the
// possibility that a getter-setter would actually modify us ...
- const_cast<sprite_instance*>(this)->get_member(as_object::PROP_ENABLED,
&enabled);
+ const_cast<sprite_instance*>(this)->get_member(NSV::PROP_ENABLED,
&enabled);
return enabled.to_bool();
}
Index: server/swf_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- server/swf_function.cpp 19 Sep 2007 14:20:49 -0000 1.35
+++ server/swf_function.cpp 23 Sep 2007 08:48:18 -0000 1.36
@@ -30,6 +30,7 @@
#include "VM.h" // for storing _global in a local register
#include "builtin_function.h" // for Function constructor
#include "Object.h" // for getObjectInterface
+#include "namedStrings.h"
#include <typeinfo>
#include <iostream>
@@ -87,7 +88,7 @@
// returning an as_function ?
//
as_value ctor;
- bool ret = proto->get_member(as_object::PROP_uuCONSTRUCTORuu, &ctor);
+ bool ret = proto->get_member(NSV::PROP_uuCONSTRUCTORuu, &ctor);
if ( ! ret )
{
#ifdef GNASH_DEBUG_GETSUPER
@@ -114,7 +115,7 @@
#endif
as_value ctor_proto;
- ret = ctor_obj->get_member(as_object::PROP_PROTOTYPE, &ctor_proto);
+ ret = ctor_obj->get_member(NSV::PROP_PROTOTYPE, &ctor_proto);
if ( ! ret )
{
@@ -154,7 +155,7 @@
{
arguments->push(fn.arg(i));
}
- arguments->set_member(as_object::PROP_CALLEE, &callee);
+ arguments->set_member(NSV::PROP_CALLEE, &callee);
return arguments;
Index: server/textformat.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/textformat.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- server/textformat.cpp 19 Sep 2007 14:20:49 -0000 1.29
+++ server/textformat.cpp 23 Sep 2007 08:48:18 -0000 1.30
@@ -17,12 +17,13 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: textformat.cpp,v 1.29 2007/09/19 14:20:49 cmusick Exp $
+// $Id: textformat.cpp,v 1.30 2007/09/23 08:48:18 cmusick Exp $
#include "log.h"
#include "textformat.h"
#include "fn_call.h"
#include "builtin_function.h" // for getter/setter properties
+#include "namedStrings.h"
namespace gnash {
@@ -165,63 +166,63 @@
//log_msg(_("Change from %f for %f characters for object at %p"), start,
end, obj);
// Check for the flags that could be set
- if (obj->get_member(as_object::PROP_UNDERLINE, &method)) {
+ if (obj->get_member(NSV::PROP_UNDERLINE, &method)) {
//log_msg(_("Underline exists and is set to %d"), method.to_bool());
obj->obj.underlinedSet(method.to_bool());
}
- if (obj->get_member(as_object::PROP_ITALIC, &method)) {
+ if (obj->get_member(NSV::PROP_ITALIC, &method)) {
//log_msg(_("Italic exists and is set to %d"), method.to_bool());
obj->obj.italicedSet(method.to_bool());
}
- if (obj->get_member(as_object::PROP_BOLD, &method)) {
+ if (obj->get_member(NSV::PROP_BOLD, &method)) {
//log_msg(_("Bold exists and is set to %d"), method.to_bool());
obj->obj.boldSet(method.to_bool());
}
- if (obj->get_member(as_object::PROP_BULLET, &method)) {
+ if (obj->get_member(NSV::PROP_BULLET, &method)) {
//log_msg(_("Bullet exists and is set to %d"), method.to_bool());
obj->obj.bulletSet(method.to_bool());
}
- if (obj->get_member(as_object::PROP_COLOR, &method)) {
+ if (obj->get_member(NSV::PROP_COLOR, &method)) {
//log_msg(_("Color exists and is set to %f", method.to_number());
obj->obj.colorSet((uint32_t)method.to_number());
}
- if (obj->get_member(as_object::PROP_INDENT, &method)) {
+ if (obj->get_member(NSV::PROP_INDENT, &method)) {
//log_msg(_("Indent exists and is set to %f"), method.to_number());
obj->obj.indentSet(float(method.to_number()));
}
- if (obj->get_member(as_object::PROP_ALIGN, &method)) {
+ if (obj->get_member(NSV::PROP_ALIGN, &method)) {
//log_msg(_("Align exists and is set to %s"), method.to_string());
const char* align = method.to_string().c_str();
if ( align ) obj->obj.alignSet(align);
}
- if (obj->get_member(as_object::PROP_BLOCK_INDENT, &method)) {
+ if (obj->get_member(NSV::PROP_BLOCK_INDENT, &method)) {
//log_msg(_("BlockIndent exists and is set to %f"), method.to_number());
obj->obj.blockIndentSet(float(method.to_number()));
}
- if (obj->get_member(as_object::PROP_LEADING, &method)) {
+ if (obj->get_member(NSV::PROP_LEADING, &method)) {
//log_msg(_("Leading exists and is set to %f"), method.to_number());
obj->obj.leadingSet(float(method.to_number()));
}
- if (obj->get_member(as_object::PROP_LEFT_MARGIN, &method)) {
+ if (obj->get_member(NSV::PROP_LEFT_MARGIN, &method)) {
//log_msg(_("LeftMargin exists and is set to %f"), method.to_number());
obj->obj.leftMarginSet(float(method.to_number()));
}
- if (obj->get_member(as_object::PROP_RIGHT_MARGIN, &method)) {
+ if (obj->get_member(NSV::PROP_RIGHT_MARGIN, &method)) {
//log_msg(_("RightMargin exists and is set to %f"), method.to_number());
obj->obj.rightMarginSet(float(method.to_number()));
}
- if (obj->get_member(as_object::PROP_SIZE, &method)) {
+ if (obj->get_member(NSV::PROP_SIZE, &method)) {
//log_msg(_("Size exists and is set to %f"), method.to_number());
obj->obj.sizeSet(float(method.to_number()));
}
Index: server/asobj/AsBroadcaster.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/AsBroadcaster.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/AsBroadcaster.cpp 19 Sep 2007 14:20:50 -0000 1.5
+++ server/asobj/AsBroadcaster.cpp 23 Sep 2007 08:48:18 -0000 1.6
@@ -29,6 +29,7 @@
#include "VM.h" // for getPlayerVersion()
#include "Object.h" // for getObjectInterface
#include "action.h" // for call_method
+#include "namedStrings.h"
#include <boost/algorithm/string/case_conv.hpp> // for PROPNAME
@@ -106,20 +107,20 @@
{
log_debug("Initializing object %p as an AsBroadcaster", (void*)&o);
// TODO: reserch on protection flags for these methods
- o.set_member(as_object::PROP_ADD_LISTENER, new
builtin_function(AsBroadcaster::addListener_method));
- o.set_member(as_object::PROP_REMOVE_LISTENER, new
builtin_function(AsBroadcaster::removeListener_method));
- o.set_member(as_object::PROP_BROADCAST_MESSAGE, new
builtin_function(AsBroadcaster::broadcastMessage_method));
- o.set_member(as_object::PROP_uLISTENERS, new as_array_object());
+ o.set_member(NSV::PROP_ADD_LISTENER, new
builtin_function(AsBroadcaster::addListener_method));
+ o.set_member(NSV::PROP_REMOVE_LISTENER, new
builtin_function(AsBroadcaster::removeListener_method));
+ o.set_member(NSV::PROP_BROADCAST_MESSAGE, new
builtin_function(AsBroadcaster::broadcastMessage_method));
+ o.set_member(NSV::PROP_uLISTENERS, new as_array_object());
#ifndef NDEBUG
as_value tmp;
- assert(o.get_member(as_object::PROP_uLISTENERS, &tmp));
+ assert(o.get_member(NSV::PROP_uLISTENERS, &tmp));
assert(tmp.is_object());
- assert(o.get_member(as_object::PROP_ADD_LISTENER, &tmp));
+ assert(o.get_member(NSV::PROP_ADD_LISTENER, &tmp));
assert(tmp.is_function());
- assert(o.get_member(as_object::PROP_REMOVE_LISTENER, &tmp));
+ assert(o.get_member(NSV::PROP_REMOVE_LISTENER, &tmp));
assert(tmp.is_function());
- assert(o.get_member(as_object::PROP_BROADCAST_MESSAGE, &tmp));
+ assert(o.get_member(NSV::PROP_BROADCAST_MESSAGE, &tmp));
assert(tmp.is_function());
#endif
}
@@ -164,7 +165,7 @@
as_value newListener; assert(newListener.is_undefined());
if ( fn.nargs ) newListener = fn.arg(0);
- obj->callMethod(as_object::PROP_REMOVE_LISTENER, fn.env(), newListener);
+ obj->callMethod(NSV::PROP_REMOVE_LISTENER, fn.env(), newListener);
as_value listenersValue;
@@ -172,7 +173,7 @@
// inheritance chain in case it's own property _listeners
// has been deleted while another one is found in any base
// class.
- if ( ! obj->get_member(as_object::PROP_uLISTENERS, &listenersValue) )
+ if ( ! obj->get_member(NSV::PROP_uLISTENERS, &listenersValue) )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object has no
_listeners member"),
@@ -205,7 +206,7 @@
fn.dump_args().c_str(),
listenersValue.to_debug_string().c_str());
);
- listenersObj->callMethod(as_object::PROP_PUSH, fn.env(),
newListener);
+ listenersObj->callMethod(NSV::PROP_PUSH, fn.env(), newListener);
}
else
@@ -229,7 +230,7 @@
// inheritance chain in case it's own property _listeners
// has been deleted while another one is found in any base
// class.
- if (!obj->get_member(as_object::PROP_uLISTENERS, &listenersValue) )
+ if (!obj->get_member(NSV::PROP_uLISTENERS, &listenersValue) )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object has no
_listeners member"),
@@ -266,7 +267,7 @@
);
// TODO: implement brute force scan of pseudo-array
- unsigned int length =
listenersObj->getMember(as_object::PROP_LENGTH).to_int(fn.env());
+ unsigned int length =
listenersObj->getMember(NSV::PROP_LENGTH).to_int(fn.env());
for (unsigned int i=0; i<length; ++i)
{
as_value iVal(i);
@@ -274,7 +275,7 @@
as_value v =
listenersObj->getMember(VM::get().getStringTable().find(n));
if ( v.equals(listenerToRemove, fn.env()) )
{
-
listenersObj->callMethod(as_object::PROP_SPLICE, fn.env(), iVal, as_value(1));
+ listenersObj->callMethod(NSV::PROP_SPLICE,
fn.env(), iVal, as_value(1));
return as_value(true);
}
}
@@ -303,7 +304,7 @@
// inheritance chain in case it's own property _listeners
// has been deleted while another one is found in any base
// class.
- if ( ! obj->get_member(as_object::PROP_uLISTENERS, &listenersValue) )
+ if ( ! obj->get_member(NSV::PROP_uLISTENERS, &listenersValue) )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object has no
_listeners member"),
Index: server/asobj/ContextMenu.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/ContextMenu.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/asobj/ContextMenu.cpp 19 Sep 2007 14:20:50 -0000 1.17
+++ server/asobj/ContextMenu.cpp 23 Sep 2007 08:48:18 -0000 1.18
@@ -29,6 +29,7 @@
#include "builtin_function.h" // need builtin_function
#include "GnashException.h"
#include "Object.h" // for getObjectInterface
+#include "namedStrings.h"
namespace gnash {
@@ -73,7 +74,7 @@
as_function* getCallback()
{
as_value tmp;
- if (get_member(as_object::PROP_ON_SELECT, &tmp))
+ if (get_member(NSV::PROP_ON_SELECT, &tmp))
return tmp.to_as_function();
else return NULL;
}
@@ -86,7 +87,7 @@
///
void setCallback(const as_value& callback)
{
- set_member(as_object::PROP_ON_SELECT, callback);
+ set_member(NSV::PROP_ON_SELECT, callback);
}
/// Attach the exported interface of this ActionScript class
Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- server/asobj/Global.cpp 11 Sep 2007 17:01:23 -0000 1.68
+++ server/asobj/Global.cpp 23 Sep 2007 08:48:18 -0000 1.69
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: Global.cpp,v 1.68 2007/09/11 17:01:23 strk Exp $ */
+/* $Id: Global.cpp,v 1.69 2007/09/23 08:48:18 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -65,6 +65,7 @@
#include "builtin_function.h"
#include "edit_text_character.h"
#include "rc.h"
+#include "ClassHierarchy.h"
#include "fn_call.h"
#include "sprite_instance.h"
@@ -378,53 +379,41 @@
init_member("setInterval", new builtin_function(timer_setinterval));
init_member("clearInterval", new builtin_function(timer_clearinterval));
- // System was added in Player Version 6, but
- // seem to be available even if SWF target version is
- // inferior
- system_class_init(*this); // System and System.capabilities
-
- // I find Stage object used in SWF5 movies, don't
- // see a good reason not to enable this always
- stage_class_init(*this);
+// If extensions aren't used, then no extensions will be loaded.
+#ifdef USE_EXTENSIONS
+ ClassHierarchy CH(this, &et);
+#else
+ ClassHierarchy CH(this, NULL);
+#endif
+ CH.massDeclare(vm.getSWFVersion());
+
+ if (vm.getSWFVersion() >= 5)
+ {
+ object_class_init(*this);
+ array_class_init(*this);
+ }
+ if (vm.getSWFVersion() >= 6)
+ {
+ function_class_init(*this);
+ }
if ( vm.getSWFVersion() < 3 ) goto extscan;
//-----------------------
// SWF3
//-----------------------
- movieclip_class_init(*this);
- textfield_class_init(*this);
-
if ( vm.getSWFVersion() < 4 ) goto extscan;
//-----------------------
// SWF4
//-----------------------
init_member("trace", new builtin_function(as_global_trace));
- // The methods of the Math class are available
- // as global methods in SWF4 and as members of
- // the Math class from SWF5 up
- math_class_init(*this);
if ( vm.getSWFVersion() < 5 ) goto extscan;
//-----------------------
// SWF5
//-----------------------
- boolean_class_init(*this);
- color_class_init(*this);
- selection_class_init(*this); // Selection
- sound_class_init(*this);
- xmlsocket_class_init(*this);
- date_class_init(*this);
- xml_class_init(*this);
- xmlnode_class_init(*this);
- mouse_class_init(*this);
- object_class_init(*this);
- number_class_init(*this);
- string_class_init(*this);
- array_class_init(*this);
- key_class_init(*this); // Key
init_member("escape", new builtin_function(as_global_escape));
init_member("unescape", new builtin_function(as_global_unescape));
init_member("parseFloat", new builtin_function(as_global_parsefloat));
@@ -438,40 +427,18 @@
init_member("NaN", as_value(NAN));
init_member("Infinity", as_value(INFINITY));
- // TODO: check if this is available in SWF4
- // (for SWF5 it just exists as a useless function, it seems)
- AsBroadcaster_init(*this);
-
if ( vm.getSWFVersion() < 6 ) goto extscan;
//-----------------------
// SWF6
//-----------------------
- function_class_init(*this);
- // See: http://sephiroth.it/reference.php?id=717&cat=1
- textsnapshot_class_init(*this);
init_member("LocalConnection", new
builtin_function(localconnection_new));
init_member("TextFormat", new builtin_function(textformat_new));
- video_class_init(*this); // Video
- camera_class_init(*this); // Camera
- microphone_class_init(*this); // Microphone
- sharedobject_class_init(*this);
- loadvars_class_init(*this);
- customactions_class_init(*this);
if ( vm.getSWFVersion() < 7 ) goto extscan;
//-----------------------
// SWF7
//-----------------------
- netconnection_class_init(*this);
- netstream_class_init(*this);
- contextmenu_class_init(*this);
- moviecliploader_class_init(*this);
- // sephiroth.it refers this to be introduced in SWF7
- // but empirical checks seem to confirm it's also avaiable in SWF6
- // if player is >= 7
- error_class_init(*this);
-
if ( vm.getSWFVersion() < 8 ) goto extscan;
//-----------------------
// SWF8
Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- server/asobj/Makefile.am 11 Sep 2007 17:01:23 -0000 1.44
+++ server/asobj/Makefile.am 23 Sep 2007 08:48:18 -0000 1.45
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-# $Id: Makefile.am,v 1.44 2007/09/11 17:01:23 strk Exp $
+# $Id: Makefile.am,v 1.45 2007/09/23 08:48:18 cmusick Exp $
AUTOMAKE_OPTIONS =
@@ -49,6 +49,7 @@
Boolean.cpp \
BlurFilter_as.cpp \
Camera.cpp \
+ ClassHierarchy.cpp \
Color.cpp \
ColorMatrixFilter_as.cpp \
ContextMenu.cpp \
@@ -92,6 +93,7 @@
Boolean.h \
BlurFilter_as.h \
Camera.h \
+ ClassHierarchy.h \
Color.h \
ColorMatrixFilter_as.h \
ContextMenu.h \
Index: server/asobj/NetStream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- server/asobj/NetStream.cpp 19 Sep 2007 14:20:50 -0000 1.73
+++ server/asobj/NetStream.cpp 23 Sep 2007 08:48:18 -0000 1.74
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: NetStream.cpp,v 1.73 2007/09/19 14:20:50 cmusick Exp $ */
+/* $Id: NetStream.cpp,v 1.74 2007/09/23 08:48:18 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -38,7 +38,7 @@
#include "action.h" // for call_method
#include "render.h" // for gnash::render::videoFrameFormat()
#include "Object.h" // for getObjectInterface
-
+#include "namedStrings.h"
#include "movie_root.h"
// Define the following macro to have status notification handling debugged
@@ -456,7 +456,7 @@
{
// TODO: check for System.onStatus too ! use a private
getStatusHandler() method for this.
as_value status;
- if (!get_member(as_object::PROP_ON_STATUS, &status) || !
status.is_function())
+ if (!get_member(NSV::PROP_ON_STATUS, &status) || ! status.is_function())
{
clearStatusQueue();
return;
Index: server/asobj/Stage.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- server/asobj/Stage.cpp 19 Sep 2007 14:20:50 -0000 1.22
+++ server/asobj/Stage.cpp 23 Sep 2007 08:48:18 -0000 1.23
@@ -29,6 +29,7 @@
#include "builtin_function.h" // need builtin_function
#include "VM.h"
#include "Object.h" // for getObjectInterface()
+#include "namedStrings.h"
#include <string>
@@ -70,7 +71,7 @@
Stage::onResize(as_environment* env)
{
as_value v;
- if (get_member(as_object::PROP_SCALE_MODE, &v) && v.to_string(env) ==
"noScale" )
+ if (get_member(NSV::PROP_SCALE_MODE, &v) && v.to_string(env) ==
"noScale" )
{
notifyResize(env);
}
@@ -92,7 +93,7 @@
Stage::notifyResize(boost::intrusive_ptr<as_object> obj, as_environment* env)
{
as_value method;
- if ( ! obj->get_member(as_object::PROP_ON_RESIZE, &method) ) {
+ if ( ! obj->get_member(NSV::PROP_ON_RESIZE, &method) ) {
// nothing to do
return;
}
Index: server/asobj/xml.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- server/asobj/xml.cpp 19 Sep 2007 14:20:50 -0000 1.46
+++ server/asobj/xml.cpp 23 Sep 2007 08:48:18 -0000 1.47
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: xml.cpp,v 1.46 2007/09/19 14:20:50 cmusick Exp $ */
+/* $Id: xml.cpp,v 1.47 2007/09/23 08:48:18 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -39,6 +39,7 @@
#include "tu_file.h"
#include "URL.h"
#include "VM.h"
+#include "namedStrings.h"
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
@@ -135,12 +136,12 @@
bool
XML::get_member(string_table::key name, as_value *val)
{
- if (name == as_object::PROP_STATUS)
+ if (name == NSV::PROP_STATUS)
{
val->set_int(_status);
return true;
}
- else if (name == as_object::PROP_LOADED)
+ else if (name == NSV::PROP_LOADED)
{
if ( _loaded < 0 ) val->set_undefined();
else val->set_bool(_loaded);
@@ -153,12 +154,12 @@
void
XML::set_member(string_table::key name, const as_value& val)
{
- if (name == as_object::PROP_STATUS)
+ if (name == NSV::PROP_STATUS)
{
_status = XML::Status(val.to_number());
return;
}
- else if (name == as_object::PROP_LOADED)
+ else if (name == NSV::PROP_LOADED)
{
bool b = val.to_bool();
log_msg(_("set_member 'loaded' (%s) became boolean %d"),
val.to_debug_string().c_str(), b);
Index: server/parser/abc_block.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/abc_block.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/parser/abc_block.cpp 22 Sep 2007 12:29:06 -0000 1.3
+++ server/parser/abc_block.cpp 23 Sep 2007 08:48:19 -0000 1.4
@@ -228,15 +228,19 @@
// 0th is used as a no-op.
uint32_t multinamePoolCount = in->read_V32();
+ // Any two namespaces with the same uri here are the same namespace,
+ // excepting private nameSpaces. This will be handled at verify time.
+ // TODO: Handle this.
mMultinamePool.resize(multinamePoolCount);
for (unsigned int i = 1; i < multinamePoolCount; ++i)
{
uint8_t kind = in->read_u8();
- mMultinamePool[i].mKind =
static_cast<abc_Multiname::kinds>(kind);
uint32_t ns = 0;
uint32_t name = 0;
uint32_t nsset = 0;
+ mMultinamePool[i].mFlags = 0;
+
// Read, but don't upper validate until after the switch
switch (kind)
{
@@ -245,17 +249,29 @@
{
ns = in->read_V32();
name = in->read_V32();
+ mMultinamePool[i].mFlags |= abc_Multiname::FLAG_QNAME;
+ if (kind == abc_Multiname::KIND_QnameA)
+ mMultinamePool[i].mFlags |=
abc_Multiname::FLAG_ATTR;
break;
}
case abc_Multiname::KIND_RTQname:
case abc_Multiname::KIND_RTQnameA:
{
name = in->read_V32();
+ mMultinamePool[i].mFlags |= abc_Multiname::FLAG_QNAME
+ | abc_Multiname::FLAG_RTNS;
+ if (kind == abc_Multiname::KIND_RTQnameA)
+ mMultinamePool[i].mFlags |=
abc_Multiname::FLAG_ATTR;
break;
}
case abc_Multiname::KIND_RTQnameL:
case abc_Multiname::KIND_RTQnameLA:
{
+ mMultinamePool[i].mFlags |= abc_Multiname::FLAG_QNAME
+ | abc_Multiname::FLAG_RTNAME
+ | abc_Multiname::FLAG_RTNS;
+ if (kind == abc_Multiname::KIND_RTQnameLA)
+ mMultinamePool[i].mFlags |=
abc_Multiname::FLAG_ATTR;
break;
}
case abc_Multiname::KIND_Multiname:
@@ -269,6 +285,9 @@
ERR((_("Action Block: 0 selection for namespace
set is invalid.\n")));
return false;
}
+ mMultinamePool[i].mFlags |= abc_Multiname::FLAG_NSSET;
+ if (kind == abc_Multiname::KIND_MultinameA)
+ mMultinamePool[i].mFlags |=
abc_Multiname::FLAG_ATTR;
break;
}
case abc_Multiname::KIND_MultinameL:
@@ -281,6 +300,10 @@
ERR((_("Action Block: 0 selection for namespace
set is invalid.\n")));
return false;
}
+ mMultinamePool[i].mFlags |= abc_Multiname::FLAG_RTNAME
+ | abc_Multiname::FLAG_NSSET;
+ if (kind == abc_Multiname::KIND_MultinameLA)
+ mMultinamePool[i].mFlags |=
abc_Multiname::FLAG_ATTR;
break;
}
default:
@@ -415,18 +438,43 @@
return false; // Name out of bounds.
}
instance.mName = &mMultinamePool[index];
+ // This must be a QName, not some other type.
+ if (!(instance.mName->mFlags & abc_Multiname::FLAG_QNAME))
+ {
+ ERR((_("Action Block: Qname required for
instance.\n")));
+ return false; // Name not Qname
+ }
uint32_t super_index = in->read_V32();
if (!super_index)
instance.mSuperType = NULL;
else if (super_index >= mMultinamePool.size())
{
- ERR((_("Action Block: Out of Bound super type
(%d).\n"), index));
+ ERR((_("Action Block: Out of Bound super type
(%d).\n"), super_index));
return false; // Bad index.
}
else
instance.mSuperType = &mMultinamePool[super_index];
+ as_object *global = VM::get().getGlobal();
+ as_value vstore;
+ if (super_index &&
!global->get_member(instance.mSuperType->mName, &vstore))
+ {
+ ERR((_("Action Block: Non-existent super type (%d).\n"),
+ super_index));
+ fprintf(stderr, "Super type doesn't exist, but
continuing (%s).\n",
+
mStringTable->value(instance.mSuperType->mName).c_str());
+ //return false;
+ }
+
+ // vstore now contains the object (we hope) which is the class
that
+ // we want to be the super of this instance.
+ if (!vstore.is_object())
+ {
+ ERR((_("Action Block: Super prospect is not an
object.\n")));
+ //return false;
+ }
+
uint8_t flags = in->read_u8();
instance.mFlags = static_cast<abc_Instance::flags> (flags);
@@ -479,6 +527,16 @@
if (!instance.mTraits[j].read(in))
return false;
}
+
+ // And now we add this instance to the type names of the VM...
+ // TODO: Quit faking!
+ as_value fake;
+ if (global->get_member(instance.mName->mName, &fake))
+ {
+ fprintf(stderr, "Already registered, but doing it
again?"
+ "Type is %s\n",
mStringTable->value(instance.mName->mName).c_str());
+ }
+ global->set_member(instance.mName->mName, as_value(2));
} // end of instances list
// Now the classes are read. TODO: Discover what these do.
@@ -556,7 +614,7 @@
// And the code:
method.mCode.resize(code_length);
unsigned int got_length;
- if ((got_length = in->read(&method.mCode.front(), code_length))
!= code_length)
+ if ((got_length = in->read(method.mCode.data(), code_length))
!= code_length)
{
ERR((_("Action Block: Not enough body. Wanted %d but
got %d.\n"),
code_length, got_length));
@@ -612,6 +670,9 @@
}
} // End of method bodies
+ // Everything has been read. It needs to be verified, with symbol tables
+ // built to make it all run.
+
// If flow reaches here, everything went fine.
return true;
}
Index: server/parser/abc_block.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/abc_block.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/parser/abc_block.h 21 Sep 2007 13:40:32 -0000 1.2
+++ server/parser/abc_block.h 23 Sep 2007 08:48:19 -0000 1.3
@@ -56,8 +56,16 @@
KIND_MultinameL = 0x1B,
KIND_MultinameLA = 0x1C
} kinds;
+ typedef enum
+ {
+ FLAG_ATTR = 0x01,
+ FLAG_QNAME = 0x02,
+ FLAG_RTNS = 0x04,
+ FLAG_RTNAME = 0x08,
+ FLAG_NSSET = 0x10
+ } flags;
- kinds mKind;
+ uint8_t mFlags;
string_table::key mName;
Namespace* mNamespace;
std::vector<Namespace*> *mNamespaceSet;
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -b -r1.135 -r1.136
--- server/vm/ASHandlers.cpp 19 Sep 2007 14:20:50 -0000 1.135
+++ server/vm/ASHandlers.cpp 23 Sep 2007 08:48:19 -0000 1.136
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: ASHandlers.cpp,v 1.135 2007/09/19 14:20:50 cmusick Exp $ */
+/* $Id: ASHandlers.cpp,v 1.136 2007/09/23 08:48:19 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -49,6 +49,7 @@
#include "movie_root.h" // for set_drag_state (ActionStartDragMovie)
#include "debugger.h"
#include "sound_handler.h"
+#include "namedStrings.h"
#include <string>
#include <map>
@@ -2432,7 +2433,7 @@
// Calling super ?
boost::intrusive_ptr<as_object> obj = function.to_object();
this_ptr = thread.getThisPointer();
- if (!obj->get_member(as_object::PROP_CONSTRUCTOR, &function) )
+ if (!obj->get_member(NSV::PROP_CONSTRUCTOR, &function) )
{
IF_VERBOSE_ASCODING_ERRORS (
log_aserror(_("Object doensn't have a constructor"));
@@ -3065,7 +3066,7 @@
// TODO: all this crap should go into an
as_object::getConstructor instead
as_value ctor;
- if (!obj->get_member(as_object::PROP_CONSTRUCTOR,
&ctor) )
+ if (!obj->get_member(NSV::PROP_CONSTRUCTOR, &ctor) )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("ActionCallMethod: object has no
constructor"));
Index: server/vm/VM.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/vm/VM.cpp 19 Sep 2007 14:20:51 -0000 1.19
+++ server/vm/VM.cpp 23 Sep 2007 08:48:19 -0000 1.20
@@ -16,7 +16,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: VM.cpp,v 1.19 2007/09/19 14:20:51 cmusick Exp $ */
+/* $Id: VM.cpp,v 1.20 2007/09/23 08:48:19 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,6 +29,7 @@
#include "Global.h"
#include "tu_timer.h" // for tu_timer::get_ticks()
#include "rc.h" //for overriding default version string with rcfile
+#include "namedStrings.h"
#include <memory>
@@ -50,82 +51,7 @@
_singleton.reset(new VM(movie));
assert(_singleton.get());
-
-// Load up our pre-known properties.
-string_table::svt preload_properties[] =
-{
- { "addListener", as_object::PROP_ADD_LISTENER },
- { "align", as_object::PROP_ALIGN },
- { "_alpha", as_object::PROP_uALPHA },
- { "blockIndent", as_object::PROP_BLOCK_INDENT },
- { "bold", as_object::PROP_BOLD },
- { "broadcastMessage", as_object::PROP_BROADCAST_MESSAGE },
- { "bullet", as_object::PROP_BULLET },
- { "callee", as_object::PROP_CALLEE },
- { "color", as_object::PROP_COLOR },
- { "constructor", as_object::PROP_CONSTRUCTOR },
- { "__constructor__", as_object::PROP_uuCONSTRUCTORuu },
- { "_currentframe", as_object::PROP_uCURRENTFRAME },
- { "_droptarget", as_object::PROP_uDROPTARGET },
- { "enabled", as_object::PROP_ENABLED },
- { "_focusrect", as_object::PROP_uFOCUSRECT },
- { "_framesloaded", as_object::PROP_uFRAMESLOADED },
- { "_height", as_object::PROP_uHEIGHT },
- { "_highquality", as_object::PROP_uHIGHQUALITY },
- { "htmlText", as_object::PROP_HTML_TEXT },
- { "indent", as_object::PROP_INDENT },
- { "italic", as_object::PROP_ITALIC },
- { "leading", as_object::PROP_LEADING },
- { "left_margin", as_object::PROP_LEFT_MARGIN },
- { "length", as_object::PROP_LENGTH },
- { "_listeners", as_object::PROP_uLISTENERS },
- { "loaded", as_object::PROP_LOADED },
- { "_name", as_object::PROP_uNAME },
- { "onLoad", as_object::PROP_ON_LOAD },
- { "onResize", as_object::PROP_ON_RESIZE },
- { "onRollOut", as_object::PROP_ON_ROLL_OUT },
- { "onRollOver", as_object::PROP_ON_ROLL_OVER },
- { "onSelect", as_object::PROP_ON_SELECT },
- { "onStatus", as_object::PROP_ON_STATUS },
- { "_parent", as_object::PROP_uPARENT },
- { "__proto__", as_object::PROP_uuPROTOuu },
- { "prototype", as_object::PROP_PROTOTYPE },
- { "push", as_object::PROP_PUSH },
- { "removeListener", as_object::PROP_REMOVE_LISTENER },
- { "rightMargin", as_object::PROP_RIGHT_MARGIN },
- { "_rotation", as_object::PROP_uROTATION },
- { "scaleMode", as_object::PROP_SCALE_MODE },
- { "size", as_object::PROP_SIZE },
- { "_soundbuftime", as_object::PROP_uSOUNDBUFTIME },
- { "splice", as_object::PROP_SPLICE },
- { "Stage", as_object::PROP_iSTAGE },
- { "status", as_object::PROP_STATUS },
- { "_target", as_object::PROP_uTARGET },
- { "text", as_object::PROP_TEXT },
- { "textColor", as_object::PROP_TEXT_COLOR },
- { "textWidth", as_object::PROP_TEXT_WIDTH },
- { "toString", as_object::PROP_TO_STRING },
- { "_totalframes", as_object::PROP_uTOTALFRAMES },
- { "underline", as_object::PROP_UNDERLINE },
- { "_url", as_object::PROP_uURL },
- { "valueOf", as_object::PROP_VALUE_OF },
- { "_visible", as_object::PROP_uVISIBLE },
- { "_width", as_object::PROP_uWIDTH },
- { "x", as_object::PROP_X },
- { "_x", as_object::PROP_uX },
- { "_xmouse", as_object::PROP_uXMOUSE },
- { "_xscale", as_object::PROP_uXSCALE },
- { "y", as_object::PROP_Y },
- { "_y", as_object::PROP_uY },
- { "_ymouse", as_object::PROP_uYMOUSE },
- { "_yscale", as_object::PROP_uYSCALE }
-};
- if (_singleton->getSWFVersion() < 7)
- {
- _singleton->mStringTable.lower_next_group();
- }
- _singleton->mStringTable.insert_group(preload_properties,
- sizeof (preload_properties) / sizeof (string_table::svt));
+ NSV::load_strings(&_singleton->mStringTable,
_singleton->getSWFVersion());
_singleton->setGlobal(new Global(*_singleton));
assert(_singleton->getGlobal());
Index: testsuite/misc-ming.all/KeyTest-Runner.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/KeyTest-Runner.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- testsuite/misc-ming.all/KeyTest-Runner.cpp 19 Sep 2007 14:20:51 -0000
1.6
+++ testsuite/misc-ming.all/KeyTest-Runner.cpp 23 Sep 2007 08:48:19 -0000
1.7
@@ -26,6 +26,7 @@
#include "dlist.h"
#include "container.h"
#include "log.h"
+#include "namedStrings.h"
#include "check.h"
#include <string>
@@ -58,33 +59,33 @@
as_value tmp;
- check(mc1->get_member(as_object::PROP_uX, &tmp));
+ check(mc1->get_member(NSV::PROP_uX, &tmp));
check_equals(tmp.to_number(), 0);
tester.advance();
check_equals(root->get_current_frame(), 2);
- check(mc1->get_member(as_object::PROP_uX, &tmp));
+ check(mc1->get_member(NSV::PROP_uX, &tmp));
check_equals(tmp.to_number(), 200);
tester.pressKey(key::J);
- check(mc1->get_member(as_object::PROP_uX, &tmp));
+ check(mc1->get_member(NSV::PROP_uX, &tmp));
check_equals(tmp.to_number(), 250);
tester.pressKey(key::K);
- check(mc1->get_member(as_object::PROP_uX, &tmp));
+ check(mc1->get_member(NSV::PROP_uX, &tmp));
check_equals(tmp.to_number(), 300);
tester.releaseKey(key::A);
- check(mc1->get_member(as_object::PROP_uX, &tmp));
+ check(mc1->get_member(NSV::PROP_uX, &tmp));
check_equals(tmp.to_number(), 250);
tester.releaseKey(key::B);
- check(mc1->get_member(as_object::PROP_uX, &tmp));
+ check(mc1->get_member(NSV::PROP_uX, &tmp));
check_equals(tmp.to_number(), 200);
// TODO: test pressing and releases keys
Index: server/namedStrings.cpp
===================================================================
RCS file: server/namedStrings.cpp
diff -N server/namedStrings.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/namedStrings.cpp 23 Sep 2007 08:48:18 -0000 1.1
@@ -0,0 +1,140 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// 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 3 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+
+// A file to contain all of the different strings for which we want compile
time
+// known string table keys.
+
+#include "namedStrings.h"
+#include "string_table.h"
+
+namespace gnash {
+namespace NSV { // Named String Values
+
+// Load up our pre-known names
+static string_table::svt preload_names[] =
+{
+ { "addListener", NSV::PROP_ADD_LISTENER },
+ { "align", NSV::PROP_ALIGN },
+ { "_alpha", NSV::PROP_uALPHA },
+ { "blockIndent", NSV::PROP_BLOCK_INDENT },
+ { "bold", NSV::PROP_BOLD },
+ { "broadcastMessage", NSV::PROP_BROADCAST_MESSAGE },
+ { "bullet", NSV::PROP_BULLET },
+ { "callee", NSV::PROP_CALLEE },
+ { "color", NSV::PROP_COLOR },
+ { "constructor", NSV::PROP_CONSTRUCTOR },
+ { "__constructor__", NSV::PROP_uuCONSTRUCTORuu },
+ { "_currentframe", NSV::PROP_uCURRENTFRAME },
+ { "_droptarget", NSV::PROP_uDROPTARGET },
+ { "enabled", NSV::PROP_ENABLED },
+ { "_focusrect", NSV::PROP_uFOCUSRECT },
+ { "_framesloaded", NSV::PROP_uFRAMESLOADED },
+ { "_height", NSV::PROP_uHEIGHT },
+ { "_highquality", NSV::PROP_uHIGHQUALITY },
+ { "htmlText", NSV::PROP_HTML_TEXT },
+ { "indent", NSV::PROP_INDENT },
+ { "italic", NSV::PROP_ITALIC },
+ { "leading", NSV::PROP_LEADING },
+ { "left_margin", NSV::PROP_LEFT_MARGIN },
+ { "length", NSV::PROP_LENGTH },
+ { "_listeners", NSV::PROP_uLISTENERS },
+ { "loaded", NSV::PROP_LOADED },
+ { "_name", NSV::PROP_uNAME },
+ { "onLoad", NSV::PROP_ON_LOAD },
+ { "onResize", NSV::PROP_ON_RESIZE },
+ { "onRollOut", NSV::PROP_ON_ROLL_OUT },
+ { "onRollOver", NSV::PROP_ON_ROLL_OVER },
+ { "onSelect", NSV::PROP_ON_SELECT },
+ { "onStatus", NSV::PROP_ON_STATUS },
+ { "_parent", NSV::PROP_uPARENT },
+ { "__proto__", NSV::PROP_uuPROTOuu },
+ { "prototype", NSV::PROP_PROTOTYPE },
+ { "push", NSV::PROP_PUSH },
+ { "removeListener", NSV::PROP_REMOVE_LISTENER },
+ { "rightMargin", NSV::PROP_RIGHT_MARGIN },
+ { "_rotation", NSV::PROP_uROTATION },
+ { "scaleMode", NSV::PROP_SCALE_MODE },
+ { "size", NSV::PROP_SIZE },
+ { "_soundbuftime", NSV::PROP_uSOUNDBUFTIME },
+ { "splice", NSV::PROP_SPLICE },
+ { "Stage", NSV::PROP_iSTAGE },
+ { "status", NSV::PROP_STATUS },
+ { "_target", NSV::PROP_uTARGET },
+ { "text", NSV::PROP_TEXT },
+ { "textColor", NSV::PROP_TEXT_COLOR },
+ { "textWidth", NSV::PROP_TEXT_WIDTH },
+ { "toString", NSV::PROP_TO_STRING },
+ { "_totalframes", NSV::PROP_uTOTALFRAMES },
+ { "underline", NSV::PROP_UNDERLINE },
+ { "_url", NSV::PROP_uURL },
+ { "valueOf", NSV::PROP_VALUE_OF },
+ { "_visible", NSV::PROP_uVISIBLE },
+ { "_width", NSV::PROP_uWIDTH },
+ { "x", NSV::PROP_X },
+ { "_x", NSV::PROP_uX },
+ { "_xmouse", NSV::PROP_uXMOUSE },
+ { "_xscale", NSV::PROP_uXSCALE },
+ { "y", NSV::PROP_Y },
+ { "_y", NSV::PROP_uY },
+ { "_ymouse", NSV::PROP_uYMOUSE },
+ { "_yscale", NSV::PROP_uYSCALE },
+ { "System", NSV::CLASS_SYSTEM },
+ { "Stage", NSV::CLASS_STAGE },
+ { "MovieClip", NSV::CLASS_MOVIE_CLIP },
+ { "TextField", NSV::CLASS_TEXT_FIELD },
+ { "Math", NSV::CLASS_MATH },
+ { "Boolean", NSV::CLASS_BOOLEAN },
+ { "Color", NSV::CLASS_COLOR },
+ { "Selection", NSV::CLASS_SELECTION },
+ { "Sound", NSV::CLASS_SOUND },
+ { "XMLSocket", NSV::CLASS_X_M_L_SOCKET },
+ { "Date", NSV::CLASS_DATE },
+ { "XML", NSV::CLASS_X_M_L },
+ { "XMLNode", NSV::CLASS_X_M_L_NODE },
+ { "Mouse", NSV::CLASS_MOUSE },
+ { "Object", NSV::CLASS_OBJECT },
+ { "String", NSV::CLASS_STRING },
+ { "Number", NSV::CLASS_NUMBER },
+ { "Array", NSV::CLASS_ARRAY },
+ { "Key", NSV::CLASS_KEY },
+ { "AsBroadcaster", NSV::CLASS_AS_BROADCASTER },
+ { "Function", NSV::CLASS_FUNCTION },
+ { "TextSnapshot", NSV::CLASS_TEXT_SNAPSHOT },
+ { "Video", NSV::CLASS_VIDEO },
+ { "Camera", NSV::CLASS_CAMERA },
+ { "Microphone", NSV::CLASS_MICROPHONE },
+ { "SharedObject", NSV::CLASS_SHARED_OBJECT },
+ { "LoadVars", NSV::CLASS_LOAD_VARS },
+ { "CustomActions", NSV::CLASS_CUSTOM_ACTIONS },
+ { "NetConnection", NSV::CLASS_NET_CONNECTION },
+ { "NetStream", NSV::CLASS_NET_STREAM },
+ { "ContextMenu", NSV::CLASS_CONTEXT_MENU },
+ { "MovieClipLoader", NSV::CLASS_MOVIE_CLIP_LOADER },
+ { "Error", NSV::CLASS_ERROR },
+};
+
+void load_strings(string_table *table, int version)
+{
+ if (version < 7)
+ table->lower_next_group();
+
+ table->insert_group(preload_names,
+ sizeof (preload_names) / sizeof (string_table::svt));
+}
+
+} // namespace NSV
+} // namespace gnash
Index: server/namedStrings.h
===================================================================
RCS file: server/namedStrings.h
diff -N server/namedStrings.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/namedStrings.h 23 Sep 2007 08:48:18 -0000 1.1
@@ -0,0 +1,138 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// 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 3 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+
+// A file to contain all of the different strings for which we want compile
time
+// known string table keys.
+#ifndef GNASH_NAMED_STRINGS_H
+#define GNASH_NAMED_STRINGS_H
+
+namespace gnash {
+
+class string_table; // Forward
+
+namespace NSV { // Named String Values
+
+typedef enum {
+ PROP_ADD_LISTENER = 1,
+ PROP_ALIGN,
+ PROP_uALPHA,
+ PROP_BLOCK_INDENT,
+ PROP_BOLD,
+ PROP_BROADCAST_MESSAGE,
+ PROP_BULLET,
+ PROP_CALLEE,
+ PROP_COLOR,
+ PROP_CONSTRUCTOR,
+ PROP_uuCONSTRUCTORuu,
+ PROP_uCURRENTFRAME,
+ PROP_uDROPTARGET,
+ PROP_ENABLED,
+ PROP_uFOCUSRECT,
+ PROP_uFRAMESLOADED,
+ PROP_uHEIGHT,
+ PROP_uHIGHQUALITY,
+ PROP_HTML_TEXT,
+ PROP_INDENT,
+ PROP_ITALIC,
+ PROP_LEADING,
+ PROP_LEFT_MARGIN,
+ PROP_LENGTH,
+ PROP_uLISTENERS,
+ PROP_LOADED,
+ PROP_uNAME,
+ PROP_ON_LOAD,
+ PROP_ON_RESIZE,
+ PROP_ON_ROLL_OUT,
+ PROP_ON_ROLL_OVER,
+ PROP_ON_SELECT,
+ PROP_ON_STATUS,
+ PROP_uPARENT,
+ PROP_uuPROTOuu,
+ PROP_PROTOTYPE,
+ PROP_PUSH,
+ PROP_REMOVE_LISTENER,
+ PROP_RIGHT_MARGIN,
+ PROP_uROTATION,
+ PROP_SCALE_MODE,
+ PROP_SIZE,
+ PROP_uSOUNDBUFTIME,
+ PROP_SPLICE,
+ PROP_iSTAGE,
+ PROP_STATUS,
+ PROP_uTARGET,
+ PROP_TEXT,
+ PROP_TEXT_COLOR,
+ PROP_TEXT_WIDTH,
+ PROP_TO_STRING,
+ PROP_uTOTALFRAMES,
+ PROP_UNDERLINE,
+ PROP_uURL,
+ PROP_VALUE_OF,
+ PROP_uVISIBLE,
+ PROP_uWIDTH,
+ PROP_X,
+ PROP_uX,
+ PROP_uXMOUSE,
+ PROP_uXSCALE,
+ PROP_Y,
+ PROP_uY,
+ PROP_uYMOUSE,
+ PROP_uYSCALE,
+ CLASS_SYSTEM,
+ CLASS_STAGE,
+ CLASS_MOVIE_CLIP,
+ CLASS_TEXT_FIELD,
+ CLASS_MATH,
+ CLASS_BOOLEAN,
+ CLASS_COLOR,
+ CLASS_SELECTION,
+ CLASS_SOUND,
+ CLASS_X_M_L_SOCKET,
+ CLASS_DATE,
+ CLASS_X_M_L,
+ CLASS_X_M_L_NODE,
+ CLASS_MOUSE,
+ CLASS_OBJECT,
+ CLASS_NUMBER,
+ CLASS_STRING,
+ CLASS_ARRAY,
+ CLASS_KEY,
+ CLASS_AS_BROADCASTER,
+ CLASS_FUNCTION,
+ CLASS_TEXT_SNAPSHOT,
+ CLASS_VIDEO,
+ CLASS_CAMERA,
+ CLASS_MICROPHONE,
+ CLASS_SHARED_OBJECT,
+ CLASS_LOAD_VARS,
+ CLASS_CUSTOM_ACTIONS,
+ CLASS_NET_CONNECTION,
+ CLASS_NET_STREAM,
+ CLASS_CONTEXT_MENU,
+ CLASS_MOVIE_CLIP_LOADER,
+ CLASS_ERROR
+ } named_strings;
+
+/// Load the prenamed strings.
+/// version controls case
+void load_strings(string_table *table, int version);
+
+} // namespace NSV
+} // namespace gnash
+
+#endif // GNASH_NAMED_STRINGS_H
+
Index: server/asobj/ClassHierarchy.cpp
===================================================================
RCS file: server/asobj/ClassHierarchy.cpp
diff -N server/asobj/ClassHierarchy.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/asobj/ClassHierarchy.cpp 23 Sep 2007 08:48:18 -0000 1.1
@@ -0,0 +1,272 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// 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 3 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "as_object.h"
+#include "as_prop_flags.h"
+#include "as_value.h"
+#include "as_function.h" // for function_class_init
+#include "array.h"
+#include "AsBroadcaster.h"
+#include "Boolean.h"
+#include "Camera.h"
+#include "Color.h"
+#include "ContextMenu.h"
+#include "CustomActions.h"
+#include "Date.h"
+#include "Error.h"
+#include "Global.h"
+#include "gstring.h"
+#include "Key.h"
+#include "LoadVars.h"
+#include "LocalConnection.h"
+#include "Microphone.h"
+#include "Number.h"
+#include "Object.h"
+#include "GMath.h"
+#include "Mouse.h"
+#include "MovieClipLoader.h"
+#include "movie_definition.h"
+#include "NetConnection.h"
+#include "NetStream.h"
+#include "Selection.h"
+#include "SharedObject.h"
+#include "Sound.h"
+#include "Stage.h"
+#include "System.h"
+#include "textformat.h"
+#include "TextSnapshot.h"
+#include "video_stream_instance.h"
+#include "extension.h"
+#include "VM.h"
+#include "timers.h"
+#include "URL.h" // for URL::encode and URL::decode (escape/unescape)
+#include "builtin_function.h"
+#include "edit_text_character.h"
+#include "namedStrings.h"
+#include "ClassHierarchy.h"
+#include "builtin_function.h"
+#include "xmlsocket.h"
+#include "xml.h"
+#include "xmlnode.h"
+
+namespace gnash {
+
+namespace { // anonymous namespace
+
+class declare_extension_function : public as_function
+{
+private:
+ ClassHierarchy::extensionClass mDeclaration;
+ as_object *mTarget;
+ Extension *mExtension;
+
+public:
+ bool isBuiltin() { return true; }
+
+ declare_extension_function(ClassHierarchy::extensionClass &c,
+ as_object *g, Extension* e) :
+ as_function(getObjectInterface()),
+ mDeclaration(c), mTarget(g), mExtension(e)
+ {
+ init_member("constructor", this);
+ }
+
+ virtual as_value operator()(const fn_call& /*fn*/)
+ {
+ as_value super;
+ if (mDeclaration.super_name)
+ {
+ // Check to be sure our super exists.
+ // This will trigger its instantiation if necessary.
+ if (!mTarget->get_member(mDeclaration.super_name,
&super))
+ {
+ // Error here -- doesn't exist.
+ // TODO: Log the error.
+ super.set_undefined();
+ return super;
+ }
+ if (!super.is_object())
+ {
+ // Error here -- not an object.
+ // TODO: Log the error.
+ super.set_undefined();
+ return super;
+ }
+ }
+ if
(mExtension->initModuleWithFunc(mDeclaration.file_name.c_str(),
+ mDeclaration.init_name.c_str(), *mTarget))
+ {
+ // Successfully loaded it, now find it, set its proto,
and return.
+ as_value us;
+ mTarget->get_member(mDeclaration.name, &us);
+ if (0 && mDeclaration.super_name)
+
us.to_object()->set_prototype(boost::intrusive_ptr<as_object>(super.to_object()));
+ fprintf(stderr, "Loaded ourselves.\n");
+ return us;
+ }
+ // Error here -- not successful in loading.
+ super.set_undefined();
+ return super;
+ }
+};
+
+class declare_native_function : public as_function
+{
+private:
+ ClassHierarchy::nativeClass mDeclaration;
+ as_object *mTarget;
+ Extension *mExtension;
+
+public:
+ bool isBuiltin() { return true; }
+
+ declare_native_function(ClassHierarchy::nativeClass &c,
+ as_object *g, Extension *e) :
+ as_function(getObjectInterface()),
+ mDeclaration(c), mTarget(g), mExtension(e)
+ {
+ init_member("constructor", this);
+ }
+
+ virtual as_value operator()(const fn_call& /*fn*/)
+ {
+ as_value super;
+ if (mDeclaration.super_name)
+ {
+ // Check to be sure our super exists.
+ // This will trigger its instantiation if necessary.
+ if (!mTarget->get_member(mDeclaration.super_name,
&super))
+ {
+ // Error here -- doesn't exist.
+ // TODO: Log the error.
+ super.set_undefined();
+ return super;
+ }
+ if (!super.is_object())
+ {
+ // Error here -- not an object.
+ // TODO: Log the error.
+ super.set_undefined();
+ return super;
+ }
+ }
+ mDeclaration.initializer(*mTarget);
+ // Successfully loaded it, now find it, set its proto, and
return.
+ as_value us;
+ mTarget->get_member(mDeclaration.name, &us);
+ if (0 && mDeclaration.super_name)
+
us.to_object()->set_prototype(boost::intrusive_ptr<as_object>(super.to_object()));
+ return us;
+ }
+};
+
+} // end anonymous namespace
+
+static
+as_value do_nothing(const fn_call&)
+{
+ return as_value();
+}
+
+bool
+ClassHierarchy::declareClass(extensionClass& c)
+{
+ if (mExtension == NULL)
+ return false; // Extensions can't be loaded.
+
+ boost::intrusive_ptr<as_function> getter =
+ new declare_extension_function(c, mGlobal, mExtension);
+ boost::intrusive_ptr<as_function> setter =
+ new builtin_function(do_nothing);
+
+ return mGlobal->init_destructive_property(c.name,
+ *getter, *setter);
+}
+
+bool
+ClassHierarchy::declareClass(nativeClass& c)
+{
+ boost::intrusive_ptr<as_function> getter =
+ new declare_native_function(c, mGlobal, mExtension);
+ boost::intrusive_ptr<as_function> setter =
+ new builtin_function(do_nothing);
+
+ return mGlobal->init_destructive_property(c.name,
+ *getter, *setter);
+}
+
+static ClassHierarchy::nativeClass knownClasses[] =
+{
+ /* { function_name, name key, super name key, lowest version }, */
+// { object_class_init, NSV::CLASS_OBJECT, 0, 5 }, // Object is special
+// { function_class_init, NSV::CLASS_FUNCTION, NSV::CLASS_OBJECT, 6 }, //
Function is special
+// { array_class_init, NSV::CLASS_ARRAY, NSV::CLASS_OBJECT, 5 }, // Array
is special
+ { system_class_init, NSV::CLASS_SYSTEM, 0, 1 },
+ { stage_class_init, NSV::CLASS_STAGE, 0, 1 },
+ { movieclip_class_init, NSV::CLASS_MOVIE_CLIP, 0, 3 },
+ { textfield_class_init, NSV::CLASS_TEXT_FIELD, 0, 3 },
+ { math_class_init, NSV::CLASS_MATH, 0, 4 },
+ { boolean_class_init, NSV::CLASS_BOOLEAN, NSV::CLASS_OBJECT, 5 },
+ { color_class_init, NSV::CLASS_COLOR, NSV::CLASS_OBJECT, 5 },
+ { selection_class_init, NSV::CLASS_SELECTION, NSV::CLASS_OBJECT, 5 },
+ { sound_class_init, NSV::CLASS_SOUND, NSV::CLASS_OBJECT, 5 },
+ { xmlsocket_class_init, NSV::CLASS_X_M_L_SOCKET, NSV::CLASS_OBJECT, 5 },
+ { date_class_init, NSV::CLASS_DATE, NSV::CLASS_OBJECT, 5 },
+ { xml_class_init, NSV::CLASS_X_M_L, NSV::CLASS_OBJECT, 5 },
+ { xmlnode_class_init, NSV::CLASS_X_M_L_NODE, NSV::CLASS_OBJECT, 5 },
+ { mouse_class_init, NSV::CLASS_MOUSE, NSV::CLASS_OBJECT, 5 },
+ { number_class_init, NSV::CLASS_NUMBER, NSV::CLASS_OBJECT, 5 },
+ { string_class_init, NSV::CLASS_STRING, NSV::CLASS_OBJECT, 5 },
+ { key_class_init, NSV::CLASS_KEY, NSV::CLASS_OBJECT, 5 },
+ { AsBroadcaster_init, NSV::CLASS_AS_BROADCASTER, NSV::CLASS_OBJECT, 5 },
+ { textsnapshot_class_init, NSV::CLASS_TEXT_SNAPSHOT, NSV::CLASS_OBJECT,
6 },
+ { video_class_init, NSV::CLASS_VIDEO, NSV::CLASS_OBJECT, 6 },
+ { camera_class_init, NSV::CLASS_CAMERA, NSV::CLASS_OBJECT, 6 },
+ { microphone_class_init, NSV::CLASS_MICROPHONE, NSV::CLASS_OBJECT, 6 },
+ { sharedobject_class_init, NSV::CLASS_SHARED_OBJECT, NSV::CLASS_OBJECT,
6 },
+ { loadvars_class_init, NSV::CLASS_LOAD_VARS, NSV::CLASS_OBJECT, 6 },
+ { customactions_class_init, NSV::CLASS_CUSTOM_ACTIONS,
NSV::CLASS_OBJECT, 6 },
+ { netconnection_class_init, NSV::CLASS_NET_CONNECTION,
NSV::CLASS_OBJECT, 7 },
+ { netstream_class_init, NSV::CLASS_NET_STREAM, NSV::CLASS_OBJECT, 7 },
+ { contextmenu_class_init, NSV::CLASS_CONTEXT_MENU, NSV::CLASS_OBJECT, 7
},
+ { moviecliploader_class_init, NSV::CLASS_MOVIE_CLIP_LOADER,
NSV::CLASS_OBJECT, 7 },
+ { error_class_init, NSV::CLASS_ERROR, NSV::CLASS_OBJECT, 7 },
+};
+
+void
+ClassHierarchy::massDeclare(int version)
+{
+ // Natives get declared first. It doesn't make any sense for a native
+ // to depend on an extension, but it does make sense the other way
+ // around.
+ unsigned int size = sizeof (knownClasses) / sizeof (nativeClass);
+ for (unsigned int i = 0; i < size; ++i)
+ {
+ nativeClass& c = knownClasses[i];
+ if (c.version > version)
+ continue;
+ declareClass(c);
+ }
+
+ if (mExtension != NULL)
+ {
+ /* Load extensions here */
+ }
+}
+
+} /* namespace gnash */
Index: server/asobj/ClassHierarchy.h
===================================================================
RCS file: server/asobj/ClassHierarchy.h
diff -N server/asobj/ClassHierarchy.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/asobj/ClassHierarchy.h 23 Sep 2007 08:48:18 -0000 1.1
@@ -0,0 +1,126 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// 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 3 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef GNASH_CLASS_HIERARCHY_H
+#define GNASH_CLASS_HIERARCHY_H
+
+#include "as_object.h"
+
+namespace gnash {
+
+class Extension;
+
+/// Register all of the ActionScript classes, with their dependencies.
+class ClassHierarchy
+{
+public:
+ struct extensionClass
+ {
+ /// \brief
+ /// The file name which contains the library, relative to the
+ /// plugins directory.
+ std::string file_name;
+
+ /// \brief Initialization function name
+ ///
+ /// The name of the function which will yield the prototype
+ /// object. It should be a function with signature:
+ /// void init_name(as_object &obj);
+ /// which sets its prototype as the member 'name' in the
+ /// object. See extensions/mysql/mysql_db.cpp function
+ /// mysql_class_init
+ std::string init_name;
+
+ /// \brief The name of the class.
+ string_table::key name;
+
+ /// \brief
+ /// The name of the inherited class.
+ /// Ordinarily should be CLASS_OBJECT
+ string_table::key super_name;
+
+ /// \brief
+ /// The version at which this should be added.
+ int version;
+ };
+
+ struct nativeClass
+ {
+ /// The type of function to use for initing.
+ typedef void (*init_func)(as_object& obj);
+
+ /// \brief
+ /// The initialization function
+ ///
+ /// See extensionClass.init_name for the necessary function.
+ init_func initializer;
+
+ /// The name of the class.
+ string_table::key name;
+
+ /// \brief
+ /// The name of the inherited class. Object is assumed if
+ /// none is given. (Unless name is itself Object)
+ string_table::key super_name;
+
+ /// \brief
+ /// The version at which this should be added.
+ int version;
+ };
+
+ /// \brief
+ /// Declare an ActionScript class, with information on how
+ /// to load it from an extension.
+ ///
+ /// @param c
+ /// The extensionClass structure which defines the class.
+ ///
+ /// @return true, unless the class with c.name already existed.
+ bool declareClass(extensionClass& c);
+
+ /// \brief
+ /// Declare an ActionScript class, with information on how
+ /// to instantiate it from the core.
+ ///
+ /// @param c
+ /// The nativeClass structure which defines the class.
+ ///
+ /// @return true, unless the class with c.name already existed.
+ bool declareClass(nativeClass& c);
+
+ /// \brief
+ /// Declare all of the native and extension classes from the
+ /// tables contained in the source file.
+ ///
+ void massDeclare(int version);
+
+ /// \brief
+ /// Construct the declaration object with the given global object
+ /// and extension object.
+ ClassHierarchy(as_object *global, Extension *e) :
+ mGlobal(global), mExtension(e)
+ {/**/}
+
+private:
+ as_object *mGlobal;
+ Extension *mExtension;
+};
+
+} /* namespace gnash */
+#endif /* GNASH_CLASS_HIERARCHY_H */
+
- [Gnash-commit] gnash ChangeLog libbase/extension.cpp libbase/e...,
Chad Musick <=