[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/Makefile.am server/actio...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/Makefile.am server/actio... |
Date: |
Fri, 03 Nov 2006 14:03:38 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/11/03 14:03:37
Modified files:
. : ChangeLog
server : Makefile.am action.h as_environment.cpp
as_environment.h button_character_instance.cpp
button_character_instance.h character.cpp
character.h dlist.cpp dlist.h
edit_text_character.cpp edit_text_character.h
movie.h sprite_instance.cpp sprite_instance.h
swf_function.cpp swf_function.h textformat.cpp
textformat.h timers.cpp timers.h xmlsocket.h
server/asobj : ASSound.cpp ASSound.h
server/parser : button_character_def.h movie_def_impl.h
sprite_definition.h
server/swf : ASHandlers.cpp
testsuite : MovieTester.cpp
Added files:
server : event_id.h
Log message:
* server/: [too many files]
Changed some 'tu' containers to 'std' ones...
* server/: action.h, event_id.h, Makefile.am: extracted event_id
class from action.h header.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1489&r2=1.1490
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.83&r2=1.84
http://cvs.savannah.gnu.org/viewcvs/gnash/server/action.h?cvsroot=gnash&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.h?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.71&r2=1.72
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/textformat.cpp?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/textformat.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/xmlsocket.h?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/event_id.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ASSound.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ASSound.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/button_character_def.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.h?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/sprite_definition.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.cpp?cvsroot=gnash&r1=1.7&r2=1.8
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1489
retrieving revision 1.1490
diff -u -b -r1.1489 -r1.1490
--- ChangeLog 3 Nov 2006 14:01:29 -0000 1.1489
+++ ChangeLog 3 Nov 2006 14:03:37 -0000 1.1490
@@ -1,6 +1,10 @@
2006-11-03 Sandro Santilli <address@hidden>
- * server/server/StringPredicates.h: added StringNoCaseEqual.
+ * server/: [too many files]
+ Changed some 'tu' containers to 'std' ones...
+ * server/: action.h, event_id.h, Makefile.am: extracted event_id
+ class from action.h header.
+ * server/StringPredicates.h: added StringNoCaseEqual.
* server/as_value.{h,cpp}: to_std_string method added.
* libbase/noseek_fd_adapter.cpp: signed vs. unsigned warnings
fixes.
Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -b -r1.83 -r1.84
--- server/Makefile.am 3 Nov 2006 08:39:25 -0000 1.83
+++ server/Makefile.am 3 Nov 2006 14:03:37 -0000 1.84
@@ -18,7 +18,7 @@
#
#
-# $Id: Makefile.am,v 1.83 2006/11/03 08:39:25 strk Exp $
+# $Id: Makefile.am,v 1.84 2006/11/03 14:03:37 strk Exp $
AUTOMAKE_OPTIONS =
@@ -118,6 +118,7 @@
character.h \
generic_character.h \
edit_text_character.h \
+ event_id.h \
execute_tag.h \
font.h \
fontlib.h \
Index: server/action.h
===================================================================
RCS file: /sources/gnash/gnash/server/action.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- server/action.h 29 Oct 2006 18:34:11 -0000 1.47
+++ server/action.h 3 Nov 2006 14:03:37 -0000 1.48
@@ -51,95 +51,6 @@
extern DSOEXPORT smart_ptr<as_object> s_global;
- //
- // event_id
- //
-
- /// For keyDown and stuff like that.
- class DSOEXPORT event_id
- {
- public:
- /// These must match the function names in
event_id::get_function_name()
- enum id_code
- {
- INVALID,
-
- // These are for buttons & sprites.
- PRESS,
- RELEASE,
- RELEASE_OUTSIDE,
- ROLL_OVER,
- ROLL_OUT,
- DRAG_OVER,
- DRAG_OUT,
- KEY_PRESS,
-
- // These are for sprites only.
- INITIALIZE,
- LOAD,
- UNLOAD,
- ENTER_FRAME,
- MOUSE_DOWN,
- MOUSE_UP,
- MOUSE_MOVE,
- KEY_DOWN,
- KEY_UP,
- DATA,
-
- // These are for the MoveClipLoader ActionScript only
- LOAD_START,
- LOAD_ERROR,
- LOAD_PROGRESS,
- LOAD_INIT,
-
- // These are for the XMLSocket ActionScript only
- SOCK_CLOSE,
- SOCK_CONNECT,
- SOCK_DATA,
- SOCK_XML,
-
- // These are for the XML ActionScript only
- XML_LOAD,
- XML_DATA,
-
- // This is for setInterval
- TIMER,
-
- CONSTRUCT,
- SETFOCUS,
- KILLFOCUS,
-
- EVENT_COUNT
- };
-
- unsigned char m_id;
- unsigned char m_key_code;
-
- event_id() : m_id(INVALID), m_key_code(key::INVALID) {}
-
- event_id(id_code id, key::code c = key::INVALID)
- :
- m_id((unsigned char) id),
- m_key_code((unsigned char) c)
- {
- // For the button key events, you must supply a keycode.
- // Otherwise, don't.
- assert((m_key_code == key::INVALID && (m_id !=
KEY_PRESS))
- || (m_key_code != key::INVALID && (m_id ==
KEY_PRESS)));
- }
-
- bool operator==(const event_id& id) const { return m_id ==
id.m_id && m_key_code == id.m_key_code; }
-
- /// Return the name of a method-handler function
- /// corresponding to this event.
- const tu_string& get_function_name() const;
-
- /// \brief
- /// Return true if this is a mouse event
- /// (triggerable with a mouse activity)
- bool is_mouse_event() const;
- };
-
class DSOLOCAL as_property_interface
{
public:
@@ -147,38 +58,6 @@
virtual bool set_property(int index, const as_value& val) =
0;
};
-
-
-// tulrich: I'm not too sure this is useful. For things like
-// xml_as_object, is it sufficient to always store the event handlers
-// as ordinary members using their canonical names, instead of this
-// special table? I have a feeling that's what Macromedia does
-// (though I'm not sure).
-#if 0
- // This class is just as_object, with an event
- // handler table added.
- class DSOLOCAL as_object_with_handlers : public as_object
- {
- public:
- // ActionScript event handler table.
- hash<event_id, gnash::as_value> m_event_handlers;
-
- // ActionScript event handler.
- void set_event_handler(event_id id, const as_value& method)
- {
- // m_event_handlers.push_back(as);
- //m_event_handlers.set(id, method);
- }
-
- bool get_event_handler(event_id id, gnash::as_value* result)
- {
- //return m_event_handlers.get(id, result);
- return false;
- }
- };
-#endif // 0
-
-
//
// Some handy helpers
//
Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/as_environment.cpp 3 Nov 2006 08:39:25 -0000 1.27
+++ server/as_environment.cpp 3 Nov 2006 14:03:37 -0000 1.28
@@ -16,7 +16,7 @@
//
-/* $Id: as_environment.cpp,v 1.27 2006/11/03 08:39:25 strk Exp $ */
+/* $Id: as_environment.cpp,v 1.28 2006/11/03 14:03:37 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,23 +29,25 @@
#include "as_value.h"
#include "with_stack_entry.h"
+#include <string>
+
namespace gnash {
// Return the value of the given var, if it's defined.
as_value
-as_environment::get_variable(const tu_string& varname,
+as_environment::get_variable(const std::string& varname,
const std::vector<with_stack_entry>& with_stack) const
{
// Path lookup rigamarole.
character* target = m_target;
- tu_string path;
- tu_string var;
+ std::string path;
+ std::string var;
//log_msg("get_variable(%s)", varname.c_str());
if (parse_path(varname, path, var)) {
target = find_target(path); // @@ Use with_stack here too??? Need
to test.
if (target) {
as_value val;
- target->get_member(var, &val);
+ target->get_member(var.c_str(), &val);
return val;
} else {
log_error("find_target(\"%s\") failed", path.c_str());
@@ -57,7 +59,7 @@
}
as_value
-as_environment::get_variable(const tu_string& varname) const
+as_environment::get_variable(const std::string& varname) const
{
static std::vector<with_stack_entry> empty_with_stack;
return get_variable(varname, empty_with_stack);
@@ -65,7 +67,7 @@
as_value
as_environment::get_variable_raw(
- const tu_string& varname,
+ const std::string& varname,
const std::vector<with_stack_entry>& with_stack) const
// varname must be a plain variable name; no path parsing.
{
@@ -78,7 +80,7 @@
// Check the with-stack.
for (size_t i = with_stack.size(); i > 0; --i) {
as_object* obj = with_stack[i-1].m_object.get_ptr();
- if (obj && obj->get_member(varname, &val)) {
+ if (obj && obj->get_member(varname.c_str(), &val)) {
// Found the var in this context.
return val;
}
@@ -98,7 +100,7 @@
}
// Check target members.
- if (m_target->get_member(varname, &val)) {
+ if (m_target->get_member(varname.c_str(), &val)) {
return val;
}
@@ -109,7 +111,7 @@
if (varname == "_global") {
return as_value(s_global.get_ptr());
}
- if (s_global->get_member(varname, &val)) {
+ if (s_global->get_member(varname.c_str(), &val)) {
return val;
}
@@ -124,7 +126,7 @@
// varname must be a plain variable name; no path parsing.
as_value
-as_environment::get_variable_raw(const tu_string& varname) const
+as_environment::get_variable_raw(const std::string& varname) const
{
static std::vector<with_stack_entry> empty_with_stack;
return get_variable_raw(varname, empty_with_stack);
@@ -133,7 +135,7 @@
// Given a path to variable, set its value.
void
as_environment::set_variable(
- const tu_string& varname,
+ const std::string& varname,
const as_value& val,
const std::vector<with_stack_entry>& with_stack)
{
@@ -144,13 +146,13 @@
// Path lookup rigamarole.
character* target = m_target;
- tu_string path;
- tu_string var;
+ std::string path;
+ std::string var;
//log_msg("set_variable(%s, %s)", varname.c_str(), val.to_string());
if (parse_path(varname, path, var)) {
target = find_target(path);
if (target) {
- target->set_member(var, val);
+ target->set_member(var.c_str(), val);
}
} else {
this->set_variable_raw(varname, val, with_stack);
@@ -159,7 +161,7 @@
void
as_environment::set_variable(
- const tu_string& varname,
+ const std::string& varname,
const as_value& val)
{
static std::vector<with_stack_entry> empty_with_stack;
@@ -169,7 +171,7 @@
// No path rigamarole.
void
as_environment::set_variable_raw(
- const tu_string& varname,
+ const std::string& varname,
const as_value& val,
const std::vector<with_stack_entry>& with_stack)
{
@@ -178,9 +180,9 @@
{
as_object* obj = with_stack[i].m_object.get_ptr();
as_value dummy;
- if (obj && obj->get_member(varname, &dummy)) {
+ if (obj && obj->get_member(varname.c_str(), &dummy)) {
// This object has the member; so set it here.
- obj->set_member(varname, val);
+ obj->set_member(varname.c_str(), val);
return;
}
}
@@ -195,12 +197,12 @@
assert(m_target);
- m_target->set_member(varname, val);
+ m_target->set_member(varname.c_str(), val);
}
void
as_environment::set_variable_raw(
- const tu_string& varname,
+ const std::string& varname,
const as_value& val)
{
static std::vector<with_stack_entry> empty_with_stack;
@@ -209,7 +211,7 @@
// Set/initialize the value of the local variable.
void
-as_environment::set_local(const tu_string& varname, const as_value& val)
+as_environment::set_local(const std::string& varname, const as_value& val)
{
// Is it in the current frame already?
int index = find_local(varname);
@@ -229,7 +231,7 @@
// doesn't exist yet, since it's faster than set_local();
// e.g. when setting up args for a function.
void
-as_environment::add_local(const tu_string& varname, const as_value& val)
+as_environment::add_local(const std::string& varname, const as_value& val)
{
assert(varname.length() > 0);
m_local_frames.push_back(frame_slot(varname, val));
@@ -237,7 +239,7 @@
// Create the specified local var if it doesn't exist already.
void
-as_environment::declare_local(const tu_string& varname)
+as_environment::declare_local(const std::string& varname)
{
// Is it in the current frame already?
int index = find_local(varname);
@@ -251,9 +253,9 @@
}
bool
-as_environment::get_member(const tu_stringi& varname, as_value* val) const
+as_environment::get_member(const std::string& varname, as_value* val) const
{
- Variables::const_iterator it = _variables.find(varname.c_str());
+ Variables::const_iterator it = _variables.find(varname);
if ( it == _variables.end() ) return false;
*val = it->second;
@@ -262,9 +264,9 @@
void
-as_environment::set_member(const tu_stringi& varname, const as_value& val)
+as_environment::set_member(const std::string& varname, const as_value& val)
{
- _variables[varname.c_str()] = val;
+ _variables[varname] = val;
}
as_value&
@@ -314,7 +316,7 @@
//
// Otherwise return -1.
int
-as_environment::find_local(const tu_string& varname) const
+as_environment::find_local(const std::string& varname) const
{
// Linear search sucks, but is probably fine for
// typical use of local vars in script. There could
@@ -337,8 +339,8 @@
/* public static */
bool
-as_environment::parse_path(const tu_string& var_path,
- tu_string& path, tu_string& var)
+as_environment::parse_path(const std::string& var_path,
+ std::string& path, std::string& var)
{
//log_msg("parse_path(%s)", var_path.c_str());
// Search for colon.
@@ -378,7 +380,8 @@
colon_index--;
}
}
- // @@ could be better. This whole usage of tu_string is very flabby...
+
+ // @@ could be better.
path = var_path;
path.resize(colon_index);
@@ -399,7 +402,7 @@
}
else if (val.get_type() == as_value::STRING)
{
- return find_target(val.to_tu_string());
+ return find_target(std::string(val.to_string()));
}
else
{
@@ -430,7 +433,7 @@
// Supports both /slash/syntax and dot.syntax
//
character*
-as_environment::find_target(const tu_string& path) const
+as_environment::find_target(const std::string& path) const
{
if (path.length() <= 0) {
return m_target;
@@ -454,7 +457,7 @@
return env;
}
- tu_string subpart;
+ std::string subpart;
while (env) {
const char* next_slash = next_slash_or_dot(p);
subpart = p;
Index: server/as_environment.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/as_environment.h 3 Nov 2006 08:39:25 -0000 1.27
+++ server/as_environment.h 3 Nov 2006 14:03:37 -0000 1.28
@@ -18,7 +18,7 @@
//
//
-/* $Id: as_environment.h,v 1.27 2006/11/03 08:39:25 strk Exp $ */
+/* $Id: as_environment.h,v 1.28 2006/11/03 14:03:37 strk Exp $ */
#ifndef GNASH_AS_ENVIRONMENT_H
#define GNASH_AS_ENVIRONMENT_H
@@ -31,6 +31,7 @@
#include "StringPredicates.h" // for Variables
#include <map> // for composition (Variables)
+#include <string> // for frame_slot name
#include <vector>
#include <iostream> // for dump_stack inline
@@ -51,14 +52,14 @@
class frame_slot
{
public:
- tu_string m_name;
+ std::string m_name;
as_value m_value;
frame_slot()
{
}
- frame_slot(const tu_string& name, const as_value& val)
+ frame_slot(const std::string& name, const as_value& val)
:
m_name(name),
m_value(val)
@@ -135,36 +136,36 @@
/// Return the (possibly UNDEFINED) value of the named var.
/// Variable name can contain path elements.
///
- as_value get_variable(const tu_string& varname) const;
+ as_value get_variable(const std::string& varname) const;
/// Same of the above, but no support for path.
- as_value get_variable_raw(const tu_string& varname) const;
+ as_value get_variable_raw(const std::string& varname) const;
/// \brief
/// Return the (possibly UNDEFINED) value of the named var.
/// Variable name can contain path elements.
/// Uses the with_stack ActionContext
///
- as_value get_variable(const tu_string& varname,
+ as_value get_variable(const std::string& varname,
const std::vector<with_stack_entry>& with_stack) const;
/// \brief
/// Given a path to variable, set its value.
/// Variable name can contain path elements.
///
- void set_variable(const tu_string& path, const as_value& val);
+ void set_variable(const std::string& path, const as_value& val);
/// Given a variable name, set its value (no support for path)
- void set_variable_raw(const tu_string& path, const as_value& val);
+ void set_variable_raw(const std::string& path, const as_value& val);
/// \brief
/// Given a path to variable, set its value,
/// using the with_stack ActionContext
- void set_variable(const tu_string& path, const as_value& val,
+ void set_variable(const std::string& path, const as_value& val,
const std::vector<with_stack_entry>& with_stack);
/// Set/initialize the value of the local variable.
- void set_local(const tu_string& varname, const as_value& val);
+ void set_local(const std::string& varname, const as_value& val);
/// \brief
/// Add a local var with the given name and value to our
@@ -173,25 +174,25 @@
/// Use this when you know the var
/// doesn't exist yet, since it's faster than set_local();
/// e.g. when setting up args for a function.
- void add_local(const tu_string& varname, const as_value& val);
+ void add_local(const std::string& varname, const as_value& val);
/// Create the specified local var if it doesn't exist already.
- void declare_local(const tu_string& varname);
+ void declare_local(const std::string& varname);
/// Retrieve the named member (variable).
//
/// If no member is found under the given name
/// 'val' is untouched and 'false' is returned.
///
- /// TODO: rename to get_variable, take a std::string
+ /// TODO: rename to get_variable
///
- bool get_member(const tu_stringi& varname, as_value* val) const;
+ bool get_member(const std::string& varname, as_value* val) const;
/// Set the named variable
//
/// TODO: rename to set_variable, take a std::string
///
- void set_member(const tu_stringi& varname, const as_value& val);
+ void set_member(const std::string& varname, const as_value& val);
// Parameter/local stack frame management.
int get_local_frame_top() const { return m_local_frames.size(); }
@@ -232,7 +233,7 @@
//
/// Supports both /slash/syntax and dot.syntax
///
- character* find_target(const tu_string& path) const;
+ character* find_target(const std::string& path) const;
/// \brief
/// Find the sprite/movie represented by the given value.
@@ -302,8 +303,8 @@
//
// If no colon or dot, returns false and leaves *path & *var alone.
//
- static bool parse_path(const tu_string& var_path, tu_string& path,
- tu_string& var);
+ static bool parse_path(const std::string& var_path, std::string& path,
+ std::string& var);
/// The variables container (case-insensitive)
@@ -322,14 +323,14 @@
/// Movie target.
character* m_target;
- int find_local(const tu_string& varname) const;
+ int find_local(const std::string& varname) const;
/// Given a variable name, set its value (no support for path)
- void set_variable_raw(const tu_string& path, const as_value& val,
+ void set_variable_raw(const std::string& path, const as_value& val,
const std::vector<with_stack_entry>& with_stack);
/// Same of the above, but no support for path.
- as_value get_variable_raw(const tu_string& varname,
+ as_value get_variable_raw(const std::string& varname,
const std::vector<with_stack_entry>& with_stack) const;
Index: server/button_character_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/button_character_instance.cpp 26 Oct 2006 17:29:09 -0000
1.10
+++ server/button_character_instance.cpp 3 Nov 2006 14:03:37 -0000
1.11
@@ -200,7 +200,7 @@
// called from keypress listener only
bool
-button_character_instance::on_event(event_id id)
+button_character_instance::on_event(const event_id& id)
{
if (id.m_id != event_id::KEY_PRESS)
@@ -366,7 +366,7 @@
void
-button_character_instance::on_button_event(event_id event)
+button_character_instance::on_button_event(const event_id& event)
{
e_mouse_state new_state = m_mouse_state;
Index: server/button_character_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/button_character_instance.h 12 Oct 2006 16:37:25 -0000 1.3
+++ server/button_character_instance.h 3 Nov 2006 14:03:37 -0000 1.4
@@ -5,7 +5,7 @@
// SWF buttons. Mouse-sensitive update/display, actions, etc.
-/* $Id: button_character_instance.h,v 1.3 2006/10/12 16:37:25 udog Exp $ */
+/* $Id: button_character_instance.h,v 1.4 2006/11/03 14:03:37 strk Exp $ */
#ifndef GNASH_BUTTON_CHARACTER_INSTANCE_H
#define GNASH_BUTTON_CHARACTER_INSTANCE_H
@@ -71,7 +71,7 @@
bool can_handle_mouse_event() { return true; }
// called from keypress listener only
- bool on_event(event_id id);
+ bool on_event(const event_id& id);
movie_root* get_root() { return get_parent()->get_root(); }
@@ -97,7 +97,7 @@
///
virtual movie* get_topmost_mouse_entity(float x, float y);
- virtual void on_button_event(event_id event);
+ virtual void on_button_event(const event_id& event);
void restart_characters(int condition);
Index: server/character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/character.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/character.cpp 29 Oct 2006 18:34:11 -0000 1.8
+++ server/character.cpp 3 Nov 2006 14:03:37 -0000 1.9
@@ -18,7 +18,7 @@
//
//
-/* $Id: character.cpp,v 1.8 2006/10/29 18:34:11 rsavoye Exp $ */
+/* $Id: character.cpp,v 1.9 2006/11/03 14:03:37 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -126,7 +126,7 @@
}
character*
-character::get_relative_target_common(const tu_string& name)
+character::get_relative_target_common(const std::string& name)
{
if (name == "." || name == "this")
{
Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/character.h 29 Oct 2006 18:34:11 -0000 1.24
+++ server/character.h 3 Nov 2006 14:03:37 -0000 1.25
@@ -18,7 +18,7 @@
//
//
-/* $Id: character.h,v 1.24 2006/10/29 18:34:11 rsavoye Exp $ */
+/* $Id: character.h,v 1.25 2006/11/03 14:03:37 strk Exp $ */
#ifndef GNASH_CHARACTER_H
#define GNASH_CHARACTER_H
@@ -30,11 +30,14 @@
#include "gnash.h"
#include "action.h"
#include "types.h"
-#include "container.h"
+#include "container.h" // still needed ?
#include "utility.h"
#include "movie.h" // for inheritance (must drop)
+#include "event_id.h" // for inlines
+#include <map>
#include <cstdarg>
+#include <string>
#include <cassert>
#include <typeinfo>
@@ -50,15 +53,25 @@
///
class character : public movie
{
+
+public:
+
+ typedef std::map<event_id, as_value> Events;
+
+private:
+
int m_id;
- tu_string m_name;
+
+ /// Name of this character (if any)
+ std::string _name;
+
int m_depth;
cxform m_color_transform;
matrix m_matrix;
float m_ratio;
uint16_t m_clip_depth;
bool m_enabled;
- hash<event_id, as_value> m_event_handlers;
+ Events _event_handlers;
void (*m_display_callback)(void*);
void* m_display_callback_user_ptr;
@@ -73,7 +86,7 @@
void do_mouse_drag();
/// look for '.', '..', '_level0' and '_root'
- character* get_relative_target_common(const tu_string& name);
+ character* get_relative_target_common(const std::string& name);
public:
@@ -144,8 +157,9 @@
uint16_t get_clip_depth() const { return m_clip_depth; }
void set_clip_depth(uint16_t d) { m_clip_depth = d; }
- void set_name(const char* name) { m_name = name; }
- const tu_string& get_name() const { return m_name; }
+ void set_name(const char* name) { _name = name; }
+
+ const std::string& get_name() const { return _name; }
virtual bool can_handle_mouse_event() = 0;
@@ -173,25 +187,24 @@
virtual cxform get_world_cxform() const;
// Event handler accessors.
- bool get_event_handler(event_id id, as_value* result)
+ bool get_event_handler(const event_id& id, as_value* result)
{
- return m_event_handlers.get(id, result);
+ std::map<event_id, as_value>::iterator it = \
+ _event_handlers.find(id);
+ if ( it == _event_handlers.end() ) return false;
+ *result = it->second;
+ return true;
}
- void set_event_handler(event_id id, const as_value& method)
+ void set_event_handler(const event_id& id, const as_value& method)
{
- m_event_handlers[id] = method;
+ _event_handlers[id] = method;
if (id.m_id == event_id::KEY_PRESS)
{
has_keypress_event();
}
}
- const hash<event_id, as_value>* get_event_handlers() const
- {
- return &m_event_handlers;
- }
-
virtual void has_keypress_event() {}
// Movie interfaces. By default do nothing. sprite_instance and some
others override these.
@@ -231,7 +244,7 @@
///
/// In ActionScript 1.0, everything seems to be CASE
/// INSENSITIVE.
- virtual character* get_relative_target(const tu_string& name)
+ virtual character* get_relative_target(const std::string& name)
{
return get_relative_target_common(name);
}
@@ -280,6 +293,14 @@
// nop
}
+ // TODO : make protected
+ const std::map<event_id, as_value>& get_event_handlers() const
+ {
+ return _event_handlers;
+ }
+
+
+
};
Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/dlist.cpp 31 Oct 2006 12:55:24 -0000 1.33
+++ server/dlist.cpp 3 Nov 2006 14:03:37 -0000 1.34
@@ -21,6 +21,7 @@
#include "log.h"
#include "render.h"
#include "gnash.h"
+#include "StringPredicates.h"
#include <typeinfo>
#include <iostream>
@@ -60,9 +61,9 @@
class NameEquals {
public:
- const tu_string& _name;
+ const std::string& _name;
- NameEquals(const tu_string& name)
+ NameEquals(const std::string& name)
:
_name(name)
{}
@@ -74,17 +75,21 @@
};
class NameEqualsNoCase {
+
+ StringNoCaseEqual noCaseEquals;
+
public:
- const tu_stringi& _name;
+ const std::string& _name;
- NameEqualsNoCase(const tu_stringi& name)
+ NameEqualsNoCase(const std::string& name)
:
_name(name)
{}
- bool operator() (const DisplayItem& item) {
+ bool operator() (const DisplayItem& item)
+ {
if ( ! item.get_ptr() ) return false;
- return item->get_name() == _name;
+ return noCaseEquals(item->get_name(), _name);
}
};
@@ -134,7 +139,7 @@
character*
-DisplayList::get_character_by_name(const tu_string& name)
+DisplayList::get_character_by_name(const std::string& name)
{
container_type::iterator it = find_if(
_characters.begin(),
@@ -147,7 +152,7 @@
}
character*
-DisplayList::get_character_by_name_i(const tu_stringi& name)
+DisplayList::get_character_by_name_i(const std::string& name)
{
container_type::iterator it = find_if(
_characters.begin(),
Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/dlist.h 31 Oct 2006 12:55:24 -0000 1.16
+++ server/dlist.h 3 Nov 2006 14:03:37 -0000 1.17
@@ -160,16 +160,17 @@
/// \brief
/// May return NULL.
/// If there are multiples, returns the *first* match only!
- character* get_character_by_name(const tu_string& name);
+ character* get_character_by_name(const std::string& name);
- const character* get_character_by_name(const tu_string& name) const {
+ const character* get_character_by_name(const std::string& name) const
+ {
return
const_cast<DisplayList*>(this)->get_character_by_name(name);
}
/// \brief
/// May return NULL.
/// If there are multiples, returns the *first* match only!
- character* get_character_by_name_i(const tu_stringi& name);
+ character* get_character_by_name_i(const std::string& name);
/// \brief
/// Visit each character in the list in depth order
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- server/edit_text_character.cpp 23 Oct 2006 19:03:46 -0000 1.22
+++ server/edit_text_character.cpp 3 Nov 2006 14:03:37 -0000 1.23
@@ -3,7 +3,7 @@
// This source code has been donated to the Public Domain. Do
// whatever you want with it.
-/* $Id: edit_text_character.cpp,v 1.22 2006/10/23 19:03:46 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.23 2006/11/03 14:03:37 strk Exp $ */
#include "utf8.h"
#include "log.h"
@@ -165,7 +165,7 @@
}
-bool edit_text_character::on_event(event_id id)
+bool edit_text_character::on_event(const event_id& id)
{
if (m_def->get_readonly() == true)
{
@@ -180,7 +180,7 @@
{
get_root()->add_keypress_listener(this);
m_has_focus = true;
- m_cursor = m_text.size();
+ m_cursor = _text.size();
format_text();
}
break;
@@ -200,12 +200,12 @@
case event_id::KEY_PRESS:
{
- std::string s(m_text.c_str());
+ std::string s(_text);
std::string c;
c = (char) id.m_key_code;
- // may be m_text is changed in ActionScript
- m_cursor = imin(m_cursor, m_text.size());
+ // may be _text is changed in ActionScript
+ m_cursor = imin(m_cursor, _text.size());
switch (c[0])
{
@@ -239,7 +239,7 @@
case key::END:
case key::PGDN:
case key::DOWN:
- m_cursor = m_text.size();
+ m_cursor = _text.size();
format_text();
break;
@@ -249,7 +249,7 @@
break;
case key::RIGHT:
- m_cursor = m_cursor < m_text.size() ?
m_cursor + 1 : m_text.size();
+ m_cursor = m_cursor < _text.size() ?
m_cursor + 1 : _text.size();
format_text();
break;
@@ -290,20 +290,23 @@
}
void
-edit_text_character::set_text_value(const char* new_text)
+edit_text_character::set_text_value(const char* new_text_cstr)
{
- if (m_text == new_text)
+ std::string new_text;
+ if ( new_text_cstr ) new_text = new_text_cstr;
+
+ if (_text == new_text)
{
return;
}
set_invalidated();
- m_text = new_text;
+ _text = new_text;
if (m_def->get_max_length() > 0
- && m_text.length() > m_def->get_max_length() )
+ && _text.length() > m_def->get_max_length() )
{
- m_text.resize(m_def->get_max_length());
+ _text.resize(m_def->get_max_length());
}
format_text();
@@ -397,7 +400,7 @@
case M_TEXT:
//if (name == "text")
{
- val->set_tu_string(m_text);
+ val->set_string(_text.c_str());
return true;
}
case M_VISIBLE:
@@ -608,7 +611,8 @@
m_xcursor = x;
m_ycursor = y;
- const char* text = &m_text[0];
+ assert(! _text.empty() );
+ const char* text = &_text[0];
while (uint32_t code = utf8::decode_next_unicode_character(&text))
{
// @@ try to truncate overflow text??
@@ -822,7 +826,7 @@
// If the variable string contains a path, we extract
// the appropriate target from it and update the variable
// name
- tu_string path, var;
+ std::string path, var;
if ( as_environment::parse_path(varname, path, var) )
{
// find target for the path component
Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/edit_text_character.h 29 Oct 2006 18:34:11 -0000 1.15
+++ server/edit_text_character.h 3 Nov 2006 14:03:37 -0000 1.16
@@ -52,7 +52,7 @@
virtual bool can_handle_mouse_event() { return true; }
virtual movie* get_topmost_mouse_entity(float x, float y);
- virtual bool on_event(event_id id);
+ virtual bool on_event(const event_id& id);
virtual movie_root *get_root();
virtual const char* get_variable_name() const
@@ -65,7 +65,7 @@
virtual const char* get_text_value() const
{
- return m_text.c_str();
+ return _text.c_str();
}
/// We have a "text" member.
@@ -84,7 +84,7 @@
private:
/// The actual text
- tu_string m_text;
+ std::string _text;
/// immutable definition of this object, as read
/// from the SWF stream. Assured to be not-NULL
@@ -107,7 +107,7 @@
std::vector<line_style> m_dummy_line_style;
- /// Convert the characters in m_text into a series of
+ /// Convert the characters in _text into a series of
/// text_glyph_records to be rendered.
void format_text();
Index: server/movie.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/movie.h 29 Oct 2006 18:34:11 -0000 1.24
+++ server/movie.h 3 Nov 2006 14:03:37 -0000 1.25
@@ -32,7 +32,6 @@
#include "utility.h"
#include "smart_ptr.h"
#include "movie_interface.h" // for inheritance
-#include "action.h" // for event_id definitions
#include "matrix.h" // for return of get_world_matrix
#include <cstdarg>
@@ -42,6 +41,7 @@
class movie_root;
class swf_event;
+class event_id;
/// \brief
/// @@@ To be obsoleted. This class is only confusing.
@@ -333,7 +333,7 @@
return false;
}
- virtual void on_button_event(event_id id)
+ virtual void on_button_event(const event_id& id)
{
on_event(id);
}
@@ -344,19 +344,11 @@
//
-#if 0
- virtual movie* get_relative_target(const tu_string& /* name */)
- {
- assert(0);
- return NULL;
- }
-#endif
-
/// ActionScript event handler. Returns true if a handler was called.
//
/// Must be overridden or will always return false.
///
- virtual bool on_event(event_id /* id */)
+ virtual bool on_event(const event_id& /* id */)
{
return false;
}
@@ -428,13 +420,15 @@
return this;
}
+#if 0
virtual void clone_display_object(
- const tu_string& /* name */,
- const tu_string& /* newname */,
+ const std::string& /* name */,
+ const std::string& /* newname */,
uint16_t /* depth */ )
{
assert(0);
}
+#endif
virtual void remove_display_object(const tu_string& /* name */)
{
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -b -r1.71 -r1.72
--- server/sprite_instance.cpp 31 Oct 2006 12:55:24 -0000 1.71
+++ server/sprite_instance.cpp 3 Nov 2006 14:03:37 -0000 1.72
@@ -216,6 +216,9 @@
}
}
+// TODO: wrap the functionality in a sprite_instance method
+// and invoke it from here, this should only be a wrapper
+//
//duplicateMovieClip(name:String, depth:Number, [initObject:Object]) :
MovieClip
static void sprite_duplicate_movieclip(const fn_call& fn)
{
@@ -236,12 +239,13 @@
// Copy event handlers from sprite
// We should not copy 'm_action_buffer' since the 'm_method' already
contains it
std::vector<swf_event*> event_handlers;
- const hash<event_id, as_value>* sprite_events =
sprite->get_event_handlers();
- typedef hash<event_id, as_value>::const_iterator event_iterator;
- for (event_iterator it = sprite_events->begin(), itEnd =
sprite_events->end();
+ const std::map<event_id, as_value>& sprite_events =
sprite->get_event_handlers();
+ typedef std::map<event_id, as_value>::const_iterator event_iterator;
+ for (event_iterator it = sprite_events.begin(),
+ itEnd = sprite_events.end();
it != itEnd; ++it )
{
- swf_event* e = new swf_event;
+ swf_event* e = new swf_event; // FIXME: who will delete this ?
e->m_event = it->first;
e->m_method = it->second;
event_handlers.push_back(e);
@@ -816,7 +820,7 @@
case M_NAME:
//else if (name == "_name")
{
- val->set_tu_string(get_name());
+ val->set_string(get_name().c_str());
return true;
}
case M_DROPTARGET:
@@ -920,7 +924,7 @@
}
case M_ONLOAD:
{
- if (m_as_environment.get_member(name, val))
+ if (m_as_environment.get_member(std::string(name.c_str()), val))
{
return true;
}
@@ -938,14 +942,14 @@
} // end switch
// Try variables.
- if (m_as_environment.get_member(name, val))
+ if (m_as_environment.get_member(std::string(name.c_str()), val))
{
return true;
}
// Not a built-in property. Check items on our
// display list.
- character* ch = m_display_list.get_character_by_name_i(name);
+ character* ch =
m_display_list.get_character_by_name_i(std::string(name.c_str()));
if (ch)
{
// Found object.
@@ -1069,8 +1073,8 @@
return sprite;
}
-void sprite_instance::clone_display_object(const tu_string& name,
- const tu_string& newname, uint16_t depth)
+void sprite_instance::clone_display_object(const std::string& name,
+ const std::string& newname, uint16_t depth)
{
// GNASH_REPORT_FUNCTION;
@@ -1095,9 +1099,12 @@
}
#if 1
-void sprite_instance::remove_display_object(const tu_string& name)
+void sprite_instance::remove_display_object(const tu_string& name_tu)
{
// GNASH_REPORT_FUNCTION;
+
+ std::string name(name_tu.c_str());
+
character* ch = m_display_list.get_character_by_name(name);
if (ch)
{
@@ -1108,7 +1115,7 @@
}
#endif
-bool sprite_instance::on_event(event_id id)
+bool sprite_instance::on_event(const event_id& id)
{
// Keep m_as_environment alive during any method calls!
smart_ptr<as_object> this_ptr(this);
@@ -1150,7 +1157,7 @@
}
character*
-sprite_instance::get_relative_target(const tu_string& name)
+sprite_instance::get_relative_target(const std::string& name)
{
character* ch = get_relative_target_common(name);
@@ -1385,7 +1392,7 @@
// CASE INSENSITIVE compare.
// In ActionScript 2.0, this must change
// to CASE SENSITIVE!!!
- character* ch = m_display_list.get_character_by_name_i(
name);
+ character* ch = m_display_list.get_character_by_name_i(
name.c_str());
if ( ch ) // item found
{
const char* text = val.to_string();
@@ -1415,14 +1422,14 @@
#endif
// If that didn't work, set a variable within this environment.
- m_as_environment.set_member(name, val);
+ m_as_environment.set_member(name.c_str(), val);
}
const char* sprite_instance::get_variable(const char* path_to_var) const
{
assert(m_parent == NULL); // should only be called on the root movie.
- tu_string path(path_to_var);
+ std::string path(path_to_var);
// NOTE: this is static so that the string
// value won't go away after we return!!!
@@ -1453,7 +1460,7 @@
// should only be called on the root movie.
assert(m_parent == NULL);
- tu_string path(path_to_var);
+ std::string path(path_to_var);
as_value val(new_value);
m_as_environment.set_variable(path, val);
@@ -1475,7 +1482,7 @@
return;
}
- tu_string path(path_to_var);
+ std::string path(path_to_var);
as_value val(new_value);
m_as_environment.set_variable(path, val);
@@ -1829,17 +1836,17 @@
{
// IF_VERBOSE_DEBUG(log_msg("add changed to move
on depth %d\n", depth));//xxxxxx
// compare events
- //hash<event_id, as_value>* existing_events =
(hash<event_id, as_value>*) existing_char->get_event_handlers();
- const hash<event_id, as_value>* existing_events =
existing_char->get_event_handlers();
- size_t n = event_handlers.size();
- if (existing_events->size() == n)
- {
+ const Events& existing_events =
existing_char->get_event_handlers();
+size_t n = event_handlers.size();
+if (existing_events.size() == n)
+{
bool same_events = true;
for (size_t i = 0; i < n; i++)
{
- as_value result;
- if
(existing_events->get(event_handlers[i]->m_event, &result))
+ Events::const_iterator it =
existing_events.find(event_handlers[i]->m_event);
+ if ( it != existing_events.end() )
{
+ as_value result = it->second;
// compare actionscipt in event
if (event_handlers[i]->m_method
== result)
{
@@ -1855,7 +1862,7 @@
move_display_object(depth, true,
color_transform, true, matrix, ratio, clip_depth);
return NULL;
}
- }
+}
}
//printf("%s: character %s, id is %d, count is %d\n", __FUNCTION__,
existing_char->get_name(), character_id,m_display_list.get_character_count());
// FIXME:
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- server/sprite_instance.h 31 Oct 2006 12:55:24 -0000 1.34
+++ server/sprite_instance.h 3 Nov 2006 14:03:37 -0000 1.35
@@ -17,7 +17,7 @@
//
//
-/* $Id: sprite_instance.h,v 1.34 2006/10/31 12:55:24 strk Exp $ */
+/* $Id: sprite_instance.h,v 1.35 2006/11/03 14:03:37 strk Exp $ */
// Stateful live Sprite instance
@@ -366,7 +366,7 @@
const as_value& val);
/// Overridden to look in DisplayList for a match
- virtual character* get_relative_target(const tu_string& name);
+ virtual character* get_relative_target(const std::string& name);
/// Execute the actions for the specified frame.
//
@@ -385,8 +385,8 @@
/// Duplicate the object with the specified name
/// and add it with a new name at a new depth.
- void clone_display_object(const tu_string& name,
- const tu_string& newname, uint16_t depth);
+ void clone_display_object(const std::string& name,
+ const std::string& newname, uint16_t depth);
/// Remove the object with the specified name.
//
@@ -395,7 +395,7 @@
void remove_display_object(const tu_string& name);
/// Dispatch event handler(s), if any.
- virtual bool on_event(event_id id);
+ virtual bool on_event(const event_id& id);
/// Do the events that (appear to) happen as the movie
@@ -454,7 +454,7 @@
// should only be called on the root movie.
assert(m_parent == NULL);
- as_value obj =
m_as_environment.get_variable(tu_string(path_to_object));
+ as_value obj =
m_as_environment.get_variable(std::string(path_to_object));
as_object* as_obj = obj.to_object();
if (as_obj)
{
Index: server/swf_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/swf_function.cpp 31 Oct 2006 14:46:13 -0000 1.4
+++ server/swf_function.cpp 3 Nov 2006 14:03:37 -0000 1.5
@@ -32,6 +32,7 @@
#include <typeinfo>
#include <iostream>
+#include <string>
using namespace std;
Index: server/swf_function.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/swf_function.h 29 Oct 2006 18:34:11 -0000 1.3
+++ server/swf_function.h 3 Nov 2006 14:03:37 -0000 1.4
@@ -30,6 +30,7 @@
#include "with_stack_entry.h" // for composition (vector element)
#include <cassert>
+#include <string>
// Forward declarations
namespace gnash {
@@ -69,7 +70,7 @@
struct arg_spec
{
int m_register;
- tu_string m_name;
+ std::string m_name;
};
std::vector<arg_spec> m_args;
bool m_is_function2;
Index: server/textformat.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/textformat.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/textformat.cpp 29 Oct 2006 18:34:11 -0000 1.15
+++ server/textformat.cpp 3 Nov 2006 14:03:37 -0000 1.16
@@ -181,7 +181,8 @@
if (obj->get_member("align", &method)) {
//log_msg("Align exists and is set to %s\n", method.to_string());
- obj->obj.alignSet(method.to_tu_string());
+ const char* align = method.to_string();
+ if ( align ) obj->obj.alignSet(align);
}
if (obj->get_member("blockIndent", &method)) {
Index: server/textformat.h
===================================================================
RCS file: /sources/gnash/gnash/server/textformat.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/textformat.h 29 Oct 2006 18:34:11 -0000 1.11
+++ server/textformat.h 3 Nov 2006 14:03:37 -0000 1.12
@@ -38,10 +38,9 @@
public:
text_format();
- // tulrich: TODO need to take const ref!
- text_format(tu_string font);
- text_format(tu_string font, int size);
- text_format(tu_string font, int size, int color);
+ text_format(const std::string& font);
+ text_format(const std::string& font, int size);
+ text_format(const std::string& font, int size, int color);
~text_format();
/// Return a Boolean value that indicates whether the text is
underlined.
@@ -72,10 +71,12 @@
/// paragraph is centered. If "right", the paragraph is
/// right-aligned.
///
- const tu_string& align() const { return _align; }
+ /// FIXME: use an enum !
+ ///
+ const std::string& align() const { return _align; }
/// Return the name of a font for text as a string.
- const tu_string& font() const { return _font; }
+ const std::string& font() const { return _font; }
///
float blockIndent() { return _block_indent; }
@@ -99,7 +100,9 @@
void bulletSet(bool x) { _bullet = x; }
void colorSet(uint32 x) { _color = x; }
void indentSet(float x) { _indent = x; }
- void alignSet(tu_string x) { _align = x; }
+
+ void alignSet(const std::string& x) { _align = x; }
+
void blockIndentSet(float x) { _block_indent = x; }
void leadingSet(float x) { _leading = x; }
void leftMarginSet(float x) { _left_margin = x; }
@@ -137,7 +140,9 @@
/// paragraph is centered. If "right", the paragraph is
/// right-aligned.
///
- tu_string _align;
+ /// FIXME: use an enum !
+ ///
+ std::string _align;
//
float _block_indent;
@@ -149,7 +154,7 @@
uint32 _color;
// The name of a font for text as a string.
- tu_string _font;
+ std::string _font;
/// An integer that indicates the indentation from the left
/// margin to the first character in the paragraph
@@ -180,7 +185,7 @@
/// The URL to which the text in this text format hyperlinks.
/// If url is an empty string, the text does not have a hyperlink
- tu_string _url;
+ std::string _url;
};
Index: server/timers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/timers.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/timers.cpp 29 Oct 2006 18:34:11 -0000 1.16
+++ server/timers.cpp 3 Nov 2006 14:03:37 -0000 1.17
@@ -18,7 +18,7 @@
//
//
-/* $Id: timers.cpp,v 1.16 2006/10/29 18:34:11 rsavoye Exp $ */
+/* $Id: timers.cpp,v 1.17 2006/11/03 14:03:37 strk Exp $ */
//#include "action.h"
#include "as_function.h" // for class as_function
@@ -161,7 +161,7 @@
as_value val(as_func);
int ms =
static_cast<int>(fn.env->bottom(fn.first_arg_bottom_index-1).to_number());
- tu_string local_name;
+ string local_name;
as_value local_val;
fn.env->add_frame_barrier();
Index: server/timers.h
===================================================================
RCS file: /sources/gnash/gnash/server/timers.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/timers.h 29 Oct 2006 18:34:11 -0000 1.10
+++ server/timers.h 3 Nov 2006 14:03:37 -0000 1.11
@@ -26,10 +26,12 @@
#include "tu_timer.h"
+#include <string>
+
namespace gnash {
struct variable {
- tu_string name;
+ std::string name;
as_value value;
};
@@ -61,8 +63,8 @@
as_object *getASObject() { return _object; }
std::vector<struct variable *> *getLocals() { return _locals; }
int getIntervalID() { return _which; }
- void add_local(tu_string name, as_value value) {
- struct variable *var = new struct variable;
+ void add_local(const std::string& name, as_value value) {
+ struct variable *var = new struct variable; // FIXME: who'll delete ?
var->name = name;
var->value = value;
_locals->push_back(var);
Index: server/xmlsocket.h
===================================================================
RCS file: /sources/gnash/gnash/server/xmlsocket.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/xmlsocket.h 29 Oct 2006 18:34:11 -0000 1.12
+++ server/xmlsocket.h 3 Nov 2006 14:03:37 -0000 1.13
@@ -28,7 +28,8 @@
#include "tu_config.h"
#include "xml.h"
#include "impl.h"
-#include "container.h"
+
+#include <string>
#ifdef HAVE_LIBXML
@@ -55,7 +56,7 @@
void messagesClear() { _messages.clear(); }
void messageRemove(int x) { _messages.erase(_messages.begin() + x); }
int messagesCount() { return _messages.size(); }
- tu_string operator [] (int x) { return _messages[x]; }
+ std::string operator [] (int x) { return _messages[x]; }
bool processingData();
void processing(bool x);
@@ -83,7 +84,7 @@
bool _closed;
bool _connect;
bool _processing;
- std::vector<tu_string> _messages;
+ std::vector<std::string> _messages;
std::vector<as_object *> _nodes;
};
Index: server/asobj/ASSound.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/ASSound.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/ASSound.cpp 16 Oct 2006 14:33:38 -0000 1.4
+++ server/asobj/ASSound.cpp 3 Nov 2006 14:03:37 -0000 1.5
@@ -27,6 +27,8 @@
#include "sprite_instance.h"
#include "fn_call.h"
+#include <string>
+
namespace gnash {
Sound::Sound() {
@@ -188,12 +190,13 @@
sound_as_object* so = (sound_as_object*) (as_object*) fn.this_ptr;
assert(so);
- so->sound = fn.arg(0).to_tu_string();
+ const char* name = fn.arg(0).to_string();
+ if ( name ) so->sound = name;
// check the import.
movie_definition* def =
fn.env->get_target()->get_root_movie()->get_movie_definition();
assert(def);
- smart_ptr<resource> res = def->get_exported_resource(so->sound);
+ smart_ptr<resource> res = def->get_exported_resource(so->sound.c_str());
if (res == NULL)
{
log_error("import error: resource '%s' is not exported\n",
so->sound.c_str());
Index: server/asobj/ASSound.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/ASSound.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/asobj/ASSound.h 26 Aug 2006 13:09:53 -0000 1.3
+++ server/asobj/ASSound.h 3 Nov 2006 14:03:37 -0000 1.4
@@ -60,7 +60,7 @@
{
public:
//Sound obj;
- tu_string sound;
+ std::string sound;
int sound_id;
};
Index: server/parser/button_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/button_character_def.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/parser/button_character_def.h 27 Oct 2006 14:30:51 -0000
1.4
+++ server/parser/button_character_def.h 3 Nov 2006 14:03:37 -0000
1.5
@@ -116,7 +116,7 @@
// why it is virtual anyway.
// get_button_bound() is used for buttons.
assert(0); // should not be called
- rect unused;
+ static rect unused;
return unused;
}
Index: server/parser/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/parser/movie_def_impl.h 29 Oct 2006 18:34:16 -0000 1.14
+++ server/parser/movie_def_impl.h 3 Nov 2006 14:03:37 -0000 1.15
@@ -517,7 +517,7 @@
// is used only shape character definitions. See character_def.h to learn
// why it is virtual anyway.
assert(0); // should not be called
- rect unused;
+ static rect unused;
return unused;
}
Index: server/parser/sprite_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/sprite_definition.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/parser/sprite_definition.h 29 Oct 2006 18:34:16 -0000 1.6
+++ server/parser/sprite_definition.h 3 Nov 2006 14:03:37 -0000 1.7
@@ -349,7 +349,7 @@
// is used only shape character definitions. See character_def.h to learn
// why it is virtual anyway.
assert(0); // should not be called
- rect unused;
+ static rect unused;
return unused;
}
Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- server/swf/ASHandlers.cpp 29 Oct 2006 18:34:16 -0000 1.85
+++ server/swf/ASHandlers.cpp 3 Nov 2006 14:03:37 -0000 1.86
@@ -16,7 +16,7 @@
//
-/* $Id: ASHandlers.cpp,v 1.85 2006/10/29 18:34:16 rsavoye Exp $ */
+/* $Id: ASHandlers.cpp,v 1.86 2006/11/03 14:03:37 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -711,26 +711,24 @@
assert(code[pc] == SWF::ACTION_SETTARGET); // 0x8B
// Change the movie we're working on.
- const char* target_name = code.read_string(pc+3);
+ std::string target_name ( code.read_string(pc+3) );
+
character *new_target;
// if the string is blank, we set target to the root movie
// TODO - double check this is correct?
- if (target_name[0] == '\0')
- {
- new_target = env.find_target((tu_string)"/");
- }
- else
+ if ( target_name.empty() )
{
- new_target = env.find_target((tu_string)target_name);
+ target_name = "/";
}
+ new_target = env.find_target(target_name);
if (new_target == NULL)
{
IF_VERBOSE_ACTION (
log_action("ERROR: Couldn't find movie \"%s\" "
"to set target to! Not setting target at all...",
- (const char *)target_name);
+ target_name.c_str());
);
}
else
@@ -935,7 +933,14 @@
ensure_stack(env, 1); // variable name
as_value& top_value = env.top(0);
- tu_string var_string = top_value.to_tu_string();
+ const char* ptr = top_value.to_string();
+ if ( ! ptr )
+ {
+ top_value.set_undefined();
+ return;
+ }
+
+ std::string var_string(ptr);
top_value = env.get_variable(var_string, thread.getWithStack());
@@ -944,7 +949,7 @@
if (top_value.to_object() == NULL) {
log_action("-- get var: %s=%s",
var_string.c_str(),
- top_value.to_tu_string().c_str());
+ top_value.to_string());
} else {
log_action("-- get var: %s=%s at %p",
var_string.c_str(),
@@ -964,7 +969,8 @@
// stack must be contain at least two items
ensure_stack(env, 2);
- env.set_variable(env.top(1).to_tu_string(), env.top(0),
+ assert(env.top(1).to_string());
+ env.set_variable(env.top(1).to_string(), env.top(0),
thread.getWithStack());
IF_VERBOSE_ACTION (
@@ -986,22 +992,20 @@
//Vitaly: env.drop(1) remove object on which refers const char *
target_name
//strk: shouldn't we use env.pop() instead ?
//const char * target_name = env.top(0).to_string();
- tu_string target_name = env.top(0).to_string();
+ assert(env.top(0).to_string());
+ std::string target_name = env.top(0).to_string();
env.drop(1); // pop the target name off the stack
character *new_target;
// if the string is blank, we set target to the root movie
// TODO - double check this is correct?
- if (target_name.size() == 0)
- {
- new_target = env.find_target((tu_string)"/");
- }
- else
+ if ( target_name.empty() )
{
- new_target = env.find_target(target_name);
+ target_name = "/";
}
+ new_target = env.find_target(target_name);
if (new_target == NULL)
{
log_warning(
@@ -1105,8 +1109,8 @@
else
{
si->clone_display_object(
- env.top(2).to_tu_string(),
- env.top(1).to_tu_string(),
+ env.top(2).to_std_string(),
+ env.top(1).to_std_string(),
(int) env.top(0).to_number());
}
env.drop(3);
@@ -1896,13 +1900,15 @@
as_value var = env.top(0);
- as_value oldval = env.get_variable_raw(var.to_tu_string());
+ std::string varstr(var.to_string());
+
+ as_value oldval = env.get_variable_raw(varstr);
if (!oldval.get_type() == as_value::UNDEFINED) {
// set variable to 'undefined'
// that hopefully --ref_count and eventually
// release memory.
- env.set_variable_raw(var.to_tu_string(), as_value());
+ env.set_variable_raw(varstr, as_value());
env.top(0).set_bool(true);
} else {
env.top(0).set_bool(false);
@@ -1918,7 +1924,7 @@
as_value value = env.pop();
as_value varname = env.pop();
- env.set_local(varname.to_tu_string(), value);
+ env.set_local(varname.to_std_string(), value);
}
void
@@ -1936,7 +1942,7 @@
if (env.top(0).get_type() == as_value::STRING)
{
// Function is a string; lookup the function.
- const tu_string &function_name = env.top(0).to_tu_string();
+ const std::string function_name(env.top(0).to_string());
function = env.get_variable(function_name);
if (function.get_type() != as_value::AS_FUNCTION &&
@@ -2028,18 +2034,20 @@
ensure_stack(env, 2); // classname, nargs
- as_value classname = env.pop();
+ as_value val = env.pop();
+ std::string classname;
+ if ( val.to_string() ) classname = val.to_string();
IF_VERBOSE_ACTION (
log_action("---new object: %s",
- classname.to_tu_string().c_str());
+ classname.c_str());
);
int nargs = (int) env.pop().to_number();
ensure_stack(env, nargs); // previous 2 entries popped
- as_value constructor = env.get_variable(classname.to_tu_string());
+ as_value constructor = env.get_variable(classname);
as_value new_obj = construct_object(constructor, env, nargs,
env.get_top_index());
@@ -2055,7 +2063,7 @@
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
ensure_stack(env, 1); // var name
- const tu_string &varname = env.top(0).to_tu_string();
+ std::string varname = env.top(0).to_std_string();
env.declare_local(varname);
env.drop(1);
}
@@ -2208,7 +2216,7 @@
// Get the object
as_value& var_name = env.top(0);
- const tu_string& var_string = var_name.to_tu_string();
+ std::string var_string = var_name.to_std_string();
as_value variable = env.get_variable(var_string);
const as_object* obj = variable.to_object();
@@ -2736,7 +2744,7 @@
// Extract name.
// @@ security: watch out for possible missing terminator here!
- tu_string name = code.read_string(i);
+ std::string name = code.read_string(i);
i += name.length() + 1; // add NULL-termination
//cerr << " name:" << name << endl;
@@ -2878,7 +2886,7 @@
// Extract name.
// @@ security: watch out for possible missing terminator here!
- tu_string name = code.read_string(i);
+ std::string name = code.read_string(i);
i += name.length() + 1;
//cerr << " name:" << name << endl;
Index: testsuite/MovieTester.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- testsuite/MovieTester.cpp 2 Nov 2006 13:40:55 -0000 1.7
+++ testsuite/MovieTester.cpp 3 Nov 2006 14:03:37 -0000 1.8
@@ -80,10 +80,9 @@
const character*
MovieTester::findDisplayItemByName(const sprite_instance& mc,
- const std::string& name_str)
+ const std::string& name)
{
const DisplayList& dlist = mc.getDisplayList();
- const tu_string name = name_str.c_str();
return dlist.get_character_by_name(name);
}
Index: server/event_id.h
===================================================================
RCS file: server/event_id.h
diff -N server/event_id.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/event_id.h 3 Nov 2006 14:03:37 -0000 1.1
@@ -0,0 +1,139 @@
+//
+// Copyright (C) 2005, 2006 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 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+
+#ifndef GNASH_EVENT_ID_H
+#define GNASH_EVENT_ID_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tu_config.h"
+
+#include <cwchar>
+
+class tu_string; // for get_function_name
+
+namespace gnash {
+
+
+/// For keyDown and stuff like that.
+class DSOEXPORT event_id
+{
+public:
+ /// These must match the function names in event_id::get_function_name()
+ enum id_code
+ {
+ INVALID,
+
+ // These are for buttons & sprites.
+ PRESS,
+ RELEASE,
+ RELEASE_OUTSIDE,
+ ROLL_OVER,
+ ROLL_OUT,
+ DRAG_OVER,
+ DRAG_OUT,
+ KEY_PRESS,
+
+ // These are for sprites only.
+ INITIALIZE,
+ LOAD,
+ UNLOAD,
+ ENTER_FRAME,
+ MOUSE_DOWN,
+ MOUSE_UP,
+ MOUSE_MOVE,
+ KEY_DOWN,
+ KEY_UP,
+ DATA,
+
+ // These are for the MoveClipLoader ActionScript only
+ LOAD_START,
+ LOAD_ERROR,
+ LOAD_PROGRESS,
+ LOAD_INIT,
+
+ // These are for the XMLSocket ActionScript only
+ SOCK_CLOSE,
+ SOCK_CONNECT,
+ SOCK_DATA,
+ SOCK_XML,
+
+ // These are for the XML ActionScript only
+ XML_LOAD,
+ XML_DATA,
+
+ // This is for setInterval
+ TIMER,
+
+ CONSTRUCT,
+ SETFOCUS,
+ KILLFOCUS,
+
+ EVENT_COUNT
+ };
+
+ unsigned char m_id;
+ unsigned char m_key_code;
+
+ event_id() : m_id(INVALID), m_key_code(key::INVALID) {}
+
+ event_id(id_code id, key::code c = key::INVALID)
+ :
+ m_id((unsigned char) id),
+ m_key_code((unsigned char) c)
+ {
+ // For the button key events, you must supply a keycode.
+ // Otherwise, don't.
+ assert((m_key_code == key::INVALID && (m_id != KEY_PRESS))
+ || (m_key_code != key::INVALID && (m_id == KEY_PRESS)));
+ }
+
+ bool operator==(const event_id& id) const { return m_id == id.m_id
&& m_key_code == id.m_key_code; }
+
+ bool operator< (const event_id& id) const
+ {
+ if ( m_id < id.m_id ) return true;
+ if ( m_id > id.m_id ) return false;
+
+ // m_id are equal, check key code
+ if ( m_key_code < id.m_key_code ) return true;
+ return false;
+ }
+
+ /// Return the name of a method-handler function
+ /// corresponding to this event.
+ const tu_string& get_function_name() const;
+
+ /// \brief
+ /// Return true if this is a mouse event
+ /// (triggerable with a mouse activity)
+ bool is_mouse_event() const;
+};
+
+} // end namespace gnash
+
+
+#endif // GNASH_EVENT_ID_H
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/Makefile.am server/actio...,
Sandro Santilli <=